mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
dzn: add a bunch of missing struct-keywords
If we're going to have any chance of porting this code to C, we're going to have to be better at spelling out structs. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
This commit is contained in:
parent
4903a7c051
commit
d61c2e965b
11 changed files with 579 additions and 576 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -110,20 +110,20 @@ num_descs_for_type(VkDescriptorType type, bool static_sampler)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_layout_destroy(dzn_descriptor_set_layout *set_layout,
|
||||
dzn_descriptor_set_layout_destroy(struct dzn_descriptor_set_layout *set_layout,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!set_layout)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(set_layout->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(set_layout->base.device, struct dzn_device, vk);
|
||||
|
||||
vk_object_base_finish(&set_layout->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, set_layout);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_descriptor_set_layout_create(dzn_device *device,
|
||||
dzn_descriptor_set_layout_create(struct dzn_device *device,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDescriptorSetLayout *out)
|
||||
|
|
@ -206,9 +206,9 @@ dzn_descriptor_set_layout_create(dzn_device *device,
|
|||
ranges, total_ranges);
|
||||
VK_MULTIALLOC_DECL(&ma, D3D12_STATIC_SAMPLER_DESC, static_samplers,
|
||||
static_sampler_count);
|
||||
VK_MULTIALLOC_DECL(&ma, const dzn_sampler *, immutable_samplers,
|
||||
VK_MULTIALLOC_DECL(&ma, const struct dzn_sampler *, immutable_samplers,
|
||||
immutable_sampler_count);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_descriptor_set_layout_binding, binfos,
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_descriptor_set_layout_binding, binfos,
|
||||
binding_count);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
|
||||
|
|
@ -398,7 +398,7 @@ dzn_descriptor_set_layout_create(dzn_device *device,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
dzn_descriptor_set_layout_get_heap_offset(const dzn_descriptor_set_layout *layout,
|
||||
dzn_descriptor_set_layout_get_heap_offset(const struct dzn_descriptor_set_layout *layout,
|
||||
uint32_t b,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||
bool writeable)
|
||||
|
|
@ -425,7 +425,7 @@ dzn_descriptor_set_layout_get_heap_offset(const dzn_descriptor_set_layout *layou
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
dzn_descriptor_set_layout_get_desc_count(const dzn_descriptor_set_layout *layout,
|
||||
dzn_descriptor_set_layout_get_desc_count(const struct dzn_descriptor_set_layout *layout,
|
||||
uint32_t b)
|
||||
{
|
||||
D3D12_SHADER_VISIBILITY visibility = layout->bindings[b].visibility;
|
||||
|
|
@ -462,9 +462,9 @@ dzn_DestroyDescriptorSetLayout(VkDevice device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_pipeline_layout_destroy(dzn_pipeline_layout *layout)
|
||||
dzn_pipeline_layout_destroy(struct dzn_pipeline_layout *layout)
|
||||
{
|
||||
dzn_device *device = container_of(layout->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(layout->base.device, struct dzn_device, vk);
|
||||
|
||||
if (layout->root.sig)
|
||||
ID3D12RootSignature_Release(layout->root.sig);
|
||||
|
|
@ -483,7 +483,7 @@ dzn_pipeline_layout_destroy(dzn_pipeline_layout *layout)
|
|||
#define MAX_ROOT_DWORDS 64
|
||||
|
||||
static VkResult
|
||||
dzn_pipeline_layout_create(dzn_device *device,
|
||||
dzn_pipeline_layout_create(struct dzn_device *device,
|
||||
const VkPipelineLayoutCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkPipelineLayout *out)
|
||||
|
|
@ -500,8 +500,8 @@ dzn_pipeline_layout_create(dzn_device *device,
|
|||
}
|
||||
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_pipeline_layout, layout, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dxil_spirv_vulkan_binding,
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_pipeline_layout, layout, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dxil_spirv_vulkan_binding,
|
||||
bindings, binding_count);
|
||||
|
||||
if (!vk_multialloc_zalloc(&ma, &device->vk.alloc,
|
||||
|
|
@ -531,7 +531,7 @@ dzn_pipeline_layout_create(dzn_device *device,
|
|||
layout->set_count = pCreateInfo->setLayoutCount;
|
||||
for (uint32_t j = 0; j < layout->set_count; j++) {
|
||||
VK_FROM_HANDLE(dzn_descriptor_set_layout, set_layout, pCreateInfo->pSetLayouts[j]);
|
||||
dxil_spirv_vulkan_binding *bindings = layout->binding_translation[j].bindings;
|
||||
struct dxil_spirv_vulkan_binding *bindings = layout->binding_translation[j].bindings;
|
||||
|
||||
layout->sets[j].dynamic_buffer_count = set_layout->dynamic_buffers.count;
|
||||
memcpy(layout->sets[j].range_desc_count, set_layout->range_desc_count,
|
||||
|
|
@ -696,8 +696,8 @@ dzn_pipeline_layout_create(dzn_device *device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
dzn_pipeline_layout *
|
||||
dzn_pipeline_layout_ref(dzn_pipeline_layout *layout)
|
||||
struct dzn_pipeline_layout *
|
||||
dzn_pipeline_layout_ref(struct dzn_pipeline_layout *layout)
|
||||
{
|
||||
if (layout)
|
||||
p_atomic_inc(&layout->refcount);
|
||||
|
|
@ -706,7 +706,7 @@ dzn_pipeline_layout_ref(dzn_pipeline_layout *layout)
|
|||
}
|
||||
|
||||
void
|
||||
dzn_pipeline_layout_unref(dzn_pipeline_layout *layout)
|
||||
dzn_pipeline_layout_unref(struct dzn_pipeline_layout *layout)
|
||||
{
|
||||
if (layout) {
|
||||
if (p_atomic_dec_zero(&layout->refcount))
|
||||
|
|
@ -757,7 +757,7 @@ desc_type_to_heap_type(VkDescriptorType in)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_heap_finish(dzn_descriptor_heap *heap)
|
||||
dzn_descriptor_heap_finish(struct dzn_descriptor_heap *heap)
|
||||
{
|
||||
if (heap->heap)
|
||||
ID3D12DescriptorHeap_Release(heap->heap);
|
||||
|
|
@ -767,8 +767,8 @@ dzn_descriptor_heap_finish(dzn_descriptor_heap *heap)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_descriptor_heap_init(dzn_descriptor_heap *heap,
|
||||
dzn_device *device,
|
||||
dzn_descriptor_heap_init(struct dzn_descriptor_heap *heap,
|
||||
struct dzn_device *device,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||
uint32_t desc_count,
|
||||
bool shader_visible)
|
||||
|
|
@ -808,7 +808,7 @@ dzn_descriptor_heap_init(dzn_descriptor_heap *heap,
|
|||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE
|
||||
dzn_descriptor_heap_get_cpu_handle(const dzn_descriptor_heap *heap, uint32_t desc_offset)
|
||||
dzn_descriptor_heap_get_cpu_handle(const struct dzn_descriptor_heap *heap, uint32_t desc_offset)
|
||||
{
|
||||
return D3D12_CPU_DESCRIPTOR_HANDLE {
|
||||
.ptr = heap->cpu_base + (desc_offset * heap->desc_sz),
|
||||
|
|
@ -816,7 +816,7 @@ dzn_descriptor_heap_get_cpu_handle(const dzn_descriptor_heap *heap, uint32_t des
|
|||
}
|
||||
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE
|
||||
dzn_descriptor_heap_get_gpu_handle(const dzn_descriptor_heap *heap, uint32_t desc_offset)
|
||||
dzn_descriptor_heap_get_gpu_handle(const struct dzn_descriptor_heap *heap, uint32_t desc_offset)
|
||||
{
|
||||
return D3D12_GPU_DESCRIPTOR_HANDLE {
|
||||
.ptr = heap->gpu_base ? heap->gpu_base + (desc_offset * heap->desc_sz) : 0,
|
||||
|
|
@ -824,23 +824,23 @@ dzn_descriptor_heap_get_gpu_handle(const dzn_descriptor_heap *heap, uint32_t des
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_heap_write_sampler_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_sampler_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t desc_offset,
|
||||
const dzn_sampler *sampler)
|
||||
const struct dzn_sampler *sampler)
|
||||
{
|
||||
ID3D12Device1_CreateSampler(heap->dev, &sampler->desc,
|
||||
dzn_descriptor_heap_get_cpu_handle(heap, desc_offset));
|
||||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_write_image_view_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_image_view_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t desc_offset,
|
||||
bool writeable, bool cube_as_2darray,
|
||||
const dzn_image_view *iview)
|
||||
const struct dzn_image_view *iview)
|
||||
{
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE view_handle =
|
||||
dzn_descriptor_heap_get_cpu_handle(heap, desc_offset);
|
||||
dzn_image *image = container_of(iview->vk.image, dzn_image, vk);
|
||||
struct dzn_image *image = container_of(iview->vk.image, struct dzn_image, vk);
|
||||
|
||||
if (writeable) {
|
||||
ID3D12Device1_CreateUnorderedAccessView(heap->dev, image->res, NULL, &iview->uav_desc, view_handle);
|
||||
|
|
@ -875,10 +875,10 @@ dzn_descriptor_heap_write_image_view_desc(dzn_descriptor_heap *heap,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_heap_write_buffer_view_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_buffer_view_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t desc_offset,
|
||||
bool writeable,
|
||||
const dzn_buffer_view *bview)
|
||||
const struct dzn_buffer_view *bview)
|
||||
{
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE view_handle =
|
||||
dzn_descriptor_heap_get_cpu_handle(heap, desc_offset);
|
||||
|
|
@ -890,10 +890,10 @@ dzn_descriptor_heap_write_buffer_view_desc(dzn_descriptor_heap *heap,
|
|||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_write_buffer_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_buffer_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t desc_offset,
|
||||
bool writeable,
|
||||
const dzn_buffer_desc *info)
|
||||
const struct dzn_buffer_desc *info)
|
||||
{
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE view_handle =
|
||||
dzn_descriptor_heap_get_cpu_handle(heap, desc_offset);
|
||||
|
|
@ -938,9 +938,9 @@ dzn_descriptor_heap_write_buffer_desc(dzn_descriptor_heap *heap,
|
|||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_copy(dzn_descriptor_heap *dst_heap,
|
||||
dzn_descriptor_heap_copy(struct dzn_descriptor_heap *dst_heap,
|
||||
uint32_t dst_offset,
|
||||
const dzn_descriptor_heap *src_heap,
|
||||
const struct dzn_descriptor_heap *src_heap,
|
||||
uint32_t src_offset,
|
||||
uint32_t desc_count)
|
||||
{
|
||||
|
|
@ -960,8 +960,8 @@ struct dzn_descriptor_set_ptr {
|
|||
};
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_ptr_validate(const dzn_descriptor_set *set,
|
||||
dzn_descriptor_set_ptr *ptr)
|
||||
dzn_descriptor_set_ptr_validate(const struct dzn_descriptor_set *set,
|
||||
struct dzn_descriptor_set_ptr *ptr)
|
||||
{
|
||||
|
||||
if (ptr->binding >= set->layout->binding_count) {
|
||||
|
|
@ -979,8 +979,8 @@ dzn_descriptor_set_ptr_validate(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_ptr_init(const dzn_descriptor_set *set,
|
||||
dzn_descriptor_set_ptr *ptr,
|
||||
dzn_descriptor_set_ptr_init(const struct dzn_descriptor_set *set,
|
||||
struct dzn_descriptor_set_ptr *ptr,
|
||||
uint32_t binding, uint32_t elem)
|
||||
{
|
||||
ptr->binding = binding;
|
||||
|
|
@ -989,8 +989,8 @@ dzn_descriptor_set_ptr_init(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_ptr_move(const dzn_descriptor_set *set,
|
||||
dzn_descriptor_set_ptr *ptr,
|
||||
dzn_descriptor_set_ptr_move(const struct dzn_descriptor_set *set,
|
||||
struct dzn_descriptor_set_ptr *ptr,
|
||||
uint32_t count)
|
||||
{
|
||||
if (ptr->binding == ~0)
|
||||
|
|
@ -1014,14 +1014,14 @@ dzn_descriptor_set_ptr_move(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static bool
|
||||
dzn_descriptor_set_ptr_is_valid(const dzn_descriptor_set_ptr *ptr)
|
||||
dzn_descriptor_set_ptr_is_valid(const struct dzn_descriptor_set_ptr *ptr)
|
||||
{
|
||||
return ptr->binding != ~0 && ptr->elem != ~0;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
dzn_descriptor_set_remaining_descs_in_binding(const dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr)
|
||||
dzn_descriptor_set_remaining_descs_in_binding(const struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr)
|
||||
{
|
||||
if (ptr->binding >= set->layout->binding_count)
|
||||
return 0;
|
||||
|
|
@ -1034,9 +1034,9 @@ dzn_descriptor_set_remaining_descs_in_binding(const dzn_descriptor_set *set,
|
|||
|
||||
|
||||
static uint32_t
|
||||
dzn_descriptor_set_get_heap_offset(const dzn_descriptor_set *set,
|
||||
dzn_descriptor_set_get_heap_offset(const struct dzn_descriptor_set *set,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
bool writeable)
|
||||
{
|
||||
if (ptr->binding == ~0)
|
||||
|
|
@ -1051,9 +1051,9 @@ dzn_descriptor_set_get_heap_offset(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_write_sampler_desc(dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
const dzn_sampler *sampler)
|
||||
dzn_descriptor_set_write_sampler_desc(struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
const struct dzn_sampler *sampler)
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
|
||||
uint32_t heap_offset =
|
||||
|
|
@ -1069,8 +1069,8 @@ dzn_descriptor_set_write_sampler_desc(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
dzn_descriptor_set_get_dynamic_buffer_idx(const dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr)
|
||||
dzn_descriptor_set_get_dynamic_buffer_idx(const struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr)
|
||||
{
|
||||
if (ptr->binding == ~0)
|
||||
return ~0;
|
||||
|
|
@ -1084,9 +1084,9 @@ dzn_descriptor_set_get_dynamic_buffer_idx(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_write_dynamic_buffer_desc(dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
const dzn_buffer_desc *info)
|
||||
dzn_descriptor_set_write_dynamic_buffer_desc(struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
const struct dzn_buffer_desc *info)
|
||||
{
|
||||
uint32_t dynamic_buffer_idx =
|
||||
dzn_descriptor_set_get_dynamic_buffer_idx(set, ptr);
|
||||
|
|
@ -1098,8 +1098,8 @@ dzn_descriptor_set_write_dynamic_buffer_desc(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static VkDescriptorType
|
||||
dzn_descriptor_set_get_desc_vk_type(const dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr)
|
||||
dzn_descriptor_set_get_desc_vk_type(const struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr)
|
||||
{
|
||||
if (ptr->binding >= set->layout->binding_count)
|
||||
return (VkDescriptorType)~0;
|
||||
|
|
@ -1108,10 +1108,10 @@ dzn_descriptor_set_get_desc_vk_type(const dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_write_image_view_desc(dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
dzn_descriptor_set_write_image_view_desc(struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
bool cube_as_2darray,
|
||||
const dzn_image_view *iview)
|
||||
const struct dzn_image_view *iview)
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
||||
uint32_t heap_offset =
|
||||
|
|
@ -1139,9 +1139,9 @@ dzn_descriptor_set_write_image_view_desc(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_write_buffer_view_desc(dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
const dzn_buffer_view *bview)
|
||||
dzn_descriptor_set_write_buffer_view_desc(struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
const struct dzn_buffer_view *bview)
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
||||
uint32_t heap_offset =
|
||||
|
|
@ -1167,9 +1167,9 @@ dzn_descriptor_set_write_buffer_view_desc(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_write_buffer_desc(dzn_descriptor_set *set,
|
||||
const dzn_descriptor_set_ptr *ptr,
|
||||
const dzn_buffer_desc *bdesc)
|
||||
dzn_descriptor_set_write_buffer_desc(struct dzn_descriptor_set *set,
|
||||
const struct dzn_descriptor_set_ptr *ptr,
|
||||
const struct dzn_buffer_desc *bdesc)
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
||||
uint32_t heap_offset =
|
||||
|
|
@ -1195,10 +1195,10 @@ dzn_descriptor_set_write_buffer_desc(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_init(dzn_descriptor_set *set,
|
||||
dzn_device *device,
|
||||
dzn_descriptor_pool *pool,
|
||||
dzn_descriptor_set_layout *layout)
|
||||
dzn_descriptor_set_init(struct dzn_descriptor_set *set,
|
||||
struct dzn_device *device,
|
||||
struct dzn_descriptor_pool *pool,
|
||||
struct dzn_descriptor_set_layout *layout)
|
||||
{
|
||||
vk_object_base_init(&device->vk, &set->base, VK_OBJECT_TYPE_DESCRIPTOR_SET);
|
||||
|
||||
|
|
@ -1223,8 +1223,8 @@ dzn_descriptor_set_init(dzn_descriptor_set *set,
|
|||
if (!has_samplers || layout->bindings[b].immutable_sampler_idx == ~0)
|
||||
continue;
|
||||
|
||||
dzn_descriptor_set_ptr ptr;
|
||||
const dzn_sampler **sampler =
|
||||
struct dzn_descriptor_set_ptr ptr;
|
||||
const struct dzn_sampler **sampler =
|
||||
&layout->immutable_samplers[layout->bindings[b].immutable_sampler_idx];
|
||||
for (dzn_descriptor_set_ptr_init(set, &ptr, b, 0);
|
||||
dzn_descriptor_set_ptr_is_valid(&ptr);
|
||||
|
|
@ -1237,7 +1237,7 @@ dzn_descriptor_set_init(dzn_descriptor_set *set,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_set_finish(dzn_descriptor_set *set)
|
||||
dzn_descriptor_set_finish(struct dzn_descriptor_set *set)
|
||||
{
|
||||
vk_object_base_finish(&set->base);
|
||||
set->pool = NULL;
|
||||
|
|
@ -1245,13 +1245,13 @@ dzn_descriptor_set_finish(dzn_descriptor_set *set)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_descriptor_pool_destroy(dzn_descriptor_pool *pool,
|
||||
dzn_descriptor_pool_destroy(struct dzn_descriptor_pool *pool,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!pool)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(pool->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(pool->base.device, struct dzn_device, vk);
|
||||
|
||||
dzn_foreach_pool_type (type) {
|
||||
if (pool->desc_count[type])
|
||||
|
|
@ -1263,14 +1263,14 @@ dzn_descriptor_pool_destroy(dzn_descriptor_pool *pool,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_descriptor_pool_create(dzn_device *device,
|
||||
dzn_descriptor_pool_create(struct dzn_device *device,
|
||||
const VkDescriptorPoolCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDescriptorPool *out)
|
||||
{
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_descriptor_pool, pool, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_descriptor_set, sets, pCreateInfo->maxSets);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_descriptor_pool, pool, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_descriptor_set, sets, pCreateInfo->maxSets);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT))
|
||||
|
|
@ -1332,11 +1332,11 @@ dzn_descriptor_pool_create(dzn_device *device,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_descriptor_pool_defragment_heap(dzn_descriptor_pool *pool,
|
||||
dzn_descriptor_pool_defragment_heap(struct dzn_descriptor_pool *pool,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type)
|
||||
{
|
||||
dzn_device *device = container_of(pool->base.device, dzn_device, vk);
|
||||
dzn_descriptor_heap new_heap;
|
||||
struct dzn_device *device = container_of(pool->base.device, struct dzn_device, vk);
|
||||
struct dzn_descriptor_heap new_heap;
|
||||
|
||||
VkResult result =
|
||||
dzn_descriptor_heap_init(&new_heap, device, type,
|
||||
|
|
@ -1402,10 +1402,10 @@ dzn_ResetDescriptorPool(VkDevice device,
|
|||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_finish(dzn_descriptor_heap_pool *pool)
|
||||
dzn_descriptor_heap_pool_finish(struct dzn_descriptor_heap_pool *pool)
|
||||
{
|
||||
list_splicetail(&pool->active_heaps, &pool->free_heaps);
|
||||
list_for_each_entry_safe(dzn_descriptor_heap_pool_entry, entry, &pool->free_heaps, link) {
|
||||
list_for_each_entry_safe(struct dzn_descriptor_heap_pool_entry, entry, &pool->free_heaps, link) {
|
||||
list_del(&entry->link);
|
||||
dzn_descriptor_heap_finish(&entry->heap);
|
||||
vk_free(pool->alloc, entry);
|
||||
|
|
@ -1413,8 +1413,8 @@ dzn_descriptor_heap_pool_finish(dzn_descriptor_heap_pool *pool)
|
|||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_init(dzn_descriptor_heap_pool *pool,
|
||||
dzn_device *device,
|
||||
dzn_descriptor_heap_pool_init(struct dzn_descriptor_heap_pool *pool,
|
||||
struct dzn_device *device,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||
bool shader_visible,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
|
|
@ -1433,15 +1433,15 @@ dzn_descriptor_heap_pool_init(dzn_descriptor_heap_pool *pool,
|
|||
}
|
||||
|
||||
VkResult
|
||||
dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
|
||||
dzn_device *device, uint32_t desc_count,
|
||||
dzn_descriptor_heap **heap,
|
||||
dzn_descriptor_heap_pool_alloc_slots(struct dzn_descriptor_heap_pool *pool,
|
||||
struct dzn_device *device, uint32_t desc_count,
|
||||
struct dzn_descriptor_heap **heap,
|
||||
uint32_t *first_slot)
|
||||
{
|
||||
dzn_descriptor_heap *last_heap =
|
||||
struct dzn_descriptor_heap *last_heap =
|
||||
list_is_empty(&pool->active_heaps) ?
|
||||
NULL :
|
||||
&(list_last_entry(&pool->active_heaps, dzn_descriptor_heap_pool_entry, link)->heap);
|
||||
&(list_last_entry(&pool->active_heaps, struct dzn_descriptor_heap_pool_entry, link)->heap);
|
||||
uint32_t last_heap_desc_count =
|
||||
last_heap ? last_heap->desc_count : 0;
|
||||
|
||||
|
|
@ -1460,9 +1460,9 @@ dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
|
|||
heap_desc_count = MIN2(heap_desc_count, 2048);
|
||||
}
|
||||
|
||||
dzn_descriptor_heap_pool_entry *new_heap = NULL;
|
||||
struct dzn_descriptor_heap_pool_entry *new_heap = NULL;
|
||||
|
||||
list_for_each_entry_safe(dzn_descriptor_heap_pool_entry, entry, &pool->free_heaps, link) {
|
||||
list_for_each_entry_safe(struct dzn_descriptor_heap_pool_entry, entry, &pool->free_heaps, link) {
|
||||
if (entry->heap.desc_count >= heap_desc_count) {
|
||||
new_heap = entry;
|
||||
list_del(&entry->link);
|
||||
|
|
@ -1471,7 +1471,7 @@ dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
|
|||
}
|
||||
|
||||
if (!new_heap) {
|
||||
new_heap = (dzn_descriptor_heap_pool_entry *)
|
||||
new_heap = (struct dzn_descriptor_heap_pool_entry *)
|
||||
vk_zalloc(pool->alloc, sizeof(*new_heap), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!new_heap)
|
||||
|
|
@ -1498,7 +1498,7 @@ dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
|
|||
}
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_reset(dzn_descriptor_heap_pool *pool)
|
||||
dzn_descriptor_heap_pool_reset(struct dzn_descriptor_heap_pool *pool)
|
||||
{
|
||||
pool->offset = 0;
|
||||
list_splicetail(&pool->active_heaps, &pool->free_heaps);
|
||||
|
|
@ -1537,7 +1537,7 @@ dzn_AllocateDescriptorSets(VkDevice dev,
|
|||
}
|
||||
}
|
||||
|
||||
dzn_descriptor_set *set = NULL;
|
||||
struct dzn_descriptor_set *set = NULL;
|
||||
for (; set_idx < pool->set_count; set_idx++) {
|
||||
if (!pool->sets[set_idx].layout) {
|
||||
set = &pool->sets[set_idx];
|
||||
|
|
@ -1577,7 +1577,7 @@ dzn_FreeDescriptorSets(VkDevice dev,
|
|||
pool->free_offset[type] = 0;
|
||||
|
||||
for (uint32_t s = 0; s < pool->set_count; s++) {
|
||||
const dzn_descriptor_set *set = &pool->sets[s];
|
||||
const struct dzn_descriptor_set *set = &pool->sets[s];
|
||||
|
||||
if (set->layout) {
|
||||
dzn_foreach_pool_type (type) {
|
||||
|
|
@ -1598,7 +1598,7 @@ dzn_descriptor_set_write(const VkWriteDescriptorSet *pDescriptorWrite)
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_descriptor_set, set, pDescriptorWrite->dstSet);
|
||||
|
||||
dzn_descriptor_set_ptr ptr;
|
||||
struct dzn_descriptor_set_ptr ptr;
|
||||
|
||||
dzn_descriptor_set_ptr_init(set, &ptr,
|
||||
pDescriptorWrite->dstBinding,
|
||||
|
|
@ -1662,7 +1662,7 @@ dzn_descriptor_set_write(const VkWriteDescriptorSet *pDescriptorWrite)
|
|||
dzn_descriptor_set_ptr_move(set, &ptr, 1)) {
|
||||
assert(dzn_descriptor_set_get_desc_vk_type(set, &ptr) == pDescriptorWrite->descriptorType);
|
||||
const VkDescriptorBufferInfo *binfo = &pDescriptorWrite->pBufferInfo[d];
|
||||
dzn_buffer_desc desc {
|
||||
struct dzn_buffer_desc desc {
|
||||
pDescriptorWrite->descriptorType,
|
||||
dzn_buffer_from_handle(binfo->buffer),
|
||||
binfo->range, binfo->offset
|
||||
|
|
@ -1681,7 +1681,7 @@ dzn_descriptor_set_write(const VkWriteDescriptorSet *pDescriptorWrite)
|
|||
dzn_descriptor_set_ptr_move(set, &ptr, 1)) {
|
||||
assert(dzn_descriptor_set_get_desc_vk_type(set, &ptr) == pDescriptorWrite->descriptorType);
|
||||
const VkDescriptorBufferInfo *binfo = &pDescriptorWrite->pBufferInfo[d];
|
||||
dzn_buffer_desc desc {
|
||||
struct dzn_buffer_desc desc {
|
||||
pDescriptorWrite->descriptorType,
|
||||
dzn_buffer_from_handle(binfo->buffer),
|
||||
binfo->range, binfo->offset
|
||||
|
|
@ -1721,7 +1721,7 @@ dzn_descriptor_set_copy(const VkCopyDescriptorSet *pDescriptorCopy)
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_descriptor_set, src_set, pDescriptorCopy->srcSet);
|
||||
VK_FROM_HANDLE(dzn_descriptor_set, dst_set, pDescriptorCopy->dstSet);
|
||||
dzn_descriptor_set_ptr src_ptr, dst_ptr;
|
||||
struct dzn_descriptor_set_ptr src_ptr, dst_ptr;
|
||||
|
||||
dzn_descriptor_set_ptr_init(src_set, &src_ptr,
|
||||
pDescriptorCopy->srcBinding,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
#define DZN_API_VERSION VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION)
|
||||
|
||||
static const vk_instance_extension_table instance_extensions = {
|
||||
static const struct vk_instance_extension_table instance_extensions = {
|
||||
.KHR_get_physical_device_properties2 = true,
|
||||
#ifdef DZN_USE_WSI_PLATFORM
|
||||
.KHR_surface = true,
|
||||
|
|
@ -74,7 +74,7 @@ static const vk_instance_extension_table instance_extensions = {
|
|||
};
|
||||
|
||||
static void
|
||||
dzn_physical_device_get_extensions(dzn_physical_device *pdev)
|
||||
dzn_physical_device_get_extensions(struct dzn_physical_device *pdev)
|
||||
{
|
||||
pdev->vk.supported_extensions = vk_device_extension_table {
|
||||
#ifdef DZN_USE_WSI_PLATFORM
|
||||
|
|
@ -109,9 +109,9 @@ static const struct debug_control dzn_debug_options[] = {
|
|||
};
|
||||
|
||||
static void
|
||||
dzn_physical_device_destroy(dzn_physical_device *pdev)
|
||||
dzn_physical_device_destroy(struct dzn_physical_device *pdev)
|
||||
{
|
||||
dzn_instance *instance = container_of(pdev->vk.instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance = container_of(pdev->vk.instance, struct dzn_instance, vk);
|
||||
|
||||
list_del(&pdev->link);
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ dzn_physical_device_destroy(dzn_physical_device *pdev)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_instance_destroy(dzn_instance *instance, const VkAllocationCallbacks *alloc)
|
||||
dzn_instance_destroy(struct dzn_instance *instance, const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
if (!instance)
|
||||
return;
|
||||
|
|
@ -135,7 +135,7 @@ dzn_instance_destroy(dzn_instance *instance, const VkAllocationCallbacks *alloc)
|
|||
if (instance->dxil_validator)
|
||||
dxil_destroy_validator(instance->dxil_validator);
|
||||
|
||||
list_for_each_entry_safe(dzn_physical_device, pdev,
|
||||
list_for_each_entry_safe(struct dzn_physical_device, pdev,
|
||||
&instance->physical_devices, link) {
|
||||
dzn_physical_device_destroy(pdev);
|
||||
}
|
||||
|
|
@ -149,13 +149,13 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo,
|
|||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *out)
|
||||
{
|
||||
dzn_instance *instance = (dzn_instance *)
|
||||
struct dzn_instance *instance = (struct dzn_instance *)
|
||||
vk_zalloc2(vk_default_allocator(), pAllocator, sizeof(*instance), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (!instance)
|
||||
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vk_instance_dispatch_table dispatch_table;
|
||||
struct vk_instance_dispatch_table dispatch_table;
|
||||
vk_instance_dispatch_table_from_entrypoints(&dispatch_table,
|
||||
&dzn_instance_entrypoints,
|
||||
true);
|
||||
|
|
@ -208,18 +208,18 @@ dzn_DestroyInstance(VkInstance instance,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_physical_device_create(dzn_instance *instance,
|
||||
dzn_physical_device_create(struct dzn_instance *instance,
|
||||
IDXGIAdapter1 *adapter,
|
||||
const DXGI_ADAPTER_DESC1 *adapter_desc)
|
||||
{
|
||||
dzn_physical_device *pdev = (dzn_physical_device *)
|
||||
struct dzn_physical_device *pdev = (struct dzn_physical_device *)
|
||||
vk_zalloc(&instance->vk.alloc, sizeof(*pdev), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
|
||||
if (!pdev)
|
||||
return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vk_physical_device_dispatch_table dispatch_table;
|
||||
struct vk_physical_device_dispatch_table dispatch_table;
|
||||
vk_physical_device_dispatch_table_from_entrypoints(&dispatch_table,
|
||||
&dzn_physical_device_entrypoints,
|
||||
true);
|
||||
|
|
@ -270,7 +270,7 @@ dzn_physical_device_create(dzn_instance *instance,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_physical_device_cache_caps(dzn_physical_device *pdev)
|
||||
dzn_physical_device_cache_caps(struct dzn_physical_device *pdev)
|
||||
{
|
||||
D3D_FEATURE_LEVEL checklist[] = {
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
|
|
@ -351,7 +351,7 @@ dzn_physical_device_cache_caps(dzn_physical_device *pdev)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_physical_device_init_memory(dzn_physical_device *pdev)
|
||||
dzn_physical_device_init_memory(struct dzn_physical_device *pdev)
|
||||
{
|
||||
VkPhysicalDeviceMemoryProperties *mem = &pdev->memory;
|
||||
const DXGI_ADAPTER_DESC1 *desc = &pdev->adapter_desc;
|
||||
|
|
@ -420,14 +420,14 @@ dzn_physical_device_init_memory(dzn_physical_device *pdev)
|
|||
}
|
||||
|
||||
static D3D12_HEAP_FLAGS
|
||||
dzn_physical_device_get_heap_flags_for_mem_type(const dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_heap_flags_for_mem_type(const struct dzn_physical_device *pdev,
|
||||
uint32_t mem_type)
|
||||
{
|
||||
return pdev->heap_flags_for_mem_type[mem_type];
|
||||
}
|
||||
|
||||
uint32_t
|
||||
dzn_physical_device_get_mem_type_mask_for_resource(const dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_mem_type_mask_for_resource(const struct dzn_physical_device *pdev,
|
||||
const D3D12_RESOURCE_DESC *desc)
|
||||
{
|
||||
if (pdev->options.ResourceHeapTier > D3D12_RESOURCE_HEAP_TIER_1)
|
||||
|
|
@ -470,9 +470,9 @@ dzn_physical_device_get_max_array_layers()
|
|||
}
|
||||
|
||||
static ID3D12Device1 *
|
||||
dzn_physical_device_get_d3d12_dev(dzn_physical_device *pdev)
|
||||
dzn_physical_device_get_d3d12_dev(struct dzn_physical_device *pdev)
|
||||
{
|
||||
dzn_instance *instance = container_of(pdev->vk.instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance = container_of(pdev->vk.instance, struct dzn_instance, vk);
|
||||
|
||||
mtx_lock(&pdev->dev_lock);
|
||||
if (!pdev->dev) {
|
||||
|
|
@ -487,7 +487,7 @@ dzn_physical_device_get_d3d12_dev(dzn_physical_device *pdev)
|
|||
}
|
||||
|
||||
D3D12_FEATURE_DATA_FORMAT_SUPPORT
|
||||
dzn_physical_device_get_format_support(dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_format_support(struct dzn_physical_device *pdev,
|
||||
VkFormat format)
|
||||
{
|
||||
VkImageUsageFlags usage =
|
||||
|
|
@ -544,7 +544,7 @@ dzn_physical_device_get_format_support(dzn_physical_device *pdev,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_physical_device_get_format_properties(dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_format_properties(struct dzn_physical_device *pdev,
|
||||
VkFormat format,
|
||||
VkFormatProperties2 *properties)
|
||||
{
|
||||
|
|
@ -648,7 +648,7 @@ dzn_physical_device_get_format_properties(dzn_physical_device *pdev,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_physical_device_get_image_format_properties(dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_image_format_properties(struct dzn_physical_device *pdev,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *info,
|
||||
VkImageFormatProperties2 *properties)
|
||||
{
|
||||
|
|
@ -932,7 +932,7 @@ dzn_EnumeratePhysicalDevices(VkInstance inst,
|
|||
VK_OUTARRAY_MAKE_TYPED(VkPhysicalDevice, out, pPhysicalDevices,
|
||||
pPhysicalDeviceCount);
|
||||
|
||||
list_for_each_entry(dzn_physical_device, pdev, &instance->physical_devices, link) {
|
||||
list_for_each_entry(struct dzn_physical_device, pdev, &instance->physical_devices, link) {
|
||||
vk_outarray_append_typed(VkPhysicalDevice, &out, i)
|
||||
*i = dzn_physical_device_to_handle(pdev);
|
||||
}
|
||||
|
|
@ -949,7 +949,7 @@ dzn_EnumerateInstanceVersion(uint32_t *pApiVersion)
|
|||
}
|
||||
|
||||
static bool
|
||||
dzn_physical_device_supports_compressed_format(dzn_physical_device *pdev,
|
||||
dzn_physical_device_supports_compressed_format(struct dzn_physical_device *pdev,
|
||||
const VkFormat *formats,
|
||||
uint32_t format_count)
|
||||
{
|
||||
|
|
@ -968,7 +968,7 @@ dzn_physical_device_supports_compressed_format(dzn_physical_device *pdev,
|
|||
}
|
||||
|
||||
static bool
|
||||
dzn_physical_device_supports_bc(dzn_physical_device *pdev)
|
||||
dzn_physical_device_supports_bc(struct dzn_physical_device *pdev)
|
||||
{
|
||||
static const VkFormat formats[] = {
|
||||
VK_FORMAT_BC1_RGB_UNORM_BLOCK,
|
||||
|
|
@ -1389,14 +1389,14 @@ dzn_EnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_queue_sync_wait(dzn_queue *queue, const struct vk_sync_wait *wait)
|
||||
dzn_queue_sync_wait(struct dzn_queue *queue, const struct vk_sync_wait *wait)
|
||||
{
|
||||
if (wait->sync->type == &vk_sync_dummy_type)
|
||||
return VK_SUCCESS;
|
||||
|
||||
dzn_device *device = container_of(queue->vk.base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(queue->vk.base.device, struct dzn_device, vk);
|
||||
assert(wait->sync->type == &dzn_sync_type);
|
||||
dzn_sync *sync = container_of(wait->sync, dzn_sync, vk);
|
||||
struct dzn_sync *sync = container_of(wait->sync, struct dzn_sync, vk);
|
||||
uint64_t value =
|
||||
(sync->vk.flags & VK_SYNC_IS_TIMELINE) ? wait->wait_value : 1;
|
||||
|
||||
|
|
@ -1409,14 +1409,14 @@ dzn_queue_sync_wait(dzn_queue *queue, const struct vk_sync_wait *wait)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_queue_sync_signal(dzn_queue *queue, const struct vk_sync_signal *signal)
|
||||
dzn_queue_sync_signal(struct dzn_queue *queue, const struct vk_sync_signal *signal)
|
||||
{
|
||||
if (signal->sync->type == &vk_sync_dummy_type)
|
||||
return VK_SUCCESS;
|
||||
|
||||
dzn_device *device = container_of(queue->vk.base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(queue->vk.base.device, struct dzn_device, vk);
|
||||
assert(signal->sync->type == &dzn_sync_type);
|
||||
dzn_sync *sync = container_of(signal->sync, dzn_sync, vk);
|
||||
struct dzn_sync *sync = container_of(signal->sync, struct dzn_sync, vk);
|
||||
uint64_t value =
|
||||
(sync->vk.flags & VK_SYNC_IS_TIMELINE) ? signal->signal_value : 1;
|
||||
assert(value > 0);
|
||||
|
|
@ -1433,8 +1433,8 @@ static VkResult
|
|||
dzn_queue_submit(struct vk_queue *q,
|
||||
struct vk_queue_submit *info)
|
||||
{
|
||||
dzn_queue *queue = container_of(q, dzn_queue, vk);
|
||||
dzn_device *device = container_of(q->base.device, dzn_device, vk);
|
||||
struct dzn_queue *queue = container_of(q, struct dzn_queue, vk);
|
||||
struct dzn_device *device = container_of(q->base.device, struct dzn_device, vk);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
for (uint32_t i = 0; i < info->wait_count; i++) {
|
||||
|
|
@ -1444,17 +1444,17 @@ dzn_queue_submit(struct vk_queue *q,
|
|||
}
|
||||
|
||||
for (uint32_t i = 0; i < info->command_buffer_count; i++) {
|
||||
dzn_cmd_buffer *cmd_buffer =
|
||||
container_of(info->command_buffers[i], dzn_cmd_buffer, vk);
|
||||
struct dzn_cmd_buffer *cmd_buffer =
|
||||
container_of(info->command_buffers[i], struct dzn_cmd_buffer, vk);
|
||||
|
||||
ID3D12CommandList *cmdlists[] = { (ID3D12CommandList *)cmd_buffer->cmdlist };
|
||||
|
||||
util_dynarray_foreach(&cmd_buffer->events.wait, dzn_event *, evt) {
|
||||
util_dynarray_foreach(&cmd_buffer->events.wait, struct dzn_event *, evt) {
|
||||
if (FAILED(ID3D12CommandQueue_Wait(queue->cmdqueue, (*evt)->fence, 1)))
|
||||
return vk_error(device, VK_ERROR_UNKNOWN);
|
||||
}
|
||||
|
||||
util_dynarray_foreach(&cmd_buffer->queries.wait, dzn_cmd_buffer_query_range, range) {
|
||||
util_dynarray_foreach(&cmd_buffer->queries.wait, struct dzn_cmd_buffer_query_range, range) {
|
||||
mtx_lock(&range->qpool->queries_lock);
|
||||
for (uint32_t q = range->start; q < range->start + range->count; q++) {
|
||||
struct dzn_query *query = &range->qpool->queries[q];
|
||||
|
|
@ -1466,7 +1466,7 @@ dzn_queue_submit(struct vk_queue *q,
|
|||
mtx_unlock(&range->qpool->queries_lock);
|
||||
}
|
||||
|
||||
util_dynarray_foreach(&cmd_buffer->queries.reset, dzn_cmd_buffer_query_range, range) {
|
||||
util_dynarray_foreach(&cmd_buffer->queries.reset, struct dzn_cmd_buffer_query_range, range) {
|
||||
mtx_lock(&range->qpool->queries_lock);
|
||||
for (uint32_t q = range->start; q < range->start + range->count; q++) {
|
||||
struct dzn_query *query = &range->qpool->queries[q];
|
||||
|
|
@ -1481,12 +1481,12 @@ dzn_queue_submit(struct vk_queue *q,
|
|||
|
||||
ID3D12CommandQueue_ExecuteCommandLists(queue->cmdqueue, 1, cmdlists);
|
||||
|
||||
util_dynarray_foreach(&cmd_buffer->events.signal, dzn_cmd_event_signal, evt) {
|
||||
util_dynarray_foreach(&cmd_buffer->events.signal, struct dzn_cmd_event_signal, evt) {
|
||||
if (FAILED(ID3D12CommandQueue_Signal(queue->cmdqueue, evt->event->fence, evt->value ? 1 : 0)))
|
||||
return vk_error(device, VK_ERROR_UNKNOWN);
|
||||
}
|
||||
|
||||
util_dynarray_foreach(&cmd_buffer->queries.signal, dzn_cmd_buffer_query_range, range) {
|
||||
util_dynarray_foreach(&cmd_buffer->queries.signal, struct dzn_cmd_buffer_query_range, range) {
|
||||
mtx_lock(&range->qpool->queries_lock);
|
||||
for (uint32_t q = range->start; q < range->start + range->count; q++) {
|
||||
struct dzn_query *query = &range->qpool->queries[q];
|
||||
|
|
@ -1511,7 +1511,7 @@ dzn_queue_submit(struct vk_queue *q,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_queue_finish(dzn_queue *queue)
|
||||
dzn_queue_finish(struct dzn_queue *queue)
|
||||
{
|
||||
if (queue->cmdqueue)
|
||||
ID3D12CommandQueue_Release(queue->cmdqueue);
|
||||
|
|
@ -1523,12 +1523,12 @@ dzn_queue_finish(dzn_queue *queue)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_queue_init(dzn_queue *queue,
|
||||
dzn_device *device,
|
||||
dzn_queue_init(struct dzn_queue *queue,
|
||||
struct dzn_device *device,
|
||||
const VkDeviceQueueCreateInfo *pCreateInfo,
|
||||
uint32_t index_in_family)
|
||||
{
|
||||
dzn_physical_device *pdev = container_of(device->vk.physical, dzn_physical_device, vk);
|
||||
struct dzn_physical_device *pdev = container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
|
||||
VkResult result = vk_queue_init(&queue->vk, &device->vk, pCreateInfo, index_in_family);
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
@ -1610,7 +1610,7 @@ dzn_device_unref_pipeline_layout(struct vk_device *dev, VkPipelineLayout layout)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_device_query_init(dzn_device *device)
|
||||
dzn_device_query_init(struct dzn_device *device)
|
||||
{
|
||||
/* FIXME: create the resource in the default heap */
|
||||
D3D12_HEAP_PROPERTIES hprops;
|
||||
|
|
@ -1649,23 +1649,23 @@ dzn_device_query_init(dzn_device *device)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_device_query_finish(dzn_device *device)
|
||||
dzn_device_query_finish(struct dzn_device *device)
|
||||
{
|
||||
if (device->queries.refs)
|
||||
ID3D12Resource_Release(device->queries.refs);
|
||||
}
|
||||
|
||||
static void
|
||||
dzn_device_destroy(dzn_device *device, const VkAllocationCallbacks *pAllocator)
|
||||
dzn_device_destroy(struct dzn_device *device, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
|
||||
vk_foreach_queue_safe(q, &device->vk) {
|
||||
dzn_queue *queue = container_of(q, dzn_queue, vk);
|
||||
struct dzn_queue *queue = container_of(q, struct dzn_queue, vk);
|
||||
|
||||
dzn_queue_finish(queue);
|
||||
}
|
||||
|
|
@ -1681,12 +1681,12 @@ dzn_device_destroy(dzn_device *device, const VkAllocationCallbacks *pAllocator)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_device_create(dzn_physical_device *pdev,
|
||||
dzn_device_create(struct dzn_physical_device *pdev,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDevice *out)
|
||||
{
|
||||
dzn_instance *instance = container_of(pdev->vk.instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance = container_of(pdev->vk.instance, struct dzn_instance, vk);
|
||||
|
||||
uint32_t queue_count = 0;
|
||||
for (uint32_t qf = 0; qf < pCreateInfo->queueCreateInfoCount; qf++) {
|
||||
|
|
@ -1695,14 +1695,14 @@ dzn_device_create(dzn_physical_device *pdev,
|
|||
}
|
||||
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_device, device, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_queue, queues, queue_count);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_device, device, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_queue, queues, queue_count);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &instance->vk.alloc, pAllocator,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
|
||||
return vk_error(pdev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vk_device_dispatch_table dispatch_table;
|
||||
struct vk_device_dispatch_table dispatch_table;
|
||||
|
||||
/* For secondary command buffer support, overwrite any command entrypoints
|
||||
* in the main device-level dispatch table with
|
||||
|
|
@ -1798,11 +1798,11 @@ dzn_device_create(dzn_physical_device *pdev,
|
|||
}
|
||||
|
||||
ID3D12RootSignature *
|
||||
dzn_device_create_root_sig(dzn_device *device,
|
||||
dzn_device_create_root_sig(struct dzn_device *device,
|
||||
const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *desc)
|
||||
{
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
ID3D10Blob *sig, *error;
|
||||
|
||||
if (FAILED(instance->d3d12.serialize_root_sig(desc,
|
||||
|
|
@ -1841,8 +1841,8 @@ dzn_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
VkDevice *pDevice)
|
||||
{
|
||||
VK_FROM_HANDLE(dzn_physical_device, physical_device, physicalDevice);
|
||||
dzn_instance *instance =
|
||||
container_of(physical_device->vk.instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(physical_device->vk.instance, struct dzn_instance, vk);
|
||||
VkResult result;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO);
|
||||
|
|
@ -1879,13 +1879,13 @@ dzn_DestroyDevice(VkDevice dev,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_device_memory_destroy(dzn_device_memory *mem,
|
||||
dzn_device_memory_destroy(struct dzn_device_memory *mem,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!mem)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(mem->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(mem->base.device, struct dzn_device, vk);
|
||||
|
||||
if (mem->map)
|
||||
ID3D12Resource_Unmap(mem->map_res, 0, NULL);
|
||||
|
|
@ -1901,15 +1901,15 @@ dzn_device_memory_destroy(dzn_device_memory *mem,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_device_memory_create(dzn_device *device,
|
||||
dzn_device_memory_create(struct dzn_device *device,
|
||||
const VkMemoryAllocateInfo *pAllocateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDeviceMemory *out)
|
||||
{
|
||||
dzn_physical_device *pdevice =
|
||||
container_of(device->vk.physical, dzn_physical_device, vk);
|
||||
struct dzn_physical_device *pdevice =
|
||||
container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
|
||||
dzn_device_memory *mem = (dzn_device_memory *)
|
||||
struct dzn_device_memory *mem = (struct dzn_device_memory *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*mem), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!mem)
|
||||
|
|
@ -2093,12 +2093,12 @@ dzn_InvalidateMappedMemoryRanges(VkDevice _device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_buffer_destroy(dzn_buffer *buf, const VkAllocationCallbacks *pAllocator)
|
||||
dzn_buffer_destroy(struct dzn_buffer *buf, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(buf->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(buf->base.device, struct dzn_device, vk);
|
||||
|
||||
if (buf->res)
|
||||
ID3D12Resource_Release(buf->res);
|
||||
|
|
@ -2108,12 +2108,12 @@ dzn_buffer_destroy(dzn_buffer *buf, const VkAllocationCallbacks *pAllocator)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_buffer_create(dzn_device *device,
|
||||
dzn_buffer_create(struct dzn_device *device,
|
||||
const VkBufferCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkBuffer *out)
|
||||
{
|
||||
dzn_buffer *buf = (dzn_buffer *)
|
||||
struct dzn_buffer *buf = (struct dzn_buffer *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*buf), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!buf)
|
||||
|
|
@ -2157,7 +2157,7 @@ dzn_buffer_get_dxgi_format(VkFormat format)
|
|||
}
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_buffer_get_copy_loc(const dzn_buffer *buf,
|
||||
dzn_buffer_get_copy_loc(const struct dzn_buffer *buf,
|
||||
VkFormat format,
|
||||
const VkBufferImageCopy2KHR *region,
|
||||
VkImageAspectFlagBits aspect,
|
||||
|
|
@ -2201,7 +2201,7 @@ dzn_buffer_get_copy_loc(const dzn_buffer *buf,
|
|||
}
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_buffer_get_line_copy_loc(const dzn_buffer *buf, VkFormat format,
|
||||
dzn_buffer_get_line_copy_loc(const struct dzn_buffer *buf, VkFormat format,
|
||||
const VkBufferImageCopy2KHR *region,
|
||||
const D3D12_TEXTURE_COPY_LOCATION *loc,
|
||||
uint32_t y, uint32_t z, uint32_t *start_x)
|
||||
|
|
@ -2277,8 +2277,8 @@ dzn_GetBufferMemoryRequirements2(VkDevice dev,
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_device, device, dev);
|
||||
VK_FROM_HANDLE(dzn_buffer, buffer, pInfo->buffer);
|
||||
dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, dzn_physical_device, vk);
|
||||
struct dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
|
||||
/* uh, this is grossly over-estimating things */
|
||||
uint32_t alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
|
|
@ -2346,14 +2346,14 @@ dzn_BindBufferMemory2(VkDevice _device,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_framebuffer_create(dzn_device *device,
|
||||
dzn_framebuffer_create(struct dzn_device *device,
|
||||
const VkFramebufferCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkFramebuffer *out)
|
||||
{
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_framebuffer, framebuffer, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_image_view *, attachments, pCreateInfo->attachmentCount);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_framebuffer, framebuffer, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_image_view *, attachments, pCreateInfo->attachmentCount);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT))
|
||||
|
|
@ -2376,14 +2376,14 @@ dzn_framebuffer_create(dzn_device *device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_framebuffer_destroy(dzn_framebuffer *framebuffer,
|
||||
dzn_framebuffer_destroy(struct dzn_framebuffer *framebuffer,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!framebuffer)
|
||||
return;
|
||||
|
||||
dzn_device *device =
|
||||
container_of(framebuffer->base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(framebuffer->base.device, struct dzn_device, vk);
|
||||
|
||||
vk_object_base_finish(&framebuffer->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, framebuffer);
|
||||
|
|
@ -2408,14 +2408,14 @@ dzn_DestroyFramebuffer(VkDevice device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_event_destroy(dzn_event *event,
|
||||
dzn_event_destroy(struct dzn_event *event,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
dzn_device *device =
|
||||
container_of(event->base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(event->base.device, struct dzn_device, vk);
|
||||
|
||||
if (event->fence)
|
||||
ID3D12Fence_Release(event->fence);
|
||||
|
|
@ -2425,12 +2425,12 @@ dzn_event_destroy(dzn_event *event,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_event_create(dzn_device *device,
|
||||
dzn_event_create(struct dzn_device *device,
|
||||
const VkEventCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkEvent *out)
|
||||
{
|
||||
dzn_event *event = (dzn_event *)
|
||||
struct dzn_event *event = (struct dzn_event *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*event), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!event)
|
||||
|
|
@ -2538,26 +2538,26 @@ dzn_sampler_translate_addr_mode(VkSamplerAddressMode in)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_sampler_destroy(dzn_sampler *sampler,
|
||||
dzn_sampler_destroy(struct dzn_sampler *sampler,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!sampler)
|
||||
return;
|
||||
|
||||
dzn_device *device =
|
||||
container_of(sampler->base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(sampler->base.device, struct dzn_device, vk);
|
||||
|
||||
vk_object_base_finish(&sampler->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, sampler);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_sampler_create(dzn_device *device,
|
||||
dzn_sampler_create(struct dzn_device *device,
|
||||
const VkSamplerCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSampler *out)
|
||||
{
|
||||
dzn_sampler *sampler = (dzn_sampler *)
|
||||
struct dzn_sampler *sampler = (struct dzn_sampler *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!sampler)
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@
|
|||
#include "vk_util.h"
|
||||
|
||||
static void
|
||||
dzn_image_destroy(dzn_image *image,
|
||||
dzn_image_destroy(struct dzn_image *image,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(image->vk.base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(image->vk.base.device, struct dzn_device, vk);
|
||||
|
||||
if (image->res)
|
||||
ID3D12Resource_Release(image->res);
|
||||
|
|
@ -45,16 +45,16 @@ dzn_image_destroy(dzn_image *image,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_image_create(dzn_device *device,
|
||||
dzn_image_create(struct dzn_device *device,
|
||||
const VkImageCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkImage *out)
|
||||
{
|
||||
dzn_image *image = (dzn_image *)
|
||||
struct dzn_image *image = (struct dzn_image *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*image), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, dzn_physical_device, vk);
|
||||
struct dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
|
||||
if (!image)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
|
@ -288,7 +288,7 @@ dzn_image_get_plane_format(VkFormat format,
|
|||
}
|
||||
|
||||
uint32_t
|
||||
dzn_image_layers_get_subresource_index(const dzn_image *image,
|
||||
dzn_image_layers_get_subresource_index(const struct dzn_image *image,
|
||||
const VkImageSubresourceLayers *subres,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t layer)
|
||||
|
|
@ -302,7 +302,7 @@ dzn_image_layers_get_subresource_index(const dzn_image *image,
|
|||
}
|
||||
|
||||
uint32_t
|
||||
dzn_image_range_get_subresource_index(const dzn_image *image,
|
||||
dzn_image_range_get_subresource_index(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *subres,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t level, uint32_t layer)
|
||||
|
|
@ -316,7 +316,7 @@ dzn_image_range_get_subresource_index(const dzn_image *image,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
dzn_image_get_subresource_index(const dzn_image *image,
|
||||
dzn_image_get_subresource_index(const struct dzn_image *image,
|
||||
const VkImageSubresource *subres,
|
||||
VkImageAspectFlagBits aspect)
|
||||
{
|
||||
|
|
@ -329,7 +329,7 @@ dzn_image_get_subresource_index(const dzn_image *image,
|
|||
}
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_image_get_copy_loc(const dzn_image *image,
|
||||
dzn_image_get_copy_loc(const struct dzn_image *image,
|
||||
const VkImageSubresourceLayers *subres,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t layer)
|
||||
|
|
@ -364,7 +364,7 @@ dzn_image_get_copy_loc(const dzn_image *image,
|
|||
}
|
||||
|
||||
D3D12_DEPTH_STENCIL_VIEW_DESC
|
||||
dzn_image_get_dsv_desc(const dzn_image *image,
|
||||
dzn_image_get_dsv_desc(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *range,
|
||||
uint32_t level)
|
||||
{
|
||||
|
|
@ -425,7 +425,7 @@ dzn_image_get_dsv_desc(const dzn_image *image,
|
|||
}
|
||||
|
||||
D3D12_RENDER_TARGET_VIEW_DESC
|
||||
dzn_image_get_rtv_desc(const dzn_image *image,
|
||||
dzn_image_get_rtv_desc(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *range,
|
||||
uint32_t level)
|
||||
{
|
||||
|
|
@ -571,14 +571,14 @@ dzn_DestroyImage(VkDevice device, VkImage image,
|
|||
dzn_image_destroy(dzn_image_from_handle(image), pAllocator);
|
||||
}
|
||||
|
||||
static dzn_image *
|
||||
dzn_swapchain_get_image(dzn_device *device,
|
||||
static struct dzn_image *
|
||||
dzn_swapchain_get_image(struct dzn_device *device,
|
||||
VkSwapchainKHR swapchain,
|
||||
uint32_t index)
|
||||
{
|
||||
uint32_t n_images = index + 1;
|
||||
STACK_ARRAY(VkImage, images, n_images);
|
||||
dzn_image *image = NULL;
|
||||
struct dzn_image *image = NULL;
|
||||
|
||||
VkResult result = wsi_common_get_images(swapchain, &n_images, images);
|
||||
|
||||
|
|
@ -607,7 +607,7 @@ dzn_BindImageMemory2(VkDevice dev,
|
|||
case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: {
|
||||
const VkBindImageMemorySwapchainInfoKHR *swapchain_info =
|
||||
(const VkBindImageMemorySwapchainInfoKHR *) s;
|
||||
dzn_image *swapchain_image =
|
||||
struct dzn_image *swapchain_image =
|
||||
dzn_swapchain_get_image(device,
|
||||
swapchain_info->swapchain,
|
||||
swapchain_info->imageIndex);
|
||||
|
|
@ -652,8 +652,8 @@ dzn_GetImageMemoryRequirements2(VkDevice _device,
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_device, device, _device);
|
||||
VK_FROM_HANDLE(dzn_image, image, pInfo->image);
|
||||
dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, dzn_physical_device, vk);
|
||||
struct dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
|
||||
vk_foreach_struct_const(ext, pInfo->pNext) {
|
||||
dzn_debug_ignored_stype(ext->sType);
|
||||
|
|
@ -762,7 +762,7 @@ translate_swizzle(VkComponentSwizzle in, uint32_t comp)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_image_view_prepare_srv_desc(dzn_image_view *iview)
|
||||
dzn_image_view_prepare_srv_desc(struct dzn_image_view *iview)
|
||||
{
|
||||
uint32_t plane_slice = (iview->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT) ? 1 : 0;
|
||||
bool ms = iview->vk.image->samples > 1;
|
||||
|
|
@ -870,7 +870,7 @@ dzn_image_view_prepare_srv_desc(dzn_image_view *iview)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_image_view_prepare_uav_desc(dzn_image_view *iview)
|
||||
dzn_image_view_prepare_uav_desc(struct dzn_image_view *iview)
|
||||
{
|
||||
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
|
||||
|
||||
|
|
@ -924,7 +924,7 @@ dzn_image_view_prepare_uav_desc(dzn_image_view *iview)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_image_view_prepare_rtv_desc(dzn_image_view *iview)
|
||||
dzn_image_view_prepare_rtv_desc(struct dzn_image_view *iview)
|
||||
{
|
||||
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
|
||||
bool from_3d_image = iview->vk.image->image_type == VK_IMAGE_TYPE_3D;
|
||||
|
|
@ -996,7 +996,7 @@ dzn_image_view_prepare_rtv_desc(dzn_image_view *iview)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_image_view_prepare_dsv_desc(dzn_image_view *iview)
|
||||
dzn_image_view_prepare_dsv_desc(struct dzn_image_view *iview)
|
||||
{
|
||||
bool use_array = iview->vk.base_array_layer > 0 || iview->vk.layer_count > 1;
|
||||
bool ms = iview->vk.image->samples > 1;
|
||||
|
|
@ -1048,14 +1048,14 @@ dzn_image_view_prepare_dsv_desc(dzn_image_view *iview)
|
|||
}
|
||||
|
||||
void
|
||||
dzn_image_view_finish(dzn_image_view *iview)
|
||||
dzn_image_view_finish(struct dzn_image_view *iview)
|
||||
{
|
||||
vk_image_view_finish(&iview->vk);
|
||||
}
|
||||
|
||||
void
|
||||
dzn_image_view_init(dzn_device *device,
|
||||
dzn_image_view *iview,
|
||||
dzn_image_view_init(struct dzn_device *device,
|
||||
struct dzn_image_view *iview,
|
||||
const VkImageViewCreateInfo *pCreateInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(dzn_image, image, pCreateInfo->image);
|
||||
|
|
@ -1105,25 +1105,25 @@ dzn_image_view_init(dzn_device *device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_image_view_destroy(dzn_image_view *iview,
|
||||
dzn_image_view_destroy(struct dzn_image_view *iview,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!iview)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(iview->vk.base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(iview->vk.base.device, struct dzn_device, vk);
|
||||
|
||||
vk_image_view_finish(&iview->vk);
|
||||
vk_free2(&device->vk.alloc, pAllocator, iview);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_image_view_create(dzn_device *device,
|
||||
dzn_image_view_create(struct dzn_device *device,
|
||||
const VkImageViewCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkImageView *out)
|
||||
{
|
||||
dzn_image_view *iview = (dzn_image_view *)
|
||||
struct dzn_image_view *iview = (struct dzn_image_view *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*iview), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!iview)
|
||||
|
|
@ -1154,27 +1154,27 @@ dzn_DestroyImageView(VkDevice device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_buffer_view_destroy(dzn_buffer_view *bview,
|
||||
dzn_buffer_view_destroy(struct dzn_buffer_view *bview,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!bview)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(bview->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(bview->base.device, struct dzn_device, vk);
|
||||
|
||||
vk_object_base_finish(&bview->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, bview);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_buffer_view_create(dzn_device *device,
|
||||
dzn_buffer_view_create(struct dzn_device *device,
|
||||
const VkBufferViewCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkBufferView *out)
|
||||
{
|
||||
VK_FROM_HANDLE(dzn_buffer, buf, pCreateInfo->buffer);
|
||||
|
||||
dzn_buffer_view *bview = (dzn_buffer_view *)
|
||||
struct dzn_buffer_view *bview = (struct dzn_buffer_view *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*bview), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!bview)
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@
|
|||
#include "dxil_validator.h"
|
||||
|
||||
static void
|
||||
dzn_meta_compile_shader(dzn_device *device, nir_shader *nir,
|
||||
dzn_meta_compile_shader(struct dzn_device *device, nir_shader *nir,
|
||||
D3D12_SHADER_BYTECODE *slot)
|
||||
{
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
|
||||
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
|
||||
|
||||
|
|
@ -90,9 +90,9 @@ dzn_meta_compile_shader(dzn_device *device, nir_shader *nir,
|
|||
#define DZN_META_INDIRECT_DRAW_MAX_PARAM_COUNT 4
|
||||
|
||||
static void
|
||||
dzn_meta_indirect_draw_finish(dzn_device *device, enum dzn_indirect_draw_type type)
|
||||
dzn_meta_indirect_draw_finish(struct dzn_device *device, enum dzn_indirect_draw_type type)
|
||||
{
|
||||
dzn_meta_indirect_draw *meta = &device->indirect_draws[type];
|
||||
struct dzn_meta_indirect_draw *meta = &device->indirect_draws[type];
|
||||
|
||||
if (meta->root_sig)
|
||||
ID3D12RootSignature_Release(meta->root_sig);
|
||||
|
|
@ -102,12 +102,12 @@ dzn_meta_indirect_draw_finish(dzn_device *device, enum dzn_indirect_draw_type ty
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_meta_indirect_draw_init(dzn_device *device,
|
||||
dzn_meta_indirect_draw_init(struct dzn_device *device,
|
||||
enum dzn_indirect_draw_type type)
|
||||
{
|
||||
dzn_meta_indirect_draw *meta = &device->indirect_draws[type];
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_meta_indirect_draw *meta = &device->indirect_draws[type];
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
VkResult ret = VK_SUCCESS;
|
||||
|
||||
glsl_type_singleton_init_or_ref();
|
||||
|
|
@ -211,10 +211,10 @@ out:
|
|||
#define DZN_META_TRIANGLE_FAN_REWRITE_IDX_MAX_PARAM_COUNT 3
|
||||
|
||||
static void
|
||||
dzn_meta_triangle_fan_rewrite_index_finish(dzn_device *device,
|
||||
dzn_meta_triangle_fan_rewrite_index_finish(struct dzn_device *device,
|
||||
enum dzn_index_type old_index_type)
|
||||
{
|
||||
dzn_meta_triangle_fan_rewrite_index *meta =
|
||||
struct dzn_meta_triangle_fan_rewrite_index *meta =
|
||||
&device->triangle_fan[old_index_type];
|
||||
|
||||
if (meta->root_sig)
|
||||
|
|
@ -226,13 +226,13 @@ dzn_meta_triangle_fan_rewrite_index_finish(dzn_device *device,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_meta_triangle_fan_rewrite_index_init(dzn_device *device,
|
||||
dzn_meta_triangle_fan_rewrite_index_init(struct dzn_device *device,
|
||||
enum dzn_index_type old_index_type)
|
||||
{
|
||||
dzn_meta_triangle_fan_rewrite_index *meta =
|
||||
struct dzn_meta_triangle_fan_rewrite_index *meta =
|
||||
&device->triangle_fan[old_index_type];
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
VkResult ret = VK_SUCCESS;
|
||||
|
||||
glsl_type_singleton_init_or_ref();
|
||||
|
|
@ -354,9 +354,9 @@ out:
|
|||
}
|
||||
|
||||
static const D3D12_SHADER_BYTECODE *
|
||||
dzn_meta_blits_get_vs(dzn_device *device)
|
||||
dzn_meta_blits_get_vs(struct dzn_device *device)
|
||||
{
|
||||
dzn_meta_blits *meta = &device->blits;
|
||||
struct dzn_meta_blits *meta = &device->blits;
|
||||
D3D12_SHADER_BYTECODE *out;
|
||||
|
||||
mtx_lock(&meta->shaders_lock);
|
||||
|
|
@ -397,10 +397,10 @@ dzn_meta_blits_get_vs(dzn_device *device)
|
|||
}
|
||||
|
||||
static const D3D12_SHADER_BYTECODE *
|
||||
dzn_meta_blits_get_fs(dzn_device *device,
|
||||
dzn_meta_blits_get_fs(struct dzn_device *device,
|
||||
const struct dzn_nir_blit_info *info)
|
||||
{
|
||||
dzn_meta_blits *meta = &device->blits;
|
||||
struct dzn_meta_blits *meta = &device->blits;
|
||||
D3D12_SHADER_BYTECODE *out = NULL;
|
||||
|
||||
mtx_lock(&meta->shaders_lock);
|
||||
|
|
@ -448,7 +448,7 @@ dzn_meta_blits_get_fs(dzn_device *device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_meta_blit_destroy(dzn_device *device, dzn_meta_blit *blit)
|
||||
dzn_meta_blit_destroy(struct dzn_device *device, struct dzn_meta_blit *blit)
|
||||
{
|
||||
if (!blit)
|
||||
return;
|
||||
|
|
@ -461,11 +461,11 @@ dzn_meta_blit_destroy(dzn_device *device, dzn_meta_blit *blit)
|
|||
vk_free(&device->vk.alloc, blit);
|
||||
}
|
||||
|
||||
static dzn_meta_blit *
|
||||
dzn_meta_blit_create(dzn_device *device, const dzn_meta_blit_key *key)
|
||||
static struct dzn_meta_blit *
|
||||
dzn_meta_blit_create(struct dzn_device *device, const struct dzn_meta_blit_key *key)
|
||||
{
|
||||
dzn_meta_blits *blits = &device->blits;
|
||||
dzn_meta_blit *blit = (dzn_meta_blit *)
|
||||
struct dzn_meta_blits *blits = &device->blits;
|
||||
struct dzn_meta_blit *blit = (struct dzn_meta_blit *)
|
||||
vk_zalloc(&device->vk.alloc, sizeof(*blit), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
|
||||
|
|
@ -621,17 +621,17 @@ dzn_meta_blit_create(dzn_device *device, const dzn_meta_blit_key *key)
|
|||
return blit;
|
||||
}
|
||||
|
||||
const dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(dzn_device *device,
|
||||
const dzn_meta_blit_key *key)
|
||||
const struct dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(struct dzn_device *device,
|
||||
const struct dzn_meta_blit_key *key)
|
||||
{
|
||||
dzn_meta_blit *out = NULL;
|
||||
struct dzn_meta_blit *out = NULL;
|
||||
|
||||
STATIC_ASSERT(sizeof(key) == sizeof(uint64_t));
|
||||
|
||||
mtx_lock(&device->blits.contexts_lock);
|
||||
|
||||
out = (dzn_meta_blit *)
|
||||
out = (struct dzn_meta_blit *)
|
||||
_mesa_hash_table_u64_search(device->blits.contexts, key->u64);
|
||||
if (!out) {
|
||||
out = dzn_meta_blit_create(device, key);
|
||||
|
|
@ -646,9 +646,9 @@ dzn_meta_blits_get_context(dzn_device *device,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_meta_blits_finish(dzn_device *device)
|
||||
dzn_meta_blits_finish(struct dzn_device *device)
|
||||
{
|
||||
dzn_meta_blits *meta = &device->blits;
|
||||
struct dzn_meta_blits *meta = &device->blits;
|
||||
|
||||
vk_free(&device->vk.alloc, (void *)meta->vs.pShaderBytecode);
|
||||
|
||||
|
|
@ -660,7 +660,7 @@ dzn_meta_blits_finish(dzn_device *device)
|
|||
|
||||
if (meta->contexts) {
|
||||
hash_table_foreach(meta->contexts->table, he)
|
||||
dzn_meta_blit_destroy(device, (dzn_meta_blit *)he->data);
|
||||
dzn_meta_blit_destroy(device, (struct dzn_meta_blit *)he->data);
|
||||
_mesa_hash_table_u64_destroy(meta->contexts);
|
||||
}
|
||||
|
||||
|
|
@ -669,11 +669,11 @@ dzn_meta_blits_finish(dzn_device *device)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_meta_blits_init(dzn_device *device)
|
||||
dzn_meta_blits_init(struct dzn_device *device)
|
||||
{
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
dzn_meta_blits *meta = &device->blits;
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
struct dzn_meta_blits *meta = &device->blits;
|
||||
|
||||
mtx_init(&meta->shaders_lock, mtx_plain);
|
||||
mtx_init(&meta->contexts_lock, mtx_plain);
|
||||
|
|
@ -694,7 +694,7 @@ dzn_meta_blits_init(dzn_device *device)
|
|||
}
|
||||
|
||||
void
|
||||
dzn_meta_finish(dzn_device *device)
|
||||
dzn_meta_finish(struct dzn_device *device)
|
||||
{
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(device->triangle_fan); i++)
|
||||
dzn_meta_triangle_fan_rewrite_index_finish(device, (enum dzn_index_type)i);
|
||||
|
|
@ -706,7 +706,7 @@ dzn_meta_finish(dzn_device *device)
|
|||
}
|
||||
|
||||
VkResult
|
||||
dzn_meta_init(dzn_device *device)
|
||||
dzn_meta_init(struct dzn_device *device)
|
||||
{
|
||||
VkResult result = dzn_meta_blits_init(device);
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ dzn_CreateRenderPass2(VkDevice dev,
|
|||
VK_FROM_HANDLE(dzn_device, device, dev);
|
||||
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_render_pass, pass, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_subpass, subpasses,
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_render_pass, pass, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_subpass, subpasses,
|
||||
pCreateInfo->subpassCount);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_attachment, attachments,
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_attachment, attachments,
|
||||
pCreateInfo->attachmentCount);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@ to_dxil_shader_stage(VkShaderStageFlagBits in)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_pipeline_compile_shader(dzn_device *device,
|
||||
dzn_pipeline_compile_shader(struct dzn_device *device,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
dzn_pipeline_layout *layout,
|
||||
struct dzn_pipeline_layout *layout,
|
||||
const VkPipelineShaderStageCreateInfo *stage_info,
|
||||
enum dxil_spirv_yz_flip_mode yz_flip_mode,
|
||||
uint16_t y_flip_mask, uint16_t z_flip_mask,
|
||||
bool force_sample_rate_shading,
|
||||
D3D12_SHADER_BYTECODE *slot)
|
||||
{
|
||||
dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, dzn_instance, vk);
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
const VkSpecializationInfo *spec_info = stage_info->pSpecializationInfo;
|
||||
VK_FROM_HANDLE(vk_shader_module, module, stage_info->module);
|
||||
struct dxil_spirv_object dxil_object;
|
||||
|
|
@ -192,14 +192,14 @@ dzn_pipeline_get_gfx_shader_slot(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_graphics_pipeline_translate_vi(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_vi(struct dzn_graphics_pipeline *pipeline,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in,
|
||||
D3D12_INPUT_ELEMENT_DESC **input_elems)
|
||||
{
|
||||
dzn_device *device =
|
||||
container_of(pipeline->base.base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(pipeline->base.base.device, struct dzn_device, vk);
|
||||
const VkPipelineVertexInputStateCreateInfo *in_vi =
|
||||
in->pVertexInputState;
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ to_prim_topology(VkPrimitiveTopology in, unsigned patch_control_points)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_translate_ia(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_ia(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -347,7 +347,7 @@ translate_cull_mode(VkCullModeFlags in)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_translate_rast(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_rast(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -385,7 +385,7 @@ dzn_graphics_pipeline_translate_rast(dzn_graphics_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_translate_ms(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_ms(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -419,7 +419,7 @@ translate_stencil_op(VkStencilOp in)
|
|||
}
|
||||
|
||||
static void
|
||||
translate_stencil_test(dzn_graphics_pipeline *pipeline,
|
||||
translate_stencil_test(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -530,7 +530,7 @@ translate_stencil_test(dzn_graphics_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_translate_zsa(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_zsa(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -649,7 +649,7 @@ translate_logic_op(VkLogicOp in)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_translate_blend(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_translate_blend(struct dzn_graphics_pipeline *pipeline,
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
|
|
@ -704,10 +704,10 @@ dzn_graphics_pipeline_translate_blend(dzn_graphics_pipeline *pipeline,
|
|||
|
||||
|
||||
static void
|
||||
dzn_pipeline_init(dzn_pipeline *pipeline,
|
||||
dzn_device *device,
|
||||
dzn_pipeline_init(struct dzn_pipeline *pipeline,
|
||||
struct dzn_device *device,
|
||||
VkPipelineBindPoint type,
|
||||
dzn_pipeline_layout *layout)
|
||||
struct dzn_pipeline_layout *layout)
|
||||
{
|
||||
pipeline->type = type;
|
||||
pipeline->root.sets_param_count = layout->root.sets_param_count;
|
||||
|
|
@ -727,7 +727,7 @@ dzn_pipeline_init(dzn_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_pipeline_finish(dzn_pipeline *pipeline)
|
||||
dzn_pipeline_finish(struct dzn_pipeline *pipeline)
|
||||
{
|
||||
if (pipeline->state)
|
||||
ID3D12PipelineState_Release(pipeline->state);
|
||||
|
|
@ -738,7 +738,7 @@ dzn_pipeline_finish(dzn_pipeline *pipeline)
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_graphics_pipeline_destroy(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_destroy(struct dzn_graphics_pipeline *pipeline,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
if (!pipeline)
|
||||
|
|
@ -754,7 +754,7 @@ dzn_graphics_pipeline_destroy(dzn_graphics_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_graphics_pipeline_create(dzn_device *device,
|
||||
dzn_graphics_pipeline_create(struct dzn_device *device,
|
||||
VkPipelineCache cache,
|
||||
const VkGraphicsPipelineCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
|
|
@ -762,12 +762,12 @@ dzn_graphics_pipeline_create(dzn_device *device,
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_render_pass, pass, pCreateInfo->renderPass);
|
||||
VK_FROM_HANDLE(dzn_pipeline_layout, layout, pCreateInfo->layout);
|
||||
const dzn_subpass *subpass = &pass->subpasses[pCreateInfo->subpass];
|
||||
const struct dzn_subpass *subpass = &pass->subpasses[pCreateInfo->subpass];
|
||||
uint32_t stage_mask = 0;
|
||||
VkResult ret;
|
||||
HRESULT hres = 0;
|
||||
|
||||
dzn_graphics_pipeline *pipeline = (dzn_graphics_pipeline *)
|
||||
struct dzn_graphics_pipeline *pipeline = (struct dzn_graphics_pipeline *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!pipeline)
|
||||
|
|
@ -933,13 +933,13 @@ out:
|
|||
#define DZN_INDIRECT_CMD_SIG_MAX_ARGS 3
|
||||
|
||||
ID3D12CommandSignature *
|
||||
dzn_graphics_pipeline_get_indirect_cmd_sig(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_get_indirect_cmd_sig(struct dzn_graphics_pipeline *pipeline,
|
||||
enum dzn_indirect_draw_cmd_sig_type type)
|
||||
{
|
||||
assert(type < DZN_NUM_INDIRECT_DRAW_CMD_SIGS);
|
||||
|
||||
dzn_device *device =
|
||||
container_of(pipeline->base.base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(pipeline->base.base.device, struct dzn_device, vk);
|
||||
ID3D12CommandSignature *cmdsig = pipeline->indirect_cmd_sigs[type];
|
||||
|
||||
if (cmdsig)
|
||||
|
|
@ -1034,7 +1034,7 @@ dzn_CreateGraphicsPipelines(VkDevice dev,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_compute_pipeline_destroy(dzn_compute_pipeline *pipeline,
|
||||
dzn_compute_pipeline_destroy(struct dzn_compute_pipeline *pipeline,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
if (!pipeline)
|
||||
|
|
@ -1048,7 +1048,7 @@ dzn_compute_pipeline_destroy(dzn_compute_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_compute_pipeline_create(dzn_device *device,
|
||||
dzn_compute_pipeline_create(struct dzn_device *device,
|
||||
VkPipelineCache cache,
|
||||
const VkComputePipelineCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
|
|
@ -1056,7 +1056,7 @@ dzn_compute_pipeline_create(dzn_device *device,
|
|||
{
|
||||
VK_FROM_HANDLE(dzn_pipeline_layout, layout, pCreateInfo->layout);
|
||||
|
||||
dzn_compute_pipeline *pipeline = (dzn_compute_pipeline *)
|
||||
struct dzn_compute_pipeline *pipeline = (struct dzn_compute_pipeline *)
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!pipeline)
|
||||
|
|
@ -1097,13 +1097,13 @@ out:
|
|||
}
|
||||
|
||||
ID3D12CommandSignature *
|
||||
dzn_compute_pipeline_get_indirect_cmd_sig(dzn_compute_pipeline *pipeline)
|
||||
dzn_compute_pipeline_get_indirect_cmd_sig(struct dzn_compute_pipeline *pipeline)
|
||||
{
|
||||
if (pipeline->indirect_cmd_sig)
|
||||
return pipeline->indirect_cmd_sig;
|
||||
|
||||
dzn_device *device =
|
||||
container_of(pipeline->base.base.device, dzn_device, vk);
|
||||
struct dzn_device *device =
|
||||
container_of(pipeline->base.base.device, struct dzn_device, vk);
|
||||
|
||||
D3D12_INDIRECT_ARGUMENT_DESC indirect_dispatch_args[] = {
|
||||
{
|
||||
|
|
@ -1185,11 +1185,11 @@ dzn_DestroyPipeline(VkDevice device,
|
|||
return;
|
||||
|
||||
if (pipe->type == VK_PIPELINE_BIND_POINT_GRAPHICS) {
|
||||
dzn_graphics_pipeline *gfx = container_of(pipe, dzn_graphics_pipeline, base);
|
||||
struct dzn_graphics_pipeline *gfx = container_of(pipe, struct dzn_graphics_pipeline, base);
|
||||
dzn_graphics_pipeline_destroy(gfx, pAllocator);
|
||||
} else {
|
||||
assert(pipe->type == VK_PIPELINE_BIND_POINT_COMPUTE);
|
||||
dzn_compute_pipeline *compute = container_of(pipe, dzn_compute_pipeline, base);
|
||||
struct dzn_compute_pipeline *compute = container_of(pipe, struct dzn_compute_pipeline, base);
|
||||
dzn_compute_pipeline_destroy(compute, pAllocator);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,25 +26,25 @@
|
|||
#include "vk_alloc.h"
|
||||
|
||||
static void
|
||||
dzn_pipeline_cache_destroy(dzn_pipeline_cache *pcache,
|
||||
dzn_pipeline_cache_destroy(struct dzn_pipeline_cache *pcache,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!pcache)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(pcache->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(pcache->base.device, struct dzn_device, vk);
|
||||
|
||||
vk_object_base_finish(&pcache->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, pcache);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_pipeline_cache_create(dzn_device *device,
|
||||
dzn_pipeline_cache_create(struct dzn_device *device,
|
||||
const VkPipelineCacheCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkPipelineCache *out)
|
||||
{
|
||||
dzn_pipeline_cache *pcache = (dzn_pipeline_cache *)
|
||||
struct dzn_pipeline_cache *pcache = (struct dzn_pipeline_cache *)
|
||||
vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pcache), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!pcache)
|
||||
|
|
|
|||
|
|
@ -155,8 +155,9 @@ struct dzn_meta_blits {
|
|||
struct hash_table_u64 *contexts;
|
||||
};
|
||||
|
||||
const dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(dzn_device *device, const dzn_meta_blit_key *key);
|
||||
const struct dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(struct dzn_device *device,
|
||||
const struct dzn_meta_blit_key *key);
|
||||
|
||||
#define MAX_SYNC_TYPES 2
|
||||
#define MAX_QUEUE_FAMILIES 3
|
||||
|
|
@ -195,11 +196,11 @@ struct dzn_physical_device {
|
|||
};
|
||||
|
||||
D3D12_FEATURE_DATA_FORMAT_SUPPORT
|
||||
dzn_physical_device_get_format_support(dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_format_support(struct dzn_physical_device *pdev,
|
||||
VkFormat format);
|
||||
|
||||
uint32_t
|
||||
dzn_physical_device_get_mem_type_mask_for_resource(const dzn_physical_device *pdev,
|
||||
dzn_physical_device_get_mem_type_mask_for_resource(const struct dzn_physical_device *pdev,
|
||||
const D3D12_RESOURCE_DESC *desc);
|
||||
|
||||
#define dzn_debug_ignored_stype(sType) \
|
||||
|
|
@ -248,16 +249,16 @@ struct dzn_device {
|
|||
} queries;
|
||||
};
|
||||
|
||||
void dzn_meta_finish(dzn_device *device);
|
||||
void dzn_meta_finish(struct dzn_device *device);
|
||||
|
||||
VkResult dzn_meta_init(dzn_device *device);
|
||||
VkResult dzn_meta_init(struct dzn_device *device);
|
||||
|
||||
const dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(dzn_device *device,
|
||||
const dzn_meta_blit_key *key);
|
||||
const struct dzn_meta_blit *
|
||||
dzn_meta_blits_get_context(struct dzn_device *device,
|
||||
const struct dzn_meta_blit_key *key);
|
||||
|
||||
ID3D12RootSignature *
|
||||
dzn_device_create_root_sig(dzn_device *device,
|
||||
dzn_device_create_root_sig(struct dzn_device *device,
|
||||
const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *desc);
|
||||
|
||||
struct dzn_device_memory {
|
||||
|
|
@ -373,32 +374,32 @@ struct dzn_descriptor_heap {
|
|||
};
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE
|
||||
dzn_descriptor_heap_get_cpu_handle(const dzn_descriptor_heap *heap, uint32_t slot);
|
||||
dzn_descriptor_heap_get_cpu_handle(const struct dzn_descriptor_heap *heap, uint32_t slot);
|
||||
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE
|
||||
dzn_descriptor_heap_get_gpu_handle(const dzn_descriptor_heap *heap, uint32_t slot);
|
||||
dzn_descriptor_heap_get_gpu_handle(const struct dzn_descriptor_heap *heap, uint32_t slot);
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_write_image_view_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_image_view_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t heap_offset,
|
||||
bool writeable,
|
||||
bool cube_as_2darray,
|
||||
const dzn_image_view *iview);
|
||||
const struct dzn_image_view *iview);
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_write_buffer_desc(dzn_descriptor_heap *heap,
|
||||
dzn_descriptor_heap_write_buffer_desc(struct dzn_descriptor_heap *heap,
|
||||
uint32_t heap_offset,
|
||||
bool writeable,
|
||||
const dzn_buffer_desc *bdesc);
|
||||
const struct dzn_buffer_desc *bdesc);
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_copy(dzn_descriptor_heap *dst_heap, uint32_t dst_heap_offset,
|
||||
const dzn_descriptor_heap *src_heap, uint32_t src_heap_offset,
|
||||
dzn_descriptor_heap_copy(struct dzn_descriptor_heap *dst_heap, uint32_t dst_heap_offset,
|
||||
const struct dzn_descriptor_heap *src_heap, uint32_t src_heap_offset,
|
||||
uint32_t desc_count);
|
||||
|
||||
struct dzn_descriptor_heap_pool_entry {
|
||||
struct list_head link;
|
||||
dzn_descriptor_heap heap;
|
||||
struct dzn_descriptor_heap heap;
|
||||
};
|
||||
|
||||
struct dzn_descriptor_heap_pool {
|
||||
|
|
@ -411,23 +412,23 @@ struct dzn_descriptor_heap_pool {
|
|||
};
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_init(dzn_descriptor_heap_pool *pool,
|
||||
dzn_device *device,
|
||||
dzn_descriptor_heap_pool_init(struct dzn_descriptor_heap_pool *pool,
|
||||
struct dzn_device *device,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||
bool shader_visible,
|
||||
const VkAllocationCallbacks *alloc);
|
||||
const VkAllocationCallbacks *alloc);
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_finish(dzn_descriptor_heap_pool *pool);
|
||||
dzn_descriptor_heap_pool_finish(struct dzn_descriptor_heap_pool *pool);
|
||||
|
||||
void
|
||||
dzn_descriptor_heap_pool_reset(dzn_descriptor_heap_pool *pool);
|
||||
dzn_descriptor_heap_pool_reset(struct dzn_descriptor_heap_pool *pool);
|
||||
|
||||
VkResult
|
||||
dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
|
||||
dzn_device *device,
|
||||
dzn_descriptor_heap_pool_alloc_slots(struct dzn_descriptor_heap_pool *pool,
|
||||
struct dzn_device *device,
|
||||
uint32_t num_slots,
|
||||
dzn_descriptor_heap **heap,
|
||||
struct dzn_descriptor_heap **heap,
|
||||
uint32_t *first_slot);
|
||||
|
||||
struct dzn_cmd_buffer_query_range {
|
||||
|
|
@ -460,7 +461,7 @@ struct dzn_cmd_buffer_state {
|
|||
struct dzn_framebuffer *framebuffer;
|
||||
D3D12_RECT render_area;
|
||||
const struct dzn_pipeline *pipeline;
|
||||
dzn_descriptor_heap *heaps[NUM_POOL_TYPES];
|
||||
struct dzn_descriptor_heap *heaps[NUM_POOL_TYPES];
|
||||
struct dzn_render_pass *pass;
|
||||
struct {
|
||||
BITSET_DECLARE(dirty, MAX_VBS);
|
||||
|
|
@ -537,10 +538,10 @@ struct dzn_cmd_buffer {
|
|||
|
||||
struct {
|
||||
struct hash_table *ht;
|
||||
dzn_descriptor_heap_pool pool;
|
||||
struct dzn_descriptor_heap_pool pool;
|
||||
} rtvs, dsvs;
|
||||
|
||||
dzn_descriptor_heap_pool cbv_srv_uav_pool, sampler_pool;
|
||||
struct dzn_descriptor_heap_pool cbv_srv_uav_pool, sampler_pool;
|
||||
|
||||
struct list_head internal_bufs;
|
||||
|
||||
|
|
@ -554,8 +555,8 @@ struct dzn_descriptor_pool {
|
|||
|
||||
uint32_t set_count;
|
||||
uint32_t used_set_count;
|
||||
dzn_descriptor_set *sets;
|
||||
dzn_descriptor_heap heaps[NUM_POOL_TYPES];
|
||||
struct dzn_descriptor_set *sets;
|
||||
struct dzn_descriptor_heap heaps[NUM_POOL_TYPES];
|
||||
uint32_t desc_count[NUM_POOL_TYPES];
|
||||
uint32_t used_desc_count[NUM_POOL_TYPES];
|
||||
uint32_t free_offset[NUM_POOL_TYPES];
|
||||
|
|
@ -586,7 +587,7 @@ struct dzn_descriptor_set_layout {
|
|||
uint32_t static_sampler_count;
|
||||
const D3D12_STATIC_SAMPLER_DESC *static_samplers;
|
||||
uint32_t immutable_sampler_count;
|
||||
const dzn_sampler **immutable_samplers;
|
||||
const struct dzn_sampler **immutable_samplers;
|
||||
struct {
|
||||
uint32_t bindings[MAX_DYNAMIC_BUFFERS];
|
||||
uint32_t count;
|
||||
|
|
@ -600,7 +601,7 @@ struct dzn_descriptor_set_layout {
|
|||
struct dzn_descriptor_set {
|
||||
struct vk_object_base base;
|
||||
struct dzn_buffer_desc dynamic_buffers[MAX_DYNAMIC_BUFFERS];
|
||||
dzn_descriptor_pool *pool;
|
||||
struct dzn_descriptor_pool *pool;
|
||||
uint32_t heap_offsets[NUM_POOL_TYPES];
|
||||
uint32_t heap_sizes[NUM_POOL_TYPES];
|
||||
const struct dzn_descriptor_set_layout *layout;
|
||||
|
|
@ -617,7 +618,7 @@ struct dzn_pipeline_layout {
|
|||
uint32_t dynamic_buffer_count;
|
||||
uint32_t range_desc_count[NUM_POOL_TYPES];
|
||||
} sets[MAX_SETS];
|
||||
dxil_spirv_vulkan_descriptor_set binding_translation[MAX_SETS];
|
||||
struct dxil_spirv_vulkan_descriptor_set binding_translation[MAX_SETS];
|
||||
uint32_t set_count;
|
||||
uint32_t desc_count[NUM_POOL_TYPES];
|
||||
struct {
|
||||
|
|
@ -630,11 +631,11 @@ struct dzn_pipeline_layout {
|
|||
} root;
|
||||
};
|
||||
|
||||
dzn_pipeline_layout *
|
||||
dzn_pipeline_layout_ref(dzn_pipeline_layout *layout);
|
||||
struct dzn_pipeline_layout *
|
||||
dzn_pipeline_layout_ref(struct dzn_pipeline_layout *layout);
|
||||
|
||||
void
|
||||
dzn_pipeline_layout_unref(dzn_pipeline_layout *layout);
|
||||
dzn_pipeline_layout_unref(struct dzn_pipeline_layout *layout);
|
||||
|
||||
#define MAX_RTS 8
|
||||
#define MAX_INPUT_ATTACHMENTS 4
|
||||
|
|
@ -668,7 +669,7 @@ enum dzn_register_space {
|
|||
struct dzn_pipeline {
|
||||
struct vk_object_base base;
|
||||
VkPipelineBindPoint type;
|
||||
dzn_device *device;
|
||||
struct dzn_device *device;
|
||||
struct {
|
||||
uint32_t sets_param_count;
|
||||
uint32_t sysval_cbv_param_idx;
|
||||
|
|
@ -696,7 +697,7 @@ enum dzn_indirect_draw_cmd_sig_type {
|
|||
};
|
||||
|
||||
struct dzn_graphics_pipeline {
|
||||
dzn_pipeline base;
|
||||
struct dzn_pipeline base;
|
||||
struct {
|
||||
unsigned count;
|
||||
uint32_t strides[MAX_VBS];
|
||||
|
|
@ -744,11 +745,11 @@ struct dzn_graphics_pipeline {
|
|||
};
|
||||
|
||||
ID3D12CommandSignature *
|
||||
dzn_graphics_pipeline_get_indirect_cmd_sig(dzn_graphics_pipeline *pipeline,
|
||||
dzn_graphics_pipeline_get_indirect_cmd_sig(struct dzn_graphics_pipeline *pipeline,
|
||||
enum dzn_indirect_draw_cmd_sig_type cmd_sig_type);
|
||||
|
||||
struct dzn_compute_pipeline {
|
||||
dzn_pipeline base;
|
||||
struct dzn_pipeline base;
|
||||
struct {
|
||||
uint32_t x, y, z;
|
||||
} local_size;
|
||||
|
|
@ -757,7 +758,7 @@ struct dzn_compute_pipeline {
|
|||
};
|
||||
|
||||
ID3D12CommandSignature *
|
||||
dzn_compute_pipeline_get_indirect_cmd_sig(dzn_compute_pipeline *pipeline);
|
||||
dzn_compute_pipeline_get_indirect_cmd_sig(struct dzn_compute_pipeline *pipeline);
|
||||
|
||||
#define MAX_MIP_LEVELS 14
|
||||
|
||||
|
|
@ -770,7 +771,7 @@ struct dzn_image {
|
|||
} linear;
|
||||
D3D12_RESOURCE_DESC desc;
|
||||
ID3D12Resource *res;
|
||||
dzn_device_memory *mem;
|
||||
struct dzn_device_memory *mem;
|
||||
VkDeviceSize mem_offset;
|
||||
};
|
||||
|
||||
|
|
@ -786,12 +787,12 @@ DXGI_FORMAT
|
|||
dzn_image_get_placed_footprint_format(VkFormat fmt, VkImageAspectFlags aspect);
|
||||
|
||||
D3D12_DEPTH_STENCIL_VIEW_DESC
|
||||
dzn_image_get_dsv_desc(const dzn_image *image,
|
||||
dzn_image_get_dsv_desc(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *range,
|
||||
uint32_t level);
|
||||
|
||||
D3D12_RENDER_TARGET_VIEW_DESC
|
||||
dzn_image_get_rtv_desc(const dzn_image *image,
|
||||
dzn_image_get_rtv_desc(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *range,
|
||||
uint32_t level);
|
||||
|
||||
|
|
@ -799,18 +800,18 @@ D3D12_RESOURCE_STATES
|
|||
dzn_image_layout_to_state(VkImageLayout layout, VkImageAspectFlagBits aspect);
|
||||
|
||||
uint32_t
|
||||
dzn_image_layers_get_subresource_index(const dzn_image *image,
|
||||
dzn_image_layers_get_subresource_index(const struct dzn_image *image,
|
||||
const VkImageSubresourceLayers *subres,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t layer);
|
||||
uint32_t
|
||||
dzn_image_range_get_subresource_index(const dzn_image *image,
|
||||
dzn_image_range_get_subresource_index(const struct dzn_image *image,
|
||||
const VkImageSubresourceRange *range,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t level, uint32_t layer);
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_image_get_copy_loc(const dzn_image *image,
|
||||
dzn_image_get_copy_loc(const struct dzn_image *image,
|
||||
const VkImageSubresourceLayers *layers,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t layer);
|
||||
|
|
@ -824,12 +825,12 @@ struct dzn_image_view {
|
|||
};
|
||||
|
||||
void
|
||||
dzn_image_view_init(dzn_device *device,
|
||||
dzn_image_view *iview,
|
||||
dzn_image_view_init(struct dzn_device *device,
|
||||
struct dzn_image_view *iview,
|
||||
const VkImageViewCreateInfo *info);
|
||||
|
||||
void
|
||||
dzn_image_view_finish(dzn_image_view *iview);
|
||||
dzn_image_view_finish(struct dzn_image_view *iview);
|
||||
|
||||
struct dzn_buffer {
|
||||
struct vk_object_base base;
|
||||
|
|
@ -847,13 +848,13 @@ DXGI_FORMAT
|
|||
dzn_buffer_get_dxgi_format(VkFormat format);
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_buffer_get_copy_loc(const dzn_buffer *buf, VkFormat format,
|
||||
dzn_buffer_get_copy_loc(const struct dzn_buffer *buf, VkFormat format,
|
||||
const VkBufferImageCopy2KHR *info,
|
||||
VkImageAspectFlagBits aspect,
|
||||
uint32_t layer);
|
||||
|
||||
D3D12_TEXTURE_COPY_LOCATION
|
||||
dzn_buffer_get_line_copy_loc(const dzn_buffer *buf, VkFormat format,
|
||||
dzn_buffer_get_line_copy_loc(const struct dzn_buffer *buf, VkFormat format,
|
||||
const VkBufferImageCopy2KHR *region,
|
||||
const D3D12_TEXTURE_COPY_LOCATION *loc,
|
||||
uint32_t y, uint32_t z, uint32_t *start_x);
|
||||
|
|
@ -864,7 +865,7 @@ dzn_buffer_supports_region_copy(const D3D12_TEXTURE_COPY_LOCATION *loc);
|
|||
struct dzn_buffer_view {
|
||||
struct vk_object_base base;
|
||||
|
||||
const dzn_buffer *buffer;
|
||||
const struct dzn_buffer *buffer;
|
||||
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc;
|
||||
D3D12_UNORDERED_ACCESS_VIEW_DESC uav_desc;
|
||||
|
|
@ -983,16 +984,16 @@ struct dzn_query_pool {
|
|||
};
|
||||
|
||||
D3D12_QUERY_TYPE
|
||||
dzn_query_pool_get_query_type(const dzn_query_pool *qpool, VkQueryControlFlags flag);
|
||||
dzn_query_pool_get_query_type(const struct dzn_query_pool *qpool, VkQueryControlFlags flag);
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_result_offset(const dzn_query_pool *qpool, uint32_t query);
|
||||
dzn_query_pool_get_result_offset(const struct dzn_query_pool *qpool, uint32_t query);
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_availability_offset(const dzn_query_pool *qpool, uint32_t query);
|
||||
dzn_query_pool_get_availability_offset(const struct dzn_query_pool *qpool, uint32_t query);
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_result_size(const dzn_query_pool *qpool, uint32_t count);
|
||||
dzn_query_pool_get_result_size(const struct dzn_query_pool *qpool, uint32_t count);
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(dzn_cmd_buffer, vk.base, VkCommandBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER)
|
||||
VK_DEFINE_HANDLE_CASTS(dzn_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ dzn_query_pool_get_heap_type(VkQueryType in)
|
|||
}
|
||||
|
||||
D3D12_QUERY_TYPE
|
||||
dzn_query_pool_get_query_type(const dzn_query_pool *qpool,
|
||||
dzn_query_pool_get_query_type(const struct dzn_query_pool *qpool,
|
||||
VkQueryControlFlags flags)
|
||||
{
|
||||
switch (qpool->heap_type) {
|
||||
|
|
@ -53,13 +53,13 @@ dzn_query_pool_get_query_type(const dzn_query_pool *qpool,
|
|||
}
|
||||
|
||||
static void
|
||||
dzn_query_pool_destroy(dzn_query_pool *qpool,
|
||||
dzn_query_pool_destroy(struct dzn_query_pool *qpool,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
if (!qpool)
|
||||
return;
|
||||
|
||||
dzn_device *device = container_of(qpool->base.device, dzn_device, vk);
|
||||
struct dzn_device *device = container_of(qpool->base.device, struct dzn_device, vk);
|
||||
|
||||
if (qpool->collect_map)
|
||||
ID3D12Resource_Unmap(qpool->collect_buffer, 0, NULL);
|
||||
|
|
@ -84,14 +84,14 @@ dzn_query_pool_destroy(dzn_query_pool *qpool,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
dzn_query_pool_create(dzn_device *device,
|
||||
dzn_query_pool_create(struct dzn_device *device,
|
||||
const VkQueryPoolCreateInfo *info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
VkQueryPool *out)
|
||||
{
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_query_pool, qpool, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, dzn_query, queries, info->queryCount);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_query_pool, qpool, 1);
|
||||
VK_MULTIALLOC_DECL(&ma, struct dzn_query, queries, info->queryCount);
|
||||
|
||||
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, alloc,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT))
|
||||
|
|
@ -185,19 +185,19 @@ dzn_query_pool_create(dzn_device *device,
|
|||
}
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_result_offset(const dzn_query_pool *qpool, uint32_t query)
|
||||
dzn_query_pool_get_result_offset(const struct dzn_query_pool *qpool, uint32_t query)
|
||||
{
|
||||
return query * qpool->query_size;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_result_size(const dzn_query_pool *qpool, uint32_t query_count)
|
||||
dzn_query_pool_get_result_size(const struct dzn_query_pool *qpool, uint32_t query_count)
|
||||
{
|
||||
return query_count * qpool->query_size;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
dzn_query_pool_get_availability_offset(const dzn_query_pool *qpool, uint32_t query)
|
||||
dzn_query_pool_get_availability_offset(const struct dzn_query_pool *qpool, uint32_t query)
|
||||
{
|
||||
return (qpool->query_count * qpool->query_size) + (sizeof(uint64_t) * query);
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ dzn_ResetQueryPool(VkDevice device,
|
|||
|
||||
mtx_lock(&qpool->queries_lock);
|
||||
for (uint32_t q = 0; q < queryCount; q++) {
|
||||
dzn_query *query = &qpool->queries[firstQuery + q];
|
||||
struct dzn_query *query = &qpool->queries[firstQuery + q];
|
||||
|
||||
query->fence_value = 0;
|
||||
if (query->fence) {
|
||||
|
|
@ -263,7 +263,7 @@ dzn_GetQueryPoolResults(VkDevice device,
|
|||
VkResult result = VK_SUCCESS;
|
||||
|
||||
for (uint32_t q = 0; q < queryCount; q++) {
|
||||
dzn_query *query = &qpool->queries[q + firstQuery];
|
||||
struct dzn_query *query = &qpool->queries[q + firstQuery];
|
||||
|
||||
uint8_t *dst_ptr = (uint8_t *)pData + (stride * q);
|
||||
uint8_t *src_ptr =
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ dzn_sync_init(struct vk_device *device,
|
|||
struct vk_sync *sync,
|
||||
uint64_t initial_value)
|
||||
{
|
||||
dzn_sync *dsync = container_of(sync, dzn_sync, vk);
|
||||
dzn_device *ddev = container_of(device, dzn_device, vk);
|
||||
struct dzn_sync *dsync = container_of(sync, struct dzn_sync, vk);
|
||||
struct dzn_device *ddev = container_of(device, struct dzn_device, vk);
|
||||
|
||||
assert(!(sync->flags & VK_SYNC_IS_SHAREABLE));
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ static void
|
|||
dzn_sync_finish(struct vk_device *device,
|
||||
struct vk_sync *sync)
|
||||
{
|
||||
dzn_sync *dsync = container_of(sync, dzn_sync, vk);
|
||||
struct dzn_sync *dsync = container_of(sync, struct dzn_sync, vk);
|
||||
|
||||
ID3D12Fence_Release(dsync->fence);
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ dzn_sync_signal(struct vk_device *device,
|
|||
struct vk_sync *sync,
|
||||
uint64_t value)
|
||||
{
|
||||
dzn_sync *dsync = container_of(sync, dzn_sync, vk);
|
||||
struct dzn_sync *dsync = container_of(sync, struct dzn_sync, vk);
|
||||
|
||||
if (!(sync->flags & VK_SYNC_IS_TIMELINE))
|
||||
value = 1;
|
||||
|
|
@ -79,7 +79,7 @@ dzn_sync_get_value(struct vk_device *device,
|
|||
struct vk_sync *sync,
|
||||
uint64_t *value)
|
||||
{
|
||||
dzn_sync *dsync = container_of(sync, dzn_sync, vk);
|
||||
struct dzn_sync *dsync = container_of(sync, struct dzn_sync, vk);
|
||||
|
||||
*value = ID3D12Fence_GetCompletedValue(dsync->fence);
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -89,7 +89,7 @@ static VkResult
|
|||
dzn_sync_reset(struct vk_device *device,
|
||||
struct vk_sync *sync)
|
||||
{
|
||||
dzn_sync *dsync = container_of(sync, dzn_sync, vk);
|
||||
struct dzn_sync *dsync = container_of(sync, struct dzn_sync, vk);
|
||||
|
||||
if (FAILED(ID3D12Fence_Signal(dsync->fence, 0)))
|
||||
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
|
|
@ -102,9 +102,9 @@ dzn_sync_move(struct vk_device *device,
|
|||
struct vk_sync *dst,
|
||||
struct vk_sync *src)
|
||||
{
|
||||
dzn_device *ddev = container_of(device, dzn_device, vk);
|
||||
dzn_sync *ddst = container_of(dst, dzn_sync, vk);
|
||||
dzn_sync *dsrc = container_of(src, dzn_sync, vk);
|
||||
struct dzn_device *ddev = container_of(device, struct dzn_device, vk);
|
||||
struct dzn_sync *ddst = container_of(dst, struct dzn_sync, vk);
|
||||
struct dzn_sync *dsrc = container_of(src, struct dzn_sync, vk);
|
||||
ID3D12Fence *new_fence;
|
||||
|
||||
if (FAILED(ID3D12Device1_CreateFence(ddev->dev, 0,
|
||||
|
|
@ -126,7 +126,7 @@ dzn_sync_wait(struct vk_device *device,
|
|||
enum vk_sync_wait_flags wait_flags,
|
||||
uint64_t abs_timeout_ns)
|
||||
{
|
||||
dzn_device *ddev = container_of(device, dzn_device, vk);
|
||||
struct dzn_device *ddev = container_of(device, struct dzn_device, vk);
|
||||
|
||||
HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
if (event == NULL)
|
||||
|
|
@ -136,7 +136,7 @@ dzn_sync_wait(struct vk_device *device,
|
|||
STACK_ARRAY(uint64_t, values, wait_count);
|
||||
|
||||
for (uint32_t i = 0; i < wait_count; i++) {
|
||||
dzn_sync *sync = container_of(waits[i].sync, dzn_sync, vk);
|
||||
struct dzn_sync *sync = container_of(waits[i].sync, struct dzn_sync, vk);
|
||||
|
||||
fences[i] = sync->fence;
|
||||
values[i] = (sync->vk.flags & VK_SYNC_IS_TIMELINE) ? waits[i].wait_value : 1;
|
||||
|
|
@ -188,7 +188,7 @@ dzn_sync_wait(struct vk_device *device,
|
|||
}
|
||||
|
||||
const struct vk_sync_type dzn_sync_type = {
|
||||
.size = sizeof(dzn_sync),
|
||||
.size = sizeof(struct dzn_sync),
|
||||
.features = (enum vk_sync_features)
|
||||
(VK_SYNC_FEATURE_BINARY |
|
||||
VK_SYNC_FEATURE_TIMELINE |
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue