diff options
author | Roland Scheidegger <[email protected]> | 2013-02-27 19:07:18 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-02-28 03:39:53 +0100 |
commit | 6b35c2b110be0d9ae6a292250fdcbab11a9190a5 (patch) | |
tree | 5141a7490ac67ee8df3542f8396b2ba4e6423ec7 /src/gallium/drivers/softpipe/sp_context.c | |
parent | 0845d16976b41e0a151f96b900fb58a7f26d7774 (diff) |
softpipe/draw/tgsi: simplify driver/tgsi sampler interface
Use a single sampler adapter instead of per-sampler-unit samplers,
and just pass along texture unit and sampler unit in the calls.
The reason is that for dx10-style sample opcodes pre-wired
samplers including all the texture state aren't really feasible (and for
sample_i/sviewinfo we don't even have samplers).
Of course right now softpipe doesn't actually do anything more than
just look up all its pre-wired per-texunit/per-samplerunit sampler as
it did before so this doesn't really achieve much except one more
function call, however this is now all softpipe's fault (fixing that in
a way which doesn't suck is still an unsolved problem).
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_context.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e2cc1e17dae..141b7a8b185 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -51,6 +51,7 @@ #include "sp_texture.h" #include "sp_query.h" #include "sp_screen.h" +#include "sp_tex_sample.h" static void @@ -115,6 +116,10 @@ softpipe_destroy( struct pipe_context *pipe ) tgsi_exec_machine_destroy(softpipe->fs_machine); + for (i = 0; i < PIPE_SHADER_TYPES; i++) { + FREE(softpipe->tgsi.sampler[i]); + } + FREE( softpipe ); } @@ -190,6 +195,10 @@ softpipe_create_context( struct pipe_screen *screen, util_init_math(); + for (i = 0; i < PIPE_SHADER_TYPES; i++) { + softpipe->tgsi.sampler[i] = sp_create_tgsi_sampler(); + } + softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE ); softpipe->dump_gs = debug_get_bool_option( "SOFTPIPE_DUMP_GS", FALSE ); @@ -256,17 +265,15 @@ softpipe_create_context( struct pipe_screen *screen, if (!softpipe->draw) goto fail; - draw_texture_samplers(softpipe->draw, - PIPE_SHADER_VERTEX, - PIPE_MAX_SAMPLERS, - (struct tgsi_sampler **) - softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]); - - draw_texture_samplers(softpipe->draw, - PIPE_SHADER_GEOMETRY, - PIPE_MAX_SAMPLERS, - (struct tgsi_sampler **) - softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]); + draw_texture_sampler(softpipe->draw, + PIPE_SHADER_VERTEX, + (struct tgsi_sampler *) + softpipe->tgsi.sampler[PIPE_SHADER_VERTEX]); + + draw_texture_sampler(softpipe->draw, + PIPE_SHADER_GEOMETRY, + (struct tgsi_sampler *) + softpipe->tgsi.sampler[PIPE_SHADER_GEOMETRY]); if (debug_get_bool_option( "SOFTPIPE_NO_RAST", FALSE )) softpipe->no_rast = TRUE; |