vkd3d-shader/hlsl: Lower non-constant array loads for SM1.

This is achieved by means of creating a variable storing zero,
loading every array element, comparing if the non-constant index
matches the index of that element at runtime, and in that case
store the corresponding element in the variable.

This seems to be the same strategy that the native compiler uses.
This commit is contained in:
Francisco Casas
2024-07-08 15:13:07 -04:00
committed by Henri Verbeet
parent e0cfd8f86a
commit 9f515a9daa
Notes: Henri Verbeet 2024-08-08 23:47:10 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/936
3 changed files with 148 additions and 29 deletions

View File

@@ -375,7 +375,7 @@ draw quad
probe (0, 0) rgba (6, 1, 0, 0)
[pixel shader todo]
[pixel shader]
// Relative addressing extends the allocation size only up to the array's size.
float idx;
@@ -405,8 +405,8 @@ uniform 8 float 2
uniform 12 float 3
uniform 16 float 4
uniform 20 float 3
todo draw quad
draw quad
probe (0, 0) rgba (3, 3, 3, 3)
uniform 20 float 1
todo draw quad
draw quad
probe (0, 0) rgba (1, 1, 1, 1)