Module: vkd3d Branch: master Commit: 3d9baef321cb73ddbfbea09c06cc99e72f1425dc URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/3d9baef321cb73ddbfbea09c06cc99...
Author: Francisco Casas fcasas@codeweavers.com Date: Mon Aug 8 18:11:03 2022 -0400
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
---
libs/vkd3d-shader/hlsl.c | 11 +- libs/vkd3d-shader/hlsl.h | 2 + libs/vkd3d-shader/hlsl.y | 144 +++++++++++++++++++++- tests/hlsl-initializer-implicit-array.shader_test | 16 +-- 4 files changed, 158 insertions(+), 15 deletions(-)