From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 17 ++++++++++------- tests/hlsl-initializer-objects.shader_test | 10 +++++----- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 7239b183..4bdd770a 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -412,17 +412,20 @@ unsigned int hlsl_type_component_count(struct hlsl_type *type) { return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count; } - if (type->type != HLSL_CLASS_STRUCT) + if (type->type == HLSL_CLASS_OBJECT) { - ERR("Unexpected data type %#x.\n", type->type); - return 0; + return 1; } - - LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) + if (type->type == HLSL_CLASS_STRUCT) { - count += hlsl_type_component_count(field->type); + LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) + { + count += hlsl_type_component_count(field->type); + } + return count; } - return count; + assert(0); + return 0; }
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2) diff --git a/tests/hlsl-initializer-objects.shader_test b/tests/hlsl-initializer-objects.shader_test index 2306d07f..5261aa05 100644 --- a/tests/hlsl-initializer-objects.shader_test +++ b/tests/hlsl-initializer-objects.shader_test @@ -25,8 +25,8 @@ float4 main() : sv_target }
[test] -todo draw quad -todo probe all rgba (0.2, 0.2, 0.2, 0.1) +draw quad +probe all rgba (0.2, 0.2, 0.2, 0.1)
[pixel shader] @@ -49,7 +49,7 @@ float4 main() : sv_target
[test] todo draw quad -todo probe all rgba (31.1, 41.1, 51.1, 61.1) 1 +probe all rgba (31.1, 41.1, 51.1, 61.1) 1
[pixel shader] @@ -71,7 +71,7 @@ float4 main() : sv_target }
-[pixel shader fail todo] +[pixel shader fail] Texture2D tex;
struct foo @@ -90,7 +90,7 @@ float4 main() : sv_target }
-[pixel shader fail todo] +[pixel shader fail] Texture2D tex;
struct foo