vkd3d: Implement indirect ray tracing.
Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
This commit is contained in:
parent
8ac7aaca99
commit
cdabda7805
|
@ -9414,6 +9414,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_EndEvent(d3d12_command_list_ifa
|
||||||
STATIC_ASSERT(sizeof(VkDispatchIndirectCommand) == sizeof(D3D12_DISPATCH_ARGUMENTS));
|
STATIC_ASSERT(sizeof(VkDispatchIndirectCommand) == sizeof(D3D12_DISPATCH_ARGUMENTS));
|
||||||
STATIC_ASSERT(sizeof(VkDrawIndexedIndirectCommand) == sizeof(D3D12_DRAW_INDEXED_ARGUMENTS));
|
STATIC_ASSERT(sizeof(VkDrawIndexedIndirectCommand) == sizeof(D3D12_DRAW_INDEXED_ARGUMENTS));
|
||||||
STATIC_ASSERT(sizeof(VkDrawIndirectCommand) == sizeof(D3D12_DRAW_ARGUMENTS));
|
STATIC_ASSERT(sizeof(VkDrawIndirectCommand) == sizeof(D3D12_DRAW_ARGUMENTS));
|
||||||
|
STATIC_ASSERT(offsetof(VkTraceRaysIndirectCommand2KHR, depth) == offsetof(D3D12_DISPATCH_RAYS_DESC, Depth));
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_list_iface *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_list_iface *iface,
|
||||||
ID3D12CommandSignature *command_signature, UINT max_command_count, ID3D12Resource *arg_buffer,
|
ID3D12CommandSignature *command_signature, UINT max_command_count, ID3D12Resource *arg_buffer,
|
||||||
|
@ -9483,11 +9484,13 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_l
|
||||||
{
|
{
|
||||||
scratch.buffer = count_impl->res.vk_buffer;
|
scratch.buffer = count_impl->res.vk_buffer;
|
||||||
scratch.offset = count_impl->mem.offset + count_buffer_offset;
|
scratch.offset = count_impl->mem.offset + count_buffer_offset;
|
||||||
|
scratch.va = d3d12_resource_get_va(count_impl, count_buffer_offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scratch.buffer = arg_impl->res.vk_buffer;
|
scratch.buffer = arg_impl->res.vk_buffer;
|
||||||
scratch.offset = arg_impl->mem.offset + arg_buffer_offset;
|
scratch.offset = arg_impl->mem.offset + arg_buffer_offset;
|
||||||
|
scratch.va = d3d12_resource_get_va(arg_impl, arg_buffer_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (arg_desc->Type)
|
switch (arg_desc->Type)
|
||||||
|
@ -9556,6 +9559,28 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_l
|
||||||
VK_CALL(vkCmdDispatchIndirect(list->vk_command_buffer, scratch.buffer, scratch.offset));
|
VK_CALL(vkCmdDispatchIndirect(list->vk_command_buffer, scratch.buffer, scratch.offset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS:
|
||||||
|
if (max_command_count != 1)
|
||||||
|
FIXME("Ignoring command count %u.\n", max_command_count);
|
||||||
|
|
||||||
|
if (count_buffer)
|
||||||
|
FIXME_ONCE("Count buffers not supported for indirect ray dispatch.\n");
|
||||||
|
|
||||||
|
if (!d3d12_command_list_update_raygen_state(list))
|
||||||
|
{
|
||||||
|
WARN("Failed to update raygen state, ignoring ray dispatch.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!list->device->device_info.ray_tracing_maintenance1_features.rayTracingPipelineTraceRaysIndirect2)
|
||||||
|
{
|
||||||
|
WARN("TraceRaysIndirect2 is not supported, ignoring ray dispatch.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
VK_CALL(vkCmdTraceRaysIndirect2KHR(list->vk_command_buffer, scratch.va));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("Ignoring unhandled argument type %#x.\n", arg_desc->Type);
|
FIXME("Ignoring unhandled argument type %#x.\n", arg_desc->Type);
|
||||||
break;
|
break;
|
||||||
|
@ -12261,6 +12286,7 @@ HRESULT d3d12_command_signature_create(struct d3d12_device *device, const D3D12_
|
||||||
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW:
|
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW:
|
||||||
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED:
|
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED:
|
||||||
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH:
|
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH:
|
||||||
|
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS:
|
||||||
if (i != desc->NumArgumentDescs - 1)
|
if (i != desc->NumArgumentDescs - 1)
|
||||||
{
|
{
|
||||||
WARN("Draw/dispatch must be the last element of a command signature.\n");
|
WARN("Draw/dispatch must be the last element of a command signature.\n");
|
||||||
|
|
|
@ -5477,12 +5477,11 @@ static D3D12_RAYTRACING_TIER d3d12_device_determine_ray_tracing_tier(struct d3d1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tier == D3D12_RAYTRACING_TIER_1_0 && info->ray_query_features.rayQuery &&
|
if (tier == D3D12_RAYTRACING_TIER_1_0 && info->ray_query_features.rayQuery &&
|
||||||
info->ray_tracing_pipeline_features.rayTraversalPrimitiveCulling &&
|
info->ray_tracing_pipeline_features.rayTraversalPrimitiveCulling)
|
||||||
info->ray_tracing_pipeline_features.rayTracingPipelineTraceRaysIndirect)
|
|
||||||
{
|
{
|
||||||
/* Try to enable DXR 1.1. We can support everything from 1.1 with existing spec,
|
/* Try to enable DXR 1.1.
|
||||||
* except ExecuteIndirect DispatchRays().
|
* Hide this support behind a CONFIG flag for time being.
|
||||||
* Hide this support behind a CONFIG flag for time being. */
|
* TODO: require VK_KHR_ray_tracing_maintenance1. */
|
||||||
supports_vbo_formats = d3d12_device_supports_rtas_formats(device,
|
supports_vbo_formats = d3d12_device_supports_rtas_formats(device,
|
||||||
required_vbo_formats_tier_11, ARRAY_SIZE(required_vbo_formats_tier_11));
|
required_vbo_formats_tier_11, ARRAY_SIZE(required_vbo_formats_tier_11));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue