mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
libs/vkd3d: Create Vulkan buffer views for UAV counter resources.
This commit is contained in:
parent
9d899b3f06
commit
495bd6fddc
@ -1142,11 +1142,9 @@ static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView(ID3D12Devic
|
||||
TRACE("iface %p, resource %p, counter_resource %p, desc %p, descriptor %#lx.\n",
|
||||
iface, resource, counter_resource, desc, descriptor.ptr);
|
||||
|
||||
if (counter_resource)
|
||||
FIXME("Counter resources not implemented yet.\n");
|
||||
|
||||
d3d12_desc_create_uav((struct d3d12_desc *)descriptor.ptr,
|
||||
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource), desc);
|
||||
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource),
|
||||
unsafe_impl_from_ID3D12Resource(counter_resource), desc);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView(ID3D12Device *iface,
|
||||
|
@ -770,7 +770,10 @@ static struct vkd3d_view *vkd3d_view_create(void)
|
||||
struct vkd3d_view *view;
|
||||
|
||||
if ((view = vkd3d_malloc(sizeof(*view))))
|
||||
{
|
||||
view->refcount = 1;
|
||||
view->vk_counter_view = VK_NULL_HANDLE;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -797,6 +800,9 @@ static void vkd3d_view_decref(struct vkd3d_view *view,
|
||||
VK_CALL(vkDestroyBufferView(device->vk_device, view->u.vk_buffer_view, NULL));
|
||||
else
|
||||
VK_CALL(vkDestroyImageView(device->vk_device, view->u.vk_image_view, NULL));
|
||||
|
||||
if (view->vk_counter_view)
|
||||
VK_CALL(vkDestroyBufferView(device->vk_device, view->vk_counter_view, NULL));
|
||||
}
|
||||
else if (descriptor->magic == VKD3D_DESCRIPTOR_MAGIC_SAMPLER)
|
||||
{
|
||||
@ -1076,8 +1082,8 @@ static unsigned int vkd3d_view_flags_from_d3d12_buffer_uav_flags(D3D12_BUFFER_UA
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor, struct d3d12_device *device,
|
||||
struct d3d12_resource *resource, struct d3d12_resource *counter_resource,
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc)
|
||||
{
|
||||
struct vkd3d_view *view;
|
||||
@ -1113,6 +1119,18 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor,
|
||||
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
|
||||
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
descriptor->u.view = view;
|
||||
|
||||
if (counter_resource)
|
||||
{
|
||||
assert(d3d12_resource_is_buffer(counter_resource));
|
||||
assert(desc->u.Buffer.StructureByteStride);
|
||||
if (!vkd3d_create_buffer_view(device, counter_resource, DXGI_FORMAT_R32_UINT,
|
||||
desc->u.Buffer.CounterOffsetInBytes / sizeof(uint32_t), 1, 0, 0, &view->vk_counter_view))
|
||||
{
|
||||
view->vk_counter_view = VK_NULL_HANDLE;
|
||||
d3d12_desc_destroy(descriptor, device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
|
||||
@ -1188,8 +1206,8 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
|
||||
descriptor->u.view = view;
|
||||
}
|
||||
|
||||
void d3d12_desc_create_uav(struct d3d12_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
void d3d12_desc_create_uav(struct d3d12_desc *descriptor, struct d3d12_device *device,
|
||||
struct d3d12_resource *resource, struct d3d12_resource *counter_resource,
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc)
|
||||
{
|
||||
d3d12_desc_destroy(descriptor, device);
|
||||
@ -1201,10 +1219,16 @@ void d3d12_desc_create_uav(struct d3d12_desc *descriptor,
|
||||
}
|
||||
|
||||
if (d3d12_resource_is_buffer(resource))
|
||||
vkd3d_create_buffer_uav(descriptor, device, resource, desc);
|
||||
{
|
||||
vkd3d_create_buffer_uav(descriptor, device, resource, counter_resource, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (counter_resource)
|
||||
FIXME("Unexpected counter resource for texture view.\n");
|
||||
vkd3d_create_texture_uav(descriptor, device, resource, desc);
|
||||
}
|
||||
}
|
||||
|
||||
bool vkd3d_create_raw_buffer_uav(struct d3d12_device *device,
|
||||
D3D12_GPU_VIRTUAL_ADDRESS gpu_address, VkBufferView *vk_buffer_view)
|
||||
|
@ -196,6 +196,7 @@ struct vkd3d_view
|
||||
VkImageView vk_image_view;
|
||||
VkSampler vk_sampler;
|
||||
} u;
|
||||
VkBufferView vk_counter_view;
|
||||
};
|
||||
|
||||
struct d3d12_desc
|
||||
@ -216,8 +217,8 @@ void d3d12_desc_create_cbv(struct d3d12_desc *descriptor,
|
||||
void d3d12_desc_create_srv(struct d3d12_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
const D3D12_SHADER_RESOURCE_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
void d3d12_desc_create_uav(struct d3d12_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
void d3d12_desc_create_uav(struct d3d12_desc *descriptor, struct d3d12_device *device,
|
||||
struct d3d12_resource *resource, struct d3d12_resource *counter_resource,
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
||||
struct d3d12_device *device, const D3D12_SAMPLER_DESC *desc) DECLSPEC_HIDDEN;
|
||||
|
Loading…
Reference in New Issue
Block a user