From 42f1f393292b59cec961af0b33a0c3401db1bb16 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 17 Jan 2025 22:18:49 +0900 Subject: [PATCH] [qfcc] Support subpassInput for image_coord Easiest to special case it since tex_coord uses the same dim_widths array. --- tools/qfcc/source/expr_construct.c | 3 +++ tools/qfcc/source/glsl-builtins.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/expr_construct.c b/tools/qfcc/source/expr_construct.c index 20aa93fd9..b319c17a9 100644 --- a/tools/qfcc/source/expr_construct.c +++ b/tools/qfcc/source/expr_construct.c @@ -294,6 +294,9 @@ const expr_t * constructor_expr (const expr_t *e, const expr_t *params) { auto type = e->typ.type; + if (is_void (type)) { + return error (e, "cannot construct the void"); + } if (is_algebra (type)) { return error (e, "algebra not implemented"); } diff --git a/tools/qfcc/source/glsl-builtins.c b/tools/qfcc/source/glsl-builtins.c index 7035e1e12..1ab965fd5 100644 --- a/tools/qfcc/source/glsl-builtins.c +++ b/tools/qfcc/source/glsl-builtins.c @@ -80,13 +80,16 @@ image_property (const type_t *type, const attribute_t *property) return new_type_expr (image->sample_type); } else if (strcmp (property->name, "image_coord") == 0) { int width = dim_widths[image->dim]; + if (image->dim == glid_subpassdata) { + width = 2; + } if (!width) { return new_type_expr (&type_void); } if (image->dim < glid_3d) { width += image->arrayed; } - return new_type_expr (vector_type (&type_float, width)); + return new_type_expr (vector_type (&type_int, width)); } else if (strcmp (property->name, "size_type") == 0) { int width = size_widths[image->dim]; if (!width) {