glsl: Expand non-expr & non-swizzle scalar rvalues in vectorizing.
This commit is contained in:
parent
3f49a8c9a5
commit
606544214e
|
@ -106,9 +106,10 @@ public:
|
|||
* the nodes of the tree (expression float log2 (swiz z (var_ref v0))),
|
||||
* rewriting it into (expression vec3 log2 (swiz xyz (var_ref v0))).
|
||||
*
|
||||
* The function modifies only ir_expressions and ir_swizzles. For expressions
|
||||
* it sets a new type and swizzles any scalar dereferences into appropriately
|
||||
* sized vector arguments. For example, if combining
|
||||
* The function operates on ir_expressions (and its operands) and ir_swizzles.
|
||||
* For expressions it sets a new type and swizzles any non-expression and non-
|
||||
* swizzle scalar operands into appropriately sized vector arguments. For
|
||||
* example, if combining
|
||||
*
|
||||
* (assign (x) (var_ref r1) (expression float + (swiz x (var_ref v0) (var_ref v1))))
|
||||
* (assign (y) (var_ref r1) (expression float + (swiz y (var_ref v0) (var_ref v1))))
|
||||
|
@ -146,9 +147,10 @@ rewrite_swizzle(ir_instruction *ir, void *data)
|
|||
mask->num_components, 1);
|
||||
for (unsigned i = 0; i < 4; i++) {
|
||||
if (expr->operands[i]) {
|
||||
ir_dereference *deref = expr->operands[i]->as_dereference();
|
||||
if (deref && deref->type->is_scalar()) {
|
||||
expr->operands[i] = new(ir) ir_swizzle(deref, 0, 0, 0, 0,
|
||||
ir_rvalue *rval = expr->operands[i]->as_rvalue();
|
||||
if (rval && rval->type->is_scalar() &&
|
||||
!rval->as_expression() && !rval->as_swizzle()) {
|
||||
expr->operands[i] = new(ir) ir_swizzle(rval, 0, 0, 0, 0,
|
||||
mask->num_components);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue