mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
glsl: skip comparison opt when adding vars of different size
The spec allows adding scalars with a vector or matrix. In this case the opt was losing swizzle and size information. This fixes a bug with Doom (2016) shaders. Fixes:34ec1a24d6("glsl: Optimize (x + y cmp 0) into (x cmp -y).") Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit2a5121bf35)
This commit is contained in:
parent
fb39f5d2e8
commit
45bea64814
1 changed files with 6 additions and 0 deletions
|
|
@ -709,6 +709,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
if (!is_vec_zero(zero))
|
||||
continue;
|
||||
|
||||
/* We are allowed to add scalars with a vector or matrix. In that
|
||||
* case lets just exit early.
|
||||
*/
|
||||
if (add->operands[0]->type != add->operands[1]->type)
|
||||
continue;
|
||||
|
||||
/* Depending of the zero position we want to optimize
|
||||
* (0 cmp x+y) into (-x cmp y) or (x+y cmp 0) into (x cmp -y)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue