summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c17
-rw-r--r--src/compiler/spirv/vtn_private.h7
2 files changed, 23 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 3b7f8d8a9ac..5becd3418da 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -819,6 +819,13 @@ struct_member_decoration_cb(struct vtn_builder *b,
break;
case SpvDecorationCPacked:
+ if (b->shader->info.stage != MESA_SHADER_KERNEL)
+ vtn_warn("Decoration only allowed for CL-style kernels: %s",
+ spirv_decoration_to_string(dec->decoration));
+ else
+ ctx->type->packed = true;
+ break;
+
case SpvDecorationSaturatedConversion:
case SpvDecorationFuncParamAttr:
case SpvDecorationFPRoundingMode:
@@ -979,6 +986,13 @@ type_decoration_cb(struct vtn_builder *b,
break;
case SpvDecorationCPacked:
+ if (b->shader->info.stage != MESA_SHADER_KERNEL)
+ vtn_warn("Decoration only allowed for CL-style kernels: %s",
+ spirv_decoration_to_string(dec->decoration));
+ else
+ type->packed = true;
+ break;
+
case SpvDecorationSaturatedConversion:
case SpvDecorationFuncParamAttr:
case SpvDecorationFPRoundingMode:
@@ -1242,6 +1256,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->length = num_fields;
val->type->members = ralloc_array(b, struct vtn_type *, num_fields);
val->type->offsets = ralloc_array(b, unsigned, num_fields);
+ val->type->packed = false;
NIR_VLA(struct glsl_struct_field, fields, count);
for (unsigned i = 0; i < num_fields; i++) {
@@ -1266,7 +1281,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
const char *name = val->name ? val->name : "struct";
- val->type->type = glsl_struct_type(fields, num_fields, name);
+ val->type->type = glsl_struct_type(fields, num_fields, name, false);
break;
}
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index bdf326c26f7..20aedc170d9 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -335,6 +335,13 @@ struct vtn_type {
* (i.e. a block that contains only builtins).
*/
bool builtin_block:1;
+
+ /* for structs and unions it specifies the minimum alignment of the
+ * members. 0 means packed.
+ *
+ * Set by CPacked and Alignment Decorations in kernels.
+ */
+ bool packed:1;
};
/* Members for pointer types */