mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elements.
The generated pixel shader input signature must be consistent with the generated vertex shader output signature for the same data type. Since the interpolation mode affects allocation order, the allocator needs to know the modifiers for both input and output signature elements.
This commit is contained in:
parent
7180a96741
commit
b65f5fb069
Notes:
Henri Verbeet
2024-10-22 20:54:15 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1193
@ -344,6 +344,23 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir
|
|||||||
return ext_var;
|
return ext_var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t combine_field_storage_modifiers(uint32_t modifiers, uint32_t field_modifiers)
|
||||||
|
{
|
||||||
|
field_modifiers |= modifiers;
|
||||||
|
|
||||||
|
/* TODO: 'sample' modifier is not supported yet. */
|
||||||
|
|
||||||
|
/* 'nointerpolation' always takes precedence, next the same is done for
|
||||||
|
* 'sample', remaining modifiers are combined. */
|
||||||
|
if (field_modifiers & HLSL_STORAGE_NOINTERPOLATION)
|
||||||
|
{
|
||||||
|
field_modifiers &= ~HLSL_INTERPOLATION_MODIFIERS_MASK;
|
||||||
|
field_modifiers |= HLSL_STORAGE_NOINTERPOLATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
return field_modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *lhs,
|
static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *lhs,
|
||||||
uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||||
{
|
{
|
||||||
@ -425,12 +442,13 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
|
|
||||||
for (i = 0; i < hlsl_type_element_count(type); ++i)
|
for (i = 0; i < hlsl_type_element_count(type); ++i)
|
||||||
{
|
{
|
||||||
uint32_t element_modifiers = modifiers;
|
uint32_t element_modifiers;
|
||||||
|
|
||||||
if (type->class == HLSL_CLASS_ARRAY)
|
if (type->class == HLSL_CLASS_ARRAY)
|
||||||
{
|
{
|
||||||
elem_semantic_index = semantic_index
|
elem_semantic_index = semantic_index
|
||||||
+ i * hlsl_type_get_array_element_reg_size(type->e.array.type, HLSL_REGSET_NUMERIC) / 4;
|
+ i * hlsl_type_get_array_element_reg_size(type->e.array.type, HLSL_REGSET_NUMERIC) / 4;
|
||||||
|
element_modifiers = modifiers;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -444,17 +462,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
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;
|
element_modifiers = combine_field_storage_modifiers(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)))
|
||||||
@ -563,10 +571,13 @@ static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
|
|
||||||
for (i = 0; i < hlsl_type_element_count(type); ++i)
|
for (i = 0; i < hlsl_type_element_count(type); ++i)
|
||||||
{
|
{
|
||||||
|
uint32_t element_modifiers;
|
||||||
|
|
||||||
if (type->class == HLSL_CLASS_ARRAY)
|
if (type->class == HLSL_CLASS_ARRAY)
|
||||||
{
|
{
|
||||||
elem_semantic_index = semantic_index
|
elem_semantic_index = semantic_index
|
||||||
+ i * hlsl_type_get_array_element_reg_size(type->e.array.type, HLSL_REGSET_NUMERIC) / 4;
|
+ i * hlsl_type_get_array_element_reg_size(type->e.array.type, HLSL_REGSET_NUMERIC) / 4;
|
||||||
|
element_modifiers = modifiers;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -577,6 +588,7 @@ static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
semantic = &field->semantic;
|
semantic = &field->semantic;
|
||||||
elem_semantic_index = semantic->index;
|
elem_semantic_index = semantic->index;
|
||||||
loc = &field->loc;
|
loc = &field->loc;
|
||||||
|
element_modifiers = combine_field_storage_modifiers(modifiers, field->storage_modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc)))
|
||||||
@ -587,7 +599,7 @@ static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
return;
|
return;
|
||||||
hlsl_block_add_instr(&func->body, &element_load->node);
|
hlsl_block_add_instr(&func->body, &element_load->node);
|
||||||
|
|
||||||
append_output_copy_recurse(ctx, func, element_load, modifiers, semantic, elem_semantic_index);
|
append_output_copy_recurse(ctx, func, element_load, element_modifiers, semantic, elem_semantic_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user