vkd3d-shader/hlsl: Support initialization of implicit size arrays.

HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT (zero) is used as a temporal value
for elements_count for implicit size arrays.
This value is replaced by the correct one after parsing the initializer.

In case the implicit array is not initialized correctly, hlsl_error()
is called but the array size is kept at 0. So the rest of the code
must handle these cases.

In shader model 5.1, unlike in 5.0, declaring a multi-dimensional
object-type array with the last dimension implicit results in
an error. This happens even in presence of an initializer.

So, both gen_struct_fields() and declare_vars() first check if the
shader model is 5.1, the array elements are objects, and if there is
at least one implicit array size to handle the whole type as an
unbounded resource array.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
This commit is contained in:
Francisco Casas
2022-08-08 18:11:03 -04:00
committed by Alexandre Julliard
parent 96a7236700
commit 3d9baef321
Notes: Alexandre Julliard 2022-10-18 00:13:00 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/7
4 changed files with 158 additions and 15 deletions

View File

@ -7,8 +7,8 @@ float4 main() : SV_TARGET
}
[test]
todo draw quad
todo probe all rgba (50, 60, 70, 80)
draw quad
probe all rgba (50, 60, 70, 80)
[pixel shader]
@ -21,8 +21,8 @@ float4 main() : sv_target
}
[test]
todo draw quad
todo probe all rgba (5.0, 6.0, 7.0, 8.0)
draw quad
probe all rgba (5.0, 6.0, 7.0, 8.0)
[pixel shader]
@ -34,8 +34,8 @@ float4 main() : sv_target
}
[test]
todo draw quad
todo probe all rgba (7.0, 8.0, 9.0, 10.0)
draw quad
probe all rgba (7.0, 8.0, 9.0, 10.0)
[pixel shader]
@ -62,8 +62,8 @@ float4 main() : SV_TARGET
}
[test]
todo draw quad
todo probe all rgba (318.0, 320.0, 322.0, 324.0)
draw quad
probe all rgba (318.0, 320.0, 322.0, 324.0)
[pixel shader fail]