Module: Mesa
Branch: master
Commit: b19f1dc7d66d1e7eb02d2ac6ce7f0579bab51d84
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b19f1dc7d66d1e7eb02d2ac6ce7f0579bab51d84

Author: Marek Vasut <[email protected]>
Date:   Sat Feb  6 04:23:55 2021 +0100

compiler/nir: Increment shader input count and mark as used when adding new 
gl_PointCoord

In case a new gl_PointCoord shader input is created, increment shader
input count and set valid driver_location to the new input variable,
otherwise the input gets aliased to input 0 and shows up in NIR_PRINT
output as whatever shader input 0 is instead of gl_PointCoord. Also
set the input as used, otherwise it might get removed.

Signed-off-by: Marek Vasut <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9214>

---

 src/compiler/nir/nir_lower_texcoord_replace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_lower_texcoord_replace.c 
b/src/compiler/nir/nir_lower_texcoord_replace.c
index 2a1a8295b65..fd3a0859a46 100644
--- a/src/compiler/nir/nir_lower_texcoord_replace.c
+++ b/src/compiler/nir/nir_lower_texcoord_replace.c
@@ -81,6 +81,8 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl,
          pntc = nir_variable_create(b.shader, nir_var_shader_in,
                                     glsl_vec_type(2), "gl_PointCoord");
          pntc->data.location = VARYING_SLOT_PNTC;
+         pntc->data.driver_location = b.shader->num_inputs++;
+         b.shader->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_PNTC);
       }
 
       new_coord = nir_load_var(&b, pntc);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to