diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h index 827f12b3..158c20b2 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h +++ b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h @@ -208,8 +208,8 @@ namespace SHADE /*-----------------------------------------------------------------------*/ #ifdef _DEBUG /// - /// Sets a Vulkan object's name for debugging purposes. This function will not be - /// compiled outsied of Debug configurations. Hence, it is advised to use provided + /// Sets a Vulkan HPP object's name for debugging purposes. This function will not be + /// compiled outside of Debug configurations. Hence, it is advised to use provided /// macro function SET_VK_OBJ_NAME() instead of using this function directly. /// /// Type of the object. @@ -217,6 +217,16 @@ namespace SHADE /// Object's name. template inline void SetVulkanObjectName(vk::ObjectType objType, T objHandle, const std::string& objName); + /// + /// Sets a Vulkan object's name for debugging purposes. This function will not be + /// compiled outside of Debug configurations. Hence, it is advised to use provided + /// macro function SET_VK_OBJ_NAME_VK() instead of using this function directly. + /// + /// Type of the object. + /// Handle to the Vulkan Object to name. + /// Object's name. + template + inline void SetVulkanObjectNameVk(vk::ObjectType objType, T objVkHandle, const std::string& objName); #endif /*-----------------------------------------------------------------------*/ diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.hpp b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.hpp index d72ab09e..e8de27fb 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.hpp +++ b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.hpp @@ -32,6 +32,18 @@ namespace SHADE info.pObjectName = objName.data(); vkLogicalDevice.setDebugUtilsObjectNameEXT(info); } + template + void SHVkLogicalDevice::SetVulkanObjectNameVk(vk::ObjectType objType, T objVkHandle, const std::string& objName) + { + if (objName.empty()) + return; + + vk::DebugUtilsObjectNameInfoEXT info; + info.objectType = objType; + info.objectHandle = (uint64_t) objVkHandle; + info.pObjectName = objName.data(); + vkLogicalDevice.setDebugUtilsObjectNameEXT(info); + } #endif } @@ -41,6 +53,9 @@ namespace SHADE #ifdef _DEBUG #define SET_VK_OBJ_NAME(DEVICE, OBJ_TYPE, OBJ_HDL, OBJ_NAME) \ DEVICE->SetVulkanObjectName(OBJ_TYPE, OBJ_HDL, OBJ_NAME); +#define SET_VK_OBJ_NAME_VK(DEVICE, OBJ_TYPE, OBJ_HDL, OBJ_NAME) \ + DEVICE->SetVulkanObjectNameVk(OBJ_TYPE, OBJ_HDL, OBJ_NAME); #else #define SET_VK_OBJ_NAME(DEVICE, OBJ_TYPE, OBJ_HDL, OBJ_NAME) +#define SET_VK_OBJ_NAME_VK(DEVICE, OBJ_TYPE, OBJ_HDL, OBJ_NAME) #endif diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMeshLibrary.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMeshLibrary.cpp index 3474fea3..d34c1b7d 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMeshLibrary.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMeshLibrary.cpp @@ -165,35 +165,40 @@ namespace SHADE device, cmdBuffer, vertPosBuffer, vertPosStorage.data(), static_cast(vertPosStorage.size()) * sizeof(SHMesh::VertexPosition), - BuffUsage::eVertexBuffer + BuffUsage::eVertexBuffer, + "Mesh Library Vertex Positions" ); SHVkUtil::EnsureBufferAndCopyData ( device, cmdBuffer, vertTexCoordBuffer, vertTexCoordStorage.data(), static_cast(vertTexCoordStorage.size()) * sizeof(SHMesh::VertexTexCoord), - BuffUsage::eVertexBuffer + BuffUsage::eVertexBuffer, + "Mesh Library Vertex TexCoords" ); SHVkUtil::EnsureBufferAndCopyData ( device, cmdBuffer, vertTangentBuffer, vertTangentStorage.data(), static_cast(vertTangentStorage.size()) * sizeof(SHMesh::VertexTangent), - BuffUsage::eVertexBuffer + BuffUsage::eVertexBuffer, + "Mesh Library Vertex Tangents" ); SHVkUtil::EnsureBufferAndCopyData ( device, cmdBuffer, vertNormalBuffer, vertNormalStorage.data(), static_cast(vertNormalStorage.size()) * sizeof(SHMesh::VertexNormal), - BuffUsage::eVertexBuffer + BuffUsage::eVertexBuffer, + "Mesh Library Vertex Normals" ); SHVkUtil::EnsureBufferAndCopyData ( device, cmdBuffer, indexBuffer, indexStorage.data(), static_cast(indexStorage.size()) * sizeof(SHMesh::Index), - BuffUsage::eIndexBuffer + BuffUsage::eIndexBuffer, + "Mesh Library Indices" ); isDirty = false; diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp index 3b6448fa..9c330b9f 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp @@ -23,6 +23,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h" #include "Graphics/Descriptors/SHVkDescriptorSetGroup.h" #include "Graphics/Images/SHVkImage.h" +#include "Graphics/Images/SHVkImageView.h" #include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h" #include "Assets/Asset Types/SHTextureAsset.h" @@ -150,6 +151,9 @@ namespace SHADE texOrder.emplace_back(job.TextureHandle); combinedImageSamplers.emplace_back(std::make_tuple(job.TextureHandle->ImageView, job.Sampler, vk::ImageLayout::eShaderReadOnlyOptimal)); job.TextureHandle->TextureArrayIndex = static_cast(texOrder.size()) - 1U; + + SET_VK_OBJ_NAME(device, vk::ObjectType::eImage, job.Image->GetVkImage(), "[Image] Texture Library Texture #" + std::to_string(job.TextureHandle->TextureArrayIndex)); + SET_VK_OBJ_NAME(device, vk::ObjectType::eImageView, job.TextureHandle->ImageView->GetImageView(), "[ImageView] Texture Library Texture #" + std::to_string(job.TextureHandle->TextureArrayIndex)); } addJobs.clear();