Remove std::string from VulkanProfiler (the scope profiler for uploads)

This commit is contained in:
Henrik Rydgård 2022-12-01 11:39:20 +01:00
parent 6a7682368d
commit c05ec8b520
2 changed files with 5 additions and 8 deletions

View File

@ -40,7 +40,7 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm
// Log it all out.
for (auto &scope : scopes_) {
if (scope.endQueryId == -1) {
WARN_LOG(G3D, "Unclosed scope: %s", scope.name.c_str());
WARN_LOG(G3D, "Unclosed scope: %s", scope.name);
continue;
}
uint64_t startTime = results[scope.startQueryId];
@ -50,7 +50,7 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm
double milliseconds = (double)delta * timestampConversionFactor;
INFO_LOG(G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name.c_str(), milliseconds);
INFO_LOG(G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name, milliseconds);
}
scopes_.clear();
@ -73,14 +73,11 @@ void VulkanProfiler::Begin(VkCommandBuffer cmdBuf, VkPipelineStageFlagBits stage
return;
}
ProfilerScope scope;
va_list args;
va_start(args, fmt);
char temp[512];
vsnprintf(temp, sizeof(temp), fmt, args);
vsnprintf(scope.name, sizeof(scope.name), fmt, args);
va_end(args);
ProfilerScope scope;
scope.name = temp;
scope.startQueryId = numQueries_;
scope.endQueryId = -1;
scope.level = (int)scopeStack_.size();

View File

@ -13,7 +13,7 @@
// Put the whole thing in a FrameData to allow for overlap.
struct ProfilerScope {
std::string name;
char name[52]; // to make a struct size of 64, just because
int startQueryId;
int endQueryId;
int level;