Skip to content

r300: enable R400 cos and sin hardware vertex shader opcodes

Patrick Lerda requested to merge noblock/mesa:r300enabler400cosandsin into main

What does this MR do and why?

r300: enable R400 cos and sin hardware vertex shader opcodes

The R400 has working hardware opcodes for cos and sin at
the vertex shader level. This change enables these features.

This change was tested on an ATI R430 (0x554d). Here are the
piglit tests which are generating and testing these opcodes:

spec/glsl-1.10/execution/built-in-functions/vs-cos-float: pass
spec/glsl-1.10/execution/built-in-functions/vs-cos-vec2: pass
spec/glsl-1.10/execution/built-in-functions/vs-cos-vec3: pass
spec/glsl-1.10/execution/built-in-functions/vs-cos-vec4: pass
spec/glsl-1.10/execution/built-in-functions/vs-sin-float: pass
spec/glsl-1.10/execution/built-in-functions/vs-sin-vec2: pass
spec/glsl-1.10/execution/built-in-functions/vs-sin-vec3: pass
spec/glsl-1.10/execution/built-in-functions/vs-sin-vec4: pass
spec/glsl-1.10/execution/built-in-functions/vs-tan-float: pass
spec/glsl-1.10/execution/built-in-functions/vs-tan-vec2: pass
spec/glsl-1.10/execution/built-in-functions/vs-tan-vec3: pass
spec/glsl-1.10/execution/built-in-functions/vs-tan-vec4: pass
spec/glsl-1.10/execution/builtins/glsl-vs-masked-cos: pass

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10504
Signed-off-by: Patrick Lerda <patrick9876@free.fr>

Here is the shader-db report:

instructions helped:   shaders/godot3.4/103.shader_test VS:              58 -> 56 (-3.45%)
instructions helped:   shaders/glmark/4-2.shader_test VS:                84 -> 75 (-10.71%)
instructions helped:   shaders/unity/99-Water.shader_test VS:            90 -> 80 (-11.11%)

consts helped:   shaders/glmark/4-2.shader_test VS:                23 -> 22 (-4.35%)

cycles helped:   shaders/godot3.4/103.shader_test VS:              58 -> 56 (-3.45%)
cycles helped:   shaders/glmark/4-2.shader_test VS:                84 -> 75 (-10.71%)
cycles helped:   shaders/unity/99-Water.shader_test VS:            91 -> 81 (-10.99%)

total instructions in shared programs: 26424 -> 26403 (-0.08%)
instructions in affected programs: 232 -> 211 (-9.05%)
helped: 3
HURT: 0
helped stats (abs) min: 2 max: 10 x̄: 7.00 x̃: 9
helped stats (rel) min: 3.45% max: 11.11% x̄: 8.42% x̃: 10.71%

total vinst in shared programs: 12879 -> 12879 (0.00%)
vinst in affected programs: 0 -> 0
helped: 0
HURT: 0

total sinst in shared programs: 8076 -> 8076 (0.00%)
sinst in affected programs: 0 -> 0
helped: 0
HURT: 0

total predicate in shared programs: 0 -> 0
predicate in affected programs: 0 -> 0
helped: 0
HURT: 0

total tex in shared programs: 1565 -> 1565 (0.00%)
tex in affected programs: 0 -> 0
helped: 0
HURT: 0

total presub in shared programs: 1043 -> 1043 (0.00%)
presub in affected programs: 0 -> 0
helped: 0
HURT: 0

total omod in shared programs: 151 -> 151 (0.00%)
omod in affected programs: 0 -> 0
helped: 0
HURT: 0

total temps in shared programs: 4475 -> 4475 (0.00%)
temps in affected programs: 0 -> 0
helped: 0
HURT: 0

total consts in shared programs: 17821 -> 17820 (<.01%)
consts in affected programs: 23 -> 22 (-4.35%)
helped: 1
HURT: 0

total lits in shared programs: 0 -> 0
lits in affected programs: 0 -> 0
helped: 0
HURT: 0

total cycles in shared programs: 43598 -> 43577 (-0.05%)
cycles in affected programs: 233 -> 212 (-9.01%)
helped: 3
HURT: 0
helped stats (abs) min: 2 max: 10 x̄: 7.00 x̃: 9
helped stats (rel) min: 3.45% max: 10.99% x̄: 8.38% x̃: 10.71%

LOST:   0
GAINED: 0

Total CPU time (seconds): 39.07 -> 38.95 (-0.31%)

Merge request reports