vkd3d: Allocate descriptor heap buffer storage for bound SSBO ranges.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2020-10-22 19:09:33 +02:00
parent 95f6c8db69
commit e0f1675838
2 changed files with 19 additions and 5 deletions

View File

@ -5429,7 +5429,7 @@ static HRESULT d3d12_descriptor_heap_init_data_buffer(struct d3d12_descriptor_he
const struct vkd3d_vk_device_procs *vk_procs = &descriptor_heap->device->vk_procs;
VkDeviceSize alignment = max(device->device_info.properties2.properties.limits.minStorageBufferOffsetAlignment,
device->device_info.properties2.properties.limits.nonCoherentAtomSize);
VkDeviceSize uav_counter_size = 0;
VkDeviceSize uav_counter_size = 0, offset_buffer_size = 0;
VkDeviceSize buffer_size, offset;
D3D12_HEAP_PROPERTIES heap_info;
D3D12_RESOURCE_DESC buffer_desc;
@ -5437,11 +5437,16 @@ static HRESULT d3d12_descriptor_heap_init_data_buffer(struct d3d12_descriptor_he
VkResult vr;
HRESULT hr;
if (desc->Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV &&
(device->bindless_state.flags & VKD3D_RAW_VA_UAV_COUNTER))
uav_counter_size = align(desc->NumDescriptors * sizeof(VkDeviceAddress), alignment);
if (desc->Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
{
if (device->bindless_state.flags & VKD3D_RAW_VA_UAV_COUNTER)
uav_counter_size = align(desc->NumDescriptors * sizeof(VkDeviceAddress), alignment);
buffer_size = uav_counter_size;
if (device->bindless_state.flags & VKD3D_SSBO_OFFSET_BUFFER)
offset_buffer_size = align(desc->NumDescriptors * sizeof(struct vkd3d_bound_ssbo_range), alignment);
}
buffer_size = uav_counter_size + offset_buffer_size;
if (!buffer_size)
return S_OK;
@ -5488,6 +5493,7 @@ static HRESULT d3d12_descriptor_heap_init_data_buffer(struct d3d12_descriptor_he
offset = 0;
d3d12_descriptor_heap_get_buffer_range(descriptor_heap, &offset, uav_counter_size, &descriptor_heap->uav_counters);
d3d12_descriptor_heap_get_buffer_range(descriptor_heap, &offset, offset_buffer_size, &descriptor_heap->ssbo_ranges);
return S_OK;
}

View File

@ -725,6 +725,12 @@ static inline struct d3d12_dsv_desc *d3d12_dsv_desc_from_cpu_handle(D3D12_CPU_DE
void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_device *device,
struct d3d12_resource *resource, const D3D12_DEPTH_STENCIL_VIEW_DESC *desc);
struct vkd3d_bound_ssbo_range
{
uint32_t offset; /* offset to first byte */
uint32_t length; /* bound size in bytes */
};
struct vkd3d_host_visible_buffer_range
{
VkDescriptorBufferInfo descriptor;
@ -747,6 +753,7 @@ struct d3d12_descriptor_heap
void *host_memory;
struct vkd3d_host_visible_buffer_range uav_counters;
struct vkd3d_host_visible_buffer_range ssbo_ranges;
struct d3d12_device *device;
@ -1578,6 +1585,7 @@ enum vkd3d_bindless_flags
VKD3D_RAW_VA_UAV_COUNTER = (1u << 4),
VKD3D_BINDLESS_CBV_AS_SSBO = (1u << 5),
VKD3D_BINDLESS_RAW_SSBO = (1u << 6),
VKD3D_SSBO_OFFSET_BUFFER = (1u << 7),
};
#define VKD3D_BINDLESS_SET_MAX_EXTRA_BINDINGS 8