Module: vkd3d Branch: master Commit: e6dabf22bf7926cb78085836798f8a2adedaaba0 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=e6dabf22bf7926cb78085836...
Author: Zebediah Figura zfigura@codeweavers.com Date: Tue Mar 22 16:59:11 2022 -0500
vkd3d-shader/hlsl: Respect the 'nointerpolation' modifier.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
Makefile.am | 1 - libs/vkd3d-shader/hlsl_codegen.c | 9 ++++++--- libs/vkd3d-shader/hlsl_sm4.c | 9 ++++++++- 3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 64cfe534..8845be37 100644 --- a/Makefile.am +++ b/Makefile.am @@ -352,7 +352,6 @@ XFAIL_TESTS = \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/logic-operations.shader_test \ tests/max.shader_test \ - tests/nointerpolation.shader_test \ tests/sampler-offset.shader_test \ tests/trigonometry.shader_test endif diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 98be3aeb..a6a574a7 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -34,7 +34,8 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru /* Use the synthetic name for the temp, rather than the uniform, so that we * can write the uniform name into the shader reflection data. */
- if (!(uniform = hlsl_new_var(ctx, temp->name, temp->data_type, temp->loc, NULL, 0, &temp->reg_reservation))) + if (!(uniform = hlsl_new_var(ctx, temp->name, temp->data_type, + temp->loc, NULL, temp->modifiers, &temp->reg_reservation))) return; list_add_before(&temp->scope_entry, &uniform->scope_entry); list_add_tail(&ctx->extern_vars, &uniform->extern_entry); @@ -76,7 +77,8 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct return; } new_semantic.index = semantic->index; - if (!(input = hlsl_new_var(ctx, hlsl_strdup(ctx, name->buffer), type, var->loc, &new_semantic, 0, NULL))) + if (!(input = hlsl_new_var(ctx, hlsl_strdup(ctx, name->buffer), + type, var->loc, &new_semantic, var->modifiers, NULL))) { hlsl_release_string_buffer(ctx, name); vkd3d_free((void *)new_semantic.name); @@ -147,7 +149,8 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct return; } new_semantic.index = semantic->index; - if (!(output = hlsl_new_var(ctx, hlsl_strdup(ctx, name->buffer), type, var->loc, &new_semantic, 0, NULL))) + if (!(output = hlsl_new_var(ctx, hlsl_strdup(ctx, name->buffer), + type, var->loc, &new_semantic, var->modifiers, NULL))) { vkd3d_free((void *)new_semantic.name); hlsl_release_string_buffer(ctx, name); diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c index c1e93e93..2dd9cde8 100644 --- a/libs/vkd3d-shader/hlsl_sm4.c +++ b/libs/vkd3d-shader/hlsl_sm4.c @@ -1203,7 +1203,14 @@ static void write_sm4_dcl_semantic(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b }
if (profile->type == VKD3D_SHADER_TYPE_PIXEL) - instr.opcode |= VKD3DSIM_LINEAR << VKD3D_SM4_INTERPOLATION_MODE_SHIFT; + { + enum vkd3d_shader_interpolation_mode mode = VKD3DSIM_LINEAR; + + if (var->modifiers & HLSL_STORAGE_NOINTERPOLATION) + mode = VKD3DSIM_CONSTANT; + + instr.opcode |= mode << VKD3D_SM4_INTERPOLATION_MODE_SHIFT; + } } else {