mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Add a separate field for the target location of a signature element.
We want to be able to remap input signatures based on the signature index, but signature normalization both reorders the signature, and requires the old register index, so add a new field for this.
This commit is contained in:
parent
bad72d1874
commit
cb96482500
Notes:
Alexandre Julliard
2023-08-03 21:25:28 +09:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/280
@ -557,6 +557,7 @@ static bool add_signature_element(struct vkd3d_shader_sm1_parser *sm1, bool outp
|
||||
element->sysval_semantic = sysval;
|
||||
element->component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
||||
element->register_index = register_index;
|
||||
element->target_location = register_index;
|
||||
element->register_count = 1;
|
||||
element->mask = mask;
|
||||
element->used_mask = is_dcl ? 0 : mask;
|
||||
|
@ -391,6 +391,7 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
||||
read_dword(&ptr, &e[i].sysval_semantic);
|
||||
read_dword(&ptr, &e[i].component_type);
|
||||
read_dword(&ptr, &e[i].register_index);
|
||||
e[i].target_location = e[i].register_index;
|
||||
e[i].register_count = 1;
|
||||
read_dword(&ptr, &mask);
|
||||
e[i].mask = mask & 0xff;
|
||||
|
@ -4602,7 +4602,7 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int location = signature_element->register_index;
|
||||
unsigned int location = signature_element->target_location;
|
||||
|
||||
input_id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream,
|
||||
storage_class, component_type, input_component_count, array_sizes, 2);
|
||||
@ -4980,7 +4980,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int location = signature_element->register_index;
|
||||
unsigned int location = signature_element->target_location;
|
||||
|
||||
if (is_patch_constant)
|
||||
location += shader_signature_next_location(&compiler->output_signature);
|
||||
@ -4989,10 +4989,10 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
||||
storage_class, component_type, output_component_count, array_sizes, 2);
|
||||
vkd3d_spirv_add_iface_variable(builder, id);
|
||||
|
||||
if (is_dual_source_blending(compiler) && signature_element->register_index < 2)
|
||||
if (is_dual_source_blending(compiler) && location < 2)
|
||||
{
|
||||
vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationLocation, 0);
|
||||
vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationIndex, signature_element->register_index);
|
||||
vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationIndex, location);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -815,11 +815,14 @@ struct signature_element
|
||||
unsigned int stream_index;
|
||||
enum vkd3d_shader_sysval_semantic sysval_semantic;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
/* Register index in the source shader. */
|
||||
unsigned int register_index;
|
||||
unsigned int register_count;
|
||||
unsigned int mask;
|
||||
unsigned int used_mask;
|
||||
enum vkd3d_shader_minimum_precision min_precision;
|
||||
/* Register index / location in the target shader. */
|
||||
unsigned int target_location;
|
||||
};
|
||||
|
||||
struct shader_signature
|
||||
|
Loading…
Reference in New Issue
Block a user