libs/vkd3d: Implement d3d12_command_list_ClearUnorderedAccessViewUint() for R32_UINT buffer views.

Ideally, we would store additional informations only in CPU descriptors.
This commit is contained in:
Józef Kucia 2017-10-04 13:55:33 +02:00
parent fecc94cebc
commit 67aed755ab
3 changed files with 45 additions and 3 deletions

View File

@ -3356,11 +3356,37 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
{
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
const struct d3d12_desc *cpu_descriptor;
struct d3d12_resource *resource_impl;
FIXME("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p stub!\n",
TRACE("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p.\n",
iface, gpu_handle.ptr, cpu_handle.ptr, resource, values, rect_count, rects);
d3d12_command_list_track_resource_usage(list, unsafe_impl_from_ID3D12Resource(resource));
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
d3d12_command_list_track_resource_usage(list, resource_impl);
if (d3d12_resource_is_texture(resource_impl))
{
FIXME("Not implemented for textures.\n");
return;
}
if (rect_count)
{
FIXME("Clear rects not supported.\n");
return;
}
cpu_descriptor = d3d12_desc_from_cpu_handle(cpu_handle);
if (!cpu_descriptor->view_size)
{
FIXME("Not supported for UAV descriptor %p.\n", cpu_descriptor);
return;
}
VK_CALL(vkCmdFillBuffer(list->vk_command_buffer, resource_impl->u.vk_buffer,
cpu_descriptor->view_offset, cpu_descriptor->view_size, values[0]));
}
static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(ID3D12GraphicsCommandList *iface,
@ -3368,11 +3394,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(I
const float values[4], UINT rect_count, const D3D12_RECT *rects)
{
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
struct d3d12_resource *resource_impl;
FIXME("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p stub!\n",
iface, gpu_handle.ptr, cpu_handle.ptr, resource, values, rect_count, rects);
d3d12_command_list_track_resource_usage(list, unsafe_impl_from_ID3D12Resource(resource));
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
d3d12_command_list_track_resource_usage(list, resource_impl);
}
static void STDMETHODCALLTYPE d3d12_command_list_DiscardResource(ID3D12GraphicsCommandList *iface,

View File

@ -1131,6 +1131,16 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor, struct d3d12_
d3d12_desc_destroy(descriptor, device);
}
}
/* FIXME: Clears are implemented only for R32_UINT buffer UAVs. */
if ((desc->Format == DXGI_FORMAT_R32_TYPELESS && (desc->u.Buffer.Flags & VKD3D_VIEW_RAW_BUFFER))
|| desc->Format == DXGI_FORMAT_R32_UINT)
{
const struct vkd3d_format *format = vkd3d_get_format(DXGI_FORMAT_R32_UINT, false);
descriptor->view_offset = desc->u.Buffer.FirstElement * format->byte_count;
descriptor->view_size = desc->u.Buffer.NumElements * format->byte_count;
}
}
static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,

View File

@ -209,6 +209,9 @@ struct d3d12_desc
VkDescriptorBufferInfo vk_cbv_info;
struct vkd3d_view *view;
} u;
VkDeviceSize view_offset;
VkDeviceSize view_size;
};
static inline struct d3d12_desc *d3d12_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)