}
}
- nvk_descriptor_set_layout_unref(device, set->layout);
+ vk_descriptor_set_layout_unref(&device->vk, &set->layout->vk);
vk_object_free(&device->vk, NULL, set);
}
NVK_MIN_UBO_ALIGNMENT);
pool->entry_count++;
- set->layout = nvk_descriptor_set_layout_ref(layout);
+ vk_descriptor_set_layout_ref(&layout->vk);
+ set->layout = layout;
for (uint32_t b = 0; b < layout->binding_count; b++) {
if (layout->binding[b].type != VK_DESCRIPTOR_TYPE_SAMPLER &&
VK_MULTIALLOC_DECL(&ma, struct nvk_sampler *, samplers,
immutable_sampler_count);
- if (!vk_multialloc_zalloc(&ma, &device->vk.alloc,
- VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
+ if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma))
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
- vk_object_base_init(&device->vk, &layout->base,
- VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
-
- p_atomic_set(&layout->ref_cnt, 1);
layout->binding_count = num_bindings;
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
return VK_SUCCESS;
}
-
-void
-nvk_descriptor_set_layout_destroy(
- struct nvk_device *device, struct nvk_descriptor_set_layout *layout)
-{
- assert(layout->ref_cnt == 0);
- vk_object_free(&device->vk, NULL, layout);
-}
-
-VKAPI_ATTR void VKAPI_CALL
-nvk_DestroyDescriptorSetLayout(VkDevice _device,
- VkDescriptorSetLayout descriptorSetLayout,
- const VkAllocationCallbacks *pAllocator)
-{
- VK_FROM_HANDLE(nvk_device, device, _device);
- VK_FROM_HANDLE(nvk_descriptor_set_layout, layout, descriptorSetLayout);
-
- if (!layout)
- return;
-
- nvk_descriptor_set_layout_unref(device, layout);
-}
#include "nvk_private.h"
+#include "vulkan/runtime/vk_descriptor_set_layout.h"
#include "vulkan/runtime/vk_object.h"
struct nvk_device;
};
struct nvk_descriptor_set_layout {
- struct vk_object_base base;
-
- uint32_t ref_cnt;
+ struct vk_descriptor_set_layout vk;
unsigned char sha1[20];
struct nvk_descriptor_set_binding_layout binding[0];
};
-VK_DEFINE_HANDLE_CASTS(nvk_descriptor_set_layout, base, VkDescriptorSetLayout,
+VK_DEFINE_HANDLE_CASTS(nvk_descriptor_set_layout, vk.base,
+ VkDescriptorSetLayout,
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
void nvk_descriptor_stride_align_for_type(VkDescriptorType type,
const VkMutableDescriptorTypeListVALVE *type_list,
uint32_t *stride, uint32_t *align);
-void nvk_descriptor_set_layout_destroy(struct nvk_device *device,
- struct nvk_descriptor_set_layout *layout);
-
-static inline struct nvk_descriptor_set_layout *
-nvk_descriptor_set_layout_ref(struct nvk_descriptor_set_layout *layout)
-{
- assert(layout && layout->ref_cnt >= 1);
- p_atomic_inc(&layout->ref_cnt);
- return layout;
-}
-
-static inline void
-nvk_descriptor_set_layout_unref(struct nvk_device *device,
- struct nvk_descriptor_set_layout *layout)
-{
- assert(layout && layout->ref_cnt >= 1);
- if (p_atomic_dec_zero(&layout->ref_cnt))
- nvk_descriptor_set_layout_destroy(device, layout);
-}
-
#endif
for (uint32_t s = 0; s < pCreateInfo->setLayoutCount; s++) {
VK_FROM_HANDLE(nvk_descriptor_set_layout, set_layout,
pCreateInfo->pSetLayouts[s]);
- layout->set[s].layout = nvk_descriptor_set_layout_ref(set_layout);
+ vk_descriptor_set_layout_ref(&set_layout->vk);
+ layout->set[s].layout = set_layout;
layout->set[s].dynamic_buffer_start = dynamic_buffer_count;
dynamic_buffer_count += set_layout->dynamic_buffer_count;
}
return;
for (uint32_t s = 0; s < layout->num_sets; s++)
- nvk_descriptor_set_layout_unref(device, layout->set[s].layout);
+ vk_descriptor_set_layout_unref(&device->vk, &layout->set[s].layout->vk);
vk_object_free(&device->vk, pAllocator, layout);
}