Skip to content

Commit

Permalink
avoid get color_read_* with depth format
Browse files Browse the repository at this point in the history
  • Loading branch information
qiankanglai authored and baldurk committed Jul 25, 2023
1 parent 9f72b87 commit 36e5581
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions renderdoc/driver/gl/wrappers/gl_emulated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,14 +3254,17 @@ void APIENTRY _glGetTexImage(GLenum target, GLint level, const GLenum format, co
// see what format and type the implementation supports
GLenum implFormat = eGL_NONE, implType = eGL_NONE;

GL.glGetIntegerv(eGL_IMPLEMENTATION_COLOR_READ_FORMAT, (GLint *)&implFormat);
GL.glGetIntegerv(eGL_IMPLEMENTATION_COLOR_READ_TYPE, (GLint *)&implType);

// GL_HALF_FLOAT and GL_HALF_FLOAT_OES have different enum values but are the same otherwise.
// we always use the normal enum ourselves, but if the driver wants the _OES version then just
// use that so we match and can do a direct readback.
if(implType == eGL_HALF_FLOAT_OES && readType == eGL_HALF_FLOAT)
readType = eGL_HALF_FLOAT_OES;
if(!depthFormat)
{
GL.glGetIntegerv(eGL_IMPLEMENTATION_COLOR_READ_FORMAT, (GLint *)&implFormat);
GL.glGetIntegerv(eGL_IMPLEMENTATION_COLOR_READ_TYPE, (GLint *)&implType);

// GL_HALF_FLOAT and GL_HALF_FLOAT_OES have different enum values but are the same
// otherwise. we always use the normal enum ourselves, but if the driver wants the _OES
// version then just use that so we match and can do a direct readback.
if(implType == eGL_HALF_FLOAT_OES && readType == eGL_HALF_FLOAT)
readType = eGL_HALF_FLOAT_OES;
}

if(!depthFormat && implFormat == readFormat && implType == readType)
{
Expand Down

0 comments on commit 36e5581

Please sign in to comment.