vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov
2023-09-21 15:14:55 +02:00
committed by Alexandre Julliard
parent 1930b51d97
commit 8479ceedfc
Notes: Alexandre Julliard 2023-10-09 23:10:36 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/358
2 changed files with 16 additions and 3 deletions

View File

@ -377,6 +377,8 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *
for (i = 0; i < hlsl_type_element_count(type); ++i) for (i = 0; i < hlsl_type_element_count(type); ++i)
{ {
unsigned int element_modifiers = modifiers;
if (type->class == HLSL_CLASS_ARRAY) if (type->class == HLSL_CLASS_ARRAY)
{ {
elem_semantic_index = semantic_index elem_semantic_index = semantic_index
@ -391,6 +393,17 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *
semantic = &field->semantic; semantic = &field->semantic;
elem_semantic_index = semantic->index; elem_semantic_index = semantic->index;
loc = &field->loc; loc = &field->loc;
element_modifiers |= field->storage_modifiers;
/* TODO: 'sample' modifier is not supported yet */
/* 'nointerpolation' always takes precedence, next the same is done for 'sample',
remaining modifiers are combined. */
if (element_modifiers & HLSL_STORAGE_NOINTERPOLATION)
{
element_modifiers &= ~HLSL_INTERPOLATION_MODIFIERS_MASK;
element_modifiers |= HLSL_STORAGE_NOINTERPOLATION;
}
} }
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc)))
@ -402,7 +415,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *
return; return;
list_add_after(&c->entry, &element_load->node.entry); list_add_after(&c->entry, &element_load->node.entry);
prepend_input_copy_recurse(ctx, block, element_load, modifiers, semantic, elem_semantic_index); prepend_input_copy_recurse(ctx, block, element_load, element_modifiers, semantic, elem_semantic_index);
} }
} }
else else

View File

@ -51,7 +51,7 @@ float4 main(ps_input input) : sv_target
[test] [test]
draw triangle list 3 draw triangle list 3
todo probe all rgba (0.0, 1.0, 0.0, 1.0) probe all rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader] [vertex shader]
struct ps_input struct ps_input
@ -105,7 +105,7 @@ float4 main(centroid ps_input input) : sv_target
[test] [test]
draw triangle list 3 draw triangle list 3
todo probe all rgba (0.0, 1.0, 0.0, 1.0) probe all rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader] [vertex shader]
struct ps_input struct ps_input