Overload for getMemoryType (return type index)
This commit is contained in:
parent
59fbf41e31
commit
a9f280016f
2 changed files with 19 additions and 0 deletions
|
|
@ -1293,6 +1293,24 @@ VkBool32 VulkanExampleBase::getMemoryType(uint32_t typeBits, VkFlags properties,
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t VulkanExampleBase::getMemoryType(uint32_t typeBits, VkFlags properties)
|
||||
{
|
||||
for (uint32_t i = 0; i < 32; i++)
|
||||
{
|
||||
if ((typeBits & 1) == 1)
|
||||
{
|
||||
if ((deviceMemoryProperties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
typeBits >>= 1;
|
||||
}
|
||||
|
||||
// todo : throw error
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VulkanExampleBase::createCommandPool()
|
||||
{
|
||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ public:
|
|||
|
||||
// Get memory type for a given memory allocation (flags and bits)
|
||||
VkBool32 getMemoryType(uint32_t typeBits, VkFlags properties, uint32_t *typeIndex);
|
||||
uint32_t getMemoryType(uint32_t typeBits, VkFlags properties);
|
||||
|
||||
// Creates a new (graphics) command pool object storing command buffers
|
||||
void createCommandPool();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue