From 953be00a7223e9b11f30c64ac3d84d46b6fe912c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Apr 2024 11:25:10 +0900 Subject: [PATCH] [qfcc] Use appropriate result type for swizzles Swizzles now result in a vector of the same width as the swizzle itself rather than the source vector. --- tools/qfcc/include/expr.h | 3 --- tools/qfcc/source/expr.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index 2a632e5aa..f31b420d2 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -285,9 +285,6 @@ typedef struct { type_t *type; ///< result type } ex_horizontal_t; -//NOTE always operates on vec4 or dvec4, so needs a suitable destination and -//care must be taken when working with smaller source operands (check aligmnet -//and adjust swizzle operation as needed) typedef struct { const expr_t *src; ///< source expression unsigned source[4]; ///< src component indices diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 030c34197..922b6834e 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -667,7 +667,7 @@ new_swizzle_expr (const expr_t *src, const char *swizzle) } swiz.zero |= (0xf << comp_count) & 0xf; swiz.src = src; - swiz.type = src_type; + swiz.type = vector_type (base_type (src_type), comp_count); expr_t *expr = new_expr (); expr->type = ex_swizzle;