Vulkan: Fix reverse dependency on config.

This commit is contained in:
Unknown W. Brackets 2022-12-27 15:32:35 -08:00
parent 68fb7a477d
commit 4f216c941e
3 changed files with 22 additions and 3 deletions

View File

@ -33,8 +33,6 @@
#include "Common/GPU/Vulkan/VulkanMemory.h"
#include "Common/Thread/Promise.h"
#include "Core/Config.h"
#include "Common/GPU/Vulkan/VulkanLoader.h"
// We support a frame-global descriptor set, which can be optionally used by other code,
@ -385,6 +383,7 @@ public:
~VKContext();
void DebugAnnotate(const char *annotation) override;
void SetDebugFlags(DebugFlags flags) override;
const DeviceCaps &GetDeviceCaps() const override {
return caps_;
@ -529,6 +528,7 @@ private:
AutoRef<VKFramebuffer> curFramebuffer_;
VkDevice device_;
DebugFlags debugFlags_ = DebugFlags::NONE;
enum {
MAX_FRAME_COMMAND_BUFFERS = 256,
@ -1018,7 +1018,7 @@ VKContext::~VKContext() {
void VKContext::BeginFrame() {
// TODO: Bad dependency on g_Config here!
renderManager_.BeginFrame(g_Config.bShowGpuProfile, g_Config.bGpuLogProfiler);
renderManager_.BeginFrame(debugFlags_ & DebugFlags::PROFILE_TIMESTAMPS, debugFlags_ & DebugFlags::PROFILE_SCOPES);
FrameData &frame = frame_[vulkan_->GetCurFrame()];
push_ = frame.pushBuffer;
@ -1763,4 +1763,8 @@ void VKContext::DebugAnnotate(const char *annotation) {
renderManager_.DebugAnnotate(annotation);
}
void VKContext::SetDebugFlags(DebugFlags flags) {
debugFlags_ = flags;
}
} // namespace Draw

View File

@ -631,6 +631,13 @@ enum class TextureBindFlags {
};
ENUM_CLASS_BITOPS(TextureBindFlags);
enum class DebugFlags {
NONE = 0,
PROFILE_TIMESTAMPS = 1,
PROFILE_SCOPES = 2,
};
ENUM_CLASS_BITOPS(DebugFlags);
class DrawContext {
public:
virtual ~DrawContext();
@ -655,6 +662,7 @@ public:
virtual void SetErrorCallback(ErrorCallbackFn callback, void *userdata) {}
virtual void DebugAnnotate(const char *annotation) {}
virtual void SetDebugFlags(DebugFlags flags) {}
// Partial pipeline state, used to create pipelines. (in practice, in d3d11 they'll use the native state objects directly).
// TODO: Possibly ditch these and just put the descs directly in PipelineDesc since only D3D11 benefits.

View File

@ -1140,6 +1140,13 @@ void NativeRender(GraphicsContext *graphicsContext) {
screenManager->getUIContext()->SetTintSaturation(g_Config.fUITint, g_Config.fUISaturation);
Draw::DebugFlags debugFlags = Draw::DebugFlags::NONE;
if (g_Config.bShowGpuProfile)
debugFlags |= Draw::DebugFlags::PROFILE_TIMESTAMPS;
if (g_Config.bGpuLogProfiler)
debugFlags |= Draw::DebugFlags::PROFILE_SCOPES;
screenManager->getDrawContext()->SetDebugFlags(debugFlags);
// All actual rendering happen in here.
screenManager->render();
if (screenManager->getUIContext()->Text()) {