diff options
author | José Fonseca <[email protected]> | 2012-11-07 11:45:45 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2012-11-09 13:43:19 +0000 |
commit | 49dff2cb0588f821eae6258f330bb7368d6e43b6 (patch) | |
tree | f438b31c2307ea5f634de17eff89d8c263bdf38c /src | |
parent | 658b73a246b4e9ad35102954f917f6d8b1418b2f (diff) |
galahad: Support geometry shader / stream-output methods.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/galahad/glhd_context.c | 192 |
1 files changed, 110 insertions, 82 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 53e0b173194..ac666d45aa9 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -204,6 +204,9 @@ galahad_context_bind_sampler_states(struct pipe_context *_pipe, case PIPE_SHADER_FRAGMENT: pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers); break; + case PIPE_SHADER_GEOMETRY: + pipe->bind_geometry_sampler_states(pipe, num_samplers, samplers); + break; default: assert(0); } @@ -227,6 +230,15 @@ galahad_context_bind_fragment_sampler_states(struct pipe_context *_pipe, 0, num_samplers, samplers); } +static void +galahad_context_bind_geometry_sampler_states(struct pipe_context *_pipe, + unsigned num_samplers, + void **samplers) +{ + galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_GEOMETRY, + 0, num_samplers, samplers); +} + static void galahad_context_delete_sampler_state(struct pipe_context *_pipe, @@ -315,72 +327,39 @@ galahad_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, depth_stencil_alpha); } -static void * -galahad_context_create_fs_state(struct pipe_context *_pipe, - const struct pipe_shader_state *fs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; - - return pipe->create_fs_state(pipe, - fs); -} - -static void -galahad_context_bind_fs_state(struct pipe_context *_pipe, - void *fs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; - - pipe->bind_fs_state(pipe, - fs); -} - -static void -galahad_context_delete_fs_state(struct pipe_context *_pipe, - void *fs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; - - pipe->delete_fs_state(pipe, - fs); -} - -static void * -galahad_context_create_vs_state(struct pipe_context *_pipe, - const struct pipe_shader_state *vs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; - - return pipe->create_vs_state(pipe, - vs); -} - -static void -galahad_context_bind_vs_state(struct pipe_context *_pipe, - void *vs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; - - pipe->bind_vs_state(pipe, - vs); -} - -static void -galahad_context_delete_vs_state(struct pipe_context *_pipe, - void *vs) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct pipe_context *pipe = glhd_pipe->pipe; +#define GLHD_SHADER_STATE(shader_type) \ + static void * \ + galahad_context_create_##shader_type##_state(struct pipe_context *_pipe, \ + const struct pipe_shader_state *state) \ + { \ + struct galahad_context *glhd_pipe = galahad_context(_pipe); \ + struct pipe_context *pipe = glhd_pipe->pipe; \ + return pipe->create_##shader_type##_state(pipe, state); \ + } \ + \ + static void \ + galahad_context_bind_##shader_type##_state(struct pipe_context *_pipe, \ + void *state) \ + { \ + struct galahad_context *glhd_pipe = galahad_context(_pipe); \ + struct pipe_context *pipe = glhd_pipe->pipe; \ + pipe->bind_##shader_type##_state(pipe, state); \ + } \ + \ + static void \ + galahad_context_delete_##shader_type##_state(struct pipe_context *_pipe, \ + void *state) \ + { \ + struct galahad_context *glhd_pipe = galahad_context(_pipe); \ + struct pipe_context *pipe = glhd_pipe->pipe; \ + pipe->delete_##shader_type##_state(pipe, state); \ + } - pipe->delete_vs_state(pipe, - vs); -} +GLHD_SHADER_STATE(fs) +GLHD_SHADER_STATE(vs) +GLHD_SHADER_STATE(gs) +#undef GLHD_SHADER_STATE static void * galahad_context_create_vertex_elements_state(struct pipe_context *_pipe, @@ -595,6 +574,9 @@ galahad_context_set_sampler_views(struct pipe_context *_pipe, case PIPE_SHADER_FRAGMENT: pipe->set_fragment_sampler_views(pipe, num, views); break; + case PIPE_SHADER_GEOMETRY: + pipe->set_geometry_sampler_views(pipe, num, views); + break; default: assert(0); } @@ -611,13 +593,21 @@ galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe, static void galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe, - unsigned num, - struct pipe_sampler_view **_views) + unsigned num, + struct pipe_sampler_view **_views) { galahad_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views); } +static void +galahad_context_set_geometry_sampler_views(struct pipe_context *_pipe, + unsigned num, + struct pipe_sampler_view **_views) +{ + galahad_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY, + 0, num, _views); +} static void galahad_context_set_vertex_buffers(struct pipe_context *_pipe, @@ -675,16 +665,54 @@ galahad_context_set_index_buffer(struct pipe_context *_pipe, pipe->set_index_buffer(pipe, ib); } +static INLINE struct pipe_stream_output_target * +galahad_context_create_stream_output_target(struct pipe_context *_pipe, + struct pipe_resource *_res, + unsigned buffer_offset, + unsigned buffer_size) +{ + struct galahad_context *glhd_pipe = galahad_context(_pipe); + struct galahad_resource *glhd_resource_res = galahad_resource(_res); + struct pipe_context *pipe = glhd_pipe->pipe; + struct pipe_resource *res = glhd_resource_res->resource; + + return pipe->create_stream_output_target(pipe, + res, buffer_offset, buffer_size); +} + +static INLINE void +galahad_context_stream_output_target_destroy( + struct pipe_context *_pipe, + struct pipe_stream_output_target *target) +{ + struct galahad_context *glhd_pipe = galahad_context(_pipe); + struct pipe_context *pipe = glhd_pipe->pipe; + + pipe->stream_output_target_destroy(pipe, target); +} + +static INLINE void +galahad_context_set_stream_output_targets(struct pipe_context *_pipe, + unsigned num_targets, + struct pipe_stream_output_target **tgs, + unsigned append_bitmask) +{ + struct galahad_context *glhd_pipe = galahad_context(_pipe); + struct pipe_context *pipe = glhd_pipe->pipe; + + pipe->set_stream_output_targets(pipe, num_targets, tgs, append_bitmask); +} + static void galahad_context_resource_copy_region(struct pipe_context *_pipe, - struct pipe_resource *_dst, - unsigned dst_level, - unsigned dstx, - unsigned dsty, - unsigned dstz, - struct pipe_resource *_src, - unsigned src_level, - const struct pipe_box *src_box) + struct pipe_resource *_dst, + unsigned dst_level, + unsigned dstx, + unsigned dsty, + unsigned dstz, + struct pipe_resource *_src, + unsigned src_level, + const struct pipe_box *src_box) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct galahad_resource *glhd_resource_dst = galahad_resource(_dst); @@ -1021,7 +1049,7 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) GLHD_PIPE_INIT(create_sampler_state); GLHD_PIPE_INIT(bind_fragment_sampler_states); GLHD_PIPE_INIT(bind_vertex_sampler_states); - //GLHD_PIPE_INIT(bind_geometry_sampler_states); + GLHD_PIPE_INIT(bind_geometry_sampler_states); //GLHD_PIPE_INIT(bind_compute_sampler_states); GLHD_PIPE_INIT(delete_sampler_state); GLHD_PIPE_INIT(create_rasterizer_state); @@ -1036,9 +1064,9 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) GLHD_PIPE_INIT(create_vs_state); GLHD_PIPE_INIT(bind_vs_state); GLHD_PIPE_INIT(delete_vs_state); - //GLHD_PIPE_INIT(create_gs_state); - //GLHD_PIPE_INIT(bind_gs_state); - //GLHD_PIPE_INIT(delete_gs_state); + GLHD_PIPE_INIT(create_gs_state); + GLHD_PIPE_INIT(bind_gs_state); + GLHD_PIPE_INIT(delete_gs_state); GLHD_PIPE_INIT(create_vertex_elements_state); GLHD_PIPE_INIT(bind_vertex_elements_state); GLHD_PIPE_INIT(delete_vertex_elements_state); @@ -1053,14 +1081,14 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) GLHD_PIPE_INIT(set_viewport_state); GLHD_PIPE_INIT(set_fragment_sampler_views); GLHD_PIPE_INIT(set_vertex_sampler_views); - //GLHD_PIPE_INIT(set_geometry_sampler_views); + GLHD_PIPE_INIT(set_geometry_sampler_views); //GLHD_PIPE_INIT(set_compute_sampler_views); //GLHD_PIPE_INIT(set_shader_resources); 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(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(blit); GLHD_PIPE_INIT(clear); |