vkd3d: Implement RTAS clone and compact copy operations.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
39513d6503
commit
b5d433baaa
|
@ -341,3 +341,52 @@ void vkd3d_acceleration_structure_emit_immediate_postbuild_info(
|
|||
|
||||
vkd3d_acceleration_structure_end_barrier(list);
|
||||
}
|
||||
|
||||
static bool convert_copy_mode(
|
||||
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE mode,
|
||||
VkCopyAccelerationStructureModeKHR *vk_mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE:
|
||||
*vk_mode = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR;
|
||||
return true;
|
||||
case D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_COMPACT:
|
||||
*vk_mode = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR;
|
||||
return true;
|
||||
default:
|
||||
FIXME("Unsupported RTAS copy mode #%x.\n", mode);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void vkd3d_acceleration_structure_copy(
|
||||
struct d3d12_command_list *list,
|
||||
D3D12_GPU_VIRTUAL_ADDRESS dst, D3D12_GPU_VIRTUAL_ADDRESS src,
|
||||
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE mode)
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
||||
VkAccelerationStructureKHR dst_as, src_as;
|
||||
VkCopyAccelerationStructureInfoKHR info;
|
||||
|
||||
dst_as = vkd3d_va_map_place_acceleration_structure(&list->device->memory_allocator.va_map, list->device, dst);
|
||||
if (dst_as == VK_NULL_HANDLE)
|
||||
{
|
||||
ERR("Invalid dst address #%"PRIx64" for RTAS copy.\n", dst);
|
||||
return;
|
||||
}
|
||||
|
||||
src_as = vkd3d_va_map_place_acceleration_structure(&list->device->memory_allocator.va_map, list->device, src);
|
||||
if (src_as == VK_NULL_HANDLE)
|
||||
{
|
||||
ERR("Invalid src address #%"PRIx64" for RTAS copy.\n", src);
|
||||
return;
|
||||
}
|
||||
|
||||
info.sType = VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR;
|
||||
info.pNext = NULL;
|
||||
info.dst = dst_as;
|
||||
info.src = src_as;
|
||||
if (convert_copy_mode(mode, &info.mode))
|
||||
VK_CALL(vkCmdCopyAccelerationStructureKHR(list->vk_command_buffer, &info));
|
||||
}
|
||||
|
|
|
@ -8334,8 +8334,19 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyRaytracingAccelerationStruc
|
|||
D3D12_GPU_VIRTUAL_ADDRESS dst_data, D3D12_GPU_VIRTUAL_ADDRESS src_data,
|
||||
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE mode)
|
||||
{
|
||||
FIXME("iface %p, dst_data %#"PRIx64", src_data %#"PRIx64", mode %u stub!\n",
|
||||
iface, dst_data, src_data, mode);
|
||||
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
|
||||
|
||||
TRACE("iface %p, dst_data %#"PRIx64", src_data %#"PRIx64", mode %u\n",
|
||||
iface, dst_data, src_data, mode);
|
||||
|
||||
if (!d3d12_device_supports_ray_tracing_tier_1_0(list->device))
|
||||
{
|
||||
WARN("Acceleration structure is not supported. Calling this is invalid.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
d3d12_command_list_end_current_render_pass(list, true);
|
||||
vkd3d_acceleration_structure_copy(list, dst_data, src_data, mode);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_SetPipelineState1(d3d12_command_list_iface *iface,
|
||||
|
|
|
@ -2856,6 +2856,10 @@ void vkd3d_acceleration_structure_emit_immediate_postbuild_info(
|
|||
struct d3d12_command_list *list, uint32_t count,
|
||||
const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *desc,
|
||||
VkAccelerationStructureKHR vk_acceleration_structure);
|
||||
void vkd3d_acceleration_structure_copy(
|
||||
struct d3d12_command_list *list,
|
||||
D3D12_GPU_VIRTUAL_ADDRESS dst, D3D12_GPU_VIRTUAL_ADDRESS src,
|
||||
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE mode);
|
||||
|
||||
#define VKD3D_VENDOR_ID_NVIDIA 0x10DE
|
||||
#define VKD3D_VENDOR_ID_AMD 0x1002
|
||||
|
|
|
@ -212,6 +212,7 @@ VK_DEVICE_EXT_PFN(vkDestroyAccelerationStructureKHR)
|
|||
VK_DEVICE_EXT_PFN(vkGetAccelerationStructureDeviceAddressKHR)
|
||||
VK_DEVICE_EXT_PFN(vkCmdBuildAccelerationStructuresKHR)
|
||||
VK_DEVICE_EXT_PFN(vkCmdWriteAccelerationStructuresPropertiesKHR)
|
||||
VK_DEVICE_EXT_PFN(vkCmdCopyAccelerationStructureKHR)
|
||||
|
||||
/* VK_KHR_fragment_shading_rate */
|
||||
VK_INSTANCE_PFN(vkGetPhysicalDeviceFragmentShadingRatesKHR)
|
||||
|
|
Loading…
Reference in New Issue