YaGL: GL_EXT_texture_format_BGRA8888 implementation bug fixed
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Mon, 12 Aug 2013 12:01:49 +0000 (16:01 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Mon, 12 Aug 2013 12:01:49 +0000 (16:01 +0400)
GL_BGRA is a valid value for format, but not for internalformat, fixed it

hw/yagl_apis/gles/yagl_host_gles_calls.c

index 21f9b7a..2c0add5 100644 (file)
@@ -61,6 +61,16 @@ static GLenum yagl_get_actual_type(GLenum type)
     }
 }
 
+static GLint yagl_get_actual_internalformat(GLint internalformat)
+{
+    switch (internalformat) {
+    case GL_BGRA:
+        return GL_RGBA;
+    default:
+        return internalformat;
+    }
+}
+
 static GLint yagl_get_stride(struct yagl_gles_context *ctx,
                              GLuint alignment_type,
                              GLsizei width,
@@ -1500,6 +1510,7 @@ bool yagl_host_glTexImage2D(GLenum target,
     GLvoid *pixels = NULL;
     GLsizei stride = 0;
     GLenum actual_type = yagl_get_actual_type(type);
+    GLint actual_internalformat = yagl_get_actual_internalformat(internalformat);
 
     YAGL_GET_CTX(glTexImage2D);
 
@@ -1545,7 +1556,7 @@ bool yagl_host_glTexImage2D(GLenum target,
 
     ctx->driver->TexImage2D(target,
                             level,
-                            internalformat,
+                            actual_internalformat,
                             width,
                             height,
                             border,