1.glColorMask and glColorMaski should share the same state.
2.add GL_CLOR_WRITEMASK_NUM to define the size of gl_color_writemask
Signed-off-by: xing.huang <xing.huang@samsung.com>
Change-Id: I534fb2a8094495571596e033efb287a75ecde486
flag = oldctx->_clear_flag2 | newctx->_clear_flag2;
if (flag) {
if STATES_COMPARE(gl_color_writemask,
- 4 * newctx->gl_color_writemask_num[0] * sizeof(GLboolean)) {
- for (i = 0; i < newctx->gl_color_writemask_num[0]; i++) {
- CHECK_GL_ERROR(_orig_fastpath_glColorMaski(i,
- (newctx->gl_color_writemask + i)[0],
- (newctx->gl_color_writemask + i)[1],
- (newctx->gl_color_writemask + i)[2],
- (newctx->gl_color_writemask + i)[3]))
+ 4 * GL_CLOR_WRITEMASK_NUM * sizeof(GLboolean)) {
+ for (i = 0; i < GL_CLOR_WRITEMASK_NUM; i++) {
+ if(NULL != _orig_fastpath_glColorMaski)
+ {
+ CHECK_GL_ERROR(_orig_fastpath_glColorMaski(i,
+ (newctx->gl_color_writemask + i)[0],
+ (newctx->gl_color_writemask + i)[1],
+ (newctx->gl_color_writemask + i)[2],
+ (newctx->gl_color_writemask + i)[3]))
+ }
}
}
- if STATES_COMPARE(gl_color_writemask_for_glColorMask, 4 * sizeof(GLboolean)) {
- CHECK_GL_ERROR(_orig_fastpath_glColorMask(newctx->gl_color_writemask_for_glColorMask[0],
- newctx->gl_color_writemask_for_glColorMask[1],
- newctx->gl_color_writemask_for_glColorMask[2],
- newctx->gl_color_writemask_for_glColorMask[3]))
- }
if STATES_COMPARE(gl_depth_range, 2 * sizeof(GLclampf)) {
CHECK_GL_ERROR(_orig_fastpath_glDepthRangef(newctx->gl_depth_range[0],
newctx->gl_depth_range[1]))
#define _CLEAR_FLAG2_BIT_gl_depth_func FLAG_BIT_3
#define _CLEAR_FLAG2_BIT_gl_depth_writemask FLAG_BIT_4
#define _CLEAR_FLAG2_BIT_gl_cull_face_mode FLAG_BIT_5
-#define _CLEAR_FLAG2_BIT_gl_color_writemask_for_glColorMask FLAG_BIT_6
-
unsigned char _tex_flag1;
#define _TEX_FLAG1_BIT_gl_active_texture FLAG_BIT_0
DEFINE_FASTPAH_GL_FUNC();
_COREGL_FASTPATH_FUNC_BEGIN();
INIT_FASTPATH_GL_FUNC();
+ GLint index;
+ GLboolean changed = GL_FALSE;
- if (CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 0, red) ||
- CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 1, green) ||
- CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 2, blue) ||
- CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 3, alpha)) {
+ for (index = 0; index < GL_CLOR_WRITEMASK_NUM; index++) {
+ if (CURR_STATE_COMPARE(gl_color_writemask, 0 + 4 * index, red) ||
+ CURR_STATE_COMPARE(gl_color_writemask, 1 + 4 * index, green) ||
+ CURR_STATE_COMPARE(gl_color_writemask, 2 + 4 * index, blue) ||
+ CURR_STATE_COMPARE(gl_color_writemask, 3 + 4 * index, alpha))
+ changed = GL_TRUE;
+
+ }
+
+ if (changed) {
IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha)) {
- current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask_for_glColorMask;
- CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 0, red)
- CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 1, green)
- CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 2, blue)
- CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 3, alpha)
+ current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
+ for (index = 0; index < GL_CLOR_WRITEMASK_NUM; index++) {
+ CURR_STATE_UPDATE(gl_color_writemask, 0 + 4 * index, red)
+ CURR_STATE_UPDATE(gl_color_writemask, 1 + 4 * index, green)
+ CURR_STATE_UPDATE(gl_color_writemask, 2 + 4 * index, blue)
+ CURR_STATE_UPDATE(gl_color_writemask, 3 + 4 * index, alpha)
+ }
}
}
goto finish;
#define _COREGL_END_API_DEFINED_INSIDE
#endif
+/*this size can be get by glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS)
+ but in r4p0, it dose not support GL_MAX_COLOR_ATTACHMENTS */
+#define GL_CLOR_WRITEMASK_NUM 4
#define SET_1(v1) value[0] = v1;
#define SET_2(v1, v2) value[0] = v1; value[1] = v2;
(GLint *)value); /* DEFAULT NOT EFFECT */,
_sym_glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, (GLint *)value);)
-GLUE_STATE(GLuint, gl_color_writemask_num, 1, 1,
- _sym_glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS,
- (GLint *)value); /* DEFAULT NOT EFFECT */,
- _sym_glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, (GLint *)value);)
-
GLUE_STATE(GLuint, gl_array_buffer_binding, 1, 1, SET_1(0),
_sym_glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *)value);)
GLUE_STATE(GLuint, gl_copy_read_buffer_binding, 1, 1, SET_1(0),
_sym_glGetFloatv(GL_COLOR_CLEAR_VALUE, (GLfloat *)value);)
GLUE_STATE(GLboolean, gl_color_writemask,
- 4 * INITIAL_CTX->gl_color_writemask_num[0],
- 4 * INITIAL_CTX->gl_color_writemask_num[0],
- SET_N(4 * INITIAL_CTX->gl_color_writemask_num[0], 1, SET_1(GL_TRUE)),
+ 4 * GL_CLOR_WRITEMASK_NUM,
+ 4 * GL_CLOR_WRITEMASK_NUM,
+ SET_N(4 * GL_CLOR_WRITEMASK_NUM, 1, SET_1(GL_TRUE)),
_sym_glGetBooleanv(GL_COLOR_WRITEMASK, (GLboolean *)value);)
-
-GLUE_STATE(GLboolean, gl_color_writemask_for_glColorMask, 4, 4, SET_4(GL_TRUE, GL_TRUE, GL_TRUE,
- GL_TRUE), _sym_glGetBooleanv(GL_COLOR_WRITEMASK, (GLboolean *)value);)
-
GLUE_STATE(GLclampf, gl_depth_range, 2, 2, SET_2(0.0f, 1.0f),
_sym_glGetFloatv(GL_DEPTH_RANGE, (GLfloat *)value);)
GLUE_STATE(GLclampf, gl_depth_clear_value, 1, 1, SET_1(1.0f),
GLuint gl_uniform_buffer_binding_num[1];
GLuint gl_shader_storage_buffer_binding_num[1];
GLuint gl_atomic_counter_buffer_binding_num[1];
- GLuint gl_color_writemask_num[1];
} GLGlueFakeContext;
GLGlueFakeContext initial_fake_ctx_real;