diff options
Diffstat (limited to 'cogl/driver/gl/cogl-pipeline-opengl.c')
-rw-r--r-- | cogl/driver/gl/cogl-pipeline-opengl.c | 129 |
1 files changed, 43 insertions, 86 deletions
diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c index c7b44ee7..0bd0ff45 100644 --- a/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/driver/gl/cogl-pipeline-opengl.c @@ -50,24 +50,6 @@ #include <glib.h> #include <string.h> -/* - * GL/GLES compatability defines for pipeline thingies: - */ - -/* These aren't defined in the GLES headers */ -#ifndef GL_POINT_SPRITE -#define GL_POINT_SPRITE 0x8861 -#endif -#ifndef GL_COORD_REPLACE -#define GL_COORD_REPLACE 0x8862 -#endif -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812d -#endif -#ifndef GL_PROGRAM_POINT_SIZE -#define GL_PROGRAM_POINT_SIZE 0x8642 -#endif - static void texture_unit_init (CoglContext *ctx, CoglTextureUnit *unit, @@ -396,7 +378,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type) ctx->current_vertex_program_type = type; } -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) static CoglBool blend_factor_uses_constant (GLenum blend_factor) @@ -441,9 +423,8 @@ flush_depth_state (CoglContext *ctx, ctx->depth_writing_enabled_cache = depth_writing_enabled; } - if (ctx->driver != COGL_DRIVER_GLES1 && - (ctx->depth_range_near_cache != depth_state->range_near || - ctx->depth_range_far_cache != depth_state->range_far)) + if (ctx->depth_range_near_cache != depth_state->range_near || + ctx->depth_range_far_cache != depth_state->range_far) { if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED)) GE (ctx, glDepthRangef (depth_state->range_near, @@ -522,60 +503,50 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state ( CoglPipelineBlendState *blend_state = &authority->big_state->blend_state; - /* GLES 1 only has glBlendFunc */ - if (ctx->driver == COGL_DRIVER_GLES1) - { - GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb)); - } -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) - else +#if defined(HAVE_COGL_GL) + if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) || + blend_factor_uses_constant (blend_state + ->blend_src_factor_alpha) || + blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) || + blend_factor_uses_constant (blend_state->blend_dst_factor_alpha)) { - if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) || - blend_factor_uses_constant (blend_state - ->blend_src_factor_alpha) || - blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) || - blend_factor_uses_constant (blend_state->blend_dst_factor_alpha)) - { - float red = - cogl_color_get_red_float (&blend_state->blend_constant); - float green = - cogl_color_get_green_float (&blend_state->blend_constant); - float blue = - cogl_color_get_blue_float (&blend_state->blend_constant); - float alpha = - cogl_color_get_alpha_float (&blend_state->blend_constant); - + float red = + cogl_color_get_red_float (&blend_state->blend_constant); + float green = + cogl_color_get_green_float (&blend_state->blend_constant); + float blue = + cogl_color_get_blue_float (&blend_state->blend_constant); + float alpha = + cogl_color_get_alpha_float (&blend_state->blend_constant); - GE (ctx, glBlendColor (red, green, blue, alpha)); - } - if (ctx->glBlendEquationSeparate && - blend_state->blend_equation_rgb != - blend_state->blend_equation_alpha) - GE (ctx, - glBlendEquationSeparate (blend_state->blend_equation_rgb, - blend_state->blend_equation_alpha)); - else - GE (ctx, glBlendEquation (blend_state->blend_equation_rgb)); - - if (ctx->glBlendFuncSeparate && - (blend_state->blend_src_factor_rgb != - blend_state->blend_src_factor_alpha || - (blend_state->blend_dst_factor_rgb != - blend_state->blend_dst_factor_alpha))) - GE (ctx, glBlendFuncSeparate (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb, - blend_state->blend_src_factor_alpha, - blend_state->blend_dst_factor_alpha)); - else - GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb)); + GE (ctx, glBlendColor (red, green, blue, alpha)); } -#endif + + if (ctx->glBlendEquationSeparate && + blend_state->blend_equation_rgb != + blend_state->blend_equation_alpha) + GE (ctx, + glBlendEquationSeparate (blend_state->blend_equation_rgb, + blend_state->blend_equation_alpha)); + else + GE (ctx, glBlendEquation (blend_state->blend_equation_rgb)); + + if (ctx->glBlendFuncSeparate && + (blend_state->blend_src_factor_rgb != + blend_state->blend_src_factor_alpha || + (blend_state->blend_dst_factor_rgb != + blend_state->blend_dst_factor_alpha))) + GE (ctx, glBlendFuncSeparate (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb, + blend_state->blend_src_factor_alpha, + blend_state->blend_dst_factor_alpha)); + else + GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb)); } -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST)) { @@ -758,21 +729,7 @@ get_max_activateable_texture_units (void) } #endif /* HAVE_COGL_GL */ -#ifdef HAVE_COGL_GLES2 - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED) && - _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE)) - { - GE (ctx, glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, values + n_values)); - /* Two of the vertex attribs need to be used for the position - and color */ - values[n_values++] -= 2; - - GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, - values + n_values++)); - } -#endif - -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) { /* GL_MAX_TEXTURE_UNITS defines the number of units that are @@ -917,7 +874,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data) * this point we can't currently tell if we are using the fixed or * glsl progend. */ -#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GL) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS)) { |