diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-03-21 22:58:30 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-06-19 22:07:51 -0700 |
commit | 12131096fa421952fd198b1edb5bf5865803b8eb (patch) | |
tree | 922cebec2d59dcd902dd6aee915323e03a3732bd /src/compiler/spirv | |
parent | 21dd8814169e81f3dd398d17311b688f83b653c4 (diff) |
spirv: Restrict use of descriptor intrinsics to Vulkan
In ARB_gl_spirv we'll be able to use variables for uniform buffers, so
don't use the descriptor intrinsics to lower the block access.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 1a9ca0745fa..a7d74a0cf46 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -100,6 +100,8 @@ static nir_ssa_def * vtn_variable_resource_index(struct vtn_builder *b, struct vtn_variable *var, nir_ssa_def *desc_array_index) { + vtn_assert(b->options->environment == NIR_SPIRV_VULKAN); + if (!desc_array_index) { vtn_assert(glsl_type_is_struct_or_ifc(var->type->type)); desc_array_index = nir_imm_int(&b->nb, 0); @@ -134,6 +136,8 @@ static nir_ssa_def * vtn_resource_reindex(struct vtn_builder *b, enum vtn_variable_mode mode, nir_ssa_def *base_index, nir_ssa_def *offset_index) { + vtn_assert(b->options->environment == NIR_SPIRV_VULKAN); + nir_intrinsic_instr *instr = nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_vulkan_resource_reindex); @@ -161,6 +165,8 @@ static nir_ssa_def * vtn_descriptor_load(struct vtn_builder *b, enum vtn_variable_mode mode, nir_ssa_def *desc_index) { + vtn_assert(b->options->environment == NIR_SPIRV_VULKAN); + nir_intrinsic_instr *desc_load = nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_load_vulkan_descriptor); @@ -196,7 +202,8 @@ vtn_nir_deref_pointer_dereference(struct vtn_builder *b, nir_deref_instr *tail; if (base->deref) { tail = base->deref; - } else if (vtn_pointer_is_external_block(b, base)) { + } else if (b->options->environment == NIR_SPIRV_VULKAN && + vtn_pointer_is_external_block(b, base)) { nir_ssa_def *block_index = base->block_index; /* We dereferencing an external block pointer. Correctness of this |