[qfcc] Make push_constant blocks push_constant

And now all my vertex shaders seem to pass validation. Time for some
real testing.
This commit is contained in:
Bill Currie 2025-02-03 19:31:55 +09:00
parent de2d108e41
commit e2631db4eb
6 changed files with 10 additions and 1 deletions

View file

@ -64,6 +64,7 @@ typedef enum glsl_interface_e : unsigned {
glsl_uniform,
glsl_buffer,
glsl_shared,
glsl_push_constant,
glsl_num_interfaces
} glsl_interface_t;

View file

@ -37,6 +37,7 @@ typedef struct symbol_s symbol_t;
typedef struct symtab_s symtab_t;
typedef struct param_s param_t;
typedef struct attribute_s attribute_t;
typedef struct glsl_block_s glsl_block_t;
/** Specify the storage class of a def.
*/
@ -66,6 +67,7 @@ typedef struct specifier_s {
param_t *params;
symbol_t *sym;
symtab_t *symtab;
glsl_block_t *block;
storage_class_t storage;
union {
struct {

View file

@ -48,6 +48,7 @@ const char *glsl_interface_names[glsl_num_interfaces] = {
"uniform",
"buffer",
"shared",
"push_constant",
};
symtab_t *

View file

@ -131,6 +131,7 @@ void
glsl_finish_block (glsl_block_t *block, specifier_t spec)
{
spec.sym = block->name;
spec.block = block;
int index = 0;
for (auto s = block->members->symbols; s; s = s->next) {
s->id = index++;

View file

@ -188,6 +188,9 @@ static void
glsl_layout_push_constant (const layout_qual_t *qual, specifier_t spec,
const expr_t *qual_name)
{
if (spec.block) {
spec.block->interface = glsl_push_constant;
}
}
static void
@ -335,7 +338,7 @@ static layout_qual_t layout_qualifiers[] = {
.apply = A(glsl_layout_push_constant),
.obj_mask = D(block),
.var_type = V(any),
.if_mask = I(uniform),
.if_mask = I(uniform)|I(push_constant),//FIXME push_constant redunant
},
{ .name = "input_attachment_index",
.apply = E(glsl_layout_input_attachment_index),

View file

@ -923,6 +923,7 @@ spirv_storage_class (unsigned storage, const type_t *type)
[glsl_out] = SpvStorageClassOutput,
[glsl_uniform] = SpvStorageClassUniform,
[glsl_buffer] = SpvStorageClassStorageBuffer,
[glsl_push_constant] = SpvStorageClassPushConstant,
};
sc = iface_storage[interface];
} else if (storage < sc_count) {