summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm30.c19
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_emit.h4
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c3
3 files changed, 23 insertions, 3 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 204b814a964..418f898e0e3 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -535,7 +535,6 @@ svga_tgsi_sampler_type(const struct svga_shader_emitter *emit, int idx)
static boolean
ps30_sampler( struct svga_shader_emitter *emit,
- struct tgsi_declaration_semantic semantic,
unsigned idx )
{
SVGA3DOpDclArgs dcl;
@@ -553,6 +552,17 @@ ps30_sampler( struct svga_shader_emitter *emit,
svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
}
+boolean
+svga_shader_emit_samplers_decl( struct svga_shader_emitter *emit )
+{
+ unsigned i;
+
+ for (i = 0; i < emit->num_samplers; i++) {
+ if (!ps30_sampler(emit, i))
+ return FALSE;
+ }
+ return TRUE;
+}
boolean
svga_translate_decl_sm30( struct svga_shader_emitter *emit,
@@ -563,12 +573,15 @@ svga_translate_decl_sm30( struct svga_shader_emitter *emit,
unsigned idx;
for( idx = first; idx <= last; idx++ ) {
- boolean ok;
+ boolean ok = TRUE;
switch (decl->Declaration.File) {
case TGSI_FILE_SAMPLER:
assert (emit->unit == PIPE_SHADER_FRAGMENT);
- ok = ps30_sampler( emit, decl->Semantic, idx );
+ /* just keep track of the number of samplers here.
+ * Will emit the declaration in the helpers function.
+ */
+ emit->num_samplers = MAX2(emit->num_samplers, decl->Range.Last + 1);
break;
case TGSI_FILE_INPUT:
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 7a593ba6e9d..114c9563e2b 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -137,6 +137,7 @@ struct svga_shader_emitter
unsigned pstipple_sampler_unit;
+ int num_samplers;
uint8_t sampler_target[PIPE_MAX_SAMPLERS];
};
@@ -157,6 +158,9 @@ svga_shader_emit_instructions(struct svga_shader_emitter *emit,
const struct tgsi_token *tokens);
boolean
+svga_shader_emit_samplers_decl(struct svga_shader_emitter *emit);
+
+boolean
svga_translate_decl_sm30(struct svga_shader_emitter *emit,
const struct tgsi_full_declaration *decl);
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 3188c411863..bedda2ecf71 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -3797,6 +3797,9 @@ svga_shader_emit_helpers(struct svga_shader_emitter *emit)
}
if (emit->unit == PIPE_SHADER_FRAGMENT) {
+ if (!svga_shader_emit_samplers_decl( emit ))
+ return FALSE;
+
if (!emit_ps_preamble( emit ))
return FALSE;