From 926575a6f3fb7dee853280a58401eeb407f1afb5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 31 Jul 2023 13:00:45 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Force sm1 inputs to be 4-component only for vertex shaders. Pixel shaders still have an appropriate writemask. --- libs/vkd3d-shader/hlsl_codegen.c | 5 +++-- tests/vkd3d_shader_api.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index bfa605f4..bae8e5f9 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -321,9 +321,10 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, s if (!semantic->name) return; - vector_type_src = hlsl_get_vector_type(ctx, type->base_type, - (ctx->profile->major_version < 4) ? 4 : hlsl_type_minor_size(type)); vector_type_dst = hlsl_get_vector_type(ctx, type->base_type, hlsl_type_minor_size(type)); + vector_type_src = vector_type_dst; + if (ctx->profile->major_version < 4 && ctx->profile->type == VKD3D_SHADER_TYPE_VERTEX) + vector_type_src = hlsl_get_vector_type(ctx, type->base_type, 4); for (i = 0; i < hlsl_type_major_size(type); ++i) { diff --git a/tests/vkd3d_shader_api.c b/tests/vkd3d_shader_api.c index 4893f44f..af75e0fd 100644 --- a/tests/vkd3d_shader_api.c +++ b/tests/vkd3d_shader_api.c @@ -630,7 +630,7 @@ static void test_scan_signatures(void) { {"COLOR", 0, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 0, 0xf, 0xf}, {"TEXCOORD", 2, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 1, 0xf, 0xf}, - {"DEPTH", 0, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 2, 0xf, 0xf}, + {"DEPTH", 0, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 2, 0x1, 0x1}, {"BLENDINDICES", 0, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 3, 0xf, 0xf}, {"VPOS", 0, 0, VKD3D_SHADER_SV_POSITION, VKD3D_SHADER_COMPONENT_FLOAT, 0, 0xf, 0xf}, {"VFACE", 0, 0, VKD3D_SHADER_SV_IS_FRONT_FACE, VKD3D_SHADER_COMPONENT_FLOAT, 1, 0x1, 0x1},