Add handling for some legacy formats like LUMINANCE/ALPHA

* These are still around on GLES so we need to support them.
This commit is contained in:
baldurk
2019-05-01 21:11:49 +01:00
parent 83501f8226
commit 2c44004f80
2 changed files with 14 additions and 2 deletions
+11 -2
View File
@@ -1279,7 +1279,8 @@ size_t GLTypeSize(GLenum type)
case eGL_HALF_FLOAT: return 2;
case eGL_UNSIGNED_INT:
case eGL_INT:
case eGL_FLOAT: return 4;
case eGL_FLOAT:
case eGL_UNSIGNED_INT_8_8_8_8_REV: return 4;
case eGL_DOUBLE: return 8;
default: RDCWARN("Unhandled element type %s", ToStr(type).c_str());
}
@@ -1707,13 +1708,21 @@ ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt)
}
// special handling for formats that don't query neatly
if(fmt == eGL_LUMINANCE8_EXT || fmt == eGL_INTENSITY8_EXT || fmt == eGL_ALPHA8_EXT)
if(fmt == eGL_LUMINANCE8_EXT || fmt == eGL_INTENSITY8_EXT || fmt == eGL_ALPHA8_EXT ||
fmt == eGL_LUMINANCE || fmt == eGL_ALPHA)
{
ret.compByteWidth = 1;
ret.compCount = 1;
ret.compType = CompType::UNorm;
return ret;
}
else if(fmt == eGL_LUMINANCE8_ALPHA8_EXT || fmt == eGL_LUMINANCE_ALPHA)
{
ret.compByteWidth = 1;
ret.compCount = 2;
ret.compType = CompType::UNorm;
return ret;
}
if(IsCompressedFormat(fmt))
{
@@ -950,7 +950,10 @@ static const format_data formats[] = {
// unsized formats
{eGL_RED, eGL_UNSIGNED_BYTE, 1, 8, 0, 0},
{eGL_ALPHA, eGL_UNSIGNED_BYTE, 1, 8, 0, 0},
{eGL_LUMINANCE, eGL_UNSIGNED_BYTE, 1, 8, 0, 0},
{eGL_RG, eGL_UNSIGNED_BYTE, 2, 8, 0, 0},
{eGL_LUMINANCE_ALPHA, eGL_UNSIGNED_BYTE, 2, 8, 0, 0},
{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},