Refine pixel format

a. make RGB565, RGB5A1 identical between GL and MTL backend
b. make texture internal format compatible on GLES-2.0 ONLY GPU devices
This commit is contained in:
halx99 2020-10-20 23:27:20 +08:00
parent 59b1bd30e8
commit dd98b13a9d
4 changed files with 44 additions and 53 deletions

View File

@ -204,8 +204,9 @@ namespace backend { namespace PixelFormatUtils {
} }
} }
#if 0 // unused
// IIIIIIIIAAAAAAAA -> BBBBBGGG GGGRRRR // IIIIIIIIAAAAAAAA -> BBBBBGGG GGGRRRR
void convertLA8ToBGR565(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertLA8ToBGR565(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t* out16 = (uint16_t*)outData; uint16_t* out16 = (uint16_t*)outData;
for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2) for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2)
@ -217,7 +218,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// IIIIIIIIAAAAAAAA -> BBBBBGGG GGRRRRRA // IIIIIIIIAAAAAAAA -> BBBBBGGG GGRRRRRA
void convertLA8ToBGR5A1(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertLA8ToBGR5A1(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t* out16 = (uint16_t*)outData; uint16_t* out16 = (uint16_t*)outData;
for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2) for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2)
@ -230,7 +231,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// IIIIIIIIAAAAAAAA -> AAAABBBB GGGGRRRR // IIIIIIIIAAAAAAAA -> AAAABBBB GGGGRRRR
void convertLA8ToABGR4(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertLA8ToABGR4(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t* out16 = (uint16_t*)outData; uint16_t* out16 = (uint16_t*)outData;
for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2) for (ssize_t i = 0, l = dataLen - 1; i < l; i += 2)
@ -241,7 +242,7 @@ namespace backend { namespace PixelFormatUtils {
| (data[i + 1] & 0x00F0) >> 4; //A | (data[i + 1] & 0x00F0) >> 4; //A
} }
} }
#endif
// IIIIIIII -> RRRRRGGGGGBBBBBA // IIIIIIII -> RRRRRGGGGGBBBBBA
void convertL8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertL8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData)
@ -256,8 +257,9 @@ namespace backend { namespace PixelFormatUtils {
} }
} }
#if 0 // unused
/// IIIIIIII -> BBBBBGGG GGRRRRRA /// IIIIIIII -> BBBBBGGG GGRRRRRA
void convertL8ToBGR5A1(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertL8ToBGR5A1(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t *out16 = (uint16_t*)outData; uint16_t *out16 = (uint16_t*)outData;
for (size_t i = 0; i < dataLen; ++i) for (size_t i = 0; i < dataLen; ++i)
@ -270,7 +272,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// IIIIIIIII -> BBBBBGGG GGGRRRRR // IIIIIIIII -> BBBBBGGG GGGRRRRR
void convertL8ToBGR565(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertL8ToBGR565(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t *out16 = (uint16_t*)outData; uint16_t *out16 = (uint16_t*)outData;
for (size_t i = 0; i < dataLen; ++i) for (size_t i = 0; i < dataLen; ++i)
@ -283,7 +285,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// IIIIIIIII -> AAAABBBBB GGGGRRRR // IIIIIIIII -> AAAABBBBB GGGGRRRR
void convertL8ToABGR4(const unsigned char* data, size_t dataLen, unsigned char* outData) static void convertL8ToABGR4(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t *out16 = (uint16_t*)outData; uint16_t *out16 = (uint16_t*)outData;
for (size_t i = 0; i < dataLen; ++i) for (size_t i = 0; i < dataLen; ++i)
@ -294,6 +296,7 @@ namespace backend { namespace PixelFormatUtils {
| 0x000F; | 0x000F;
} }
} }
#endif
// IIIIIIIIAAAAAAAA -> RRRRRGGGGGBBBBBA // IIIIIIIIAAAAAAAA -> RRRRRGGGGGBBBBBA
void convertLA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertLA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData)
@ -479,9 +482,9 @@ namespace backend { namespace PixelFormatUtils {
| 0x01; //A | 0x01; //A
} }
} }
#if 0 // unused
// RRRRRRRRGGGGGGGGBBBBBBBB -> BBBBBGGG GGGRRRRR // RRRRRRRRGGGGGGGGBBBBBBBB -> BBBBBGGG GGGRRRRR
void convertRGB8ToB5G6R5(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGB8ToBGR565(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*) out; uint16_t *outData = (uint16_t*) out;
for(size_t i = 0;i < dataLen ; i += 3) for(size_t i = 0;i < dataLen ; i += 3)
@ -493,7 +496,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// RRRRRRRRGGGGGGGGBBBBBBBB -> BBBBBGGG GGRRRRRA // RRRRRRRRGGGGGGGGBBBBBBBB -> BBBBBGGG GGRRRRRA
void convertRGB8ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGB8ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*) out; uint16_t *outData = (uint16_t*) out;
for(size_t i = 0;i < dataLen ; i += 3) for(size_t i = 0;i < dataLen ; i += 3)
@ -505,7 +508,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// RRRRRRRRGGGGGGGGBBBBBBBB -> AAAABBBB GGGGRRRR // RRRRRRRRGGGGGGGGBBBBBBBB -> AAAABBBB GGGGRRRR
void convertRGB8ToABGR4(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGB8ToABGR4(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*) out; uint16_t *outData = (uint16_t*) out;
for(size_t i = 0;i < dataLen ; i += 3) for(size_t i = 0;i < dataLen ; i += 3)
@ -516,6 +519,7 @@ namespace backend { namespace PixelFormatUtils {
0x000F; //a 0x000F; //a
} }
} }
#endif
// RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> RRRRRGGG GGBBBBBA // RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> RRRRRGGG GGBBBBBA
void convertRGBA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertRGBA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData)
@ -530,8 +534,9 @@ namespace backend { namespace PixelFormatUtils {
} }
} }
#if 0 // unused
// RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> BBBBBGGG GGGRRRR // RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> BBBBBGGG GGGRRRR
void convertRGBA8ToBGR565(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGBA8ToBGR565(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*)out; uint16_t *outData = (uint16_t*)out;
const size_t pixelCnt = dataLen / 4; const size_t pixelCnt = dataLen / 4;
@ -544,7 +549,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> AAAABBBB GGGGRRRR // RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> AAAABBBB GGGGRRRR
void convertRGBA8ToABGR4(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGBA8ToABGR4(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*)out; uint16_t *outData = (uint16_t*)out;
for(size_t i=0;i < dataLen; i+=4 ) for(size_t i=0;i < dataLen; i+=4 )
@ -557,7 +562,7 @@ namespace backend { namespace PixelFormatUtils {
} }
// RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> BBBBBGGG GGRRRRRA // RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA -> BBBBBGGG GGRRRRRA
void convertRGBA8ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGBA8ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
uint16_t *outData = (uint16_t*)out; uint16_t *outData = (uint16_t*)out;
for(size_t i = 0; i < dataLen; i += 4) for(size_t i = 0; i < dataLen; i += 4)
@ -568,7 +573,7 @@ namespace backend { namespace PixelFormatUtils {
((data[i + 3] & 0x80) << 8); //a ((data[i + 3] & 0x80) << 8); //a
} }
} }
#endif
void convertRGB5A1ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertRGB5A1ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
@ -585,8 +590,9 @@ namespace backend { namespace PixelFormatUtils {
} }
} }
#if 0 // unused
// ABBBBBGG GGGRRRRR -> BBBBBGGG GGRRRRRA // ABBBBBGG GGGRRRRR -> BBBBBGGG GGRRRRRA
void convertRGB5A1ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out) static void convertRGB5A1ToBGR5A1(const unsigned char *data, size_t dataLen, unsigned char *out)
{ {
const size_t pixelLen = dataLen / 2; const size_t pixelLen = dataLen / 2;
const uint16_t *inData = (uint16_t*) data; const uint16_t *inData = (uint16_t*) data;
@ -598,7 +604,7 @@ namespace backend { namespace PixelFormatUtils {
outData[i] = (pixel >> 1) | ((pixel & 0x0001) << 15); outData[i] = (pixel >> 1) | ((pixel & 0x0001) << 15);
} }
} }
#endif
void convertRGB565ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertRGB565ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
@ -615,10 +621,6 @@ namespace backend { namespace PixelFormatUtils {
} }
} }
// BBBBBGGG GGGRRRRR -> BBBGGG GGGRRRRR
// void convertRGB565ToB5G6R5(const unsigned char *data, ssize_t dataLen, unsigned char *out)
void convertRGBA4ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertRGBA4ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
uint16_t *inData = (uint16_t*)data; uint16_t *inData = (uint16_t*)data;
@ -635,9 +637,6 @@ namespace backend { namespace PixelFormatUtils {
} }
// AAAABBBBGGGGRRRR -> AAAABBBB GGGGRRRR
//void convertRGBA4ToABGR4(const unsigned char *data, ssize_t dataLen, unsigned char *out)
void convertA8ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData) void convertA8ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData)
{ {
for (size_t i = 0; i < dataLen; i++) for (size_t i = 0; i < dataLen; i++)
@ -683,17 +682,17 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGB565: case PixelFormat::RGB565:
*outDataLen = dataLen*2; *outDataLen = dataLen*2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertL8ToBGR565(data, dataLen, *outData); convertL8ToRGB565(data, dataLen, *outData);
break; break;
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
*outDataLen = dataLen * 2; *outDataLen = dataLen * 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertL8ToABGR4(data, dataLen, *outData); convertL8ToRGBA4(data, dataLen, *outData);
break; break;
case PixelFormat::RGB5A1: case PixelFormat::RGB5A1:
*outDataLen = dataLen * 2; *outDataLen = dataLen * 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertL8ToBGR5A1(data, dataLen, *outData); convertL8ToRGB5A1(data, dataLen, *outData);
break; break;
case PixelFormat::A8: case PixelFormat::A8:
*outData = (unsigned char*)data; *outData = (unsigned char*)data;
@ -736,17 +735,17 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGB565: case PixelFormat::RGB565:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertLA8ToBGR565(data, dataLen, *outData); convertLA8ToRGB565(data, dataLen, *outData);
break; break;
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertLA8ToABGR4(data, dataLen, *outData); convertLA8ToRGBA4(data, dataLen, *outData);
break; break;
case PixelFormat::RGB5A1: case PixelFormat::RGB5A1:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertLA8ToBGR5A1(data, dataLen, *outData); convertLA8ToRGB5A1(data, dataLen, *outData);
break; break;
case PixelFormat::A8: case PixelFormat::A8:
*outDataLen = dataLen/2; *outDataLen = dataLen/2;
@ -785,17 +784,17 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGB565: case PixelFormat::RGB565:
*outDataLen = dataLen/3*2; *outDataLen = dataLen/3*2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertRGB8ToB5G6R5(data, dataLen, *outData); convertRGB8ToRGB565(data, dataLen, *outData);
break; break;
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
*outDataLen = dataLen / 3 * 2; *outDataLen = dataLen / 3 * 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertRGB8ToABGR4(data, dataLen, *outData); convertRGB8ToRGBA4(data, dataLen, *outData);
break; break;
case PixelFormat::RGB5A1: case PixelFormat::RGB5A1:
*outDataLen = dataLen / 3 * 2; *outDataLen = dataLen / 3 * 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertRGB8ToBGR5A1(data, dataLen, *outData); convertRGB8ToRGB5A1(data, dataLen, *outData);
break; break;
case PixelFormat::A8: case PixelFormat::A8:
*outDataLen = dataLen/3; *outDataLen = dataLen/3;
@ -839,18 +838,17 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGB565: case PixelFormat::RGB565:
*outDataLen = dataLen/2; *outDataLen = dataLen/2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertRGBA8ToBGR565(data, dataLen, *outData); convertRGBA8ToRGB565(data, dataLen, *outData);
break; break;
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
*outDataLen = dataLen / 2; *outDataLen = dataLen / 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
// convertRGBA8ToABGR4(data, dataLen, *outData); convertRGBA8ToRGBA4(data, dataLen, *outData);
convertRGBA8ToRGBA4(data, dataLen, *outData); // == MTLPixelFormatABGR4Unorm ??
break; break;
case PixelFormat::RGB5A1: case PixelFormat::RGB5A1:
*outDataLen = dataLen / 2; *outDataLen = dataLen / 2;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen));
convertRGBA8ToBGR5A1(data, dataLen, *outData); convertRGBA8ToRGB5A1(data, dataLen, *outData);
break; break;
case PixelFormat::A8: case PixelFormat::A8:
*outDataLen = dataLen/4; *outDataLen = dataLen/4;
@ -893,8 +891,7 @@ namespace backend { namespace PixelFormatUtils {
break; break;
case PixelFormat::RGB5A1: case PixelFormat::RGB5A1:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); *outData = (unsigned char *)data;
convertRGB5A1ToBGR5A1(data, dataLen, *outData);
break; break;
default: default:
// unsupported conversion or don't need to convert // unsupported conversion or don't need to convert
@ -922,8 +919,6 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGB565: case PixelFormat::RGB565:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char *)data; *outData = (unsigned char *)data;
// they are identical
//convertRGB565ToB5G6R5(data, dataLen, *outData);
break; break;
default: default:
// unsupported conversion or don't need to convert // unsupported conversion or don't need to convert
@ -974,7 +969,6 @@ namespace backend { namespace PixelFormatUtils {
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
*outDataLen = dataLen; *outDataLen = dataLen;
*outData = (unsigned char *)data; *outData = (unsigned char *)data;
//convertRGBA4ToABGR4(data, dataLen, *outData);
break; break;
default: default:
// unsupported conversion or don't need to convert // unsupported conversion or don't need to convert
@ -1046,13 +1040,10 @@ namespace backend { namespace PixelFormatUtils {
return convertRGB5A1ToFormat(data, dataLen, format, outData, outDataLen); return convertRGB5A1ToFormat(data, dataLen, format, outData, outDataLen);
case PixelFormat::RGB565: case PixelFormat::RGB565:
return convertRGB565ToFormat(data, dataLen, format, outData, outDataLen); return convertRGB565ToFormat(data, dataLen, format, outData, outDataLen);
#ifdef CC_USE_METAL
case PixelFormat::RGBA4: case PixelFormat::RGBA4:
return convertRGBA4ToFormat(data, dataLen, format, outData, outDataLen); return convertRGBA4ToFormat(data, dataLen, format, outData, outDataLen);
case PixelFormat::A8: case PixelFormat::A8:
return convertA8ToFormat(data, dataLen, format, outData, outDataLen); return convertA8ToFormat(data, dataLen, format, outData, outDataLen);
#endif
case PixelFormat::BGRA8: case PixelFormat::BGRA8:
return convertBGRA8ToFormat(data, dataLen, format, outData, outDataLen); return convertBGRA8ToFormat(data, dataLen, format, outData, outDataLen);
default: default:

View File

@ -103,7 +103,7 @@ namespace backend {
void convertRGBA8ToRGBA4(const unsigned char* data, size_t dataLen, unsigned char* outData); void convertRGBA8ToRGBA4(const unsigned char* data, size_t dataLen, unsigned char* outData);
void convertRGBA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData); void convertRGBA8ToRGB5A1(const unsigned char* data, size_t dataLen, unsigned char* outData);
//XXX to RGBA8
void convertRGB5A1ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData); void convertRGB5A1ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData);
void convertRGB565ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData); void convertRGB565ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData);
void convertA8ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData); void convertA8ToRGBA8(const unsigned char* data, size_t dataLen, unsigned char* outData);

View File

@ -102,7 +102,7 @@ static GPUTextureFormatInfo s_textureFormats[] =
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8 { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8
{ MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid }, // R5G6B5 { MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid }, // R5G6B5
{ MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid }, // RGBA4 { MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid }, // RGBA4
{ MTLPixelFormat(43/*BGR5A1Unorm*/), MTLPixelFormatInvalid }, // RGB5A1 { MTLPixelFormat(41/*A1BGR5Unorm*/), MTLPixelFormatInvalid }, // RGB5A1
{ MTLPixelFormatA8Unorm, MTLPixelFormatInvalid }, // A8 { MTLPixelFormatA8Unorm, MTLPixelFormatInvalid }, // A8
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // L8 { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // L8
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // LA8 { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // LA8

View File

@ -95,9 +95,9 @@ static GPUTextureFormatInfo s_textureFormats[] =
{ GL_RGBA, GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, }, // RGBA8 { GL_RGBA, GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, }, // RGBA8
{ GL_RGBA, GL_SRGB8_ALPHA8_EXT, GL_BGRA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE, }, // BGRA8 { GL_RGBA, GL_SRGB8_ALPHA8_EXT, GL_BGRA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE, }, // BGRA8
{ GL_RGB, GL_SRGB_EXT, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, }, // RGB8 { GL_RGB, GL_SRGB_EXT, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, }, // RGB8
{ GL_RGB565, GL_ZERO, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565 TO-CHECK: match to MTLPixelFormatB5G6R5Unorm { GL_RGB, GL_ZERO, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565 === MTLPixelFormatB5G6R5Unorm
{ GL_RGBA, GL_ZERO, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4}, // RGBA4 === MTLPixelFormatABGR4Unorm { GL_RGBA, GL_ZERO, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4}, // RGBA4 === MTLPixelFormatABGR4Unorm
{ GL_RGB5_A1, GL_ZERO, GL_BGRA_EXT, GL_BGRA_EXT/*GL_BGRA_EXT*/, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT}, // RGB5A1 TO-CHECK: match to MTLPixelFormatBGR5A1Unorm { GL_RGBA, GL_ZERO, GL_RGBA, GL_RGBA/*GL_BGRA_EXT*/, GL_UNSIGNED_SHORT_5_5_5_1}, // RGB5A1 === MTLPixelFormatA1BGR5Unorm
{ GL_ALPHA, GL_ZERO, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, }, // A8 { GL_ALPHA, GL_ZERO, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, }, // A8
{ GL_LUMINANCE, GL_ZERO, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, }, // L8 { GL_LUMINANCE, GL_ZERO, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, }, // L8
{ GL_LUMINANCE_ALPHA, GL_ZERO, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, }, // LA8 { GL_LUMINANCE_ALPHA, GL_ZERO, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, }, // LA8