summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-01-02 22:48:29 -0800
committerEric Anholt <[email protected]>2019-01-04 15:41:23 -0800
commitf8e6b364b0aa64f0935a232574536dc462257418 (patch)
tree15d54b0095dbb3d5eeb529c6e1e463cbcbd985a4
parente1385e879d5b6e80dc5572eb987ef773431fba27 (diff)
v3d: Fix up VS output setup during precompiles.
I noticed that a VS I was debugging was missing all of its output stores -- outputs_written was for POS, VAR0, VAR3, while the shader's variables were POS, VAR9, and VAR12. I'm not sure what outputs_written is supposed to be doing here, but we can just walk the declared variables and avoid both this bug and the emission of extra stvpms for less-than-vec4 varyings.
-rw-r--r--src/gallium/drivers/v3d/v3d_program.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index e0a77847880..03c45fffbdb 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -217,13 +217,17 @@ v3d_shader_precompile(struct v3d_context *v3d,
v3d_setup_shared_precompile_key(so, &key.base);
/* Compile VS: All outputs */
- for (int vary = 0; vary < 64; vary++) {
- if (!(s->info.outputs_written & (1ull << vary)))
- continue;
- for (int i = 0; i < 4; i++) {
+ nir_foreach_variable(var, &s->outputs) {
+ unsigned array_len = MAX2(glsl_get_length(var->type), 1);
+ assert(array_len == 1);
+ (void)array_len;
+
+ int slot = var->data.location;
+ for (int i = 0; i < glsl_get_components(var->type); i++) {
+ int swiz = var->data.location_frac + i;
key.fs_inputs[key.num_fs_inputs++] =
- v3d_slot_from_slot_and_component(vary,
- i);
+ v3d_slot_from_slot_and_component(slot,
+ swiz);
}
}