vkd3d-shader/hlsl: Add special allocation rules for FFACE and SAMPLE.

This commit is contained in:
Francisco Casas 2024-11-14 23:09:38 -03:00 committed by Henri Verbeet
parent 2c15015ec2
commit 64bc0515e0
Notes: Henri Verbeet 2024-11-24 00:09:47 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1260
2 changed files with 8 additions and 1 deletions

View File

@ -5331,6 +5331,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
enum vkd3d_shader_register_type type; enum vkd3d_shader_register_type type;
struct vkd3d_shader_version version; struct vkd3d_shader_version version;
bool special_interpolation = false;
bool vip_allocation = false; bool vip_allocation = false;
uint32_t reg; uint32_t reg;
bool builtin; bool builtin;
@ -5389,6 +5390,9 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
|| semantic == VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX || semantic == VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX
|| semantic == VKD3D_SHADER_SV_PRIMITIVE_ID) || semantic == VKD3D_SHADER_SV_PRIMITIVE_ID)
vip_allocation = true; vip_allocation = true;
if (semantic == VKD3D_SHADER_SV_IS_FRONT_FACE || semantic == VKD3D_SHADER_SV_SAMPLE_INDEX)
special_interpolation = true;
} }
if (builtin) if (builtin)
@ -5402,6 +5406,9 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
? 0 : sm4_get_interpolation_mode(var->data_type, var->storage_modifiers); ? 0 : sm4_get_interpolation_mode(var->data_type, var->storage_modifiers);
unsigned int reg_size = optimize ? var->data_type->dimx : 4; unsigned int reg_size = optimize ? var->data_type->dimx : 4;
if (special_interpolation)
mode = VKD3DSIM_NONE;
var->regs[HLSL_REGSET_NUMERIC] = allocate_register(ctx, allocator, 1, UINT_MAX, var->regs[HLSL_REGSET_NUMERIC] = allocate_register(ctx, allocator, 1, UINT_MAX,
reg_size, var->data_type->dimx, mode, var->force_align, vip_allocation); reg_size, var->data_type->dimx, mode, var->force_align, vip_allocation);

View File

@ -2845,7 +2845,7 @@ static void test_signature_reflection(void)
{vs6_source, "vs_4_0", false, vs6_inputs, ARRAY_SIZE(vs6_inputs), vs6_outputs, ARRAY_SIZE(vs6_outputs)}, {vs6_source, "vs_4_0", false, vs6_inputs, ARRAY_SIZE(vs6_inputs), vs6_outputs, ARRAY_SIZE(vs6_outputs)},
{ps13_source, "ps_4_0", false, ps13_inputs, ARRAY_SIZE(ps13_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple)}, {ps13_source, "ps_4_0", false, ps13_inputs, ARRAY_SIZE(ps13_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple)},
{ps14_source, "ps_4_0", false, ps14_inputs, ARRAY_SIZE(ps14_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple)}, {ps14_source, "ps_4_0", false, ps14_inputs, ARRAY_SIZE(ps14_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple)},
{ps15_source, "ps_4_1", false, ps15_inputs, ARRAY_SIZE(ps15_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple), NULL, 0, true}, {ps15_source, "ps_4_1", false, ps15_inputs, ARRAY_SIZE(ps15_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple)},
{hs1_source, "hs_5_0", false, NULL, 0, hs1_outputs, ARRAY_SIZE(hs1_outputs), hs1_patch_constants, ARRAY_SIZE(hs1_patch_constants)}, {hs1_source, "hs_5_0", false, NULL, 0, hs1_outputs, ARRAY_SIZE(hs1_outputs), hs1_patch_constants, ARRAY_SIZE(hs1_patch_constants)},
{hs2_source, "hs_5_0", false, NULL, 0, hs2_outputs, ARRAY_SIZE(hs2_outputs), hs2_patch_constants, ARRAY_SIZE(hs2_patch_constants)}, {hs2_source, "hs_5_0", false, NULL, 0, hs2_outputs, ARRAY_SIZE(hs2_outputs), hs2_patch_constants, ARRAY_SIZE(hs2_patch_constants)},
{hs3_source, "hs_5_0", false, NULL, 0, hs3_outputs, ARRAY_SIZE(hs3_outputs), hs3_patch_constants, ARRAY_SIZE(hs3_patch_constants)}, {hs3_source, "hs_5_0", false, NULL, 0, hs3_outputs, ARRAY_SIZE(hs3_outputs), hs3_patch_constants, ARRAY_SIZE(hs3_patch_constants)},