glsl: skip comparison opt when adding vars of different size
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 27 Jun 2018 23:23:20 +0000 (09:23 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 28 Jun 2018 02:15:17 +0000 (12:15 +1000)
commit2a5121bf355001e2c69ba05e8d9be4ed633c7bf4
tree03a7d52c5a0fce1bdc4cf53aa7c7699235f4f119
parente8eb182ec5980b96152ca4ce60bd5c364341b4d8
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: 34ec1a24d61f ("glsl: Optimize (x + y cmp 0) into (x cmp -y).")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/glsl/opt_algebraic.cpp