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{};
|
VkImageCreateInfo imageInfo{};
|
||||||
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||||
@@ -506,6 +510,14 @@ bool KRDevice::createImage(Vector2i dimensions, VkImageCreateFlags imageCreateFl
|
|||||||
if (res != VK_SUCCESS) {
|
if (res != VK_SUCCESS) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,11 @@ public:
|
|||||||
#endif
|
#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 selectSurfaceFormat(VkSurfaceKHR& surface, VkSurfaceFormatKHR& surfaceFormat);
|
||||||
KrResult selectDepthFormat(VkFormat& selectedDepthFormat);
|
KrResult selectDepthFormat(VkFormat& selectedDepthFormat);
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ void KRTexture::resize(int max_dim)
|
|||||||
getContext().getTextureManager()->memoryChanged(m_newTextureMemUsed);
|
getContext().getTextureManager()->memoryChanged(m_newTextureMemUsed);
|
||||||
getContext().getTextureManager()->addMemoryTransferredThisFrame(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);
|
getContext().getTextureManager()->memoryChanged(-m_newTextureMemUsed);
|
||||||
m_newTextureMemUsed = 0;
|
m_newTextureMemUsed = 0;
|
||||||
assert(false); // Failed to create the texture
|
assert(false); // Failed to create the texture
|
||||||
@@ -131,7 +133,7 @@ void KRTexture::resize(int max_dim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLuint KRTexture::getHandle() {
|
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?
|
resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_NONE); // TODO - Pass through getHandle() arguements to replace extraneous resetPoolExpiry calls?
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,11 @@ bool KRTexture2D::createGPUTexture(int lod_max_dim) {
|
|||||||
texture.allocation = VK_NULL_HANDLE;
|
texture.allocation = VK_NULL_HANDLE;
|
||||||
texture.image = 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;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ bool KRTextureCube::createGPUTexture(int lod_max_dim)
|
|||||||
texture.allocation = VK_NULL_HANDLE;
|
texture.allocation = VK_NULL_HANDLE;
|
||||||
texture.image = 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;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user