diff options
author | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2013-11-19 15:00:40 +0400 |
---|---|---|
committer | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2013-11-19 15:00:40 +0400 |
commit | f67330b88c751272eed8f4a2125740af3d31d1f6 (patch) | |
tree | 5fce9b63c03c2845568f5d58b2e5bf38b4003ffa /GLESv1_CM/yagl_gles1_context.c | |
parent | 4477638a9c31f7dc8dce5509d4a3216c2436909d (diff) | |
download | emulator-yagl-f67330b88c751272eed8f4a2125740af3d31d1f6.tar.gz emulator-yagl-f67330b88c751272eed8f4a2125740af3d31d1f6.tar.bz2 emulator-yagl-f67330b88c751272eed8f4a2125740af3d31d1f6.zip |
YaGL: ETC2 compressed texture formats implemented
We'll try to use host's implementation when possible, when
it's not possible we'll fall back to software implementation
which is taken from mesa. The code in mesa is in turn taken
from LunarG and is licensed under MIT license which allows
us to use it
Change-Id: I006dc334c18fa4ecc5637230e46186f9710807da
Diffstat (limited to 'GLESv1_CM/yagl_gles1_context.c')
-rw-r--r-- | GLESv1_CM/yagl_gles1_context.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/GLESv1_CM/yagl_gles1_context.c b/GLESv1_CM/yagl_gles1_context.c index 18ae84d..227363a 100644 --- a/GLESv1_CM/yagl_gles1_context.c +++ b/GLESv1_CM/yagl_gles1_context.c @@ -15,6 +15,10 @@ #include <stdlib.h> #include <assert.h> +#define YAGL_SET_ERR(err) \ + yagl_gles_context_set_error(ctx, err); \ + YAGL_LOG_ERROR("error = 0x%X", err) + #define YAGL_GLES1_NUM_COMP_TEX_FORMATS 10 static const GLchar *blend_subtract_ext = "GL_OES_blend_subtract"; @@ -637,21 +641,24 @@ static void yagl_gles1_cpal_tex_uncomp_and_apply(struct yagl_gles_context *ctx, } } -static GLenum yagl_gles1_context_compressed_tex_image(struct yagl_gles_context *ctx, - GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const GLvoid *data) +static void yagl_gles1_context_compressed_tex_image(struct yagl_gles_context *ctx, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const GLvoid *data) { const int max_tex_size = ((struct yagl_gles1_context*)ctx)->max_tex_size; YaglGles1PalFmtDesc fmt_desc; + YAGL_LOG_FUNC_SET(glCompressedTexImage2D); + if (target != GL_TEXTURE_2D) { - return GL_INVALID_ENUM; + YAGL_SET_ERR(GL_INVALID_ENUM); + return; } switch (internalformat) { @@ -662,7 +669,8 @@ static GLenum yagl_gles1_context_compressed_tex_image(struct yagl_gles_context * !yagl_gles1_tex_dims_valid(width, height, max_tex_size) || border != 0 || (imageSize != yagl_gles1_cpal_tex_size(&fmt_desc, width, height, -level))) { - return GL_INVALID_VALUE; + YAGL_SET_ERR(GL_INVALID_VALUE); + return; } yagl_gles1_cpal_tex_uncomp_and_apply(ctx, @@ -673,10 +681,26 @@ static GLenum yagl_gles1_context_compressed_tex_image(struct yagl_gles_context * data); break; default: - return GL_INVALID_ENUM; + YAGL_SET_ERR(GL_INVALID_ENUM); + return; } +} + +static void yagl_gles1_context_compressed_tex_sub_image(struct yagl_gles_context *ctx, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const GLvoid *data) +{ + YAGL_LOG_FUNC_SET(glCompressedTexSubImage2D); - return GL_NO_ERROR; + /* No formats are supported by this call in GLES1 API */ + YAGL_SET_ERR(GL_INVALID_OPERATION); } static int yagl_gles1_context_enable(struct yagl_gles_context *ctx, @@ -1279,6 +1303,7 @@ struct yagl_client_context *yagl_gles1_context_create(struct yagl_sharegroup *sg gles1_ctx->base.create_arrays = &yagl_gles1_context_create_arrays; gles1_ctx->base.get_string = &yagl_gles1_context_get_string; gles1_ctx->base.compressed_tex_image = &yagl_gles1_context_compressed_tex_image; + gles1_ctx->base.compressed_tex_sub_image = &yagl_gles1_context_compressed_tex_sub_image; gles1_ctx->base.enable = &yagl_gles1_context_enable; gles1_ctx->base.is_enabled = &yagl_gles1_context_is_enabled; gles1_ctx->base.get_integerv = &yagl_gles1_context_get_integerv; |