video_core: Add debug scopes (#6634)

This commit is contained in:
GPUCode 2023-06-23 04:37:13 +03:00 committed by GitHub
parent 89663e0db8
commit 7616496456
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 3 deletions

View file

@ -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();

View file

@ -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

View file

@ -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>;