Mesa (master): st/glsl_to_nir: fix edgeflag passthrough
Nicolai Hähnle
nh at kemper.freedesktop.org
Wed Jul 5 10:32:00 UTC 2017
Module: Mesa
Branch: master
Commit: c2065ed687dd714240928827f620852e37f7dffc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2065ed687dd714240928827f620852e37f7dffc
Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date: Sun Jun 25 18:13:39 2017 +0200
st/glsl_to_nir: fix edgeflag passthrough
We have to mark the additional shader input as used, otherwise it will
be eliminated, and we have to setup its index correctly.
This is a bit of a hack, but so is everything surrounding edgeflag
passthrough.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 +++
src/mesa/state_tracker/st_program.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 524eefa236..89f7888438 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -92,6 +92,9 @@ st_nir_assign_vs_in_locations(struct gl_program *prog, nir_shader *nir)
}
}
+ /* bit of a hack, mirroring st_translate_vertex_program */
+ input_to_index[VERT_ATTRIB_EDGEFLAG] = num_inputs;
+
nir->num_inputs = 0;
nir_foreach_variable_safe(var, &nir->inputs) {
attr = var->data.location;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index eb44fc57b5..6b6d41536c 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -557,8 +557,10 @@ st_create_vp_variant(struct st_context *st,
vpv->tgsi.ir.nir = nir_shader_clone(NULL, stvp->tgsi.ir.nir);
if (key->clamp_color)
NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_clamp_color_outputs);
- if (key->passthrough_edgeflags)
+ if (key->passthrough_edgeflags) {
NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
+ vpv->num_inputs++;
+ }
st_finalize_nir(st, &stvp->Base, vpv->tgsi.ir.nir);
More information about the mesa-commit
mailing list