zink: fix invalid Offset set for variables which do not need an offset

Offset decoration in spirv is unsigned and it does not have a notion of an invalid offset.
Unlike NIR which set -1 for invlaid offset. This translates to invalid spirv being produced.
Instead, just don't emit an Offset decoration.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18910>
This commit is contained in:
SoroushIMG
2022-07-19 13:25:02 +01:00
committed by Marge Bot
parent 6eadd6d169
commit b87c08b3bf

View File

@@ -488,8 +488,11 @@ get_glsl_type(struct ntv_context *ctx, const struct glsl_type *type)
types[i] = get_glsl_type(ctx, glsl_get_struct_field(type, i));
ret = spirv_builder_type_struct(&ctx->builder, types,
glsl_get_length(type));
for (unsigned i = 0; i < glsl_get_length(type); i++)
spirv_builder_emit_member_offset(&ctx->builder, ret, i, glsl_get_struct_field_offset(type, i));
for (unsigned i = 0; i < glsl_get_length(type); i++) {
int32_t offset = glsl_get_struct_field_offset(type, i);
if (offset >= 0)
spirv_builder_emit_member_offset(&ctx->builder, ret, i, offset);
}
} else
unreachable("Unhandled GLSL type");