Module: vkd3d Branch: master Commit: 8479ceedfc80aa88fc6423844a7568fb656ecf13 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/8479ceedfc80aa88fc6423844a7568...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Sep 21 15:14:55 2023 +0200
vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
---
libs/vkd3d-shader/hlsl_codegen.c | 15 ++++++++++++++- tests/hlsl/nointerpolation.shader_test | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index c0d18a3e..5c816e89 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -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) { + unsigned int element_modifiers = modifiers; + if (type->class == HLSL_CLASS_ARRAY) { 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; elem_semantic_index = semantic->index; 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))) @@ -402,7 +415,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block * return; 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 diff --git a/tests/hlsl/nointerpolation.shader_test b/tests/hlsl/nointerpolation.shader_test index 04f39a8e..6c218be8 100644 --- a/tests/hlsl/nointerpolation.shader_test +++ b/tests/hlsl/nointerpolation.shader_test @@ -51,7 +51,7 @@ float4 main(ps_input input) : sv_target
[test] 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] struct ps_input @@ -105,7 +105,7 @@ float4 main(centroid ps_input input) : sv_target
[test] 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] struct ps_input