[Title] Added an extension support for 'OES_standard_derivative'
authorHaegeun Park <haegeun.park@samsung.com>
Mon, 18 Feb 2013 05:15:10 +0000 (21:15 -0800)
committerHaegeun Park <haegeun.park@samsung.com>
Mon, 18 Feb 2013 05:18:30 +0000 (21:18 -0800)
[Issue#]
[Problem]
[Cause]
[Solution]
- Now glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES) works.

include/GLES2/def_gl.h
src/headers/gl.h
src/modules/fastpath/coregl_fastpath.c
src/modules/fastpath/coregl_fastpath_gl.c
src/modules/fastpath/coregl_fastpath_state.h

index e7b81451d9f2463f5b75a0aebac2d776aa3ced53..c5fcb44bbc1be2d26a47f5fe1e5cc3864cbb5ae4 100644 (file)
@@ -515,5 +515,10 @@ typedef void* GLeglImageOES;
 #define GL_BGRA_EXT                                             0x80E1
 #endif
 
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES               0x8B8B
+#endif
+
 #endif
 
index e7b81451d9f2463f5b75a0aebac2d776aa3ced53..c5fcb44bbc1be2d26a47f5fe1e5cc3864cbb5ae4 100644 (file)
@@ -515,5 +515,10 @@ typedef void* GLeglImageOES;
 #define GL_BGRA_EXT                                             0x80E1
 #endif
 
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES               0x8B8B
+#endif
+
 #endif
 
index ad2fd8d8e3f46564c1c1aade08cb93685e6e6b77..4f337613d275902effe10f3f48f83babb83c40be 100644 (file)
@@ -1531,6 +1531,10 @@ fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx)
                        CHECK_GL_ERROR(_orig_fastpath_glSampleCoverage(newctx->gl_sample_coverage_value[0],
                                       newctx->gl_sample_coverage_invert[0]))
                }
+               STATE_COMPARE(gl_fragment_shader_derivative_hint[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, newctx->gl_fragment_shader_derivative_hint[0]))
+               }
        }
 
        // _misc_flag2
index 7a04b77beb225ea236a999b45bdab3da2be7c942..970a80cd3cff24f1dbb614ad347b32713e05a2b6 100644 (file)
@@ -3012,7 +3012,6 @@ finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
-// Fix Maybe?
 void
 fastpath_glHint(GLenum target, GLenum mode)
 {
@@ -3020,21 +3019,32 @@ fastpath_glHint(GLenum target, GLenum mode)
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       if (target == GL_GENERATE_MIPMAP_HINT)
+       switch (target)
        {
-               CURR_STATE_COMPARE(gl_generate_mipmap_hint, mode)
-               {
-                       IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode))
+               case GL_GENERATE_MIPMAP_HINT:
+                       CURR_STATE_COMPARE(gl_generate_mipmap_hint, mode)
                        {
-                               current_ctx->_tex_flag1 |= FLAG_BIT_2;
-                               current_ctx->gl_generate_mipmap_hint[0] = mode;
+                               IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode))
+                               {
+                                       current_ctx->_tex_flag1 |= FLAG_BIT_2;
+                                       current_ctx->gl_generate_mipmap_hint[0] = mode;
+                               }
                        }
-               }
-       }
-       else
-       {
-               _set_gl_error(GL_INVALID_ENUM);
-               goto finish;
+                       break;
+               case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+                       CURR_STATE_COMPARE(gl_fragment_shader_derivative_hint, mode)
+                       {
+                               IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode))
+                               {
+                                       current_ctx->_misc_flag1 |= FLAG_BIT_6;
+                                       current_ctx->gl_fragment_shader_derivative_hint[0] = mode;
+                               }
+                       }
+                       break;
+               default:
+                       ERR("\E[0;31;1mERROR : Invalid (or not supported) hint target is specified!\E[0m\n");
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
        }
        goto finish;
 
index 30c722a24c384a70609dbfc5f75aa02d396453f9..e525b15e485b30d66e6bd19fa981852a7309dc44 100644 (file)
@@ -98,6 +98,7 @@ GLUE_STATE(GLfloat, gl_polygon_offset_factor, 1, 1, SET_1(0.0f), _sym_glGetFloat
 GLUE_STATE(GLfloat, gl_polygon_offset_units, 1, 1, SET_1(0.0f), _sym_glGetFloatv(GL_POLYGON_OFFSET_UNITS, (GLfloat *)value);)
 GLUE_STATE(GLclampf, gl_sample_coverage_value, 1, 1, SET_1(1.0f), _sym_glGetFloatv(GL_SAMPLE_COVERAGE_VALUE, (GLfloat *)value);)
 GLUE_STATE(GLboolean, gl_sample_coverage_invert, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT, (GLboolean *)value);)
+GLUE_STATE(GLenum, gl_fragment_shader_derivative_hint, 1, 1, SET_1(GL_DONT_CARE), _sym_glGetIntegerv(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, (GLint *)value);)
 
 // MISC FLAG 2
 GLUE_STATE(GLint, gl_scissor_box, 4, 4,