mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
libs/vkd3d-common: Move vkd3d_array_reserve() from libvkd3d.
This commit is contained in:
@@ -65,34 +65,6 @@ VkFormat vkd3d_get_vk_format(DXGI_FORMAT format)
|
||||
return vkd3d_format->vk_format;
|
||||
}
|
||||
|
||||
bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size)
|
||||
{
|
||||
size_t new_capacity, max_capacity;
|
||||
void *new_elements;
|
||||
|
||||
if (element_count <= *capacity)
|
||||
return true;
|
||||
|
||||
max_capacity = ~(size_t)0 / element_size;
|
||||
if (max_capacity < element_count)
|
||||
return false;
|
||||
|
||||
new_capacity = max(*capacity, 4);
|
||||
while (new_capacity < element_count && new_capacity <= max_capacity / 2)
|
||||
new_capacity *= 2;
|
||||
|
||||
if (new_capacity < element_count)
|
||||
new_capacity = element_count;
|
||||
|
||||
if (!(new_elements = vkd3d_realloc(*elements, new_capacity * element_size)))
|
||||
return false;
|
||||
|
||||
*elements = new_elements;
|
||||
*capacity = new_capacity;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
|
||||
{
|
||||
static const D3D_FEATURE_LEVEL valid_feature_levels[] =
|
||||
|
||||
@@ -422,9 +422,6 @@ const char *debug_vk_memory_heap_flags(VkMemoryHeapFlags flags) DECLSPEC_HIDDEN;
|
||||
const char *debug_vk_memory_property_flags(VkMemoryPropertyFlags flags) DECLSPEC_HIDDEN;
|
||||
const char *debug_vk_queue_flags(VkQueueFlags flags) DECLSPEC_HIDDEN;
|
||||
|
||||
bool vkd3d_array_reserve(void **elements, size_t *capacity,
|
||||
size_t element_count, size_t element_size) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT hresult_from_vk_result(VkResult vr) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT vkd3d_load_vk_instance_procs(struct vkd3d_vk_instance_procs *procs,
|
||||
|
||||
Reference in New Issue
Block a user