Handle GL_SRGB and GL_SRGB_ALPHA as a base format

* This doesn't seem to be legal but it's easy to just tolerate for buggy
  applications.
This commit is contained in:
baldurk
2019-09-09 11:00:29 +01:00
parent ba4ccca62f
commit 8fb2f359ff
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -341,11 +341,13 @@ size_t GetByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum format, GLenum type)
case eGL_RGB:
case eGL_RGB_INTEGER:
case eGL_BGR:
case eGL_BGR_INTEGER: return w * h * d * elemSize * 3;
case eGL_BGR_INTEGER:
case eGL_SRGB: return w * h * d * elemSize * 3;
case eGL_RGBA:
case eGL_RGBA_INTEGER:
case eGL_BGRA:
case eGL_BGRA_INTEGER: return w * h * d * elemSize * 4;
case eGL_BGRA_INTEGER:
case eGL_SRGB_ALPHA: return w * h * d * elemSize * 4;
default: RDCERR("Unhandled Byte Size format %s!", ToStr(format).c_str()); break;
}
+3 -1
View File
@@ -957,6 +957,7 @@ static const format_data formats[] = {
{eGL_RGB, eGL_UNSIGNED_BYTE, 3, 8, 0, 0},
{eGL_RGBA, eGL_UNSIGNED_BYTE, 4, 8, 0, 0},
{eGL_BGRA_EXT, eGL_UNSIGNED_BYTE, 4, 8, 0, 0},
{eGL_SRGB_ALPHA, eGL_UNSIGNED_NORMALIZED, 4, 8, 0, 0},
{eGL_DEPTH_COMPONENT, eGL_NONE, 0, 0, 24, 0},
{eGL_STENCIL_INDEX, eGL_NONE, 0, 0, 0, 8},
{eGL_DEPTH_STENCIL, eGL_NONE, 0, 0, 24, 8},
@@ -1021,7 +1022,8 @@ void APIENTRY _glGetInternalformativ(GLenum target, GLenum internalformat, GLenu
if(pname == eGL_COLOR_ENCODING)
{
if(internalformat == eGL_SRGB8 || internalformat == eGL_SRGB8_ALPHA8)
if(internalformat == eGL_SRGB8 || internalformat == eGL_SRGB8_ALPHA8 ||
internalformat == eGL_SRGB_ALPHA)
*params = eGL_SRGB;
else
*params = eGL_LINEAR;