aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/vulkan/malloc.c
diff options
context:
space:
mode:
authorGravatar Niklas Haas <git@haasn.xyz>2017-09-27 00:24:03 +0200
committerGravatar Niklas Haas <git@haasn.xyz>2017-09-27 00:25:18 +0200
commit5b6b77b8dceac346b4d279b8e5c0d8eebec2f0e8 (patch)
treef32ae2c32ca51b2868a78ead1ffe60a0a1c2c09f /video/out/vulkan/malloc.c
parent0ba6c7d73f2886b23ca2c5e7d09296140bf84f35 (diff)
vo_gpu: vulkan: normalize use of *Flags and *FlagBits
FlagBits is just the name of the enum. The actual data type representing a combination of these flags follows the *Flags convention. (The relevant difference is that the latter is defined to be uint32_t instead of left implicit) For consistency, use *Flags everywhere instead of randomly switching between *Flags and *FlagBits. Also fix a wrong type name on `stageFlags`, pointed out by @atomnuker
Diffstat (limited to 'video/out/vulkan/malloc.c')
-rw-r--r--video/out/vulkan/malloc.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/video/out/vulkan/malloc.c b/video/out/vulkan/malloc.c
index 31fcd36ddb..f6cb1143bb 100644
--- a/video/out/vulkan/malloc.c
+++ b/video/out/vulkan/malloc.c
@@ -54,10 +54,10 @@ struct vk_slab {
// actually be that many in practice, because some combinations simply never
// occur, and others will generally be the same for the same objects.
struct vk_heap {
- VkBufferUsageFlagBits usage; // the buffer usage type (or 0)
- VkMemoryPropertyFlagBits flags; // the memory type flags (or 0)
- uint32_t typeBits; // the memory type index requirements (or 0)
- struct vk_slab **slabs; // array of slabs sorted by size
+ VkBufferUsageFlags usage; // the buffer usage type (or 0)
+ VkMemoryPropertyFlags flags; // the memory type flags (or 0)
+ uint32_t typeBits; // the memory type index requirements (or 0)
+ struct vk_slab **slabs; // array of slabs sorted by size
int num_slabs;
};
@@ -89,7 +89,7 @@ static void slab_free(struct mpvk_ctx *vk, struct vk_slab *slab)
}
static bool find_best_memtype(struct mpvk_ctx *vk, uint32_t typeBits,
- VkMemoryPropertyFlagBits flags,
+ VkMemoryPropertyFlags flags,
VkMemoryType *out_type, int *out_index)
{
struct vk_malloc *ma = vk->alloc;
@@ -109,7 +109,7 @@ static bool find_best_memtype(struct mpvk_ctx *vk, uint32_t typeBits,
}
MP_ERR(vk, "Found no memory type matching property flags 0x%x and type "
- "bits 0x%x!\n", flags, (unsigned)typeBits);
+ "bits 0x%x!\n", (unsigned)flags, (unsigned)typeBits);
return false;
}
@@ -154,7 +154,7 @@ static struct vk_slab *slab_alloc(struct mpvk_ctx *vk, struct vk_heap *heap,
goto error;
MP_VERBOSE(vk, "Allocating %zu memory of type 0x%x (id %d) in heap %d.\n",
- slab->size, type.propertyFlags, index, (int)type.heapIndex);
+ slab->size, (unsigned)type.propertyFlags, index, (int)type.heapIndex);
minfo.memoryTypeIndex = index;
VK(vkAllocateMemory(vk->dev, &minfo, MPVK_ALLOCATOR, &slab->mem));
@@ -279,9 +279,8 @@ void vk_free_memslice(struct mpvk_ctx *vk, struct vk_memslice slice)
}
// reqs: can be NULL
-static struct vk_heap *find_heap(struct mpvk_ctx *vk,
- VkBufferUsageFlagBits usage,
- VkMemoryPropertyFlagBits flags,
+static struct vk_heap *find_heap(struct mpvk_ctx *vk, VkBufferUsageFlags usage,
+ VkMemoryPropertyFlags flags,
VkMemoryRequirements *reqs)
{
struct vk_malloc *ma = vk->alloc;
@@ -401,14 +400,14 @@ static bool slice_heap(struct mpvk_ctx *vk, struct vk_heap *heap, size_t size,
}
bool vk_malloc_generic(struct mpvk_ctx *vk, VkMemoryRequirements reqs,
- VkMemoryPropertyFlagBits flags, struct vk_memslice *out)
+ VkMemoryPropertyFlags flags, struct vk_memslice *out)
{
struct vk_heap *heap = find_heap(vk, 0, flags, &reqs);
return slice_heap(vk, heap, reqs.size, reqs.alignment, out);
}
-bool vk_malloc_buffer(struct mpvk_ctx *vk, VkBufferUsageFlagBits bufFlags,
- VkMemoryPropertyFlagBits memFlags, VkDeviceSize size,
+bool vk_malloc_buffer(struct mpvk_ctx *vk, VkBufferUsageFlags bufFlags,
+ VkMemoryPropertyFlags memFlags, VkDeviceSize size,
VkDeviceSize alignment, struct vk_bufslice *out)
{
struct vk_heap *heap = find_heap(vk, bufFlags, memFlags, NULL);