diff --git a/examples_tests b/examples_tests index 1b54b42b5d..f8c9b02fcd 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 1b54b42b5d31f1f1d72f2760438f2a323ab44e73 +Subproject commit f8c9b02fcd45727a864290cf993a07144b87d1e3 diff --git a/include/nbl/video/IGPUPipeline.h b/include/nbl/video/IGPUPipeline.h index 8bab01dcc6..6e2d299cec 100644 --- a/include/nbl/video/IGPUPipeline.h +++ b/include/nbl/video/IGPUPipeline.h @@ -12,6 +12,8 @@ #include "nbl/asset/IPipeline.h" #include "nbl/system/to_string.h" +#include + namespace nbl::video { diff --git a/src/nbl/video/CVulkanPipelineExecutableInfo.h b/src/nbl/video/CVulkanPipelineExecutableInfo.h index c126e845e6..79f1d8d573 100644 --- a/src/nbl/video/CVulkanPipelineExecutableInfo.h +++ b/src/nbl/video/CVulkanPipelineExecutableInfo.h @@ -18,7 +18,8 @@ inline void populateExecutableInfoFromVulkan(core::vectorvk.vkGetPipelineExecutablePropertiesKHR(vkDevice, &pipelineInfo, &executableCount, nullptr); + if (vk->vk.vkGetPipelineExecutablePropertiesKHR(vkDevice, &pipelineInfo, &executableCount, nullptr) != VK_SUCCESS) + return; if (executableCount == 0) return; @@ -26,7 +27,8 @@ inline void populateExecutableInfoFromVulkan(core::vector properties(executableCount); for (uint32_t i = 0; i < executableCount; ++i) properties[i] = {VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR, nullptr}; - vk->vk.vkGetPipelineExecutablePropertiesKHR(vkDevice, &pipelineInfo, &executableCount, properties.data()); + if (vk->vk.vkGetPipelineExecutablePropertiesKHR(vkDevice, &pipelineInfo, &executableCount, properties.data()) != VK_SUCCESS) + return; outInfo.resize(executableCount); @@ -45,70 +47,75 @@ inline void populateExecutableInfoFromVulkan(core::vectorvk.vkGetPipelineExecutableStatisticsKHR(vkDevice, &execInfo, &statCount, nullptr); + if (vk->vk.vkGetPipelineExecutableStatisticsKHR(vkDevice, &execInfo, &statCount, nullptr) != VK_SUCCESS) + statCount = 0; if (statCount > 0) { core::vector stats(statCount); for (uint32_t s = 0; s < statCount; ++s) stats[s] = {VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR, nullptr}; - vk->vk.vkGetPipelineExecutableStatisticsKHR(vkDevice, &execInfo, &statCount, stats.data()); + if (vk->vk.vkGetPipelineExecutableStatisticsKHR(vkDevice, &execInfo, &statCount, stats.data()) != VK_SUCCESS) + statCount = 0; - info.structuredStatistics.resize(statCount); - - // First pass: format name:value pairs (for the human-readable string) and - // fill structuredStatistics in lockstep so callers can pick whichever view - // they need without re-parsing. - core::vector nameValues(statCount); - size_t maxNameValueLen = 0; - for (uint32_t s = 0; s < statCount; ++s) + if (statCount > 0) { - const auto& stat = stats[s]; - auto& outStat = info.structuredStatistics[s]; - outStat.name = stat.name; - outStat.description = stat.description; - - std::string value; - switch (stat.format) + info.structuredStatistics.resize(statCount); + + // First pass: format name:value pairs (for the human-readable string) and + // fill structuredStatistics in lockstep so callers can pick whichever view + // they need without re-parsing. + core::vector nameValues(statCount); + size_t maxNameValueLen = 0; + for (uint32_t s = 0; s < statCount; ++s) { - case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR: - outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::BOOL32; - outStat.value.b32 = stat.value.b32 != VK_FALSE; - value = outStat.value.b32 ? "true" : "false"; - break; - case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR: - outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::INT64; - outStat.value.i64 = stat.value.i64; - value = std::to_string(stat.value.i64); - break; - case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR: - outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::UINT64; - outStat.value.u64 = stat.value.u64; - value = std::to_string(stat.value.u64); - break; - case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR: - outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::FLOAT64; - outStat.value.f64 = stat.value.f64; - value = std::to_string(stat.value.f64); - break; - default: - // Unknown format: leave structured value zero, keep raw text marker - value = ""; - break; + const auto& stat = stats[s]; + auto& outStat = info.structuredStatistics[s]; + outStat.name = stat.name; + outStat.description = stat.description; + + std::string value; + switch (stat.format) + { + case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR: + outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::BOOL32; + outStat.value.b32 = stat.value.b32 != VK_FALSE; + value = outStat.value.b32 ? "true" : "false"; + break; + case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR: + outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::INT64; + outStat.value.i64 = stat.value.i64; + value = std::to_string(stat.value.i64); + break; + case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR: + outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::UINT64; + outStat.value.u64 = stat.value.u64; + value = std::to_string(stat.value.u64); + break; + case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR: + outStat.format = IGPUPipelineBase::SExecutableStatistic::FORMAT::FLOAT64; + outStat.value.f64 = stat.value.f64; + value = std::to_string(stat.value.f64); + break; + default: + // Unknown format: leave structured value zero, keep raw text marker + value = ""; + break; + } + nameValues[s] = std::string(stat.name) + ": " + value; + maxNameValueLen = std::max(maxNameValueLen, nameValues[s].size()); } - nameValues[s] = std::string(stat.name) + ": " + value; - maxNameValueLen = std::max(maxNameValueLen, nameValues[s].size()); - } - // Second pass: emit with aligned columns (unchanged human-readable format) - std::string& statsStr = info.statistics; - for (uint32_t s = 0; s < statCount; ++s) - { - statsStr += nameValues[s]; - statsStr.append(maxNameValueLen - nameValues[s].size() + 4, ' '); - statsStr += "// "; - statsStr += stats[s].description; - statsStr += "\n"; + // Second pass: emit with aligned columns (unchanged human-readable format) + std::string& statsStr = info.statistics; + for (uint32_t s = 0; s < statCount; ++s) + { + statsStr += nameValues[s]; + statsStr.append(maxNameValueLen - nameValues[s].size() + 4, ' '); + statsStr += "// "; + statsStr += stats[s].description; + statsStr += "\n"; + } } } @@ -116,7 +123,8 @@ inline void populateExecutableInfoFromVulkan(core::vectorvk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, nullptr); + if (vk->vk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, nullptr) != VK_SUCCESS) + irCount = 0; if (irCount > 0) { @@ -125,7 +133,8 @@ inline void populateExecutableInfoFromVulkan(core::vectorvk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, irs.data()); + if (vk->vk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, irs.data()) != VK_SUCCESS) + continue; // Allocate data buffers and second call to get data core::vector> irData(irCount); @@ -135,7 +144,8 @@ inline void populateExecutableInfoFromVulkan(core::vectorvk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, irs.data()); + if (vk->vk.vkGetPipelineExecutableInternalRepresentationsKHR(vkDevice, &execInfo, &irCount, irs.data()) != VK_SUCCESS) + continue; info.structuredInternalRepresentations.resize(irCount);