Mesa (master): nir/spirv: Fix assert when unsampled OpTypeImage has unknown 'Depth'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Mar 12 00:21:24 UTC 2019
Module: Mesa
Branch: master
Commit: c5236fc6e299225a94234ea5e381679ffbd36227
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5236fc6e299225a94234ea5e381679ffbd36227
Author: Xavier Bouchoux <xavierb at gmail.com>
Date: Mon Oct 15 16:24:29 2018 +0200
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 <jason at jlekstrand.net>
---
src/compiler/spirv/spirv_to_nir.c | 7 ++++---
1 file 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 {
More information about the mesa-commit
mailing list