[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.
This commit is contained in:
Bill Currie 2024-04-22 11:25:10 +09:00
parent 2bc7cc3d22
commit 953be00a72
2 changed files with 1 additions and 4 deletions

View file

@ -285,9 +285,6 @@ typedef struct {
type_t *type; ///< result type type_t *type; ///< result type
} ex_horizontal_t; } 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 { typedef struct {
const expr_t *src; ///< source expression const expr_t *src; ///< source expression
unsigned source[4]; ///< src component indices unsigned source[4]; ///< src component indices

View file

@ -667,7 +667,7 @@ new_swizzle_expr (const expr_t *src, const char *swizzle)
} }
swiz.zero |= (0xf << comp_count) & 0xf; swiz.zero |= (0xf << comp_count) & 0xf;
swiz.src = src; swiz.src = src;
swiz.type = src_type; swiz.type = vector_type (base_type (src_type), comp_count);
expr_t *expr = new_expr (); expr_t *expr = new_expr ();
expr->type = ex_swizzle; expr->type = ex_swizzle;