diff options
author | Xavier Bouchoux <[email protected]> | 2018-10-15 16:24:29 +0200 |
---|---|---|
committer | Xavier Bouchoux <[email protected]> | 2019-03-11 23:28:39 +0100 |
commit | c5236fc6e299225a94234ea5e381679ffbd36227 (patch) | |
tree | 48c60b1e33647da8aec0fbe7a9066652aa3d9ecf | |
parent | d75f84cb6521c323092f50af41bce435d515a647 (diff) |
nir/spirv: Fix assert when unsampled OpTypeImage has unknown 'Depth'
'dxc' hlsl-to-spirv compiler appears to emit 2 (Unknown) in the depth field,
when the image is not sampled and the value is not needed.
Previously, shaders failed with:
SPIR-V parsing FAILED:
In file ../src/compiler/spirv/spirv_to_nir.c:1412
!is_shadow
632 bytes into the SPIR-V binary
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 2136c9df705..da0f2dcd805 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -1380,7 +1380,9 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, vtn_fail("Invalid SPIR-V image dimensionality"); } - bool is_shadow = w[4]; + /* w[4]: as per Vulkan spec "Validation Rules within a Module", + * The “Depth” operand of OpTypeImage is ignored. + */ bool is_array = w[5]; bool multisampled = w[6]; unsigned sampled = w[7]; @@ -1406,10 +1408,9 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, glsl_get_base_type(sampled_type->type); if (sampled == 1) { val->type->sampled = true; - val->type->type = glsl_sampler_type(dim, is_shadow, is_array, + val->type->type = glsl_sampler_type(dim, false, is_array, sampled_base_type); } else if (sampled == 2) { - vtn_assert(!is_shadow); val->type->sampled = false; val->type->type = glsl_image_type(dim, is_array, sampled_base_type); } else { |