[Mesa-dev] [PATCH v3 10/19] RFC: nir/vtn: handle constant builtins from kernels

Karol Herbst kherbst at redhat.com
Fri Mar 23 19:33:47 UTC 2018


With SPIR-V it is perfectly fine to declare builtins as constants and have no
constant initializer on them.

This change seems to be able to break Vulkan shaders, so please check if this
is the correct thing here.

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/compiler/spirv/vtn_variables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index af9222d6f4e..80fca6e8a32 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1580,7 +1580,6 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var,
       nir_var->data.invariant = true;
       break;
    case SpvDecorationConstant:
-      vtn_assert(nir_var->constant_initializer != NULL);
       nir_var->data.read_only = true;
       break;
    case SpvDecorationNonReadable:
@@ -2031,6 +2030,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
    case vtn_variable_mode_global:
    case vtn_variable_mode_image:
    case vtn_variable_mode_sampler:
+   case vtn_variable_mode_const:
       /* For these, we create the variable normally */
       var->var = rzalloc(b->shader, nir_variable);
       var->var->name = ralloc_strdup(var->var, val->name);
-- 
2.14.3



More information about the mesa-dev mailing list