Skip to content

r300: prefer old not native swizzle in constant folding

Filip Gawin requested to merge gawin/mesa:r300/old_swizzle into main

Consider (random@exponential@fragment@24):

...
  7: MOV temp[4].xyw, const[2].zy_x;
...
Fragment Program: after 'dataflow optimize'
# Radeon Compiler Program
...
  7: MOV temp[4].xyw, const[2].1-1_x;
...
r300compiler error: Bad swizzle in try_rewrite_constant()r300compiler error: Bad swizzle in try_rewrite_constant()

(In fragment shader we can only control negation of all channels xyzw at the same time. So .1-1_x is invalid.)

Function try_rewrite_constant in current form is not prepared to handle such bad swizzle. I thought that instead of complicating already complicated code it's better to avoid generating such invalid swizzle/negate. (To make code valid in try_rewrite_constant we would still need to return to const sources of values on all channels.)

@ondracka

Merge request reports