diff options
author | Connor Abbott <[email protected]> | 2015-07-16 11:04:22 -0700 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2015-07-16 11:04:22 -0700 |
commit | b2cfd8506034e733f71722334330b5df0bf94ef8 (patch) | |
tree | 0a0819ef362c1c846c64ae581443403d5942a83b | |
parent | b599735be442368060f57af0a513f8ad8b2a09a1 (diff) |
nir/spirv: don't declare builtin blocks
They aren't used, and the backend was barfing on them. Also, remove a
hack in in compiler.cpp now that they're gone.
-rw-r--r-- | src/glsl/nir/spirv_to_nir.c | 22 | ||||
-rw-r--r-- | src/glsl/nir/spirv_to_nir_private.h | 5 | ||||
-rw-r--r-- | src/vulkan/compiler.cpp | 4 |
3 files changed, 22 insertions, 9 deletions
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index ee44a3f291e..65a995c29de 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -359,6 +359,7 @@ struct_member_decoration_cb(struct vtn_builder *b, ctx->type->members[member]); ctx->type->members[member]->is_builtin = true; ctx->type->members[member]->builtin = dec->literals[0]; + ctx->type->builtin_block = true; break; case SpvDecorationOffset: ctx->type->offsets[member] = dec->literals[0]; @@ -404,7 +405,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, { struct vtn_value *val = vtn_push_value(b, w[1], vtn_value_type_type); - val->type = ralloc(b, struct vtn_type); + val->type = rzalloc(b, struct vtn_type); val->type->is_builtin = false; switch (opcode) { @@ -1230,13 +1231,18 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, var->type = type->type; var->name = ralloc_strdup(var, val->name); - if (type->block) + bool builtin_block = false; + if (type->block) { var->interface_type = type->type; - else if (glsl_type_is_array(type->type) && - (type->array_element->block || type->array_element->buffer_block)) + builtin_block = type->builtin_block; + } else if (glsl_type_is_array(type->type) && + (type->array_element->block || + type->array_element->buffer_block)) { var->interface_type = type->array_element->type; - else + builtin_block = type->array_element->builtin_block; + } else { var->interface_type = NULL; + } switch ((SpvStorageClass)w[3]) { case SpvStorageClassUniform: @@ -1294,6 +1300,12 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, if (var->data.mode == nir_var_uniform && var->interface_type) break; + /* Builtin blocks are lowered to individual variables during SPIR-V -> + * NIR, so don't declare them either. + */ + if (builtin_block) + break; + switch (var->data.mode) { case nir_var_shader_in: exec_list_push_tail(&b->shader->inputs, &var->node); diff --git a/src/glsl/nir/spirv_to_nir_private.h b/src/glsl/nir/spirv_to_nir_private.h index fa0489b877d..a964cc80fad 100644 --- a/src/glsl/nir/spirv_to_nir_private.h +++ b/src/glsl/nir/spirv_to_nir_private.h @@ -96,6 +96,11 @@ struct vtn_type { /* for structs, whether it was decorated as an "SSBO-like" block */ bool buffer_block; + /* for structs with block == true, whether this is a builtin block (i.e. a + * block that contains only builtins). + */ + bool builtin_block; + /* for arrays and matrices, the array stride */ unsigned stride; diff --git a/src/vulkan/compiler.cpp b/src/vulkan/compiler.cpp index cf34e7b4414..9152de63ec9 100644 --- a/src/vulkan/compiler.cpp +++ b/src/vulkan/compiler.cpp @@ -959,10 +959,6 @@ setup_nir_io(struct gl_program *prog, } foreach_list_typed(nir_variable, var, node, &shader->outputs) { - /* XXX glslang gives us this but we never use it */ - if (!strcmp(var->name, "gl_PerVertex")) - continue; - prog->OutputsWritten |= BITFIELD64_BIT(var->data.location); } } |