From 2c44004f809752f33a1bae8fb880e173e7a50618 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 1 May 2019 14:50:15 +0100 Subject: [PATCH] Add handling for some legacy formats like LUMINANCE/ALPHA * These are still around on GLES so we need to support them. --- renderdoc/driver/gl/gl_common.cpp | 13 +++++++++++-- renderdoc/driver/gl/wrappers/gl_emulated.cpp | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index 1f7bdca1a..8cffefa8e 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -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)) { diff --git a/renderdoc/driver/gl/wrappers/gl_emulated.cpp b/renderdoc/driver/gl/wrappers/gl_emulated.cpp index 22141a255..a08e65df5 100644 --- a/renderdoc/driver/gl/wrappers/gl_emulated.cpp +++ b/renderdoc/driver/gl/wrappers/gl_emulated.cpp @@ -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},