diff options
author | Yahan Zhou <yahan@google.com> | 2018-04-23 16:59:43 -0700 |
---|---|---|
committer | Yahan Zhou <yahan@google.com> | 2018-04-23 18:11:30 -0700 |
commit | 951054fd8a26ae5111220c346b87aebab60cd9eb (patch) | |
tree | 6e91b811dfa172da092dc9a3ceaf59c2f5406bc2 | |
parent | 93eee36521f0e34a823faad4e5570662042baedd (diff) | |
download | device_generic_goldfish-opengl-951054fd8a26ae5111220c346b87aebab60cd9eb.tar.gz device_generic_goldfish-opengl-951054fd8a26ae5111220c346b87aebab60cd9eb.tar.bz2 device_generic_goldfish-opengl-951054fd8a26ae5111220c346b87aebab60cd9eb.zip |
Support GL_RGBA16F and GL_RGB10_A2 pixel size
Also, GL_RGB10_A2 should work with GL_UNSIGNED_INT_2_10_10_10_REV instead of
GL_UNSIGNED_INT_10_10_10_2.
This cl does not impact real devices.
BUG: 77977729
Test: atest CtsNativeHardwareTestCases
Change-Id: I01fe508d741b04a7107f0a628b5ccb4ba320daa0
-rw-r--r-- | shared/OpenglCodecCommon/glUtils.cpp | 29 | ||||
-rw-r--r-- | system/gralloc/gralloc.cpp | 13 |
2 files changed, 30 insertions, 12 deletions
diff --git a/shared/OpenglCodecCommon/glUtils.cpp b/shared/OpenglCodecCommon/glUtils.cpp index baa7c234..3136d139 100644 --- a/shared/OpenglCodecCommon/glUtils.cpp +++ b/shared/OpenglCodecCommon/glUtils.cpp @@ -463,6 +463,10 @@ void glUtilsWritePackPointerData(void* _stream, unsigned char *src, } } +#ifndef GL_RGBA16F +#define GL_RGBA16F 0x881A +#endif // GL_RGBA16F + int glUtilsPixelBitSize(GLenum format, GLenum type) { int components = 0; @@ -474,7 +478,16 @@ int glUtilsPixelBitSize(GLenum format, GLenum type) componentsize = 8; break; case GL_SHORT: + case GL_HALF_FLOAT: case GL_UNSIGNED_SHORT: + componentsize = 16; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_FIXED: + componentsize = 32; + break; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_5_5_5_1: @@ -483,15 +496,12 @@ int glUtilsPixelBitSize(GLenum format, GLenum type) case GL_RGBA4_OES: pixelsize = 16; break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - case GL_FIXED: + case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_OES: pixelsize = 32; break; default: - ERR("glUtilsPixelBitSize: unknown pixel type - assuming pixel data 0\n"); + ERR("glUtilsPixelBitSize: unknown pixel type %d - assuming pixel data 0\n", type); componentsize = 0; } @@ -521,11 +531,16 @@ int glUtilsPixelBitSize(GLenum format, GLenum type) case GL_BGRA_EXT: components = 4; break; + case GL_RGBA16F: + pixelsize = 64; + break; default: - ERR("glUtilsPixelBitSize: unknown pixel format...\n"); + ERR("glUtilsPixelBitSize: unknown pixel format %d\n", format); components = 0; } - pixelsize = components * componentsize; + if (pixelsize == 0) { + pixelsize = components * componentsize; + } } return pixelsize; diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp index ddae86a4..986118ae 100644 --- a/system/gralloc/gralloc.cpp +++ b/system/gralloc/gralloc.cpp @@ -421,12 +421,15 @@ static void updateHostColorBuffer(cb_handle_t* cb, #ifndef GL_RGBA16F #define GL_RGBA16F 0x881A #endif // GL_RGBA16F -#ifndef GL_UNSIGNED_INT_10_10_10_2 -#define GL_UNSIGNED_INT_10_10_10_2 0x8DF6 -#endif // GL_UNSIGNED_INT_10_10_10_2 #ifndef GL_HALF_FLOAT #define GL_HALF_FLOAT 0x140B #endif // GL_HALF_FLOAT +#ifndef GL_RGB10_A2 +#define GL_RGB10_A2 0x8059 +#endif // GL_RGB10_A2 +#ifndef GL_UNSIGNED_INT_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#endif // GL_UNSIGNED_INT_2_10_10_10_REV // // gralloc device functions (alloc interface) // @@ -537,8 +540,8 @@ static int gralloc_alloc(alloc_device_t* dev, break; case HAL_PIXEL_FORMAT_RGBA_1010102: bpp = 4; - glFormat = GL_RGBA; - glType = GL_UNSIGNED_INT_10_10_10_2; + glFormat = GL_RGB10_A2; + glType = GL_UNSIGNED_INT_2_10_10_10_REV; break; #endif // PLATFORM_SDK_VERSION >= 26 #if PLATFORM_SDK_VERSION >= 21 |