mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GLES: Restore stencil/depth readback for debugger.
Only works on desktop GL.
This commit is contained in:
parent
f0694ba115
commit
35ccd16746
2 changed files with 24 additions and 6 deletions
|
@ -1085,13 +1085,27 @@ void GLQueueRunner::PerformReadback(const GLRStep &pass) {
|
|||
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
|
||||
// Always read back in 8888 format.
|
||||
const GLuint internalFormat = GL_RGBA;
|
||||
const GLuint format = GL_RGBA;
|
||||
const GLuint type = GL_UNSIGNED_BYTE;
|
||||
const int srcAlignment = 4;
|
||||
// Always read back in 8888 format for the color aspect.
|
||||
GLuint internalFormat = GL_RGBA;
|
||||
GLuint format = GL_RGBA;
|
||||
GLuint type = GL_UNSIGNED_BYTE;
|
||||
int srcAlignment = 4;
|
||||
int dstAlignment = (int)DataFormatSizeInBytes(pass.readback.dstFormat);
|
||||
|
||||
#ifndef USING_GLES2
|
||||
if (pass.readback.aspectMask & GL_DEPTH_BUFFER_BIT) {
|
||||
internalFormat = GL_DEPTH_COMPONENT;
|
||||
format = GL_DEPTH_COMPONENT;
|
||||
type = GL_FLOAT;
|
||||
srcAlignment = 4;
|
||||
} else if (pass.readback.aspectMask & GL_STENCIL_BUFFER_BIT) {
|
||||
internalFormat = GL_STENCIL_INDEX;
|
||||
format = GL_STENCIL_INDEX;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
srcAlignment = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int pixelStride = pass.readback.srcRect.w;
|
||||
// Apply the correct alignment.
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, srcAlignment);
|
||||
|
@ -1102,7 +1116,7 @@ void GLQueueRunner::PerformReadback(const GLRStep &pass) {
|
|||
|
||||
GLRect2D rect = pass.readback.srcRect;
|
||||
|
||||
bool convert = pass.readback.dstFormat != DataFormat::R8G8B8A8_UNORM;
|
||||
bool convert = internalFormat == GL_RGBA && pass.readback.dstFormat != DataFormat::R8G8B8A8_UNORM;
|
||||
|
||||
int tempSize = srcAlignment * rect.w * rect.h;
|
||||
int readbackSize = dstAlignment * rect.w * rect.h;
|
||||
|
|
|
@ -720,6 +720,10 @@ static void LogReadPixelsError(GLenum error) {
|
|||
#endif
|
||||
|
||||
bool OpenGLContext::CopyFramebufferToMemorySync(Framebuffer *src, int channelBits, int x, int y, int w, int h, Draw::DataFormat dataFormat, void *pixels, int pixelStride) {
|
||||
if (gl_extensions.IsGLES && (channelBits & FB_COLOR_BIT) == 0) {
|
||||
// Can't readback depth or stencil on GLES.
|
||||
return false;
|
||||
}
|
||||
OpenGLFramebuffer *fb = (OpenGLFramebuffer *)src;
|
||||
GLuint aspect = 0;
|
||||
if (channelBits & FB_COLOR_BIT)
|
||||
|
|
Loading…
Add table
Reference in a new issue