libs/vkd3d: Implement structured UAVs.

This commit is contained in:
Józef Kucia 2017-08-21 16:30:33 +02:00
parent 0f7c86e2bd
commit 694c20b1da

View File

@ -917,6 +917,7 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor,
const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc) const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc)
{ {
const struct vkd3d_format *format; const struct vkd3d_format *format;
unsigned int element_size;
if (!desc) if (!desc)
{ {
@ -924,28 +925,35 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor,
return; return;
} }
if (!(format = vkd3d_format_from_d3d12_resource_desc(&resource->desc, desc->Format)))
{
ERR("Failed to find format for %#x.\n", resource->desc.Format);
return;
}
if (desc->ViewDimension != D3D12_UAV_DIMENSION_BUFFER) if (desc->ViewDimension != D3D12_UAV_DIMENSION_BUFFER)
{ {
WARN("Unexpected view dimension %#x.\n", desc->ViewDimension); WARN("Unexpected view dimension %#x.\n", desc->ViewDimension);
return; return;
} }
if (desc->u.Buffer.StructureByteStride) if (desc->Format == DXGI_FORMAT_UNKNOWN && desc->u.Buffer.StructureByteStride)
FIXME("Ignoring structure byte stride %u.\n", desc->u.Buffer.StructureByteStride); {
format = vkd3d_get_format(DXGI_FORMAT_R32_UINT, false);
element_size = desc->u.Buffer.StructureByteStride;
}
else if ((format = vkd3d_format_from_d3d12_resource_desc(&resource->desc, desc->Format)))
{
element_size = format->byte_count;
}
else
{
ERR("Failed to find format for %#x.\n", resource->desc.Format);
return;
}
if (desc->u.Buffer.CounterOffsetInBytes) if (desc->u.Buffer.CounterOffsetInBytes)
FIXME("Ignoring counter offset %"PRIu64".\n", desc->u.Buffer.CounterOffsetInBytes); FIXME("Ignoring counter offset %"PRIu64".\n", desc->u.Buffer.CounterOffsetInBytes);
if (desc->u.Buffer.Flags) if (desc->u.Buffer.Flags)
FIXME("Ignoring buffer view flags %#x.\n", desc->u.Buffer.Flags); FIXME("Ignoring buffer view flags %#x.\n", desc->u.Buffer.Flags);
if (!vkd3d_create_buffer_view(device, resource, format, if (!vkd3d_create_buffer_view(device, resource, format,
desc->u.Buffer.FirstElement * format->byte_count, desc->u.Buffer.FirstElement * element_size,
desc->u.Buffer.NumElements * format->byte_count, &descriptor->u.vk_buffer_view)) desc->u.Buffer.NumElements * element_size, &descriptor->u.vk_buffer_view))
return; return;
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV; descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;