YaGL: implement textures enabling/disabling with glEnable/glDisable
authorIgor Mitsyanko <i.mitsyanko@samsung.com>
Thu, 20 Dec 2012 15:28:44 +0000 (19:28 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Mon, 15 Apr 2013 11:24:18 +0000 (15:24 +0400)
Currently this is not used in any way. Android openGL uses this information for
implementing  OES_draw_texture extension API functions glDrawTex*OES(), which
we do not support.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
hw/yagl_apis/gles/yagl_gles_context.c
hw/yagl_apis/gles/yagl_gles_context.h
hw/yagl_apis/gles/yagl_gles_texture_unit.h
hw/yagl_apis/gles/yagl_host_gles_calls.c

index 9a87e7e..b3ea14f 100644 (file)
@@ -387,6 +387,17 @@ struct yagl_gles_texture_target_state
     return &yagl_gles_context_get_active_texture_unit(ctx)->target_states[texture_target];
 }
 
+void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx,
+               yagl_gles_texture_target texture_target, bool enabled)
+{
+    struct yagl_gles_texture_target_state *texture_target_state;
+
+    texture_target_state =
+            yagl_gles_context_get_active_texture_target_state(ctx,
+                                                              texture_target);
+    texture_target_state->enabled = enabled;
+}
+
 void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx,
                                     yagl_gles_texture_target texture_target,
                                     struct yagl_gles_texture *texture,
index 1c2cffb..146c2c4 100644 (file)
@@ -160,6 +160,9 @@ struct yagl_gles_texture_target_state
     *yagl_gles_context_get_active_texture_target_state(struct yagl_gles_context *ctx,
                                                        yagl_gles_texture_target texture_target);
 
+void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx,
+               yagl_gles_texture_target texture_target, bool enabled);
+
 void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx,
                                     yagl_gles_texture_target texture_target,
                                     struct yagl_gles_texture *texture,
index 037cdb5..c683a37 100644 (file)
@@ -13,7 +13,7 @@ struct yagl_gles_texture_target_state
 
     /*
      * For GLESv1 only. In GLESv2 2D texture and cubemap textures cannot be
-     * enabled/disabled.
+     * enabled/disabled. Currently not used.
      */
     bool enabled;
 };
index 18ac715..9731caf 100644 (file)
@@ -683,10 +683,15 @@ bool yagl_host_glDepthRangef(GLclampf zNear,
 
 bool yagl_host_glDisable(GLenum cap)
 {
-    YAGL_GET_CTX(glEnable);
+    YAGL_GET_CTX(glDisable);
 
     ctx->driver->Disable(cap);
 
+    if (cap == GL_TEXTURE_2D) {
+        yagl_gles_context_active_texture_set_enabled(ctx,
+            yagl_gles_texture_target_2d, false);
+    }
+
     return true;
 }
 
@@ -829,6 +834,11 @@ bool yagl_host_glEnable(GLenum cap)
 
     ctx->driver->Enable(cap);
 
+    if (cap == GL_TEXTURE_2D) {
+        yagl_gles_context_active_texture_set_enabled(ctx,
+            yagl_gles_texture_target_2d, true);
+    }
+
     return true;
 }