Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62b22cb0 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[GLUtils] Use GL_* types for FP16 bitmap.

This patch makes sure getInternalFormat() returns GL_RGBA16F for FP16 bitmap,
getType() should return GL_HALF_FLOAT per spec
https://www.khronos.org/registry/OpenGL/extensions/OES/OES_vertex_half_float.txt,
finally, make sure checkFormat should enforce the correct format and type.

BUG: 72065799
Test: none
Change-Id: I63e79e11b1668b455e64ce20c6db806a1179fb6c
parent 3fb6ea96
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
#include <ETC1/etc1.h>

#include <SkBitmap.h>
@@ -641,7 +642,7 @@ static int checkFormat(SkColorType colorType, int format, int type)
            }
            break;
        case kRGBA_F16_SkColorType:
            if (type == GL_HALF_FLOAT_OES && format == PIXEL_FORMAT_RGBA_FP16)
            if (type == GL_HALF_FLOAT && format == GL_RGBA16F)
                return 0;
            break;
        default:
@@ -662,7 +663,7 @@ static int getInternalFormat(SkColorType colorType)
        case kRGB_565_SkColorType:
            return GL_RGB;
        case kRGBA_F16_SkColorType:
            return PIXEL_FORMAT_RGBA_FP16;
            return GL_RGBA16F;
        default:
            return -1;
    }
@@ -680,7 +681,7 @@ static int getType(SkColorType colorType)
        case kRGB_565_SkColorType:
            return GL_UNSIGNED_SHORT_5_6_5;
        case kRGBA_F16_SkColorType:
            return GL_HALF_FLOAT_OES;
            return GL_HALF_FLOAT;
        default:
            return -1;
    }