summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-03-29 13:34:36 -0600
committerBrian Paul <[email protected]>2016-03-29 13:35:09 -0600
commit2d8df0306b45163eede94421948e9b1ae05e47bd (patch)
tree20ee7f2060fea5472a37a2a381a29cddbebd8a86 /src
parent96e0894106b25eec2bab4545566d832846e99034 (diff)
svga: emit sampler declarations in the helper function for non vgpu10
With commit dc9ecf58c0c5c8a97cd41362e78c2fcd9f6e3b80, we are now getting the sampler target from the sampler view declaration. But since a sampler view declaration can be defined after a sampler declaration, we need to emit the sampler declarations in the pre-helpers function, otherwise, the sampler target might not have defined yet for the sampler declaration. Fixes viewperf maya-03 and various gl trace regressions in hwv11. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-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;