cogl: Remove color write masks from the framebuffer and pipeline API

The only thing using this is its own tests, and it's difficult to
imagine a real use for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/468
This commit is contained in:
Adam Jackson 2019-02-06 12:35:24 -05:00 committed by Georges Basile Stavracas Neto
parent b624e94ab1
commit a94841abf1
17 changed files with 8 additions and 407 deletions

View File

@ -266,7 +266,6 @@ struct _CoglContext
GLuint current_gl_program;
gboolean current_gl_dither_enabled;
CoglColorMask current_gl_color_mask;
GLenum current_gl_draw_buffer;
/* Clipping */

View File

@ -350,7 +350,6 @@ cogl_context_new (CoglDisplay *display,
context->current_gl_program = 0;
context->current_gl_dither_enabled = TRUE;
context->current_gl_color_mask = COGL_COLOR_MASK_ALL;
context->gl_blend_enable_cache = FALSE;

View File

@ -83,11 +83,10 @@ typedef enum _CoglFramebufferStateIndex
COGL_FRAMEBUFFER_STATE_INDEX_DITHER = 3,
COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW = 4,
COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION = 5,
COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK = 6,
COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING = 7,
COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE = 8,
COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE = 9,
COGL_FRAMEBUFFER_STATE_INDEX_MAX = 10
COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING = 6,
COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE = 7,
COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE = 8,
COGL_FRAMEBUFFER_STATE_INDEX_MAX = 9
} CoglFramebufferStateIndex;
typedef enum _CoglFramebufferState
@ -98,10 +97,9 @@ typedef enum _CoglFramebufferState
COGL_FRAMEBUFFER_STATE_DITHER = 1<<3,
COGL_FRAMEBUFFER_STATE_MODELVIEW = 1<<4,
COGL_FRAMEBUFFER_STATE_PROJECTION = 1<<5,
COGL_FRAMEBUFFER_STATE_COLOR_MASK = 1<<6,
COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING = 1<<7,
COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<8,
COGL_FRAMEBUFFER_STATE_STEREO_MODE = 1<<9
COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING = 1<<6,
COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<7,
COGL_FRAMEBUFFER_STATE_STEREO_MODE = 1<<8
} CoglFramebufferState;
#define COGL_FRAMEBUFFER_STATE_ALL ((1<<COGL_FRAMEBUFFER_STATE_INDEX_MAX) - 1)
@ -155,7 +153,6 @@ struct _CoglFramebuffer
gboolean dither_enabled;
gboolean depth_writing_enabled;
CoglColorMask color_mask;
CoglStereoMode stereo_mode;
/* We journal the textured rectangles we want to submit to OpenGL so

View File

@ -123,8 +123,6 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer,
framebuffer->dirty_bitmasks = TRUE;
framebuffer->color_mask = COGL_COLOR_MASK_ALL;
framebuffer->samples_per_pixel = 0;
framebuffer->clip_stack = NULL;
@ -829,17 +827,6 @@ _cogl_framebuffer_compare_projection_state (CoglFramebuffer *a,
return COGL_FRAMEBUFFER_STATE_PROJECTION;
}
static unsigned long
_cogl_framebuffer_compare_color_mask_state (CoglFramebuffer *a,
CoglFramebuffer *b)
{
if (cogl_framebuffer_get_color_mask (a) !=
cogl_framebuffer_get_color_mask (b))
return COGL_FRAMEBUFFER_STATE_COLOR_MASK;
else
return 0;
}
static unsigned long
_cogl_framebuffer_compare_front_face_winding_state (CoglFramebuffer *a,
CoglFramebuffer *b)
@ -906,10 +893,6 @@ _cogl_framebuffer_compare (CoglFramebuffer *a,
differences |=
_cogl_framebuffer_compare_projection_state (a, b);
break;
case COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK:
differences |=
_cogl_framebuffer_compare_color_mask_state (a, b);
break;
case COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING:
differences |=
_cogl_framebuffer_compare_front_face_winding_state (a, b);
@ -1015,29 +998,6 @@ cogl_framebuffer_get_is_stereo (CoglFramebuffer *framebuffer)
return framebuffer->config.stereo_enabled;
}
CoglColorMask
cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer)
{
return framebuffer->color_mask;
}
void
cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer,
CoglColorMask color_mask)
{
if (framebuffer->color_mask == color_mask)
return;
/* XXX: Currently color mask changes don't go through the journal */
_cogl_framebuffer_flush_journal (framebuffer);
framebuffer->color_mask = color_mask;
if (framebuffer->context->current_draw_buffer == framebuffer)
framebuffer->context->current_draw_buffer_changes |=
COGL_FRAMEBUFFER_STATE_COLOR_MASK;
}
CoglStereoMode
cogl_framebuffer_get_stereo_mode (CoglFramebuffer *framebuffer)
{

View File

@ -816,38 +816,6 @@ void
cogl_framebuffer_set_depth_write_enabled (CoglFramebuffer *framebuffer,
gboolean depth_write_enabled);
/**
* cogl_framebuffer_get_color_mask:
* @framebuffer: a pointer to a #CoglFramebuffer
*
* Gets the current #CoglColorMask of which channels would be written to the
* current framebuffer. Each bit set in the mask means that the
* corresponding color would be written.
*
* Returns: A #CoglColorMask
* Since: 1.8
* Stability: unstable
*/
CoglColorMask
cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer);
/**
* cogl_framebuffer_set_color_mask:
* @framebuffer: a pointer to a #CoglFramebuffer
* @color_mask: A #CoglColorMask of which color channels to write to
* the current framebuffer.
*
* Defines a bit mask of which color channels should be written to the
* given @framebuffer. If a bit is set in @color_mask that means that
* color will be written.
*
* Since: 1.8
* Stability: unstable
*/
void
cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer,
CoglColorMask color_mask);
/**
* cogl_framebuffer_get_stereo_mode:
* @framebuffer: a pointer to a #CoglFramebuffer

View File

@ -87,7 +87,6 @@ typedef enum
COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX,
COGL_PIPELINE_STATE_POINT_SIZE_INDEX,
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX,
COGL_PIPELINE_STATE_LOGIC_OPS_INDEX,
COGL_PIPELINE_STATE_CULL_FACE_INDEX,
COGL_PIPELINE_STATE_UNIFORMS_INDEX,
COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX,
@ -140,8 +139,6 @@ typedef enum _CoglPipelineState
1L<<COGL_PIPELINE_STATE_POINT_SIZE_INDEX,
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE =
1L<<COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX,
COGL_PIPELINE_STATE_LOGIC_OPS =
1L<<COGL_PIPELINE_STATE_LOGIC_OPS_INDEX,
COGL_PIPELINE_STATE_CULL_FACE =
1L<<COGL_PIPELINE_STATE_CULL_FACE_INDEX,
COGL_PIPELINE_STATE_UNIFORMS =
@ -188,7 +185,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE | \
COGL_PIPELINE_STATE_POINT_SIZE | \
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE | \
COGL_PIPELINE_STATE_LOGIC_OPS | \
COGL_PIPELINE_STATE_CULL_FACE | \
COGL_PIPELINE_STATE_UNIFORMS | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
@ -200,7 +196,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_DEPTH | \
COGL_PIPELINE_STATE_FOG | \
COGL_PIPELINE_STATE_LOGIC_OPS | \
COGL_PIPELINE_STATE_CULL_FACE | \
COGL_PIPELINE_STATE_UNIFORMS | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
@ -265,11 +260,6 @@ typedef struct
float z_far;
} CoglPipelineFogState;
typedef struct
{
CoglColorMask color_mask;
} CoglPipelineLogicOpsState;
typedef struct
{
CoglPipelineCullFaceMode mode;
@ -301,7 +291,6 @@ typedef struct
float point_size;
unsigned int non_zero_point_size : 1;
unsigned int per_vertex_point_size : 1;
CoglPipelineLogicOpsState logic_ops_state;
CoglPipelineCullFaceState cull_face_state;
CoglPipelineUniformsState uniforms_state;
CoglPipelineSnippetList vertex_snippets;

View File

@ -218,16 +218,6 @@ _cogl_pipeline_per_vertex_point_size_equal (CoglPipeline *authority0,
authority1->big_state->per_vertex_point_size);
}
gboolean
_cogl_pipeline_logic_ops_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
{
CoglPipelineLogicOpsState *logic_ops_state0 = &authority0->big_state->logic_ops_state;
CoglPipelineLogicOpsState *logic_ops_state1 = &authority1->big_state->logic_ops_state;
return logic_ops_state0->color_mask == logic_ops_state1->color_mask;
}
gboolean
_cogl_pipeline_cull_face_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
@ -1203,49 +1193,6 @@ cogl_pipeline_get_depth_state (CoglPipeline *pipeline,
*state = authority->big_state->depth_state;
}
CoglColorMask
cogl_pipeline_get_color_mask (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
return authority->big_state->logic_ops_state.color_mask;
}
void
cogl_pipeline_set_color_mask (CoglPipeline *pipeline,
CoglColorMask color_mask)
{
CoglPipelineState state = COGL_PIPELINE_STATE_LOGIC_OPS;
CoglPipeline *authority;
CoglPipelineLogicOpsState *logic_ops_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
logic_ops_state = &authority->big_state->logic_ops_state;
if (logic_ops_state->color_mask == color_mask)
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
logic_ops_state = &pipeline->big_state->logic_ops_state;
logic_ops_state->color_mask = color_mask;
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_logic_ops_state_equal);
}
void
_cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
const CoglPipelineFogState *fog_state)
@ -1951,15 +1898,6 @@ _cogl_pipeline_hash_per_vertex_point_size_state (CoglPipeline *authority,
sizeof (per_vertex_point_size));
}
void
_cogl_pipeline_hash_logic_ops_state (CoglPipeline *authority,
CoglPipelineHashState *state)
{
CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state;
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &logic_ops_state->color_mask,
sizeof (CoglColorMask));
}
void
_cogl_pipeline_hash_cull_face_state (CoglPipeline *authority,
CoglPipelineHashState *state)

View File

@ -571,38 +571,6 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
gboolean
cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline);
/**
* cogl_pipeline_get_color_mask:
* @pipeline: a #CoglPipeline object.
*
* Gets the current #CoglColorMask of which channels would be written to the
* current framebuffer. Each bit set in the mask means that the
* corresponding color would be written.
*
* Returns: A #CoglColorMask
* Since: 1.8
* Stability: unstable
*/
CoglColorMask
cogl_pipeline_get_color_mask (CoglPipeline *pipeline);
/**
* cogl_pipeline_set_color_mask:
* @pipeline: a #CoglPipeline object.
* @color_mask: A #CoglColorMask of which color channels to write to
* the current framebuffer.
*
* Defines a bit mask of which color channels should be written to the
* current framebuffer. If a bit is set in @color_mask that means that
* color will be written.
*
* Since: 1.8
* Stability: unstable
*/
void
cogl_pipeline_set_color_mask (CoglPipeline *pipeline,
CoglColorMask color_mask);
/**
* cogl_pipeline_get_user_program:
* @pipeline: a #CoglPipeline object.

View File

@ -99,7 +99,6 @@ _cogl_pipeline_init_default_pipeline (void)
CoglPipelineLightingState *lighting_state = &big_state->lighting_state;
CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
CoglPipelineBlendState *blend_state = &big_state->blend_state;
CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state;
CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state;
CoglPipelineUniformsState *uniforms_state = &big_state->uniforms_state;
@ -189,8 +188,6 @@ _cogl_pipeline_init_default_pipeline (void)
big_state->point_size = 0.0f;
logic_ops_state->color_mask = COGL_COLOR_MASK_ALL;
cull_face_state->mode = COGL_PIPELINE_CULL_FACE_MODE_NONE;
cull_face_state->front_winding = COGL_WINDING_COUNTER_CLOCKWISE;
@ -1030,13 +1027,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
if (differences & COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE)
big_state->per_vertex_point_size = src->big_state->per_vertex_point_size;
if (differences & COGL_PIPELINE_STATE_LOGIC_OPS)
{
memcpy (&big_state->logic_ops_state,
&src->big_state->logic_ops_state,
sizeof (CoglPipelineLogicOpsState));
}
if (differences & COGL_PIPELINE_STATE_CULL_FACE)
{
memcpy (&big_state->cull_face_state,
@ -1150,13 +1140,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
sizeof (CoglPipelineFogState));
break;
}
case COGL_PIPELINE_STATE_LOGIC_OPS:
{
memcpy (&pipeline->big_state->logic_ops_state,
&authority->big_state->logic_ops_state,
sizeof (CoglPipelineLogicOpsState));
break;
}
case COGL_PIPELINE_STATE_CULL_FACE:
{
memcpy (&pipeline->big_state->cull_face_state,
@ -2323,11 +2306,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
authorities1[bit]))
goto done;
break;
case COGL_PIPELINE_STATE_LOGIC_OPS_INDEX:
if (!_cogl_pipeline_logic_ops_state_equal (authorities0[bit],
authorities1[bit]))
goto done;
break;
case COGL_PIPELINE_STATE_USER_SHADER_INDEX:
if (!_cogl_pipeline_user_shader_equal (authorities0[bit],
authorities1[bit]))
@ -2776,8 +2754,6 @@ _cogl_pipeline_init_state_hash_functions (void)
_cogl_pipeline_hash_point_size_state;
state_hash_functions[COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX] =
_cogl_pipeline_hash_per_vertex_point_size_state;
state_hash_functions[COGL_PIPELINE_STATE_LOGIC_OPS_INDEX] =
_cogl_pipeline_hash_logic_ops_state;
state_hash_functions[COGL_PIPELINE_STATE_UNIFORMS_INDEX] =
_cogl_pipeline_hash_uniforms_state;
state_hash_functions[COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX] =
@ -2787,7 +2763,7 @@ _cogl_pipeline_init_state_hash_functions (void)
{
/* So we get a big error if we forget to update this code! */
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 18,
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 17,
"Make sure to install a hash function for "
"newly added pipeline state and update assert "
"in _cogl_pipeline_init_state_hash_functions");

View File

@ -773,32 +773,6 @@ typedef enum _CoglWinsysFeature
COGL_WINSYS_FEATURE_N_FEATURES
} CoglWinsysFeature;
/**
* CoglColorMask:
* @COGL_COLOR_MASK_NONE: None of the color channels are masked
* @COGL_COLOR_MASK_RED: Masks the red color channel
* @COGL_COLOR_MASK_GREEN: Masks the green color channel
* @COGL_COLOR_MASK_BLUE: Masks the blue color channel
* @COGL_COLOR_MASK_ALPHA: Masks the alpha color channel
* @COGL_COLOR_MASK_ALL: All of the color channels are masked
*
* Defines a bit mask of color channels. This can be used with
* cogl_pipeline_set_color_mask() for example to define which color
* channels should be written to the current framebuffer when
* drawing something.
*/
typedef enum
{
COGL_COLOR_MASK_NONE = 0,
COGL_COLOR_MASK_RED = 1L<<0,
COGL_COLOR_MASK_GREEN = 1L<<1,
COGL_COLOR_MASK_BLUE = 1L<<2,
COGL_COLOR_MASK_ALPHA = 1L<<3,
/* XXX: glib-mkenums is a perl script that can't cope if we split
* this onto multiple lines! *sigh* */
COGL_COLOR_MASK_ALL = (COGL_COLOR_MASK_RED | COGL_COLOR_MASK_GREEN | COGL_COLOR_MASK_BLUE | COGL_COLOR_MASK_ALPHA)
} CoglColorMask;
/**
* CoglWinding:
* @COGL_WINDING_CLOCKWISE: Vertices are in a clockwise order

View File

@ -132,7 +132,6 @@ cogl_color_init_from_hsl
cogl_color_init_from_4f
cogl_color_init_from_4fv
cogl_color_init_from_4ub
cogl_color_mask_get_type
cogl_color_new
cogl_color_premultiply
cogl_color_set_alpha
@ -254,7 +253,6 @@ cogl_framebuffer_frustum
cogl_framebuffer_get_alpha_bits
cogl_framebuffer_get_blue_bits
cogl_framebuffer_get_color_format
cogl_framebuffer_get_color_mask
cogl_framebuffer_get_context
cogl_framebuffer_get_depth_bits
cogl_framebuffer_get_depth_texture
@ -297,7 +295,6 @@ cogl_framebuffer_rotate_quaternion
#endif
cogl_framebuffer_scale
cogl_framebuffer_set_color_mask
cogl_framebuffer_set_depth_texture_enabled
cogl_framebuffer_set_depth_write_enabled
cogl_framebuffer_set_dither_enabled
@ -620,7 +617,6 @@ cogl_pipeline_get_alpha_test_function
cogl_pipeline_get_alpha_test_reference
cogl_pipeline_get_ambient
cogl_pipeline_get_color
cogl_pipeline_get_color_mask
cogl_pipeline_get_cull_face_mode
cogl_pipeline_get_depth_state
cogl_pipeline_get_diffuse
@ -650,7 +646,6 @@ cogl_pipeline_set_ambient_and_diffuse
cogl_pipeline_set_blend
cogl_pipeline_set_blend_constant
cogl_pipeline_set_color
cogl_pipeline_set_color_mask
cogl_pipeline_set_color4f
cogl_pipeline_set_color4ub
cogl_pipeline_set_cull_face_mode

View File

@ -195,20 +195,6 @@ _cogl_framebuffer_gl_flush_projection_state (CoglFramebuffer *framebuffer)
projection_entry);
}
static void
_cogl_framebuffer_gl_flush_color_mask_state (CoglFramebuffer *framebuffer)
{
CoglContext *context = framebuffer->context;
/* The color mask state is really owned by a CoglPipeline so to
* ensure the color mask is updated the next time we draw something
* we need to make sure the logic ops for the pipeline are
* re-flushed... */
context->current_pipeline_changes_since_flush |=
COGL_PIPELINE_STATE_LOGIC_OPS;
context->current_pipeline_age--;
}
static void
_cogl_framebuffer_gl_flush_front_face_winding_state (CoglFramebuffer *framebuffer)
{
@ -437,9 +423,6 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
case COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION:
_cogl_framebuffer_gl_flush_projection_state (draw_buffer);
break;
case COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK:
_cogl_framebuffer_gl_flush_color_mask_state (draw_buffer);
break;
case COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING:
_cogl_framebuffer_gl_flush_front_face_winding_state (draw_buffer);
break;
@ -968,20 +951,6 @@ _cogl_framebuffer_gl_clear (CoglFramebuffer *framebuffer,
{
GE( ctx, glClearColor (red, green, blue, alpha) );
gl_buffers |= GL_COLOR_BUFFER_BIT;
if (ctx->current_gl_color_mask != framebuffer->color_mask)
{
CoglColorMask color_mask = framebuffer->color_mask;
GE( ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED),
!!(color_mask & COGL_COLOR_MASK_GREEN),
!!(color_mask & COGL_COLOR_MASK_BLUE),
!!(color_mask & COGL_COLOR_MASK_ALPHA)));
ctx->current_gl_color_mask = color_mask;
/* Make sure the ColorMask is updated when the next primitive is drawn */
ctx->current_pipeline_changes_since_flush |=
COGL_PIPELINE_STATE_LOGIC_OPS;
ctx->current_pipeline_age--;
}
}
if (buffers & COGL_BUFFER_BIT_DEPTH)

View File

@ -581,23 +581,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
flush_depth_state (ctx, depth_state);
}
if (pipelines_difference & COGL_PIPELINE_STATE_LOGIC_OPS)
{
CoglPipeline *authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state;
CoglColorMask color_mask = logic_ops_state->color_mask;
if (ctx->current_draw_buffer)
color_mask &= ctx->current_draw_buffer->color_mask;
GE (ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED),
!!(color_mask & COGL_COLOR_MASK_GREEN),
!!(color_mask & COGL_COLOR_MASK_BLUE),
!!(color_mask & COGL_COLOR_MASK_ALPHA)));
ctx->current_gl_color_mask = color_mask;
}
if (pipelines_difference & COGL_PIPELINE_STATE_CULL_FACE)
{
CoglPipeline *authority =

View File

@ -5,7 +5,6 @@ cogl_test_conformance_sources = [
'test-blend.c',
'test-depth-test.c',
'test-color-hsl.c',
'test-color-mask.c',
'test-backface-culling.c',
'test-just-vertex-shader.c',
'test-pipeline-user-matrix.c',

View File

@ -1,111 +0,0 @@
#include <cogl/cogl.h>
#include "test-declarations.h"
#include "test-utils.h"
#define TEX_SIZE 128
#define NUM_FBOS 3
typedef struct _TestState
{
int width;
int height;
CoglTexture *tex[NUM_FBOS];
CoglFramebuffer *fbo[NUM_FBOS];
} TestState;
static void
paint (TestState *state)
{
CoglColor bg;
int i;
cogl_set_source_color4ub (255, 255, 255, 255);
/* We push the third framebuffer first so that later we can switch
back to it by popping to test that that works */
cogl_push_framebuffer (state->fbo[2]);
cogl_push_framebuffer (state->fbo[0]);
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
cogl_pop_framebuffer ();
cogl_push_framebuffer (state->fbo[1]);
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
cogl_pop_framebuffer ();
/* We should now be back on the third framebuffer */
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
cogl_pop_framebuffer ();
cogl_color_init_from_4ub (&bg, 128, 128, 128, 255);
cogl_clear (&bg, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH);
/* Render all of the textures to the screen */
for (i = 0; i < NUM_FBOS; i++)
{
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
2.0f / NUM_FBOS * i - 1.0f, -1.0f,
2.0f / NUM_FBOS * (i + 1) - 1.0f, 1.0f);
cogl_object_unref (pipeline);
}
/* Verify all of the fbos drew the right color */
for (i = 0; i < NUM_FBOS; i++)
{
uint8_t expected_colors[NUM_FBOS][4] =
{ { 0xff, 0x00, 0x00, 0xff },
{ 0x00, 0xff, 0x00, 0xff },
{ 0x00, 0x00, 0xff, 0xff } };
test_utils_check_pixel_rgb (test_fb,
state->width * (i + 0.5f) / NUM_FBOS,
state->height / 2,
expected_colors[i][0],
expected_colors[i][1],
expected_colors[i][2]);
}
}
void
test_color_mask (void)
{
TestState state;
int i;
state.width = cogl_framebuffer_get_width (test_fb);
state.height = cogl_framebuffer_get_height (test_fb);
for (i = 0; i < NUM_FBOS; i++)
{
state.tex[i] = test_utils_texture_new_with_size (test_ctx, 128, 128,
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_TEXTURE_COMPONENTS_RGB);
state.fbo[i] = cogl_offscreen_new_with_texture (state.tex[i]);
/* Clear the texture color bits */
cogl_framebuffer_clear4f (state.fbo[i],
COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
cogl_framebuffer_set_color_mask (state.fbo[i],
i == 0 ? COGL_COLOR_MASK_RED :
i == 1 ? COGL_COLOR_MASK_GREEN :
COGL_COLOR_MASK_BLUE);
}
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
paint (&state);
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");
}

View File

@ -60,7 +60,6 @@ main (int argc, char **argv)
ADD_TEST (test_path, 0, 0);
ADD_TEST (test_path_clip, 0, 0);
ADD_TEST (test_depth_test, 0, 0);
ADD_TEST (test_color_mask, 0, 0);
ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT);
ADD_TEST (test_layer_remove, 0, 0);

View File

@ -8,7 +8,6 @@ void test_premult (void);
void test_path (void);
void test_path_clip (void);
void test_depth_test (void);
void test_color_mask (void);
void test_backface_culling (void);
void test_layer_remove (void);
void test_sparse_pipeline (void);