vkd3d: Actually use RGBA16 formats for RT VBO.

It's really supposed to load 4 components and ignore. RGB16 is not
mandatory, so just use the "expected" formats after all.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-03-12 11:05:00 +01:00
parent 2b6658da67
commit d9be9b57f2
2 changed files with 6 additions and 33 deletions

View File

@ -51,29 +51,6 @@ static VkBuildAccelerationStructureFlagsKHR d3d12_build_flags_to_vk(
return vk_flags;
}
static VkFormat convert_rt_vertex_format(DXGI_FORMAT format)
{
/* DXR specifies RGBA16 or RGBA8 here, but it also completely ignores A,
* so it's *actually* DXGI_FORMAT_RGB{8,16}_{FLOAT,SNORM},
* but those formats don't exist in D3D,
* and they couldn't be bothered to add those apparently <_<. */
switch (format)
{
case DXGI_FORMAT_R16G16B16A16_FLOAT:
return VK_FORMAT_R16G16B16_SFLOAT;
case DXGI_FORMAT_R16G16B16A16_SNORM:
return VK_FORMAT_R16G16B16_SNORM;
case DXGI_FORMAT_R16G16B16A16_UNORM:
return VK_FORMAT_R16G16B16_UNORM;
case DXGI_FORMAT_R8G8B8A8_SNORM:
return VK_FORMAT_R8G8B8_SNORM;
case DXGI_FORMAT_R8G8B8A8_UNORM:
return VK_FORMAT_R8G8B8_UNORM;
default:
return vkd3d_get_vk_format(format);
}
}
bool vkd3d_acceleration_structure_convert_inputs(
struct vkd3d_acceleration_structure_build_info *info,
const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *desc)
@ -167,7 +144,7 @@ bool vkd3d_acceleration_structure_convert_inputs(
triangles->maxVertex = max(1, geom_desc->Triangles.VertexCount) - 1;
triangles->vertexStride = geom_desc->Triangles.VertexBuffer.StrideInBytes;
triangles->vertexFormat = convert_rt_vertex_format(geom_desc->Triangles.VertexFormat);
triangles->vertexFormat = vkd3d_get_vk_format(geom_desc->Triangles.VertexFormat);
triangles->vertexData.deviceAddress = geom_desc->Triangles.VertexBuffer.StartAddress;
triangles->transformData.deviceAddress = geom_desc->Triangles.Transform3x4;
break;

View File

@ -4432,21 +4432,17 @@ static D3D12_RAYTRACING_TIER d3d12_device_determine_ray_tracing_tier(struct d3d1
unsigned int i;
/* Tier 1.0 formats. 1.1 adds:
* - RGB8_{U,S}NORM
* - RGBA8_{U,S}NORM
* - RG16_UNORM
* - RGB16_UNORM
* - RGBA16_UNORM
*/
static const VkFormat required_vbo_formats[] = {
VK_FORMAT_R32G32_SFLOAT,
VK_FORMAT_R32G32B32_SFLOAT,
VK_FORMAT_R16G16_SFLOAT,
VK_FORMAT_R16G16_SNORM,
/* DXR specifies RGBA16 here, but it also completely ignores A,
* so it's *actually* DXGI_FORMAT_R16G16B16_FLOAT/SNORM,
* but those formats don't exist in D3D,
* and they couldn't be bothered to add those apparently <_<. */
VK_FORMAT_R16G16B16_SFLOAT,
VK_FORMAT_R16G16B16_SNORM,
VK_FORMAT_R16G16B16A16_SFLOAT,
VK_FORMAT_R16G16B16A16_SNORM,
};
/* Currently disabled until fully supported, but add checks for now. */
@ -4471,7 +4467,7 @@ static D3D12_RAYTRACING_TIER d3d12_device_determine_ray_tracing_tier(struct d3d1
if (!(properties.bufferFeatures & VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR))
{
supports_vbo_formats = false;
INFO("Vulkan format #%x is not supported for RTAS VBO, cannot support DXR tier 1.0.\n", required_vbo_formats[i]);
INFO("Vulkan format %u is not supported for RTAS VBO, cannot support DXR tier 1.0.\n", required_vbo_formats[i]);
}
}