vkd3d: Use index type LUT.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
d23f5f4343
commit
24de683375
|
@ -9522,15 +9522,13 @@ static void d3d12_command_list_execute_indirect_state_template(
|
||||||
/* - Stride can mismatch, i.e. we need internal alignment of arguments.
|
/* - Stride can mismatch, i.e. we need internal alignment of arguments.
|
||||||
* - Min required alignment on the indirect buffer itself might be too strict.
|
* - Min required alignment on the indirect buffer itself might be too strict.
|
||||||
* - Min required alignment on count buffer might be too strict.
|
* - Min required alignment on count buffer might be too strict.
|
||||||
* - We require debugging.
|
* - We require debugging. */
|
||||||
* - Temporary: IBO type rewrite is required. TODO: Use index type LUT feature. */
|
|
||||||
props = &list->device->device_info.device_generated_commands_properties_nv;
|
props = &list->device->device_info.device_generated_commands_properties_nv;
|
||||||
|
|
||||||
if ((signature->state_template.stride != signature->desc.ByteStride && max_command_count > 1) ||
|
if ((signature->state_template.stride != signature->desc.ByteStride && max_command_count > 1) ||
|
||||||
(arg_buffer_offset & (props->minIndirectCommandsBufferOffsetAlignment - 1)) ||
|
(arg_buffer_offset & (props->minIndirectCommandsBufferOffsetAlignment - 1)) ||
|
||||||
(count_buffer && (count_buffer_offset & (props->minSequencesCountBufferOffsetAlignment - 1))) ||
|
(count_buffer && (count_buffer_offset & (props->minSequencesCountBufferOffsetAlignment - 1))) ||
|
||||||
patch_args.debug_tag ||
|
patch_args.debug_tag)
|
||||||
require_ibo_update)
|
|
||||||
{
|
{
|
||||||
require_patch = true;
|
require_patch = true;
|
||||||
}
|
}
|
||||||
|
@ -12830,6 +12828,9 @@ static HRESULT d3d12_command_signature_init_state_template(struct d3d12_command_
|
||||||
VKD3D_PATCH_COMMAND_TOKEN_COPY_ROOT_VA_HI,
|
VKD3D_PATCH_COMMAND_TOKEN_COPY_ROOT_VA_HI,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const VkIndexType vk_index_types[] = { VK_INDEX_TYPE_UINT32, VK_INDEX_TYPE_UINT16 };
|
||||||
|
static const uint32_t d3d_index_types[] = { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R16_UINT };
|
||||||
|
|
||||||
if (!device->device_info.device_generated_commands_features_nv.deviceGeneratedCommands)
|
if (!device->device_info.device_generated_commands_features_nv.deviceGeneratedCommands)
|
||||||
{
|
{
|
||||||
WARN("Device generated commands not supported, indirect state commands will be ignored.\n");
|
WARN("Device generated commands not supported, indirect state commands will be ignored.\n");
|
||||||
|
@ -12920,6 +12921,9 @@ static HRESULT d3d12_command_signature_init_state_template(struct d3d12_command_
|
||||||
|
|
||||||
case D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW:
|
case D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW:
|
||||||
token.tokenType = VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV;
|
token.tokenType = VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV;
|
||||||
|
token.indexTypeCount = ARRAY_SIZE(vk_index_types);
|
||||||
|
token.pIndexTypeValues = d3d_index_types;
|
||||||
|
token.pIndexTypes = vk_index_types;
|
||||||
|
|
||||||
/* If device exposes 4 byte alignment of the indirect command buffer, it implies we can
|
/* If device exposes 4 byte alignment of the indirect command buffer, it implies we can
|
||||||
* pack VA at sub-scalar alignment. Probably not completely within spec, but hey ... */
|
* pack VA at sub-scalar alignment. Probably not completely within spec, but hey ... */
|
||||||
|
@ -12997,6 +13001,7 @@ static HRESULT d3d12_command_signature_init_state_template(struct d3d12_command_
|
||||||
required_stride_alignment = max(required_stride_alignment, required_alignment);
|
required_stride_alignment = max(required_stride_alignment, required_alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stream_stride = max(stream_stride, desc->ByteStride);
|
||||||
stream_stride = align(stream_stride, required_stride_alignment);
|
stream_stride = align(stream_stride, required_stride_alignment);
|
||||||
|
|
||||||
if (FAILED(hr = d3d12_command_signature_init_patch_commands_buffer(signature, device, patch_commands, patch_commands_count)))
|
if (FAILED(hr = d3d12_command_signature_init_patch_commands_buffer(signature, device, patch_commands, patch_commands_count)))
|
||||||
|
|
|
@ -11,11 +11,6 @@ struct Command
|
||||||
uint dst_offset;
|
uint dst_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int COMMAND_TYPE_COPY_INDEX_TYPE = 4;
|
|
||||||
const int DXGI_FORMAT_R32_UINT = 0x2a;
|
|
||||||
const int VK_INDEX_TYPE_UINT16 = 0;
|
|
||||||
const int VK_INDEX_TYPE_UINT32 = 1;
|
|
||||||
|
|
||||||
layout(buffer_reference, std430, buffer_reference_align = 4) readonly buffer Commands
|
layout(buffer_reference, std430, buffer_reference_align = 4) readonly buffer Commands
|
||||||
{
|
{
|
||||||
Command commands[];
|
Command commands[];
|
||||||
|
@ -66,11 +61,7 @@ void main()
|
||||||
{
|
{
|
||||||
uint src_offset = src_stride * draw_id + cmd.src_offset;
|
uint src_offset = src_stride * draw_id + cmd.src_offset;
|
||||||
uint dst_offset = dst_stride * draw_id + cmd.dst_offset;
|
uint dst_offset = dst_stride * draw_id + cmd.dst_offset;
|
||||||
|
|
||||||
uint src_value = src_buffer_va.values[src_offset];
|
uint src_value = src_buffer_va.values[src_offset];
|
||||||
if (cmd.type == COMMAND_TYPE_COPY_INDEX_TYPE)
|
|
||||||
src_value = src_value == DXGI_FORMAT_R32_UINT ? VK_INDEX_TYPE_UINT32 : VK_INDEX_TYPE_UINT16;
|
|
||||||
|
|
||||||
dst_buffer_va.values[dst_offset] = src_value;
|
dst_buffer_va.values[dst_offset] = src_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,6 @@ struct Command
|
||||||
uint dst_offset;
|
uint dst_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int COMMAND_TYPE_COPY_INDEX_TYPE = 4;
|
|
||||||
const int DXGI_FORMAT_R32_UINT = 0x2a;
|
|
||||||
const int VK_INDEX_TYPE_UINT16 = 0;
|
|
||||||
const int VK_INDEX_TYPE_UINT32 = 1;
|
|
||||||
|
|
||||||
layout(buffer_reference, std430, buffer_reference_align = 4) readonly buffer Commands
|
layout(buffer_reference, std430, buffer_reference_align = 4) readonly buffer Commands
|
||||||
{
|
{
|
||||||
Command commands[];
|
Command commands[];
|
||||||
|
@ -79,8 +74,6 @@ void main()
|
||||||
uint dst_offset = dst_stride * draw_id + cmd.dst_offset;
|
uint dst_offset = dst_stride * draw_id + cmd.dst_offset;
|
||||||
|
|
||||||
uint src_value = src_buffer_va.values[src_offset];
|
uint src_value = src_buffer_va.values[src_offset];
|
||||||
if (cmd.type == COMMAND_TYPE_COPY_INDEX_TYPE)
|
|
||||||
src_value = src_value == DXGI_FORMAT_R32_UINT ? VK_INDEX_TYPE_UINT32 : VK_INDEX_TYPE_UINT16;
|
|
||||||
|
|
||||||
if (debug_tag != 0u)
|
if (debug_tag != 0u)
|
||||||
DEBUG_CHANNEL_MSG(cmd.type, dst_offset, src_offset, src_value);
|
DEBUG_CHANNEL_MSG(cmd.type, dst_offset, src_offset, src_value);
|
||||||
|
|
Loading…
Reference in New Issue