From c6e98107bac8b1c3c311231d9505c6e77d946356 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 4 Feb 2025 01:53:40 +0900 Subject: [PATCH] [qfcc] Mark non-out and non-push_constant blocks NonWritable This is a hack until I rethink the entire glsl implementation, but it gets my vertex shaders such that Vulkan no longer rejects them. However, there are a couple struct related bugs (next). --- tools/qfcc/source/target_spirv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/qfcc/source/target_spirv.c b/tools/qfcc/source/target_spirv.c index 956d49a5e..2fe6f7660 100644 --- a/tools/qfcc/source/target_spirv.c +++ b/tools/qfcc/source/target_spirv.c @@ -2442,6 +2442,14 @@ spirv_declare_sym (specifier_t spec, const expr_t *init, symtab_t *symtab, if (is_struct (type) && type_symtab (type)->type == stab_block) { auto block = (glsl_block_t *) type_symtab (type)->data; glsl_apply_attributes (block->attributes, spec); + // FIXME this should be handled in the block code, but that + // needs a rethink + if (block->interface != glsl_out + && block->interface != glsl_push_constant) { + auto attr = new_attribute ("NonWritable", nullptr); + attr->next = sym->attributes; + sym->attributes = attr; + } } } if (symtab->type == stab_param || symtab->type == stab_local) {