[PATCH 0/1] MR293: vkd3d-shader/hlsl: Force sm1 inputs to be 4-component only for vertex shaders.
From: Zebediah Figura <zfigura(a)codeweavers.com> Pixel shaders still have an appropriate writemask. --- libs/vkd3d-shader/hlsl_codegen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 25b5ca2f..d02e608c 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 list *instrs, struct 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) { -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/293
This doesn't look harmful, but why do we force inputs to have 4 components, even if not in the case of vertex shaders? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/293#note_41207
This doesn't look harmful, but why do we force inputs to have 4 components, even if not in the case of vertex shaders?
Same answer as always: that's how native does it :-) Which is to say, for vertex shaders, inputs are declared with an .xyzw writemask, and for pixel shaders, they're declared with a writemask corresponding to the actual type. We could potentially deal with this in the sm1 backend, by e.g. writing an .xyzw writemask regardless of what the actual type is. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/293#note_41221
This merge request was approved by Francisco Casas. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/293
``` $ ./tests/vkd3d_shader_api vkd3d_shader_api:415: test 0: input 0: Todo: Got used mask 0xf. vkd3d_shader_api:415: test 0: input 4: Todo: Got used mask 0x7. vkd3d_shader_api:415: test 0: input 6: Todo: Got used mask 0x1. vkd3d_shader_api:415: test 0: input 7: Todo: Got used mask 0x1. vkd3d_shader_api:415: test 0: output 0: Todo: Got used mask 0xf. vkd3d_shader_api:415: test 5: input 0: Todo: Got used mask 0x3. vkd3d_shader_api:415: test 5: input 2: Todo: Got used mask 0xf. vkd3d_shader_api:413: test 8: input 2: Test failed: Got mask 0x1. vkd3d_shader_api:415: test 8: input 2: Test failed: Got used mask 0x1. vkd3d_shader_api: 775 tests executed (2 failures, 0 skipped, 7 todo, 0 bugs). ``` -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/293#note_42299
participants (4)
-
Francisco Casas (@fcasas) -
Giovanni Mascellani (@giomasce) -
Zebediah Figura -
Zebediah Figura (@zfigura)