diff options
author | Brian Paul <[email protected]> | 2012-08-04 08:46:41 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-08-06 08:33:17 -0600 |
commit | d6c3e6d8f34fc39dcbe9395c3a5953af726443f1 (patch) | |
tree | c75b41c48ae99d213633019150a348c3026a259c /src/gallium/drivers/softpipe/sp_context.c | |
parent | 0a14e9f09fc1cf9d5c277bb239f349203d3bed79 (diff) |
softpipe: consolidate sampler-related arrays
Combine separate arrays for vertex/fragment/geometry samplers, etc into
one array indexed by PIPE_SHADER_x.
This allows us to collapse separate code for vertex/fragment/geometry
state into loops over the shader stage. More to come.
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_context.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 3d8a69a60ad..e2e32b9bd8c 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -122,21 +122,6 @@ softpipe_destroy( struct pipe_context *pipe ) sp_destroy_tile_cache(softpipe->zsbuf_cache); pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - sp_destroy_tex_tile_cache(softpipe->tex_cache[PIPE_SHADER_FRAGMENT][i]); - pipe_sampler_view_reference(&softpipe->fragment_sampler_views[i], NULL); - } - - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - sp_destroy_tex_tile_cache(softpipe->tex_cache[PIPE_SHADER_VERTEX][i]); - pipe_sampler_view_reference(&softpipe->vertex_sampler_views[i], NULL); - } - - for (i = 0; i < PIPE_MAX_GEOMETRY_SAMPLERS; i++) { - sp_destroy_tex_tile_cache(softpipe->tex_cache[PIPE_SHADER_GEOMETRY][i]); - pipe_sampler_view_reference(&softpipe->geometry_sampler_views[i], NULL); - } - for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) { for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) { sp_destroy_tex_tile_cache(softpipe->tex_cache[sh][i]); @@ -231,6 +216,10 @@ softpipe_create_context( struct pipe_screen *screen, struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); uint i, sh; + /* Check since we have arrays[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS] */ + STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS); + STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_GEOMETRY_SAMPLERS); + util_init_math(); softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE ); @@ -303,13 +292,13 @@ softpipe_create_context( struct pipe_screen *screen, PIPE_SHADER_VERTEX, PIPE_MAX_VERTEX_SAMPLERS, (struct tgsi_sampler **) - softpipe->tgsi.vert_samplers_list); + softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]); draw_texture_samplers(softpipe->draw, PIPE_SHADER_GEOMETRY, PIPE_MAX_GEOMETRY_SAMPLERS, (struct tgsi_sampler **) - softpipe->tgsi.geom_samplers_list); + softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]); if (debug_get_bool_option( "SOFTPIPE_NO_RAST", FALSE )) softpipe->no_rast = TRUE; |