diff options
-rw-r--r-- | src/gallium/drivers/galahad/glhd_context.c | 219 |
1 files changed, 115 insertions, 104 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 66dd9aa6291..4c6e6e65cf2 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -37,7 +37,7 @@ static void -galahad_destroy(struct pipe_context *_pipe) +galahad_context_destroy(struct pipe_context *_pipe) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; @@ -48,7 +48,7 @@ galahad_destroy(struct pipe_context *_pipe) } static void -galahad_draw_vbo(struct pipe_context *_pipe, +galahad_context_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -62,7 +62,7 @@ galahad_draw_vbo(struct pipe_context *_pipe, } static struct pipe_query * -galahad_create_query(struct pipe_context *_pipe, +galahad_context_create_query(struct pipe_context *_pipe, unsigned query_type) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -83,7 +83,7 @@ galahad_create_query(struct pipe_context *_pipe, } static void -galahad_destroy_query(struct pipe_context *_pipe, +galahad_context_destroy_query(struct pipe_context *_pipe, struct pipe_query *query) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -94,7 +94,7 @@ galahad_destroy_query(struct pipe_context *_pipe, } static void -galahad_begin_query(struct pipe_context *_pipe, +galahad_context_begin_query(struct pipe_context *_pipe, struct pipe_query *query) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -105,7 +105,7 @@ galahad_begin_query(struct pipe_context *_pipe, } static void -galahad_end_query(struct pipe_context *_pipe, +galahad_context_end_query(struct pipe_context *_pipe, struct pipe_query *query) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -116,7 +116,7 @@ galahad_end_query(struct pipe_context *_pipe, } static boolean -galahad_get_query_result(struct pipe_context *_pipe, +galahad_context_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, boolean wait, union pipe_query_result *result) @@ -131,7 +131,7 @@ galahad_get_query_result(struct pipe_context *_pipe, } static void * -galahad_create_blend_state(struct pipe_context *_pipe, +galahad_context_create_blend_state(struct pipe_context *_pipe, const struct pipe_blend_state *blend) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -149,7 +149,7 @@ galahad_create_blend_state(struct pipe_context *_pipe, } static void -galahad_bind_blend_state(struct pipe_context *_pipe, +galahad_context_bind_blend_state(struct pipe_context *_pipe, void *blend) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -160,7 +160,7 @@ galahad_bind_blend_state(struct pipe_context *_pipe, } static void -galahad_delete_blend_state(struct pipe_context *_pipe, +galahad_context_delete_blend_state(struct pipe_context *_pipe, void *blend) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -171,7 +171,7 @@ galahad_delete_blend_state(struct pipe_context *_pipe, } static void * -galahad_create_sampler_state(struct pipe_context *_pipe, +galahad_context_create_sampler_state(struct pipe_context *_pipe, const struct pipe_sampler_state *sampler) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -182,7 +182,7 @@ galahad_create_sampler_state(struct pipe_context *_pipe, } static void -galahad_bind_fragment_sampler_states(struct pipe_context *_pipe, +galahad_context_bind_fragment_sampler_states(struct pipe_context *_pipe, unsigned num_samplers, void **samplers) { @@ -201,7 +201,7 @@ galahad_bind_fragment_sampler_states(struct pipe_context *_pipe, } static void -galahad_bind_vertex_sampler_states(struct pipe_context *_pipe, +galahad_context_bind_vertex_sampler_states(struct pipe_context *_pipe, unsigned num_samplers, void **samplers) { @@ -220,7 +220,7 @@ galahad_bind_vertex_sampler_states(struct pipe_context *_pipe, } static void -galahad_delete_sampler_state(struct pipe_context *_pipe, +galahad_context_delete_sampler_state(struct pipe_context *_pipe, void *sampler) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -231,7 +231,7 @@ galahad_delete_sampler_state(struct pipe_context *_pipe, } static void * -galahad_create_rasterizer_state(struct pipe_context *_pipe, +galahad_context_create_rasterizer_state(struct pipe_context *_pipe, const struct pipe_rasterizer_state *rasterizer) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -252,7 +252,7 @@ galahad_create_rasterizer_state(struct pipe_context *_pipe, } static void -galahad_bind_rasterizer_state(struct pipe_context *_pipe, +galahad_context_bind_rasterizer_state(struct pipe_context *_pipe, void *rasterizer) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -263,7 +263,7 @@ galahad_bind_rasterizer_state(struct pipe_context *_pipe, } static void -galahad_delete_rasterizer_state(struct pipe_context *_pipe, +galahad_context_delete_rasterizer_state(struct pipe_context *_pipe, void *rasterizer) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -274,7 +274,7 @@ galahad_delete_rasterizer_state(struct pipe_context *_pipe, } static void * -galahad_create_depth_stencil_alpha_state(struct pipe_context *_pipe, +galahad_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe, const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -285,7 +285,7 @@ galahad_create_depth_stencil_alpha_state(struct pipe_context *_pipe, } static void -galahad_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, +galahad_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, void *depth_stencil_alpha) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -296,7 +296,7 @@ galahad_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, } static void -galahad_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, +galahad_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, void *depth_stencil_alpha) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -307,7 +307,7 @@ galahad_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, } static void * -galahad_create_fs_state(struct pipe_context *_pipe, +galahad_context_create_fs_state(struct pipe_context *_pipe, const struct pipe_shader_state *fs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -318,7 +318,7 @@ galahad_create_fs_state(struct pipe_context *_pipe, } static void -galahad_bind_fs_state(struct pipe_context *_pipe, +galahad_context_bind_fs_state(struct pipe_context *_pipe, void *fs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -329,7 +329,7 @@ galahad_bind_fs_state(struct pipe_context *_pipe, } static void -galahad_delete_fs_state(struct pipe_context *_pipe, +galahad_context_delete_fs_state(struct pipe_context *_pipe, void *fs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -340,7 +340,7 @@ galahad_delete_fs_state(struct pipe_context *_pipe, } static void * -galahad_create_vs_state(struct pipe_context *_pipe, +galahad_context_create_vs_state(struct pipe_context *_pipe, const struct pipe_shader_state *vs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -351,7 +351,7 @@ galahad_create_vs_state(struct pipe_context *_pipe, } static void -galahad_bind_vs_state(struct pipe_context *_pipe, +galahad_context_bind_vs_state(struct pipe_context *_pipe, void *vs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -362,7 +362,7 @@ galahad_bind_vs_state(struct pipe_context *_pipe, } static void -galahad_delete_vs_state(struct pipe_context *_pipe, +galahad_context_delete_vs_state(struct pipe_context *_pipe, void *vs) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -374,7 +374,7 @@ galahad_delete_vs_state(struct pipe_context *_pipe, static void * -galahad_create_vertex_elements_state(struct pipe_context *_pipe, +galahad_context_create_vertex_elements_state(struct pipe_context *_pipe, unsigned num_elements, const struct pipe_vertex_element *vertex_elements) { @@ -389,7 +389,7 @@ galahad_create_vertex_elements_state(struct pipe_context *_pipe, } static void -galahad_bind_vertex_elements_state(struct pipe_context *_pipe, +galahad_context_bind_vertex_elements_state(struct pipe_context *_pipe, void *velems) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -400,7 +400,7 @@ galahad_bind_vertex_elements_state(struct pipe_context *_pipe, } static void -galahad_delete_vertex_elements_state(struct pipe_context *_pipe, +galahad_context_delete_vertex_elements_state(struct pipe_context *_pipe, void *velems) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -411,7 +411,7 @@ galahad_delete_vertex_elements_state(struct pipe_context *_pipe, } static void -galahad_set_blend_color(struct pipe_context *_pipe, +galahad_context_set_blend_color(struct pipe_context *_pipe, const struct pipe_blend_color *blend_color) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -422,7 +422,7 @@ galahad_set_blend_color(struct pipe_context *_pipe, } static void -galahad_set_stencil_ref(struct pipe_context *_pipe, +galahad_context_set_stencil_ref(struct pipe_context *_pipe, const struct pipe_stencil_ref *stencil_ref) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -433,7 +433,7 @@ galahad_set_stencil_ref(struct pipe_context *_pipe, } static void -galahad_set_clip_state(struct pipe_context *_pipe, +galahad_context_set_clip_state(struct pipe_context *_pipe, const struct pipe_clip_state *clip) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -444,7 +444,7 @@ galahad_set_clip_state(struct pipe_context *_pipe, } static void -galahad_set_sample_mask(struct pipe_context *_pipe, +galahad_context_set_sample_mask(struct pipe_context *_pipe, unsigned sample_mask) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -455,7 +455,7 @@ galahad_set_sample_mask(struct pipe_context *_pipe, } static void -galahad_set_constant_buffer(struct pipe_context *_pipe, +galahad_context_set_constant_buffer(struct pipe_context *_pipe, uint shader, uint index, struct pipe_constant_buffer *_cb) @@ -490,7 +490,7 @@ galahad_set_constant_buffer(struct pipe_context *_pipe, } static void -galahad_set_framebuffer_state(struct pipe_context *_pipe, +galahad_context_set_framebuffer_state(struct pipe_context *_pipe, const struct pipe_framebuffer_state *_state) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -525,7 +525,7 @@ galahad_set_framebuffer_state(struct pipe_context *_pipe, } static void -galahad_set_polygon_stipple(struct pipe_context *_pipe, +galahad_context_set_polygon_stipple(struct pipe_context *_pipe, const struct pipe_poly_stipple *poly_stipple) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -536,7 +536,7 @@ galahad_set_polygon_stipple(struct pipe_context *_pipe, } static void -galahad_set_scissor_state(struct pipe_context *_pipe, +galahad_context_set_scissor_state(struct pipe_context *_pipe, const struct pipe_scissor_state *scissor) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -547,7 +547,7 @@ galahad_set_scissor_state(struct pipe_context *_pipe, } static void -galahad_set_viewport_state(struct pipe_context *_pipe, +galahad_context_set_viewport_state(struct pipe_context *_pipe, const struct pipe_viewport_state *viewport) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -558,7 +558,7 @@ galahad_set_viewport_state(struct pipe_context *_pipe, } static void -galahad_set_fragment_sampler_views(struct pipe_context *_pipe, +galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe, unsigned num, struct pipe_sampler_view **_views) { @@ -581,7 +581,7 @@ galahad_set_fragment_sampler_views(struct pipe_context *_pipe, } static void -galahad_set_vertex_sampler_views(struct pipe_context *_pipe, +galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe, unsigned num, struct pipe_sampler_view **_views) { @@ -604,7 +604,7 @@ galahad_set_vertex_sampler_views(struct pipe_context *_pipe, } static void -galahad_set_vertex_buffers(struct pipe_context *_pipe, +galahad_context_set_vertex_buffers(struct pipe_context *_pipe, unsigned num_buffers, const struct pipe_vertex_buffer *_buffers) { @@ -627,7 +627,7 @@ galahad_set_vertex_buffers(struct pipe_context *_pipe, } static void -galahad_set_index_buffer(struct pipe_context *_pipe, +galahad_context_set_index_buffer(struct pipe_context *_pipe, const struct pipe_index_buffer *_ib) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -661,7 +661,7 @@ galahad_set_index_buffer(struct pipe_context *_pipe, } static void -galahad_resource_copy_region(struct pipe_context *_pipe, +galahad_context_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *_dst, unsigned dst_level, unsigned dstx, @@ -702,7 +702,7 @@ galahad_resource_copy_region(struct pipe_context *_pipe, } static void -galahad_clear(struct pipe_context *_pipe, +galahad_context_clear(struct pipe_context *_pipe, unsigned buffers, const union pipe_color_union *color, double depth, @@ -719,7 +719,7 @@ galahad_clear(struct pipe_context *_pipe, } static void -galahad_clear_render_target(struct pipe_context *_pipe, +galahad_context_clear_render_target(struct pipe_context *_pipe, struct pipe_surface *_dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, @@ -739,7 +739,7 @@ galahad_clear_render_target(struct pipe_context *_pipe, height); } static void -galahad_clear_depth_stencil(struct pipe_context *_pipe, +galahad_context_clear_depth_stencil(struct pipe_context *_pipe, struct pipe_surface *_dst, unsigned clear_flags, double depth, @@ -765,7 +765,7 @@ galahad_clear_depth_stencil(struct pipe_context *_pipe, } static void -galahad_flush(struct pipe_context *_pipe, +galahad_context_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence) { struct galahad_context *glhd_pipe = galahad_context(_pipe); @@ -963,63 +963,74 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) glhd_pipe->base.priv = pipe->priv; /* expose wrapped data */ glhd_pipe->base.draw = NULL; - glhd_pipe->base.destroy = galahad_destroy; - glhd_pipe->base.draw_vbo = galahad_draw_vbo; - glhd_pipe->base.create_query = galahad_create_query; - glhd_pipe->base.destroy_query = galahad_destroy_query; - glhd_pipe->base.begin_query = galahad_begin_query; - glhd_pipe->base.end_query = galahad_end_query; - glhd_pipe->base.get_query_result = galahad_get_query_result; - glhd_pipe->base.create_blend_state = galahad_create_blend_state; - glhd_pipe->base.bind_blend_state = galahad_bind_blend_state; - glhd_pipe->base.delete_blend_state = galahad_delete_blend_state; - glhd_pipe->base.create_sampler_state = galahad_create_sampler_state; - glhd_pipe->base.bind_fragment_sampler_states = galahad_bind_fragment_sampler_states; - glhd_pipe->base.bind_vertex_sampler_states = galahad_bind_vertex_sampler_states; - glhd_pipe->base.delete_sampler_state = galahad_delete_sampler_state; - glhd_pipe->base.create_rasterizer_state = galahad_create_rasterizer_state; - glhd_pipe->base.bind_rasterizer_state = galahad_bind_rasterizer_state; - glhd_pipe->base.delete_rasterizer_state = galahad_delete_rasterizer_state; - glhd_pipe->base.create_depth_stencil_alpha_state = galahad_create_depth_stencil_alpha_state; - glhd_pipe->base.bind_depth_stencil_alpha_state = galahad_bind_depth_stencil_alpha_state; - glhd_pipe->base.delete_depth_stencil_alpha_state = galahad_delete_depth_stencil_alpha_state; - glhd_pipe->base.create_fs_state = galahad_create_fs_state; - glhd_pipe->base.bind_fs_state = galahad_bind_fs_state; - glhd_pipe->base.delete_fs_state = galahad_delete_fs_state; - glhd_pipe->base.create_vs_state = galahad_create_vs_state; - glhd_pipe->base.bind_vs_state = galahad_bind_vs_state; - glhd_pipe->base.delete_vs_state = galahad_delete_vs_state; - glhd_pipe->base.create_vertex_elements_state = galahad_create_vertex_elements_state; - glhd_pipe->base.bind_vertex_elements_state = galahad_bind_vertex_elements_state; - glhd_pipe->base.delete_vertex_elements_state = galahad_delete_vertex_elements_state; - glhd_pipe->base.set_blend_color = galahad_set_blend_color; - glhd_pipe->base.set_stencil_ref = galahad_set_stencil_ref; - glhd_pipe->base.set_clip_state = galahad_set_clip_state; - glhd_pipe->base.set_sample_mask = galahad_set_sample_mask; - glhd_pipe->base.set_constant_buffer = galahad_set_constant_buffer; - glhd_pipe->base.set_framebuffer_state = galahad_set_framebuffer_state; - glhd_pipe->base.set_polygon_stipple = galahad_set_polygon_stipple; - glhd_pipe->base.set_scissor_state = galahad_set_scissor_state; - glhd_pipe->base.set_viewport_state = galahad_set_viewport_state; - glhd_pipe->base.set_fragment_sampler_views = galahad_set_fragment_sampler_views; - glhd_pipe->base.set_vertex_sampler_views = galahad_set_vertex_sampler_views; - glhd_pipe->base.set_vertex_buffers = galahad_set_vertex_buffers; - glhd_pipe->base.set_index_buffer = galahad_set_index_buffer; - glhd_pipe->base.resource_copy_region = galahad_resource_copy_region; - glhd_pipe->base.clear = galahad_clear; - glhd_pipe->base.clear_render_target = galahad_clear_render_target; - glhd_pipe->base.clear_depth_stencil = galahad_clear_depth_stencil; - glhd_pipe->base.flush = galahad_flush; - glhd_pipe->base.create_sampler_view = galahad_context_create_sampler_view; - glhd_pipe->base.sampler_view_destroy = galahad_context_sampler_view_destroy; - glhd_pipe->base.create_surface = galahad_context_create_surface; - glhd_pipe->base.surface_destroy = galahad_context_surface_destroy; - glhd_pipe->base.get_transfer = galahad_context_get_transfer; - glhd_pipe->base.transfer_destroy = galahad_context_transfer_destroy; - glhd_pipe->base.transfer_map = galahad_context_transfer_map; - glhd_pipe->base.transfer_unmap = galahad_context_transfer_unmap; - glhd_pipe->base.transfer_flush_region = galahad_context_transfer_flush_region; - glhd_pipe->base.transfer_inline_write = galahad_context_transfer_inline_write; + glhd_pipe->base.destroy = galahad_context_destroy; + +#define GLHD_PIPE_INIT(_member) \ + glhd_pipe->base . _member = pipe -> _member ? galahad_context_ ## _member : NULL + + GLHD_PIPE_INIT(draw_vbo); + GLHD_PIPE_INIT(create_query); + GLHD_PIPE_INIT(destroy_query); + GLHD_PIPE_INIT(begin_query); + GLHD_PIPE_INIT(end_query); + GLHD_PIPE_INIT(get_query_result); + GLHD_PIPE_INIT(create_blend_state); + GLHD_PIPE_INIT(bind_blend_state); + GLHD_PIPE_INIT(delete_blend_state); + GLHD_PIPE_INIT(create_sampler_state); + GLHD_PIPE_INIT(bind_fragment_sampler_states); + GLHD_PIPE_INIT(bind_vertex_sampler_states); + GLHD_PIPE_INIT(delete_sampler_state); + GLHD_PIPE_INIT(create_rasterizer_state); + GLHD_PIPE_INIT(bind_rasterizer_state); + GLHD_PIPE_INIT(delete_rasterizer_state); + GLHD_PIPE_INIT(create_depth_stencil_alpha_state); + GLHD_PIPE_INIT(bind_depth_stencil_alpha_state); + GLHD_PIPE_INIT(delete_depth_stencil_alpha_state); + GLHD_PIPE_INIT(create_fs_state); + GLHD_PIPE_INIT(bind_fs_state); + GLHD_PIPE_INIT(delete_fs_state); + GLHD_PIPE_INIT(create_vs_state); + GLHD_PIPE_INIT(bind_vs_state); + GLHD_PIPE_INIT(delete_vs_state); + GLHD_PIPE_INIT(create_vertex_elements_state); + GLHD_PIPE_INIT(bind_vertex_elements_state); + GLHD_PIPE_INIT(delete_vertex_elements_state); + GLHD_PIPE_INIT(set_blend_color); + GLHD_PIPE_INIT(set_stencil_ref); + GLHD_PIPE_INIT(set_clip_state); + GLHD_PIPE_INIT(set_sample_mask); + GLHD_PIPE_INIT(set_constant_buffer); + GLHD_PIPE_INIT(set_framebuffer_state); + GLHD_PIPE_INIT(set_polygon_stipple); + GLHD_PIPE_INIT(set_scissor_state); + GLHD_PIPE_INIT(set_viewport_state); + GLHD_PIPE_INIT(set_fragment_sampler_views); + GLHD_PIPE_INIT(set_vertex_sampler_views); + GLHD_PIPE_INIT(create_sampler_view); + GLHD_PIPE_INIT(sampler_view_destroy); + GLHD_PIPE_INIT(create_surface); + GLHD_PIPE_INIT(surface_destroy); + GLHD_PIPE_INIT(set_vertex_buffers); + GLHD_PIPE_INIT(set_index_buffer); + //GLHD_PIPE_INIT(create_stream_output_target); + //GLHD_PIPE_INIT(stream_output_target_destroy); + //GLHD_PIPE_INIT(set_stream_output_targets); + GLHD_PIPE_INIT(resource_copy_region); + GLHD_PIPE_INIT(clear); + GLHD_PIPE_INIT(clear_render_target); + GLHD_PIPE_INIT(clear_depth_stencil); + GLHD_PIPE_INIT(flush); + //GLHD_PIPE_INIT(render_condition); + //GLHD_PIPE_INIT(texture_barrier); + GLHD_PIPE_INIT(get_transfer); + GLHD_PIPE_INIT(transfer_destroy); + GLHD_PIPE_INIT(transfer_map); + GLHD_PIPE_INIT(transfer_unmap); + GLHD_PIPE_INIT(transfer_flush_region); + GLHD_PIPE_INIT(transfer_inline_write); + +#undef GLHD_PIPE_INIT glhd_pipe->pipe = pipe; |