mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
Fixes when profiler is disabled.
Typo, validation fix More fixes Fix mipgen logging Disable the logging profiler by default again Important to use the macro
This commit is contained in:
parent
9945620504
commit
3833d935f4
@ -293,12 +293,14 @@ void VulkanContext::BeginFrame(VkCommandBuffer firstCommandBuffer) {
|
||||
FrameData *frame = &frame_[curFrame_];
|
||||
// Process pending deletes.
|
||||
frame->deleteList.PerformDeletes(device_, allocator_);
|
||||
frame->profiler.BeginFrame(this, firstCommandBuffer);
|
||||
// VK_NULL_HANDLE when profiler is disabled.
|
||||
if (firstCommandBuffer) {
|
||||
frame->profiler.BeginFrame(this, firstCommandBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanContext::EndFrame() {
|
||||
frame_[curFrame_].deleteList.Take(globalDeleteList_);
|
||||
frame_[curFrame_].profiler.EndFrame();
|
||||
curFrame_++;
|
||||
if (curFrame_ >= inflightFrames_) {
|
||||
curFrame_ = 0;
|
||||
@ -678,7 +680,7 @@ VkResult VulkanContext::CreateDevice() {
|
||||
allocatorInfo.instance = instance_;
|
||||
vmaCreateAllocator(&allocatorInfo, &allocator_);
|
||||
|
||||
for (int i = 0; i < GetInflightFrames(); i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(frame_); i++) {
|
||||
frame_[i].profiler.Init(this);
|
||||
}
|
||||
|
||||
@ -1129,7 +1131,7 @@ void VulkanContext::DestroyDevice() {
|
||||
INFO_LOG(G3D, "VulkanContext::DestroyDevice (performing deletes)");
|
||||
PerformPendingDeletes();
|
||||
|
||||
for (int i = 0; i < GetInflightFrames(); i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(frame_); i++) {
|
||||
frame_[i].profiler.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,18 @@
|
||||
#include "Common/GPU/Vulkan/VulkanAlloc.h"
|
||||
#include "Common/GPU/Vulkan/VulkanProfiler.h"
|
||||
|
||||
#define VULKAN_PROFILE_ENABLED
|
||||
// Enable or disable a simple logging profiler for Vulkan.
|
||||
// Mostly useful for profiling texture uploads currently, but could be useful for
|
||||
// other things as well. We also have a nice integrated render pass profiler in the queue
|
||||
// runner, but this one is more convenient for transient events.
|
||||
// #define VULKAN_PROFILER_ENABLED
|
||||
|
||||
#if defined(VULKAN_PROFILE_ENABLED)
|
||||
#if defined(VULKAN_PROFILER_ENABLED)
|
||||
#define VK_PROFILE_BEGIN(vulkan, cmd, stage, message) vulkan->GetProfiler()->Begin(cmd, stage, message);
|
||||
#define VK_PROFILE_END(vulkan, cmd, stage) vulkan->GetProfiler()->End(cmd, stage);
|
||||
#else
|
||||
#define VK_PROFILE_BEGIN(..)
|
||||
#define VK_PROFILE_END(..)
|
||||
#define VK_PROFILE_BEGIN(vulkan, cmd, stage, message)
|
||||
#define VK_PROFILE_END(vulkan, cmd, stage)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
@ -6,18 +6,14 @@ using namespace PPSSPP_VK;
|
||||
void VulkanProfiler::Init(VulkanContext *vulkan) {
|
||||
vulkan_ = vulkan;
|
||||
|
||||
for (int i = 0; i < vulkan->GetInflightFrames(); i++) {
|
||||
VkQueryPoolCreateInfo ci{ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO };
|
||||
ci.queryCount = MAX_QUERY_COUNT;
|
||||
ci.queryType = VK_QUERY_TYPE_TIMESTAMP;
|
||||
vkCreateQueryPool(vulkan->GetDevice(), &ci, nullptr, &queryPool_);
|
||||
}
|
||||
VkQueryPoolCreateInfo ci{ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO };
|
||||
ci.queryCount = MAX_QUERY_COUNT;
|
||||
ci.queryType = VK_QUERY_TYPE_TIMESTAMP;
|
||||
vkCreateQueryPool(vulkan->GetDevice(), &ci, nullptr, &queryPool_);
|
||||
}
|
||||
|
||||
void VulkanProfiler::Shutdown() {
|
||||
for (int i = 0; i < vulkan_->GetInflightFrames(); i++) {
|
||||
vkDestroyQueryPool(vulkan_->GetDevice(), queryPool_, nullptr);
|
||||
}
|
||||
vkDestroyQueryPool(vulkan_->GetDevice(), queryPool_, nullptr);
|
||||
}
|
||||
|
||||
void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstCommandBuf) {
|
||||
@ -61,10 +57,6 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm
|
||||
numQueries_ = 0;
|
||||
}
|
||||
|
||||
void VulkanProfiler::EndFrame() {
|
||||
// Not much to do here really except check that all scopes are closed.
|
||||
}
|
||||
|
||||
void VulkanProfiler::Begin(VkCommandBuffer cmdBuf, VkPipelineStageFlagBits stageFlags, std::string scopeName) {
|
||||
if (numQueries_ >= MAX_QUERY_COUNT - 1) {
|
||||
return;
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
|
||||
void BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstCommandBuffer);
|
||||
|
||||
void EndFrame();
|
||||
|
||||
void Begin(VkCommandBuffer cmdBuf, VkPipelineStageFlagBits stage, std::string scopeName);
|
||||
void End(VkCommandBuffer cmdBuf, VkPipelineStageFlagBits stage);
|
||||
|
||||
|
@ -584,7 +584,7 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) {
|
||||
WARN_LOG(G3D, "BeginFrame while !run_!");
|
||||
}
|
||||
|
||||
#if defined(VULKAN_PROFILE_ENABLED)
|
||||
#if defined(VULKAN_PROFILER_ENABLED)
|
||||
vulkan_->BeginFrame(GetInitCmd());
|
||||
#else
|
||||
vulkan_->BeginFrame(VK_NULL_HANDLE);
|
||||
|
@ -786,7 +786,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
}
|
||||
|
||||
if (entry->vkTex) {
|
||||
vulkan->GetProfiler()->Begin(cmdInit, VkPipelineStageFlagBits(VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT),
|
||||
VK_PROFILE_BEGIN(vulkan, cmdInit, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||
StringFromFormat("Texture Upload"));
|
||||
|
||||
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
||||
@ -872,7 +872,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
// Generate any additional mipmap levels.
|
||||
// This will transition the whole stack to GENERAL if it wasn't already.
|
||||
if (maxLevel != maxLevelToGenerate) {
|
||||
VK_PROFILE_BEGIN(vulkan, cmdInit, VK_PIPELINE_STAGE_TRANSFER_BIT, StringFromFormat("Mipgen %d", maxLevel + 1));
|
||||
VK_PROFILE_BEGIN(vulkan, cmdInit, VK_PIPELINE_STAGE_TRANSFER_BIT, StringFromFormat("Mipgen up to level %d", maxLevelToGenerate));
|
||||
entry->vkTex->GenerateMips(cmdInit, maxLevel + 1, computeUpload);
|
||||
layout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
prevStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
@ -888,7 +888,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
entry->SetAlphaStatus(TexCacheEntry::TexStatus(replaced.AlphaStatus()));
|
||||
}
|
||||
entry->vkTex->EndCreate(cmdInit, false, prevStage, layout);
|
||||
VK_PROFILE_END(vulkan, cmdInit, VkPipelineStageFlagBits(VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT));
|
||||
VK_PROFILE_END(vulkan, cmdInit, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user