mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-27 20:58:11 +02:00
The nir to tgsi translator flattens all constants in the nir shader into uint32 immediates. In the svga driver, the vgpu10 shader translator then packs all these immediates into a constant buffer, and also optimizes it to prevent repetitions by only emitting a 32-bit constant once. This can cause problems with double sized constants, since either the lower or higher 32-bits of different 64-bit constant can be identical, and in the constant buffer that repeating 32-bit value will be emitted only once, so a 64-bit constant gets split into two non-contiguous 32-bit values. When this 64-bit constant is then invoked by a double instruction live ddiv or dmul, the source register can now have invalid swizzles like .xz or .xw since its 32-bit components are not contiguous. We have seen this happen in the piglit test - spec@arb_gpu_shader_fp64@execution@glsl-fs-loop-unroll-mul-fp64 which emits invalid swizzle values for double instructions. To fix this, introduce a new option in nir to tgsi shader translator that preserves uint64 constants. When a 64-bit immediate is translated into svga shader code, its 32-bit components are contiguous and aligned in the constant buffer, so accessing them only emits valid swizzles .xy and .zw. Other drivers using the nir to tgsi shader translater should not see any change in the tgsi shader emitted unless they too explicitly invoke the keep_double_immediates option like svga. Signed-off-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33749> |
||
|---|---|---|
| .. | ||
| nir_draw_helpers.c | ||
| nir_draw_helpers.h | ||
| nir_to_tgsi.c | ||
| nir_to_tgsi.h | ||
| nir_to_tgsi_info.c | ||
| nir_to_tgsi_info.h | ||
| pipe_nir.h | ||
| tgsi_to_nir.c | ||
| tgsi_to_nir.h | ||