failover: several fixes to failover pipe module

This commit is contained in:
Jerome Glisse 2008-02-08 18:25:49 +01:00 committed by John Doe
parent 909c703bfb
commit 2b6a31bfda
2 changed files with 57 additions and 24 deletions

View file

@ -114,6 +114,8 @@ struct pipe_context *failover_create( struct pipe_context *hw,
if (failover == NULL)
return NULL;
failover->hw = hw;
failover->sw = sw;
failover->pipe.winsys = hw->winsys;
failover->pipe.destroy = failover_destroy;
failover->pipe.is_format_supported = hw->is_format_supported;

View file

@ -54,8 +54,8 @@ failover_create_blend_state( struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_blend_state(pipe, blend);
state->hw_state = failover->hw->create_blend_state(pipe, blend);
state->sw_state = failover->sw->create_blend_state(failover->sw, blend);
state->hw_state = failover->hw->create_blend_state(failover->hw, blend);
return state;
}
@ -68,6 +68,7 @@ failover_bind_blend_state( struct pipe_context *pipe,
struct fo_state *state = (struct fo_state *)blend;
failover->blend = state;
failover->dirty |= FO_NEW_BLEND;
failover->sw->bind_blend_state( failover->sw, state->sw_state );
failover->hw->bind_blend_state( failover->hw, state->hw_state );
}
@ -78,8 +79,8 @@ failover_delete_blend_state( struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)blend;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_blend_state(pipe, state->sw_state);
failover->hw->delete_blend_state(pipe, state->hw_state);
failover->sw->delete_blend_state(failover->sw, state->sw_state);
failover->hw->delete_blend_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -93,6 +94,7 @@ failover_set_blend_color( struct pipe_context *pipe,
failover->blend_color = *blend_color;
failover->dirty |= FO_NEW_BLEND_COLOR;
failover->sw->set_blend_color( failover->sw, blend_color );
failover->hw->set_blend_color( failover->hw, blend_color );
}
@ -104,6 +106,7 @@ failover_set_clip_state( struct pipe_context *pipe,
failover->clip = *clip;
failover->dirty |= FO_NEW_CLIP;
failover->sw->set_clip_state( failover->sw, clip );
failover->hw->set_clip_state( failover->hw, clip );
}
@ -115,8 +118,8 @@ failover_create_depth_stencil_state(struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_depth_stencil_alpha_state(pipe, templ);
state->hw_state = failover->hw->create_depth_stencil_alpha_state(pipe, templ);
state->sw_state = failover->sw->create_depth_stencil_alpha_state(failover->sw, templ);
state->hw_state = failover->hw->create_depth_stencil_alpha_state(failover->hw, templ);
return state;
}
@ -129,6 +132,7 @@ failover_bind_depth_stencil_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state *)depth_stencil;
failover->depth_stencil = state;
failover->dirty |= FO_NEW_DEPTH_STENCIL;
failover->sw->bind_depth_stencil_alpha_state(failover->sw, state->sw_state);
failover->hw->bind_depth_stencil_alpha_state(failover->hw, state->hw_state);
}
@ -139,8 +143,8 @@ failover_delete_depth_stencil_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)ds;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_depth_stencil_alpha_state(pipe, state->sw_state);
failover->hw->delete_depth_stencil_alpha_state(pipe, state->hw_state);
failover->sw->delete_depth_stencil_alpha_state(failover->sw, state->sw_state);
failover->hw->delete_depth_stencil_alpha_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -154,6 +158,7 @@ failover_set_framebuffer_state(struct pipe_context *pipe,
failover->framebuffer = *framebuffer;
failover->dirty |= FO_NEW_FRAMEBUFFER;
failover->sw->set_framebuffer_state( failover->sw, framebuffer );
failover->hw->set_framebuffer_state( failover->hw, framebuffer );
}
@ -165,8 +170,8 @@ failover_create_fs_state(struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_fs_state(pipe, templ);
state->hw_state = failover->hw->create_fs_state(pipe, templ);
state->sw_state = failover->sw->create_fs_state(failover->sw, templ);
state->hw_state = failover->hw->create_fs_state(failover->hw, templ);
return state;
}
@ -178,6 +183,7 @@ failover_bind_fs_state(struct pipe_context *pipe, void *fs)
struct fo_state *state = (struct fo_state*)fs;
failover->fragment_shader = state;
failover->dirty |= FO_NEW_FRAGMENT_SHADER;
failover->sw->bind_fs_state(failover->sw, state->sw_state);
failover->hw->bind_fs_state(failover->hw, state->hw_state);
}
@ -188,8 +194,8 @@ failover_delete_fs_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)fs;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_fs_state(pipe, state->sw_state);
failover->hw->delete_fs_state(pipe, state->hw_state);
failover->sw->delete_fs_state(failover->sw, state->sw_state);
failover->hw->delete_fs_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -202,8 +208,8 @@ failover_create_vs_state(struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_vs_state(pipe, templ);
state->hw_state = failover->hw->create_vs_state(pipe, templ);
state->sw_state = failover->sw->create_vs_state(failover->sw, templ);
state->hw_state = failover->hw->create_vs_state(failover->hw, templ);
return state;
}
@ -217,6 +223,7 @@ failover_bind_vs_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)vs;
failover->vertex_shader = state;
failover->dirty |= FO_NEW_VERTEX_SHADER;
failover->sw->bind_vs_state(failover->sw, state->sw_state);
failover->hw->bind_vs_state(failover->hw, state->hw_state);
}
@ -227,8 +234,8 @@ failover_delete_vs_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)vs;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_vs_state(pipe, state->sw_state);
failover->hw->delete_vs_state(pipe, state->hw_state);
failover->sw->delete_vs_state(failover->sw, state->sw_state);
failover->hw->delete_vs_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -242,6 +249,7 @@ failover_set_polygon_stipple( struct pipe_context *pipe,
failover->poly_stipple = *stipple;
failover->dirty |= FO_NEW_STIPPLE;
failover->sw->set_polygon_stipple( failover->sw, stipple );
failover->hw->set_polygon_stipple( failover->hw, stipple );
}
@ -253,8 +261,8 @@ failover_create_rasterizer_state(struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_rasterizer_state(pipe, templ);
state->hw_state = failover->hw->create_rasterizer_state(pipe, templ);
state->sw_state = failover->sw->create_rasterizer_state(failover->sw, templ);
state->hw_state = failover->hw->create_rasterizer_state(failover->hw, templ);
return state;
}
@ -268,6 +276,7 @@ failover_bind_rasterizer_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)raster;
failover->rasterizer = state;
failover->dirty |= FO_NEW_RASTERIZER;
failover->sw->bind_rasterizer_state(failover->sw, state->sw_state);
failover->hw->bind_rasterizer_state(failover->hw, state->hw_state);
}
@ -278,8 +287,8 @@ failover_delete_rasterizer_state(struct pipe_context *pipe,
struct fo_state *state = (struct fo_state*)raster;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_rasterizer_state(pipe, state->sw_state);
failover->hw->delete_rasterizer_state(pipe, state->hw_state);
failover->sw->delete_rasterizer_state(failover->sw, state->sw_state);
failover->hw->delete_rasterizer_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -294,6 +303,7 @@ failover_set_scissor_state( struct pipe_context *pipe,
failover->scissor = *scissor;
failover->dirty |= FO_NEW_SCISSOR;
failover->sw->set_scissor_state( failover->sw, scissor );
failover->hw->set_scissor_state( failover->hw, scissor );
}
@ -305,8 +315,8 @@ failover_create_sampler_state(struct pipe_context *pipe,
struct fo_state *state = malloc(sizeof(struct fo_state));
struct failover_context *failover = failover_context(pipe);
state->sw_state = failover->sw->create_sampler_state(pipe, templ);
state->hw_state = failover->hw->create_sampler_state(pipe, templ);
state->sw_state = failover->sw->create_sampler_state(failover->sw, templ);
state->hw_state = failover->hw->create_sampler_state(failover->hw, templ);
return state;
}
@ -320,6 +330,8 @@ failover_bind_sampler_state(struct pipe_context *pipe,
failover->sampler[unit] = state;
failover->dirty |= FO_NEW_SAMPLER;
failover->dirty_sampler |= (1<<unit);
failover->sw->bind_sampler_state(failover->sw, unit,
state->sw_state);
failover->hw->bind_sampler_state(failover->hw, unit,
state->hw_state);
}
@ -330,8 +342,8 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
struct fo_state *state = (struct fo_state*)sampler;
struct failover_context *failover = failover_context(pipe);
failover->sw->delete_sampler_state(pipe, state->sw_state);
failover->hw->delete_sampler_state(pipe, state->hw_state);
failover->sw->delete_sampler_state(failover->sw, state->sw_state);
failover->hw->delete_sampler_state(failover->hw, state->hw_state);
state->sw_state = 0;
state->hw_state = 0;
free(state);
@ -348,6 +360,7 @@ failover_set_sampler_texture(struct pipe_context *pipe,
failover->texture[unit] = texture;
failover->dirty |= FO_NEW_TEXTURE;
failover->dirty_texture |= (1<<unit);
failover->sw->set_sampler_texture( failover->sw, unit, texture );
failover->hw->set_sampler_texture( failover->hw, unit, texture );
}
@ -360,6 +373,7 @@ failover_set_viewport_state( struct pipe_context *pipe,
failover->viewport = *viewport;
failover->dirty |= FO_NEW_VIEWPORT;
failover->sw->set_viewport_state( failover->sw, viewport );
failover->hw->set_viewport_state( failover->hw, viewport );
}
@ -374,6 +388,7 @@ failover_set_vertex_buffer(struct pipe_context *pipe,
failover->vertex_buffer[unit] = *vertex_buffer;
failover->dirty |= FO_NEW_VERTEX_BUFFER;
failover->dirty_vertex_buffer |= (1<<unit);
failover->sw->set_vertex_buffer( failover->sw, unit, vertex_buffer );
failover->hw->set_vertex_buffer( failover->hw, unit, vertex_buffer );
}
@ -388,9 +403,24 @@ failover_set_vertex_element(struct pipe_context *pipe,
failover->vertex_element[unit] = *vertex_element;
failover->dirty |= FO_NEW_VERTEX_ELEMENT;
failover->dirty_vertex_element |= (1<<unit);
failover->sw->set_vertex_element( failover->sw, unit, vertex_element );
failover->hw->set_vertex_element( failover->hw, unit, vertex_element );
}
void
failover_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
const struct pipe_constant_buffer *buf)
{
struct failover_context *failover = failover_context(pipe);
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
failover->sw->set_constant_buffer(failover->sw, shader, index, buf);
failover->hw->set_constant_buffer(failover->hw, shader, index, buf);
}
void
failover_init_state_functions( struct failover_context *failover )
@ -423,4 +453,5 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.set_viewport_state = failover_set_viewport_state;
failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;
failover->pipe.set_vertex_element = failover_set_vertex_element;
failover->pipe.set_constant_buffer = failover_set_constant_buffer;
}