mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add tag field to GLRFramebuffer for debugging
This commit is contained in:
parent
f4035a0802
commit
edd208791e
4 changed files with 54 additions and 7 deletions
|
@ -1843,3 +1843,44 @@ GLRFramebuffer::~GLRFramebuffer() {
|
|||
glDeleteRenderbuffers(1, &stencil_buffer);
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
}
|
||||
|
||||
std::string GLQueueRunner::StepToString(const GLRStep &step) const {
|
||||
char buffer[256];
|
||||
switch (step.stepType) {
|
||||
case GLRStepType::RENDER:
|
||||
{
|
||||
int w = step.render.framebuffer ? step.render.framebuffer->width : targetWidth_;
|
||||
int h = step.render.framebuffer ? step.render.framebuffer->height : targetHeight_;
|
||||
snprintf(buffer, sizeof(buffer), "RENDER %s %s (draws: %d, %dx%d)", step.tag, step.render.framebuffer ? step.render.framebuffer->Tag() : "", -1, w, h);
|
||||
break;
|
||||
}
|
||||
case GLRStepType::COPY:
|
||||
snprintf(buffer, sizeof(buffer), "COPY '%s' %s -> %s (%dx%d, %s)", step.tag, step.copy.src->Tag(), step.copy.dst->Tag(), step.copy.srcRect.w, step.copy.srcRect.h, GLRAspectToString((GLRAspect)step.copy.aspectMask));
|
||||
break;
|
||||
case GLRStepType::BLIT:
|
||||
snprintf(buffer, sizeof(buffer), "BLIT '%s' %s -> %s (%dx%d->%dx%d, %s)", step.tag, step.copy.src->Tag(), step.copy.dst->Tag(), step.blit.srcRect.w, step.blit.srcRect.h, step.blit.dstRect.w, step.blit.dstRect.h, GLRAspectToString((GLRAspect)step.blit.aspectMask));
|
||||
break;
|
||||
case GLRStepType::READBACK:
|
||||
snprintf(buffer, sizeof(buffer), "READBACK '%s' %s (%dx%d, %s)", step.tag, step.readback.src ? step.readback.src->Tag() : "(backbuffer)", step.readback.srcRect.w, step.readback.srcRect.h, GLRAspectToString((GLRAspect)step.readback.aspectMask));
|
||||
break;
|
||||
case GLRStepType::READBACK_IMAGE:
|
||||
snprintf(buffer, sizeof(buffer), "READBACK_IMAGE '%s' (%dx%d)", step.tag, step.readback_image.srcRect.w, step.readback_image.srcRect.h);
|
||||
break;
|
||||
case GLRStepType::RENDER_SKIP:
|
||||
snprintf(buffer, sizeof(buffer), "(RENDER_SKIP) %s", step.tag);
|
||||
break;
|
||||
default:
|
||||
buffer[0] = 0;
|
||||
break;
|
||||
}
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
const char *GLRAspectToString(GLRAspect aspect) {
|
||||
switch (aspect) {
|
||||
case GLR_ASPECT_COLOR: return "COLOR";
|
||||
case GLR_ASPECT_DEPTH: return "DEPTH";
|
||||
case GLR_ASPECT_STENCIL: return "STENCIL";
|
||||
default: return "N/A";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,11 +290,12 @@ enum class GLRRenderPassAction {
|
|||
|
||||
class GLRFramebuffer;
|
||||
|
||||
enum {
|
||||
enum GLRAspect {
|
||||
GLR_ASPECT_COLOR = 1,
|
||||
GLR_ASPECT_DEPTH = 2,
|
||||
GLR_ASPECT_STENCIL = 3,
|
||||
};
|
||||
const char *GLRAspectToString(GLRAspect aspect);
|
||||
|
||||
struct GLRStep {
|
||||
GLRStep(GLRStepType _type) : stepType(_type) {}
|
||||
|
@ -389,6 +390,8 @@ private:
|
|||
GLenum fbo_get_fb_target(bool read, GLuint **cached);
|
||||
void fbo_unbind();
|
||||
|
||||
std::string StepToString(const GLRStep &step) const;
|
||||
|
||||
GLRFramebuffer *curFB_ = nullptr;
|
||||
|
||||
GLuint globalVAO_ = 0;
|
||||
|
|
|
@ -53,13 +53,14 @@ public:
|
|||
|
||||
class GLRFramebuffer {
|
||||
public:
|
||||
GLRFramebuffer(const Draw::DeviceCaps &caps, int _width, int _height, bool z_stencil)
|
||||
GLRFramebuffer(const Draw::DeviceCaps &caps, int _width, int _height, bool z_stencil, const char *tag)
|
||||
: color_texture(caps, _width, _height, 1, 1), z_stencil_texture(caps, _width, _height, 1, 1),
|
||||
width(_width), height(_height), z_stencil_(z_stencil) {
|
||||
}
|
||||
|
||||
~GLRFramebuffer();
|
||||
|
||||
const char *Tag() const { return tag_.c_str(); }
|
||||
|
||||
GLuint handle = 0;
|
||||
GLRTexture color_texture;
|
||||
// Either z_stencil_texture, z_stencil_buffer, or (z_buffer and stencil_buffer) are set.
|
||||
|
@ -71,8 +72,10 @@ public:
|
|||
int width;
|
||||
int height;
|
||||
GLuint colorDepth = 0;
|
||||
|
||||
bool z_stencil_;
|
||||
|
||||
private:
|
||||
std::string tag_;
|
||||
};
|
||||
|
||||
// We need to create some custom heap-allocated types so we can forward things that need to be created on the GL thread, before
|
||||
|
@ -283,10 +286,10 @@ public:
|
|||
return step.create_shader.shader;
|
||||
}
|
||||
|
||||
GLRFramebuffer *CreateFramebuffer(int width, int height, bool z_stencil) {
|
||||
GLRFramebuffer *CreateFramebuffer(int width, int height, bool z_stencil, const char *tag) {
|
||||
GLRInitStep &step = initSteps_.push_uninitialized();
|
||||
step.stepType = GLRInitStepType::CREATE_FRAMEBUFFER;
|
||||
step.create_framebuffer.framebuffer = new GLRFramebuffer(caps_, width, height, z_stencil);
|
||||
step.create_framebuffer.framebuffer = new GLRFramebuffer(caps_, width, height, z_stencil, tag);
|
||||
return step.create_framebuffer.framebuffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1447,7 +1447,7 @@ Framebuffer *OpenGLContext::CreateFramebuffer(const FramebufferDesc &desc) {
|
|||
// TODO: Support multiview later. (It's our only use case for multi layers).
|
||||
_dbg_assert_(desc.numLayers == 1);
|
||||
|
||||
GLRFramebuffer *framebuffer = renderManager_.CreateFramebuffer(desc.width, desc.height, desc.z_stencil);
|
||||
GLRFramebuffer *framebuffer = renderManager_.CreateFramebuffer(desc.width, desc.height, desc.z_stencil, desc.tag);
|
||||
OpenGLFramebuffer *fbo = new OpenGLFramebuffer(&renderManager_, framebuffer);
|
||||
return fbo;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue