28
28
#include " Common.h"
29
29
#include < atomic>
30
30
#include < Shlwapi.h>
31
+ #include < unordered_set>
31
32
32
33
#pragma comment(lib, "shlwapi.lib")
33
34
@@ -86,7 +87,7 @@ static std::vector<VkImageView> g_SwapchainImageViews;
86
87
static std::vector<VkFramebuffer> g_Framebuffers;
87
88
static VkCommandPool g_hCommandPool;
88
89
static VkCommandBuffer g_MainCommandBuffers[COMMAND_BUFFER_COUNT];
89
- static VkFence g_MainCommandBufferExecutedFances [COMMAND_BUFFER_COUNT];
90
+ static VkFence g_MainCommandBufferExecutedFences [COMMAND_BUFFER_COUNT];
90
91
VkFence g_ImmediateFence;
91
92
static uint32_t g_NextCommandBufferIndex;
92
93
// Notice we need as many semaphores as there are swapchain images
@@ -261,16 +262,16 @@ struct CommandLineParameters
261
262
}
262
263
} g_CommandLineParameters;
263
264
264
- void SetDebugUtilsObjectName (VkObjectType type, uint64_t handle, const char * name)
265
+ void SetDebugUtilsObjectName (VkObjectType type, uint64_t handle, const std::string & name)
265
266
{
266
- if (vkSetDebugUtilsObjectNameEXT_Func == nullptr )
267
+ if (vkSetDebugUtilsObjectNameEXT_Func == nullptr )
267
268
return ;
268
269
269
270
VkDebugUtilsObjectNameInfoEXT info = { VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT };
270
271
info.objectType = type;
271
272
info.objectHandle = handle;
272
- info.pObjectName = name;
273
- vkSetDebugUtilsObjectNameEXT_Func (g_hDevice, &info);
273
+ info.pObjectName = name. c_str () ;
274
+ ERR_GUARD_VULKAN ( vkSetDebugUtilsObjectNameEXT_Func (g_hDevice, &info) );
274
275
}
275
276
276
277
void BeginSingleTimeCommands ()
@@ -284,6 +285,8 @@ void EndSingleTimeCommands()
284
285
{
285
286
ERR_GUARD_VULKAN ( vkEndCommandBuffer (g_hTemporaryCommandBuffer) );
286
287
288
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast <std::uint64_t >(g_hTemporaryCommandBuffer), " g_hTemporaryCommandBuffer" );
289
+
287
290
VkSubmitInfo submitInfo = { VK_STRUCTURE_TYPE_SUBMIT_INFO };
288
291
submitInfo.commandBufferCount = 1 ;
289
292
submitInfo.pCommandBuffers = &g_hTemporaryCommandBuffer;
@@ -700,6 +703,7 @@ static void CreateMesh()
700
703
vbInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
701
704
vbAllocCreateInfo.flags = 0 ;
702
705
ERR_GUARD_VULKAN ( vmaCreateBuffer (g_hAllocator, &vbInfo, &vbAllocCreateInfo, &g_hVertexBuffer, &g_hVertexBufferAlloc, nullptr ) );
706
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_BUFFER, reinterpret_cast <std::uint64_t >(g_hVertexBuffer), " g_hVertexBuffer" );
703
707
704
708
// Create index buffer
705
709
@@ -724,6 +728,7 @@ static void CreateMesh()
724
728
ibInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
725
729
ibAllocCreateInfo.flags = 0 ;
726
730
ERR_GUARD_VULKAN ( vmaCreateBuffer (g_hAllocator, &ibInfo, &ibAllocCreateInfo, &g_hIndexBuffer, &g_hIndexBufferAlloc, nullptr ) );
731
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_BUFFER, reinterpret_cast <std::uint64_t >(g_hIndexBuffer), " g_hIndexBuffer" );
727
732
728
733
// Copy buffers
729
734
@@ -805,7 +810,11 @@ static void CreateTexture(uint32_t sizeX, uint32_t sizeY)
805
810
VmaAllocationCreateInfo imageAllocCreateInfo = {};
806
811
imageAllocCreateInfo.usage = VMA_MEMORY_USAGE_AUTO;
807
812
808
- ERR_GUARD_VULKAN ( vmaCreateImage (g_hAllocator, &imageInfo, &imageAllocCreateInfo, &g_hTextureImage, &g_hTextureImageAlloc, nullptr ) );
813
+ VmaAllocationInfo textureImageAllocInfo = {};
814
+
815
+ ERR_GUARD_VULKAN ( vmaCreateImage (g_hAllocator, &imageInfo, &imageAllocCreateInfo, &g_hTextureImage, &g_hTextureImageAlloc, &textureImageAllocInfo) );
816
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE, reinterpret_cast <std::uint64_t >(g_hTextureImage), " g_hTextureImage" );
817
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DEVICE_MEMORY, reinterpret_cast <std::uint64_t >(textureImageAllocInfo.deviceMemory ), " textureImageAllocInfo.deviceMemory" );
809
818
810
819
// Transition image layouts, copy image.
811
820
@@ -874,6 +883,7 @@ static void CreateTexture(uint32_t sizeX, uint32_t sizeY)
874
883
textureImageViewInfo.subresourceRange .baseArrayLayer = 0 ;
875
884
textureImageViewInfo.subresourceRange .layerCount = 1 ;
876
885
ERR_GUARD_VULKAN ( vkCreateImageView (g_hDevice, &textureImageViewInfo, g_Allocs, &g_hTextureImageView) );
886
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE_VIEW, reinterpret_cast <std::uint64_t >(g_hTextureImageView), " g_hTextureImageView" );
877
887
}
878
888
879
889
struct UniformBufferObject
@@ -979,13 +989,20 @@ static void CreateSwapchain()
979
989
vkDestroySwapchainKHR (g_hDevice, g_hSwapchain, g_Allocs);
980
990
g_hSwapchain = hNewSwapchain;
981
991
992
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SWAPCHAIN_KHR, reinterpret_cast <std::uint64_t >(g_hSwapchain), " g_hSwapchain" );
993
+
982
994
// Retrieve swapchain images.
983
995
984
996
uint32_t swapchainImageCount = 0 ;
985
997
ERR_GUARD_VULKAN ( vkGetSwapchainImagesKHR (g_hDevice, g_hSwapchain, &swapchainImageCount, nullptr ) );
986
998
g_SwapchainImages.resize (swapchainImageCount);
987
999
ERR_GUARD_VULKAN ( vkGetSwapchainImagesKHR (g_hDevice, g_hSwapchain, &swapchainImageCount, g_SwapchainImages.data ()) );
988
1000
1001
+ for (size_t i = 0 ; i < swapchainImageCount; i++) {
1002
+ std::string swapchainImgName = " g_SwapchainImages[" + std::to_string (i) + " ]" ;
1003
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE, reinterpret_cast <std::uint64_t >(g_SwapchainImages[i]), swapchainImgName);
1004
+ }
1005
+
989
1006
// Create swapchain image views.
990
1007
991
1008
for (size_t i = g_SwapchainImageViews.size (); i--; )
@@ -1009,6 +1026,8 @@ static void CreateSwapchain()
1009
1026
swapchainImageViewInfo.subresourceRange .baseArrayLayer = 0 ;
1010
1027
swapchainImageViewInfo.subresourceRange .layerCount = 1 ;
1011
1028
ERR_GUARD_VULKAN ( vkCreateImageView (g_hDevice, &swapchainImageViewInfo, g_Allocs, &g_SwapchainImageViews[i]) );
1029
+ std::string imgViewName = " g_SwapchainImageViews[" + std::to_string (i) + " ]" ;
1030
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE_VIEW, reinterpret_cast <std::uint64_t >(g_SwapchainImageViews[i]), imgViewName);
1012
1031
}
1013
1032
1014
1033
// Create depth buffer
@@ -1034,7 +1053,11 @@ static void CreateSwapchain()
1034
1053
VmaAllocationCreateInfo depthImageAllocCreateInfo = {};
1035
1054
depthImageAllocCreateInfo.usage = VMA_MEMORY_USAGE_AUTO;
1036
1055
1037
- ERR_GUARD_VULKAN ( vmaCreateImage (g_hAllocator, &depthImageInfo, &depthImageAllocCreateInfo, &g_hDepthImage, &g_hDepthImageAlloc, nullptr ) );
1056
+ VmaAllocationInfo depthImageAllocInfo = {};
1057
+
1058
+ ERR_GUARD_VULKAN ( vmaCreateImage (g_hAllocator, &depthImageInfo, &depthImageAllocCreateInfo, &g_hDepthImage, &g_hDepthImageAlloc, &depthImageAllocInfo) );
1059
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE, reinterpret_cast <std::uint64_t >(g_hDepthImage), " g_hDepthImage" );
1060
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DEVICE_MEMORY, reinterpret_cast <std::uint64_t >(depthImageAllocInfo.deviceMemory ), " depthImageAllocInfo.deviceMemory" );
1038
1061
1039
1062
VkImageViewCreateInfo depthImageViewInfo = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
1040
1063
depthImageViewInfo.image = g_hDepthImage;
@@ -1047,6 +1070,7 @@ static void CreateSwapchain()
1047
1070
depthImageViewInfo.subresourceRange .layerCount = 1 ;
1048
1071
1049
1072
ERR_GUARD_VULKAN ( vkCreateImageView (g_hDevice, &depthImageViewInfo, g_Allocs, &g_hDepthImageView) );
1073
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_IMAGE_VIEW, reinterpret_cast <std::uint64_t >(g_hDepthImageView), " g_hDepthImageView" );
1050
1074
1051
1075
// Create pipeline layout
1052
1076
{
@@ -1069,6 +1093,7 @@ static void CreateSwapchain()
1069
1093
pipelineLayoutInfo.pushConstantRangeCount = 1 ;
1070
1094
pipelineLayoutInfo.pPushConstantRanges = pushConstantRanges;
1071
1095
ERR_GUARD_VULKAN ( vkCreatePipelineLayout (g_hDevice, &pipelineLayoutInfo, g_Allocs, &g_hPipelineLayout) );
1096
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_PIPELINE_LAYOUT, reinterpret_cast <std::uint64_t >(g_hPipelineLayout), " g_hPipelineLayout" );
1072
1097
}
1073
1098
1074
1099
// Create render pass
@@ -1121,6 +1146,7 @@ static void CreateSwapchain()
1121
1146
renderPassInfo.pSubpasses = &subpassDesc;
1122
1147
renderPassInfo.dependencyCount = 0 ;
1123
1148
ERR_GUARD_VULKAN ( vkCreateRenderPass (g_hDevice, &renderPassInfo, g_Allocs, &g_hRenderPass) );
1149
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_RENDER_PASS, reinterpret_cast <std::uint64_t >(g_hRenderPass), " g_hRenderPass" );
1124
1150
}
1125
1151
1126
1152
// Create pipeline
@@ -1132,13 +1158,15 @@ static void CreateSwapchain()
1132
1158
shaderModuleInfo.pCode = (const uint32_t *)vertShaderCode.data ();
1133
1159
VkShaderModule hVertShaderModule = VK_NULL_HANDLE;
1134
1160
ERR_GUARD_VULKAN ( vkCreateShaderModule (g_hDevice, &shaderModuleInfo, g_Allocs, &hVertShaderModule) );
1161
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SHADER_MODULE, reinterpret_cast <std::uint64_t >(hVertShaderModule), " hVertShaderModule" );
1135
1162
1136
1163
std::vector<char > hFragShaderCode;
1137
1164
LoadShader (hFragShaderCode, " Shader.frag.spv" );
1138
1165
shaderModuleInfo.codeSize = hFragShaderCode.size ();
1139
1166
shaderModuleInfo.pCode = (const uint32_t *)hFragShaderCode.data ();
1140
1167
VkShaderModule fragShaderModule = VK_NULL_HANDLE;
1141
1168
ERR_GUARD_VULKAN ( vkCreateShaderModule (g_hDevice, &shaderModuleInfo, g_Allocs, &fragShaderModule) );
1169
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SHADER_MODULE, reinterpret_cast <std::uint64_t >(fragShaderModule), " fragShaderModule" );
1142
1170
1143
1171
VkPipelineShaderStageCreateInfo vertPipelineShaderStageInfo = { VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO };
1144
1172
vertPipelineShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;
@@ -1278,6 +1306,8 @@ static void CreateSwapchain()
1278
1306
g_Allocs,
1279
1307
&g_hPipeline) );
1280
1308
1309
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_PIPELINE, reinterpret_cast <std::uint64_t >(g_hPipeline), " g_hPipeline" );
1310
+
1281
1311
vkDestroyShaderModule (g_hDevice, fragShaderModule, g_Allocs);
1282
1312
vkDestroyShaderModule (g_hDevice, hVertShaderModule, g_Allocs);
1283
1313
}
@@ -1301,6 +1331,8 @@ static void CreateSwapchain()
1301
1331
framebufferInfo.height = g_Extent.height ;
1302
1332
framebufferInfo.layers = 1 ;
1303
1333
ERR_GUARD_VULKAN ( vkCreateFramebuffer (g_hDevice, &framebufferInfo, g_Allocs, &g_Framebuffers[i]) );
1334
+ std::string framebufName = " g_Framebuffers[" + std::to_string (i) + " ]" ;
1335
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_FRAMEBUFFER, reinterpret_cast <std::uint64_t >(g_Framebuffers[i]), framebufName);
1304
1336
}
1305
1337
1306
1338
// Destroy the old semaphores and create new ones
@@ -1327,7 +1359,12 @@ static void CreateSwapchain()
1327
1359
1328
1360
for (std::size_t swapchain_img_index = 0 ; swapchain_img_index < g_SwapchainImageCount; swapchain_img_index++) {
1329
1361
ERR_GUARD_VULKAN (vkCreateSemaphore (g_hDevice, &semaphoreInfo, g_Allocs, &g_hImageAvailableSemaphores[swapchain_img_index]));
1362
+ std::string semaphoreName = " g_hImageAvailableSemaphores[" + std::to_string (swapchain_img_index) + " ]" ;
1363
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SEMAPHORE, reinterpret_cast <std::uint64_t >(g_hImageAvailableSemaphores[swapchain_img_index]), semaphoreName);
1364
+
1330
1365
ERR_GUARD_VULKAN (vkCreateSemaphore (g_hDevice, &semaphoreInfo, g_Allocs, &g_hRenderFinishedSemaphores[swapchain_img_index]));
1366
+ semaphoreName = " g_hRenderFinishedSemaphores[" + std::to_string (swapchain_img_index) + " ]" ;
1367
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SEMAPHORE, reinterpret_cast <std::uint64_t >(g_hRenderFinishedSemaphores[swapchain_img_index]), semaphoreName);
1331
1368
}
1332
1369
}
1333
1370
@@ -2030,6 +2067,10 @@ static void InitializeApplication()
2030
2067
deviceCreateInfo.pQueueCreateInfos = queueCreateInfo;
2031
2068
2032
2069
ERR_GUARD_VULKAN ( vkCreateDevice (g_hPhysicalDevice, &deviceCreateInfo, g_Allocs, &g_hDevice) );
2070
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DEVICE, reinterpret_cast <std::uint64_t >(g_hDevice), " g_hDevice" );
2071
+ // Only now that SetDebugUtilsObjectName is loaded, we can assign a name to g_hVulkanInstance as well
2072
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_INSTANCE, reinterpret_cast <std::uint64_t >(g_hVulkanInstance), " g_hVulkanInstance" );
2073
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_PHYSICAL_DEVICE, reinterpret_cast <std::uint64_t >(g_hPhysicalDevice), " g_hPhysicalDevice" );
2033
2074
2034
2075
// Fetch pointers to extension functions
2035
2076
if (VK_KHR_buffer_device_address_enabled)
@@ -2064,6 +2105,8 @@ static void InitializeApplication()
2064
2105
vkGetDeviceQueue (g_hDevice, g_PresentQueueFamilyIndex, 0 , &g_hPresentQueue);
2065
2106
assert (g_hGraphicsQueue);
2066
2107
assert (g_hPresentQueue);
2108
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_QUEUE, reinterpret_cast <std::uint64_t >(g_hGraphicsQueue), " g_hGraphicsQueue" );
2109
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_QUEUE, reinterpret_cast <std::uint64_t >(g_hPresentQueue), " g_hPresentQueue" );
2067
2110
2068
2111
if (g_SparseBindingEnabled)
2069
2112
{
@@ -2077,24 +2120,33 @@ static void InitializeApplication()
2077
2120
commandPoolInfo.queueFamilyIndex = g_GraphicsQueueFamilyIndex;
2078
2121
commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
2079
2122
ERR_GUARD_VULKAN ( vkCreateCommandPool (g_hDevice, &commandPoolInfo, g_Allocs, &g_hCommandPool) );
2123
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_COMMAND_POOL, reinterpret_cast <std::uint64_t >(g_hCommandPool), " g_hCommandPool" );
2080
2124
2081
2125
VkCommandBufferAllocateInfo commandBufferInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO };
2082
2126
commandBufferInfo.commandPool = g_hCommandPool;
2083
2127
commandBufferInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
2084
2128
commandBufferInfo.commandBufferCount = COMMAND_BUFFER_COUNT;
2085
2129
ERR_GUARD_VULKAN ( vkAllocateCommandBuffers (g_hDevice, &commandBufferInfo, g_MainCommandBuffers) );
2130
+ for (size_t i = 0 ; i < COMMAND_BUFFER_COUNT; i++) {
2131
+ std::string cmdBufName = " g_MainCommandBuffers[" + std::to_string (i) + " ]" ;
2132
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast <std::uint64_t >(g_MainCommandBuffers[i]), cmdBufName);
2133
+ }
2086
2134
2087
2135
VkFenceCreateInfo fenceInfo = { VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
2088
2136
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
2089
2137
for (size_t i = 0 ; i < COMMAND_BUFFER_COUNT; ++i)
2090
2138
{
2091
- ERR_GUARD_VULKAN ( vkCreateFence (g_hDevice, &fenceInfo, g_Allocs, &g_MainCommandBufferExecutedFances[i]) );
2139
+ ERR_GUARD_VULKAN ( vkCreateFence (g_hDevice, &fenceInfo, g_Allocs, &g_MainCommandBufferExecutedFences[i]) );
2140
+ std::string fenceName = " g_MainCommandBufferExecutedFences[" + std::to_string (i) + " ]" ;
2141
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_FENCE, reinterpret_cast <std::uint64_t >(g_MainCommandBufferExecutedFences[i]), fenceName);
2092
2142
}
2093
2143
2094
2144
ERR_GUARD_VULKAN ( vkCreateFence (g_hDevice, &fenceInfo, g_Allocs, &g_ImmediateFence) );
2145
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_FENCE, reinterpret_cast <std::uint64_t >(g_ImmediateFence), " g_ImmediateFence" );
2095
2146
2096
2147
commandBufferInfo.commandBufferCount = 1 ;
2097
2148
ERR_GUARD_VULKAN ( vkAllocateCommandBuffers (g_hDevice, &commandBufferInfo, &g_hTemporaryCommandBuffer) );
2149
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast <std::uint64_t >(g_hTemporaryCommandBuffer), " g_hTemporaryCommandBuffer" );
2098
2150
2099
2151
// Create texture sampler
2100
2152
@@ -2115,6 +2167,7 @@ static void InitializeApplication()
2115
2167
samplerInfo.minLod = 0 .f ;
2116
2168
samplerInfo.maxLod = FLT_MAX;
2117
2169
ERR_GUARD_VULKAN ( vkCreateSampler (g_hDevice, &samplerInfo, g_Allocs, &g_hSampler) );
2170
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_SAMPLER, reinterpret_cast <std::uint64_t >(g_hSampler), " g_hSampler" );
2118
2171
2119
2172
CreateTexture (128 , 128 );
2120
2173
CreateMesh ();
@@ -2129,6 +2182,7 @@ static void InitializeApplication()
2129
2182
descriptorSetLayoutInfo.bindingCount = 1 ;
2130
2183
descriptorSetLayoutInfo.pBindings = &samplerLayoutBinding;
2131
2184
ERR_GUARD_VULKAN ( vkCreateDescriptorSetLayout (g_hDevice, &descriptorSetLayoutInfo, g_Allocs, &g_hDescriptorSetLayout) );
2185
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, reinterpret_cast <std::uint64_t >(g_hDescriptorSetLayout), " g_hDescriptorSetLayout" );
2132
2186
2133
2187
// Create descriptor pool
2134
2188
@@ -2144,6 +2198,7 @@ static void InitializeApplication()
2144
2198
descriptorPoolInfo.pPoolSizes = descriptorPoolSizes;
2145
2199
descriptorPoolInfo.maxSets = 1 ;
2146
2200
ERR_GUARD_VULKAN ( vkCreateDescriptorPool (g_hDevice, &descriptorPoolInfo, g_Allocs, &g_hDescriptorPool) );
2201
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DESCRIPTOR_POOL, reinterpret_cast <std::uint64_t >(g_hDescriptorPool), " g_hDescriptorPool" );
2147
2202
2148
2203
// Create descriptor set layout
2149
2204
@@ -2153,6 +2208,7 @@ static void InitializeApplication()
2153
2208
descriptorSetInfo.descriptorSetCount = 1 ;
2154
2209
descriptorSetInfo.pSetLayouts = descriptorSetLayouts;
2155
2210
ERR_GUARD_VULKAN ( vkAllocateDescriptorSets (g_hDevice, &descriptorSetInfo, &g_hDescriptorSet) );
2211
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_DESCRIPTOR_SET, reinterpret_cast <std::uint64_t >(g_hDescriptorSet), " g_hDescriptorSet" );
2156
2212
2157
2213
VkDescriptorImageInfo descriptorImageInfo = {};
2158
2214
descriptorImageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
@@ -2226,10 +2282,10 @@ static void FinalizeApplication()
2226
2282
2227
2283
for (size_t i = COMMAND_BUFFER_COUNT; i--; )
2228
2284
{
2229
- if (g_MainCommandBufferExecutedFances [i] != VK_NULL_HANDLE)
2285
+ if (g_MainCommandBufferExecutedFences [i] != VK_NULL_HANDLE)
2230
2286
{
2231
- vkDestroyFence (g_hDevice, g_MainCommandBufferExecutedFances [i], g_Allocs);
2232
- g_MainCommandBufferExecutedFances [i] = VK_NULL_HANDLE;
2287
+ vkDestroyFence (g_hDevice, g_MainCommandBufferExecutedFences [i], g_Allocs);
2288
+ g_MainCommandBufferExecutedFences [i] = VK_NULL_HANDLE;
2233
2289
}
2234
2290
}
2235
2291
if (g_MainCommandBuffers[0 ] != VK_NULL_HANDLE)
@@ -2290,14 +2346,15 @@ static void DrawFrame()
2290
2346
// Begin main command buffer
2291
2347
size_t cmdBufIndex = (g_NextCommandBufferIndex++) % COMMAND_BUFFER_COUNT;
2292
2348
VkCommandBuffer hCommandBuffer = g_MainCommandBuffers[cmdBufIndex];
2293
- VkFence hCommandBufferExecutedFence = g_MainCommandBufferExecutedFances [cmdBufIndex];
2349
+ VkFence hCommandBufferExecutedFence = g_MainCommandBufferExecutedFences [cmdBufIndex];
2294
2350
2295
2351
ERR_GUARD_VULKAN ( vkWaitForFences (g_hDevice, 1 , &hCommandBufferExecutedFence, VK_TRUE, UINT64_MAX) );
2296
2352
ERR_GUARD_VULKAN ( vkResetFences (g_hDevice, 1 , &hCommandBufferExecutedFence) );
2297
2353
2298
2354
VkCommandBufferBeginInfo commandBufferBeginInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
2299
2355
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
2300
2356
ERR_GUARD_VULKAN ( vkBeginCommandBuffer (hCommandBuffer, &commandBufferBeginInfo) );
2357
+ SetDebugUtilsObjectName (VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast <std::uint64_t >(hCommandBuffer), " hCommandBuffer" );
2301
2358
2302
2359
// Acquire swapchain image
2303
2360
uint32_t imageIndex = 0 ;
0 commit comments