From 9a23a69f452ecb572cc012393f9dc20f0e3e677a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 12 May 2012 16:31:25 +0100 Subject: [PATCH] trace: Match NULL context members. --- src/gallium/drivers/trace/tr_context.c | 152 +++++++++++++------------ 1 file changed, 79 insertions(+), 73 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 11a2b163370..27bc6c538f6 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -839,7 +839,7 @@ trace_context_set_viewport_state(struct pipe_context *_pipe, static struct pipe_sampler_view * -trace_create_sampler_view(struct pipe_context *_pipe, +trace_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, const struct pipe_sampler_view *templ) { @@ -882,7 +882,7 @@ trace_create_sampler_view(struct pipe_context *_pipe, static void -trace_sampler_view_destroy(struct pipe_context *_pipe, +trace_context_sampler_view_destroy(struct pipe_context *_pipe, struct pipe_sampler_view *_view) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -909,9 +909,9 @@ trace_sampler_view_destroy(struct pipe_context *_pipe, static struct pipe_surface * -trace_create_surface(struct pipe_context *_pipe, - struct pipe_resource *_resource, - const struct pipe_surface *surf_tmpl) +trace_context_create_surface(struct pipe_context *_pipe, + struct pipe_resource *_resource, + const struct pipe_surface *surf_tmpl) { struct trace_context *tr_ctx = trace_context(_pipe); struct trace_resource *tr_res = trace_resource(_resource); @@ -942,8 +942,8 @@ trace_create_surface(struct pipe_context *_pipe, static void -trace_surface_destroy(struct pipe_context *_pipe, - struct pipe_surface *_surface) +trace_context_surface_destroy(struct pipe_context *_pipe, + struct pipe_surface *_surface) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; @@ -1480,9 +1480,9 @@ trace_context_transfer_inline_write(struct pipe_context *_context, } -static void trace_render_condition(struct pipe_context *_context, - struct pipe_query *query, - uint mode) +static void trace_context_render_condition(struct pipe_context *_context, + struct pipe_query *query, + uint mode) { struct trace_context *tr_context = trace_context(_context); struct pipe_context *context = tr_context->pipe; @@ -1499,7 +1499,7 @@ static void trace_render_condition(struct pipe_context *_context, } -static void trace_texture_barrier(struct pipe_context *_context) +static void trace_context_texture_barrier(struct pipe_context *_context) { struct trace_context *tr_context = trace_context(_context); struct pipe_context *context = tr_context->pipe; @@ -1540,68 +1540,74 @@ trace_context_create(struct trace_screen *tr_scr, tr_ctx->base.screen = &tr_scr->base; tr_ctx->base.destroy = trace_context_destroy; - tr_ctx->base.draw_vbo = trace_context_draw_vbo; - tr_ctx->base.create_query = trace_context_create_query; - tr_ctx->base.destroy_query = trace_context_destroy_query; - tr_ctx->base.begin_query = trace_context_begin_query; - tr_ctx->base.end_query = trace_context_end_query; - tr_ctx->base.get_query_result = trace_context_get_query_result; - tr_ctx->base.create_blend_state = trace_context_create_blend_state; - tr_ctx->base.bind_blend_state = trace_context_bind_blend_state; - tr_ctx->base.delete_blend_state = trace_context_delete_blend_state; - tr_ctx->base.create_sampler_state = trace_context_create_sampler_state; - tr_ctx->base.bind_fragment_sampler_states = trace_context_bind_fragment_sampler_states; - tr_ctx->base.bind_vertex_sampler_states = trace_context_bind_vertex_sampler_states; - tr_ctx->base.delete_sampler_state = trace_context_delete_sampler_state; - tr_ctx->base.create_rasterizer_state = trace_context_create_rasterizer_state; - tr_ctx->base.bind_rasterizer_state = trace_context_bind_rasterizer_state; - tr_ctx->base.delete_rasterizer_state = trace_context_delete_rasterizer_state; - tr_ctx->base.create_depth_stencil_alpha_state = trace_context_create_depth_stencil_alpha_state; - tr_ctx->base.bind_depth_stencil_alpha_state = trace_context_bind_depth_stencil_alpha_state; - tr_ctx->base.delete_depth_stencil_alpha_state = trace_context_delete_depth_stencil_alpha_state; - tr_ctx->base.create_fs_state = trace_context_create_fs_state; - tr_ctx->base.bind_fs_state = trace_context_bind_fs_state; - tr_ctx->base.delete_fs_state = trace_context_delete_fs_state; - tr_ctx->base.create_vs_state = trace_context_create_vs_state; - tr_ctx->base.bind_vs_state = trace_context_bind_vs_state; - tr_ctx->base.delete_vs_state = trace_context_delete_vs_state; - tr_ctx->base.create_vertex_elements_state = trace_context_create_vertex_elements_state; - tr_ctx->base.bind_vertex_elements_state = trace_context_bind_vertex_elements_state; - tr_ctx->base.delete_vertex_elements_state = trace_context_delete_vertex_elements_state; - tr_ctx->base.set_blend_color = trace_context_set_blend_color; - tr_ctx->base.set_stencil_ref = trace_context_set_stencil_ref; - tr_ctx->base.set_clip_state = trace_context_set_clip_state; - tr_ctx->base.set_sample_mask = trace_context_set_sample_mask; - tr_ctx->base.set_constant_buffer = trace_context_set_constant_buffer; - tr_ctx->base.set_framebuffer_state = trace_context_set_framebuffer_state; - tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple; - tr_ctx->base.set_scissor_state = trace_context_set_scissor_state; - tr_ctx->base.set_viewport_state = trace_context_set_viewport_state; - tr_ctx->base.set_fragment_sampler_views = trace_context_set_fragment_sampler_views; - tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views; - tr_ctx->base.create_sampler_view = trace_create_sampler_view; - tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy; - tr_ctx->base.create_surface = trace_create_surface; - tr_ctx->base.surface_destroy = trace_surface_destroy; - tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers; - tr_ctx->base.set_index_buffer = trace_context_set_index_buffer; - tr_ctx->base.create_stream_output_target = trace_context_create_stream_output_target; - tr_ctx->base.stream_output_target_destroy = trace_context_stream_output_target_destroy; - tr_ctx->base.set_stream_output_targets = trace_context_set_stream_output_targets; - tr_ctx->base.resource_copy_region = trace_context_resource_copy_region; - tr_ctx->base.clear = trace_context_clear; - tr_ctx->base.clear_render_target = trace_context_clear_render_target; - tr_ctx->base.clear_depth_stencil = trace_context_clear_depth_stencil; - tr_ctx->base.flush = trace_context_flush; - tr_ctx->base.render_condition = pipe->render_condition ? trace_render_condition : NULL; - tr_ctx->base.texture_barrier = pipe->texture_barrier ? trace_texture_barrier : NULL; - - tr_ctx->base.get_transfer = trace_context_get_transfer; - tr_ctx->base.transfer_destroy = trace_context_transfer_destroy; - tr_ctx->base.transfer_map = trace_context_transfer_map; - tr_ctx->base.transfer_unmap = trace_context_transfer_unmap; - tr_ctx->base.transfer_flush_region = trace_context_transfer_flush_region; - tr_ctx->base.transfer_inline_write = trace_context_transfer_inline_write; + +#define TR_CTX_INIT(_member) \ + tr_ctx->base . _member = pipe -> _member ? trace_context_ ## _member : NULL + + TR_CTX_INIT(draw_vbo); + TR_CTX_INIT(create_query); + TR_CTX_INIT(destroy_query); + TR_CTX_INIT(begin_query); + TR_CTX_INIT(end_query); + TR_CTX_INIT(get_query_result); + TR_CTX_INIT(create_blend_state); + TR_CTX_INIT(bind_blend_state); + TR_CTX_INIT(delete_blend_state); + TR_CTX_INIT(create_sampler_state); + TR_CTX_INIT(bind_fragment_sampler_states); + TR_CTX_INIT(bind_vertex_sampler_states); + TR_CTX_INIT(delete_sampler_state); + TR_CTX_INIT(create_rasterizer_state); + TR_CTX_INIT(bind_rasterizer_state); + TR_CTX_INIT(delete_rasterizer_state); + TR_CTX_INIT(create_depth_stencil_alpha_state); + TR_CTX_INIT(bind_depth_stencil_alpha_state); + TR_CTX_INIT(delete_depth_stencil_alpha_state); + TR_CTX_INIT(create_fs_state); + TR_CTX_INIT(bind_fs_state); + TR_CTX_INIT(delete_fs_state); + TR_CTX_INIT(create_vs_state); + TR_CTX_INIT(bind_vs_state); + TR_CTX_INIT(delete_vs_state); + TR_CTX_INIT(create_vertex_elements_state); + TR_CTX_INIT(bind_vertex_elements_state); + TR_CTX_INIT(delete_vertex_elements_state); + TR_CTX_INIT(set_blend_color); + TR_CTX_INIT(set_stencil_ref); + TR_CTX_INIT(set_clip_state); + TR_CTX_INIT(set_sample_mask); + TR_CTX_INIT(set_constant_buffer); + TR_CTX_INIT(set_framebuffer_state); + TR_CTX_INIT(set_polygon_stipple); + TR_CTX_INIT(set_scissor_state); + TR_CTX_INIT(set_viewport_state); + TR_CTX_INIT(set_fragment_sampler_views); + TR_CTX_INIT(set_vertex_sampler_views); + TR_CTX_INIT(create_sampler_view); + TR_CTX_INIT(sampler_view_destroy); + TR_CTX_INIT(create_surface); + TR_CTX_INIT(surface_destroy); + TR_CTX_INIT(set_vertex_buffers); + TR_CTX_INIT(set_index_buffer); + TR_CTX_INIT(create_stream_output_target); + TR_CTX_INIT(stream_output_target_destroy); + TR_CTX_INIT(set_stream_output_targets); + TR_CTX_INIT(resource_copy_region); + TR_CTX_INIT(clear); + TR_CTX_INIT(clear_render_target); + TR_CTX_INIT(clear_depth_stencil); + TR_CTX_INIT(flush); + TR_CTX_INIT(render_condition); + TR_CTX_INIT(texture_barrier); + + TR_CTX_INIT(get_transfer); + TR_CTX_INIT(transfer_destroy); + TR_CTX_INIT(transfer_map); + TR_CTX_INIT(transfer_unmap); + TR_CTX_INIT(transfer_flush_region); + TR_CTX_INIT(transfer_inline_write); + +#undef TR_CTX_INIT tr_ctx->pipe = pipe; -- 2.30.2