Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/backend/vulkan/Texture.cpp
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | std::unique_ptr<CTexture> CTexture::Create( | ||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; | imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; | ||||
if (type == Type::TEXTURE_CUBE) | if (type == Type::TEXTURE_CUBE) | ||||
imageCreateInfo.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; | imageCreateInfo.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; | ||||
VmaAllocationCreateInfo allocationCreateInfo{}; | VmaAllocationCreateInfo allocationCreateInfo{}; | ||||
if ((usage & Usage::COLOR_ATTACHMENT) || (usage & Usage::DEPTH_STENCIL_ATTACHMENT)) | if ((usage & Usage::COLOR_ATTACHMENT) || (usage & Usage::DEPTH_STENCIL_ATTACHMENT)) | ||||
allocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; | allocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; | ||||
if (GLAD_VK_EXT_memory_budget) | |||||
allocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT; | |||||
#ifndef NDEBUG | #ifndef NDEBUG | ||||
allocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT; | allocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT; | ||||
allocationCreateInfo.pUserData = const_cast<char*>(name); | allocationCreateInfo.pUserData = const_cast<char*>(name); | ||||
#endif | #endif | ||||
allocationCreateInfo.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | allocationCreateInfo.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | ||||
allocationCreateInfo.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; | allocationCreateInfo.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; | ||||
const VkResult createImageResult = vmaCreateImage( | const VkResult createImageResult = vmaCreateImage( | ||||
device->GetVMAAllocator(), &imageCreateInfo, &allocationCreateInfo, | device->GetVMAAllocator(), &imageCreateInfo, &allocationCreateInfo, | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator