Zebediah Figura : vkd3d-shader/hlsl: Handle texture types in hlsl_type_to_string().

Alexandre Julliard julliard at winehq.org
Fri Oct 8 14:10:21 CDT 2021


Module: vkd3d
Branch: master
Commit: aafe776401578b2700244d4e9a9dd122aeaf0895
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=aafe776401578b2700244d4e9a9dd122aeaf0895

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Oct  7 21:58:56 2021 -0500

vkd3d-shader/hlsl: Handle texture types in hlsl_type_to_string().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index aecc4a6..e0f26c0 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -893,6 +893,37 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
             vkd3d_string_buffer_printf(string, "<anonymous struct>");
             return string;
 
+        case HLSL_CLASS_OBJECT:
+        {
+            static const char dimensions[5][HLSL_SAMPLER_DIM_MAX + 1] =
+            {
+                [HLSL_SAMPLER_DIM_1D] = "1D",
+                [HLSL_SAMPLER_DIM_2D] = "2D",
+                [HLSL_SAMPLER_DIM_3D] = "3D",
+                [HLSL_SAMPLER_DIM_CUBE] = "Cube"
+            };
+
+            switch (type->base_type)
+            {
+                case HLSL_TYPE_TEXTURE:
+                    if (type->sampler_dim == HLSL_SAMPLER_DIM_GENERIC)
+                    {
+                        vkd3d_string_buffer_printf(string, "Texture");
+                        return string;
+                    }
+
+                    assert(type->sampler_dim < ARRAY_SIZE(dimensions));
+                    assert(type->e.resource_format->base_type < ARRAY_SIZE(base_types));
+                    vkd3d_string_buffer_printf(string, "Texture%s<%s%u>", dimensions[type->sampler_dim],
+                            base_types[type->e.resource_format->base_type], type->e.resource_format->dimx);
+                    return string;
+
+                default:
+                    vkd3d_string_buffer_printf(string, "<unexpected type>");
+                    return string;
+            }
+        }
+
         default:
             vkd3d_string_buffer_printf(string, "<unexpected type>");
             return string;




More information about the wine-cvs mailing list