From a8b77b85ca97cec22eac6ce7eede78a8cfe3b783 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Fri, 22 Jul 2022 15:28:19 -0400 Subject: [PATCH] vkd3d-shader/hlsl: Skip implicit conversion if types are equal. Otherwise we get false in implicit_compatible_data_types() when passing types that are equal but not convertible according to convertible_data_type(); e.g. getting: "Can't implicitly convert from Texture2D to Texture2D." Signed-off-by: Francisco Casas --- libs/vkd3d-shader/hlsl.y | 3 +++ tests/hlsl-initializer-objects.shader_test | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 7df7afb9..1e488afa 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -370,6 +370,9 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct { struct hlsl_type *src_type = node->data_type; + if (hlsl_types_are_equal(src_type, dst_type)) + return node; + if (!implicit_compatible_data_types(src_type, dst_type)) { struct vkd3d_string_buffer *src_string, *dst_string; diff --git a/tests/hlsl-initializer-objects.shader_test b/tests/hlsl-initializer-objects.shader_test index 70f060c2..dcb60029 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]