mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/ir: Normalise signatures and input/output registers to the Shader Model 6 pattern.
In Shader Model 6 each signature element can span a range of register indices, or 'rows', and system values do not share a register index with non-system values. Inputs and outputs are referenced by element index instead of register index. This patch merges multiple signature elements into a single element under the following conditions: - The register index in a load or store is specified dynamically by including a relative address parameter with a base register index. The dcl_index_range instruction is used to identify these. - A register declaration is split across multiple elements which declare different components of the register. - A patch constant function writes tessellation factors. These are an array in SPIR-V, but in SM 5.x each factor is declared as a separate register, and these are dynamically indexed by the fork/join instance id. Elimination of multiple fork/join phases converts the indices to constants, but merging the signature elements into a single arrayed element matches the SPIR-V output. All references to input/output register indices are converted to element indices. If a relative address is present, the element index is moved up a slot so it cannot be confused with a constant offset. Existing code only handles register index relative addressing for tessellation factors. This patch adds generic support for it.
This commit is contained in:
parent
110e48e54d
commit
6835e8176f
Notes:
Alexandre Julliard
2023-05-24 22:33:51 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/181
@ -373,6 +373,8 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
||||
{
|
||||
uint32_t name_offset, mask;
|
||||
|
||||
e[i].sort_index = i;
|
||||
|
||||
if (has_stream_index)
|
||||
read_dword(&ptr, &e[i].stream_index);
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -786,6 +786,7 @@ enum vkd3d_shader_input_sysval_semantic
|
||||
|
||||
struct signature_element
|
||||
{
|
||||
unsigned int sort_index;
|
||||
const char *semantic_name;
|
||||
unsigned int semantic_index;
|
||||
unsigned int stream_index;
|
||||
@ -959,6 +960,11 @@ static inline bool vkd3d_shader_register_is_output(const struct vkd3d_shader_reg
|
||||
return reg->type == VKD3DSPR_OUTPUT || reg->type == VKD3DSPR_COLOROUT;
|
||||
}
|
||||
|
||||
static inline bool vkd3d_shader_register_is_patch_constant(const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
return reg->type == VKD3DSPR_PATCHCONST;
|
||||
}
|
||||
|
||||
struct vkd3d_shader_location
|
||||
{
|
||||
const char *source_name;
|
||||
@ -1366,5 +1372,8 @@ int dxbc_writer_write(struct dxbc_writer *dxbc, struct vkd3d_shader_code *code);
|
||||
enum vkd3d_result instruction_array_flatten_hull_shader_phases(struct vkd3d_shader_instruction_array *instructions);
|
||||
enum vkd3d_result instruction_array_normalise_hull_shader_control_point_io(
|
||||
struct vkd3d_shader_instruction_array *instructions, const struct shader_signature *input_signature);
|
||||
enum vkd3d_result instruction_array_normalise_io_registers(struct vkd3d_shader_instruction_array *instructions,
|
||||
enum vkd3d_shader_type shader_type, struct shader_signature *input_signature,
|
||||
struct shader_signature *output_signature, struct shader_signature *patch_constant_signature);
|
||||
|
||||
#endif /* __VKD3D_SHADER_PRIVATE_H */
|
||||
|
@ -36432,7 +36432,6 @@ static void test_vs_ps_relative_addressing(void)
|
||||
|
||||
transition_resource_state(command_list, context.render_target,
|
||||
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
todo
|
||||
check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xff00ff00, 0);
|
||||
|
||||
ID3D12Resource_Release(vb);
|
||||
|
Loading…
x
Reference in New Issue
Block a user