Convert GL_HALF_FLOAT_OES to GL_HALF_FLOAT if needed.
They have different values and the desktop is not aware of the OES one.
Change-Id: I99e322f0efaba03fa9fad3ad1587461447a1305b
diff --git a/gapid/gfxapi/gles/compat.go b/gapid/gfxapi/gles/compat.go
index 88c7ba9..9b5494f 100644
--- a/gapid/gfxapi/gles/compat.go
+++ b/gapid/gfxapi/gles/compat.go
@@ -82,7 +82,8 @@
}
type features struct {
- halfFloatOES support // support for GL_OES_vertex_half_float
+ vertexHalfFloatOES support // support for GL_OES_vertex_half_float
+ textureHalfFloatOES support // support for GL_OES_texture_half_float
eglImageExternal support // support for GL_OES_EGL_image_external
vertexArrayObjects support // support for VBOs
supportGenerateMipmapHint bool // support for GL_GENERATE_MIPMAP_HINT
@@ -105,7 +106,8 @@
}
f := features{
- halfFloatOES: ext.get("GL_OES_vertex_half_float"),
+ vertexHalfFloatOES: ext.get("GL_OES_vertex_half_float"),
+ textureHalfFloatOES: ext.get("GL_OES_texture_half_float"),
eglImageExternal: ext.get("GL_OES_EGL_image_external"),
uncompressedTextureFormats: utfs,
compressedTextureFormats: getSupportedCompressedTextureFormats(ext),
@@ -262,7 +264,7 @@
// TODO: glVertexAttribIPointer
case *GlVertexAttribPointer:
- if a.Type == GLenum_GL_HALF_FLOAT_OES && target.halfFloatOES == unsupported {
+ if a.Type == GLenum_GL_HALF_FLOAT_OES && target.vertexHalfFloatOES == unsupported {
// Convert GL_HALF_FLOAT_OES to GL_HALF_FLOAT_ARB.
a = NewGlVertexAttribPointer(a.Location, a.Size, GLenum_GL_HALF_FLOAT_ARB, a.Normalized, a.Stride, memory.Pointer(a.Data))
}
@@ -356,19 +358,33 @@
}
case *GlTexImage2D:
- if _, supported := target.uncompressedTextureFormats[a.Format]; !supported {
- if err := convertTexImage2DtoRGBA(ctx, i, a, s, d, out); err == nil {
- return
+ {
+ a := *a
+ if a.Type == GLenum_GL_HALF_FLOAT_OES && target.textureHalfFloatOES == unsupported {
+ // Half-float made it to core desktop and ES specification, but it was renumbered.
+ a.Type = GLenum_GL_HALF_FLOAT
}
- ctx.Fail(err, "Converting texture")
+ if _, supported := target.uncompressedTextureFormats[a.Format]; !supported {
+ if err := convertTexImage2DtoRGBA(ctx, i, &a, s, d, out); err == nil {
+ return
+ }
+ ctx.Fail(err, "Converting texture")
+ }
}
case *GlTexSubImage2D:
- if _, supported := target.uncompressedTextureFormats[a.Format]; !supported {
- if err := convertTexSubImage2DtoRGBA(ctx, i, a, s, d, out); err == nil {
- return
+ {
+ a := *a
+ if a.Type == GLenum_GL_HALF_FLOAT_OES && target.textureHalfFloatOES == unsupported {
+ // Half-float made it to core desktop and ES specification, but it was renumbered.
+ a.Type = GLenum_GL_HALF_FLOAT
}
- ctx.Fail(err, "Converting texture")
+ if _, supported := target.uncompressedTextureFormats[a.Format]; !supported {
+ if err := convertTexSubImage2DtoRGBA(ctx, i, &a, s, d, out); err == nil {
+ return
+ }
+ ctx.Fail(err, "Converting texture")
+ }
}
case *GlCompressedTexImage2D: