From: Stanislav Vorobiov Date: Mon, 20 May 2013 14:53:33 +0000 (+0400) Subject: YaGL: Added support for GL_FLOAT and GL_HALF_FLOAT_OES textures X-Git-Tag: TizenStudio_2.0_p2.3~759^2^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23614654642d2cce17e24d3ba6e5b569b020fb1e;p=sdk%2Femulator%2Fqemu.git YaGL: Added support for GL_FLOAT and GL_HALF_FLOAT_OES textures --- diff --git a/hw/yagl_apis/gles/yagl_host_gles_calls.c b/hw/yagl_apis/gles/yagl_host_gles_calls.c index 809b028..2fa69ca 100644 --- a/hw/yagl_apis/gles/yagl_host_gles_calls.c +++ b/hw/yagl_apis/gles/yagl_host_gles_calls.c @@ -46,6 +46,21 @@ YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \ return true +/* + * We can't include GLES2/gl2ext.h here + */ +#define GL_HALF_FLOAT_OES 0x8D61 + +static GLenum yagl_get_actual_type(GLenum type) +{ + switch (type) { + case GL_HALF_FLOAT_OES: + return GL_HALF_FLOAT; + default: + return type; + } +} + static GLint yagl_get_stride(struct yagl_gles_context *ctx, GLuint alignment_type, GLsizei width, @@ -77,10 +92,13 @@ static GLint yagl_get_stride(struct yagl_gles_context *ctx, if (!ctx->pack_depth_stencil) { return GL_INVALID_ENUM; } + if ((type == GL_FLOAT) || (type == GL_HALF_FLOAT_OES)) { + return GL_INVALID_OPERATION; + } num_components = 1; break; case GL_DEPTH_COMPONENT: - if (type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT) { + if ((type != GL_UNSIGNED_SHORT) && (type != GL_UNSIGNED_INT)) { return GL_INVALID_OPERATION; } num_components = 1; @@ -124,6 +142,12 @@ static GLint yagl_get_stride(struct yagl_gles_context *ctx, } bpp = num_components * 4; break; + case GL_FLOAT: + bpp = num_components * 4; + break; + case GL_HALF_FLOAT_OES: + bpp = num_components * 2; + break; default: return GL_INVALID_ENUM; } @@ -1361,6 +1385,7 @@ bool yagl_host_glReadPixels(GLint x, yagl_object_name current_pbo = 0; GLvoid *pixels = NULL; GLsizei stride = 0; + GLenum actual_type = yagl_get_actual_type(type); YAGL_GET_CTX(glReadPixels); @@ -1393,7 +1418,7 @@ bool yagl_host_glReadPixels(GLint x, width, height, format, - type, + actual_type, pixels); if (current_pbo != 0) { @@ -1474,6 +1499,7 @@ bool yagl_host_glTexImage2D(GLenum target, bool res = true; GLvoid *pixels = NULL; GLsizei stride = 0; + GLenum actual_type = yagl_get_actual_type(type); YAGL_GET_CTX(glTexImage2D); @@ -1518,7 +1544,7 @@ bool yagl_host_glTexImage2D(GLenum target, height, border, format, - type, + actual_type, pixels); out: @@ -1612,6 +1638,7 @@ bool yagl_host_glTexSubImage2D(GLenum target, bool res = true; GLvoid *pixels = NULL; GLsizei stride = 0; + GLenum actual_type = yagl_get_actual_type(type); YAGL_GET_CTX(glTexSubImage2D); @@ -1653,7 +1680,7 @@ bool yagl_host_glTexSubImage2D(GLenum target, width, height, format, - type, + actual_type, pixels); if (format == GL_ALPHA) {