Skip to content

v3d/compiler: avoid unneeded sint/unorm clamping when lowering stores

They are being used on integer to integer stores. From Vulkan sec, final paragraph of 16.4.4 "Texel Output Format Conversion":

"Each component is converted based on its type and size (as
 defined in the Format Definition section for each
 VkFormat). ... Integer outputs are converted such that their value
 is preserved. The converted value of any integer that cannot be
 represented in the target format is undefined."

I didn't find a equivalent quote for OpenGL as all conversion entries are forcused on float to integer, fixed-point to integer, etc, and not on integer to integer. Didn't find any test failure with this change.

We didn't get any shader-db stats change with shaderdb (even overriding to OpenGL 4.4 to get more shaders built), so as a reference Vulkan shader-db stats with the pattern dEQP-VK.image..with_format..*

   total instructions in shared programs: 37534 -> 36522 (-2.70%)
   instructions in affected programs: 12080 -> 11068 (-8.38%)
   helped: 241
   HURT: 0
   Instructions are helped.

   total uniforms in shared programs: 9100 -> 8550 (-6.04%)
   uniforms in affected programs: 3004 -> 2454 (-18.31%)
   helped: 229
   HURT: 0

   total max-temps in shared programs: 6110 -> 6014 (-1.57%)
   max-temps in affected programs: 402 -> 306 (-23.88%)
   helped: 43
   HURT: 0
   Max-temps are helped.

   total nops in shared programs: 1523 -> 1526 (0.20%)
   nops in affected programs: 21 -> 24 (14.29%)
   helped: 3
   HURT: 6
   Inconclusive result (value mean confidence interval includes 0).
Edited by Alejandro Piñeiro

Merge request reports