mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 13:20:04 +00:00
video_core: Add debug scopes (#6634)
This commit is contained in:
parent
89663e0db8
commit
7616496456
6 changed files with 82 additions and 3 deletions
|
@ -765,6 +765,14 @@ bool RasterizerOpenGL::AccelerateDisplay(const GPU::Regs::FramebufferConfig& con
|
|||
return false;
|
||||
}
|
||||
|
||||
const DebugScope scope{runtime,
|
||||
Common::Vec4f{0.f, 1.f, 1.f, 1.f},
|
||||
"RasterizerOpenGL::AccelerateDisplay ({}x{} {} at {:#X})",
|
||||
src_params.width,
|
||||
src_params.height,
|
||||
VideoCore::PixelFormatAsString(src_params.pixel_format),
|
||||
src_params.addr};
|
||||
|
||||
const Surface& src_surface = res_cache.GetSurface(src_surface_id);
|
||||
const u32 scaled_width = src_surface.GetScaledWidth();
|
||||
const u32 scaled_height = src_surface.GetScaledHeight();
|
||||
|
|
|
@ -700,4 +700,14 @@ Sampler::Sampler(TextureRuntime&, VideoCore::SamplerParams params) {
|
|||
|
||||
Sampler::~Sampler() = default;
|
||||
|
||||
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view label)
|
||||
: local_scope_depth{global_scope_depth++} {
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, local_scope_depth, label.size(), label.data());
|
||||
}
|
||||
|
||||
DebugScope::~DebugScope() {
|
||||
glPopDebugGroup();
|
||||
global_scope_depth--;
|
||||
}
|
||||
|
||||
} // namespace OpenGL
|
||||
|
|
|
@ -230,11 +230,26 @@ private:
|
|||
OGLSampler sampler;
|
||||
};
|
||||
|
||||
class DebugScope {
|
||||
public:
|
||||
template <typename... T>
|
||||
explicit DebugScope(TextureRuntime& runtime, Common::Vec4f color,
|
||||
fmt::format_string<T...> format, T... args)
|
||||
: DebugScope{runtime, color, fmt::format(format, std::forward<T>(args)...)} {}
|
||||
explicit DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view label);
|
||||
~DebugScope();
|
||||
|
||||
private:
|
||||
inline static GLuint global_scope_depth = 0;
|
||||
const GLuint local_scope_depth{};
|
||||
};
|
||||
|
||||
struct Traits {
|
||||
using Runtime = OpenGL::TextureRuntime;
|
||||
using Sampler = OpenGL::Sampler;
|
||||
using Surface = OpenGL::Surface;
|
||||
using Framebuffer = OpenGL::Framebuffer;
|
||||
using DebugScope = OpenGL::DebugScope;
|
||||
};
|
||||
|
||||
using RasterizerCache = VideoCore::RasterizerCache<Traits>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue