From 06573a6a8cfb37d73831ebabcaff0ce8950dfe2b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 15 Feb 2025 21:20:49 +0900 Subject: [PATCH] [qfcc] Translate glsl format to spir-v format Due to some underscores in the glsl names, there was no way just case insensitivity would help, and I didn't want to edit the strings. --- tools/qfcc/source/glsl-layout.c | 42 ++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/glsl-layout.c b/tools/qfcc/source/glsl-layout.c index 036b3995d..ff22217ed 100644 --- a/tools/qfcc/source/glsl-layout.c +++ b/tools/qfcc/source/glsl-layout.c @@ -85,6 +85,7 @@ typedef struct layout_qual_s { unsigned if_mask; const char **stage_filter; const layout_acc_t *accessors; + const char *real_name; } layout_qual_t; static void @@ -230,7 +231,7 @@ glsl_layout_format (const layout_qual_t *qual, specifier_t spec, const expr_t *qual_name) { auto type = spec.sym->type; - type = set_image_format (type, qual->name); + type = set_image_format (type, qual->real_name); spec.sym->type = type; } @@ -894,234 +895,273 @@ static layout_qual_t layout_qualifiers[] = { .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba32f", }, { .name = "rgba16f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba16f", }, { .name = "rg32f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg32f", }, { .name = "rg16f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg16f", }, { .name = "r11f_g11f_b10f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R11fG11fB10f", }, { .name = "r32f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R32f", }, { .name = "r16f", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R16f", }, { .name = "rgba16", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba16", }, { .name = "rgb10_a2", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgb10A2", }, { .name = "rgba8", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba8", }, { .name = "rg16", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg16", }, { .name = "rg8", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg8", }, { .name = "r16", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R16", }, { .name = "r8", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R8", }, { .name = "rgba16_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba16Snorm", }, { .name = "rgba8_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba8Snorm", }, { .name = "rg16_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg16Snorm", }, { .name = "rg8_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg8Snorm", }, { .name = "r16_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R16Snorm", }, { .name = "r8_snorm", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R8Snorm", }, { .name = "rgba32i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba32i", }, { .name = "rgba16i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba16i", }, { .name = "rgba8i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba8i", }, { .name = "rg32i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg32i", }, { .name = "rg16i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg16i", }, { .name = "rg8i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg8i", }, { .name = "r32i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R32i", }, { .name = "r16i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R16i", }, { .name = "r8i", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R8i", }, { .name = "rgba32ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba32ui", }, { .name = "rgba16ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba16ui", }, { .name = "rgb10_a2ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgb10a2ui", }, { .name = "rgba8ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rgba8ui", }, { .name = "rg32ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg32ui", }, { .name = "rg16ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg16ui", }, { .name = "rg8ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "Rg8ui", }, { .name = "r32ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R32ui", }, { .name = "r16ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R16ui", }, { .name = "r8ui", .apply = A(glsl_layout_format), .obj_mask = D(var), .var_type = V(image), .if_mask = I(uniform), + .real_name = "R8ui", }, }; #undef A