Added GPU debug labels for textures.
Fixed bug causing Vulkan images to be constantly re-created.
This commit is contained in:
@@ -475,7 +475,11 @@ void KRDevice::getQueueFamiliesForSharing(uint32_t* queueFamilyIndices, uint32_t
|
||||
}
|
||||
}
|
||||
|
||||
bool KRDevice::createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFlags, VkMemoryPropertyFlags properties, VkImage* image, VmaAllocation* allocation)
|
||||
bool KRDevice::createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFlags, VkMemoryPropertyFlags properties, VkImage* image, VmaAllocation* allocation
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
, const char* debug_label
|
||||
#endif
|
||||
)
|
||||
{
|
||||
VkImageCreateInfo imageInfo{};
|
||||
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
@@ -506,6 +510,14 @@ bool KRDevice::createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFl
|
||||
if (res != VK_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
VkDebugUtilsObjectNameInfoEXT debugInfo{};
|
||||
debugInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||
debugInfo.objectHandle = (uint64_t)*image;
|
||||
debugInfo.objectType = VK_OBJECT_TYPE_IMAGE;
|
||||
debugInfo.pObjectName = debug_label;
|
||||
res = vkSetDebugUtilsObjectNameEXT(m_logicalDevice, &debugInfo);
|
||||
#endif // KRENGINE_DEBUG_GPU_LABELS
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,11 @@ public:
|
||||
#endif
|
||||
);
|
||||
|
||||
bool createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFlags, VkMemoryPropertyFlags properties, VkImage* image, VmaAllocation* allocation);
|
||||
bool createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFlags, VkMemoryPropertyFlags properties, VkImage* image, VmaAllocation* allocation
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
, const char* debug_label
|
||||
#endif
|
||||
);
|
||||
|
||||
KrResult selectSurfaceFormat(VkSurfaceKHR& surface, VkSurfaceFormatKHR& surfaceFormat);
|
||||
KrResult selectDepthFormat(VkFormat& selectedDepthFormat);
|
||||
|
||||
@@ -118,7 +118,9 @@ void KRTexture::resize(int max_dim)
|
||||
getContext().getTextureManager()->memoryChanged(m_newTextureMemUsed);
|
||||
getContext().getTextureManager()->addMemoryTransferredThisFrame(m_newTextureMemUsed);
|
||||
|
||||
if(!createGPUTexture(target_dim)) {
|
||||
if (createGPUTexture(target_dim)) {
|
||||
m_new_lod_max_dim = target_dim;
|
||||
} else {
|
||||
getContext().getTextureManager()->memoryChanged(-m_newTextureMemUsed);
|
||||
m_newTextureMemUsed = 0;
|
||||
assert(false); // Failed to create the texture
|
||||
@@ -131,7 +133,7 @@ void KRTexture::resize(int max_dim)
|
||||
}
|
||||
|
||||
GLuint KRTexture::getHandle() {
|
||||
assert(false); // TODO - Vulkan refactoring required
|
||||
// assert(false); // TODO - Vulkan refactoring required
|
||||
resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_NONE); // TODO - Pass through getHandle() arguements to replace extraneous resetPoolExpiry calls?
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,11 @@ bool KRTexture2D::createGPUTexture(int lod_max_dim) {
|
||||
texture.allocation = VK_NULL_HANDLE;
|
||||
texture.image = VK_NULL_HANDLE;
|
||||
|
||||
if (!device.createImage(getDimensions(), 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &texture.image, &texture.allocation)) {
|
||||
if (!device.createImage(getDimensions(), 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &texture.image, &texture.allocation
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
, getName().c_str()
|
||||
#endif
|
||||
)) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,11 @@ bool KRTextureCube::createGPUTexture(int lod_max_dim)
|
||||
texture.allocation = VK_NULL_HANDLE;
|
||||
texture.image = VK_NULL_HANDLE;
|
||||
|
||||
if (!device.createImage(dimensions, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &texture.image, &texture.allocation)) {
|
||||
if (!device.createImage(dimensions, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &texture.image, &texture.allocation
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
, getName().c_str()
|
||||
#endif
|
||||
)) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user