cogl: Remove always-true COGL_FEATURE_SHADERS_GLSL

https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
This commit is contained in:
Adam Jackson 2019-03-08 15:40:41 -05:00
parent 2aaed7bdfc
commit 893e894fff
14 changed files with 24 additions and 82 deletions

View File

@ -73,8 +73,7 @@ clutter_features_from_cogl (guint cogl_flags)
if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
if (cogl_flags & COGL_FEATURE_SHADERS_GLSL)
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;

View File

@ -199,7 +199,6 @@ cogl_is_context (void *object);
* offscreen framebuffers
* @COGL_FEATURE_ID_ONSCREEN_MULTIPLE: Multiple onscreen framebuffers
* supported.
* @COGL_FEATURE_ID_GLSL: GLSL support
* @COGL_FEATURE_ID_UNSIGNED_INT_INDICES: Set if
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
* cogl_indices_new().
@ -240,7 +239,6 @@ typedef enum _CoglFeatureID
COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT,
COGL_FEATURE_ID_TEXTURE_NPOT,
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
COGL_FEATURE_ID_GLSL,
COGL_FEATURE_ID_OFFSCREEN,
COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
COGL_FEATURE_ID_ONSCREEN_MULTIPLE,

View File

@ -1992,15 +1992,6 @@ get_wire_line_indices (CoglContext *ctx,
return ret;
}
static gboolean
remove_layer_cb (CoglPipeline *pipeline,
int layer_index,
void *user_data)
{
cogl_pipeline_remove_layer (pipeline, layer_index);
return TRUE;
}
static void
pipeline_destroyed_cb (CoglPipeline *weak_pipeline, void *user_data)
{
@ -2052,6 +2043,8 @@ draw_wireframe (CoglContext *ctx,
if (!wire_pipeline)
{
static CoglSnippet *snippet = NULL;
wire_pipeline =
_cogl_pipeline_weak_copy (pipeline, pipeline_destroyed_cb, NULL);
@ -2063,29 +2056,20 @@ draw_wireframe (CoglContext *ctx,
* vertex program and since we'd like to see the results of the
* vertex program in the wireframe we just add a final clobber
* of the wire color leaving the rest of the state untouched. */
if (cogl_has_feature (framebuffer->context, COGL_FEATURE_ID_GLSL))
{
static CoglSnippet *snippet = NULL;
/* The snippet is cached so that it will reuse the program
* from the pipeline cache if possible */
if (snippet == NULL)
{
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
NULL,
NULL);
cogl_snippet_set_replace (snippet,
"cogl_color_out = "
"vec4 (0.0, 1.0, 0.0, 1.0);\n");
}
cogl_pipeline_add_snippet (wire_pipeline, snippet);
}
else
/* The snippet is cached so that it will reuse the program
* from the pipeline cache if possible */
if (snippet == NULL)
{
cogl_pipeline_foreach_layer (wire_pipeline, remove_layer_cb, NULL);
cogl_pipeline_set_color4f (wire_pipeline, 0, 1, 0, 1);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
NULL,
NULL);
cogl_snippet_set_replace (snippet,
"cogl_color_out = "
"vec4 (0.0, 1.0, 0.0, 1.0);\n");
}
cogl_pipeline_add_snippet (wire_pipeline, snippet);
}
/* temporarily disable the wireframe to avoid recursion! */

View File

@ -626,10 +626,6 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
* meantime we hope this will handle most practical GLSL and ARBfp
* requirements.
*
* Also remember you need to check for either the
* %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
* using the cogl_program or cogl_shader API.
*
* Since: 2.0
* Stability: Unstable
*/

View File

@ -3054,11 +3054,10 @@ _cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context)
COGL_PIPELINE_LAYER_STATE_UNIT |
COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS);
/* If the driver supports GLSL then we might be using gl_PointCoord
/* Since the driver supports GLSL then we might be using gl_PointCoord
* to implement the sprite coords. In that case the generated code
* depends on the point sprite state */
if (cogl_has_feature (context, COGL_FEATURE_ID_GLSL))
state |= COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
state |= COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
return state;
}

View File

@ -784,8 +784,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer)
_COGL_GET_CONTEXT (ctx, 0);
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2)
if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n));
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n));
#endif
return n;

View File

@ -322,7 +322,6 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
* and %COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined.
* @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
* @COGL_FEATURE_SHADERS_GLSL: GLSL support
* @COGL_FEATURE_OFFSCREEN: FBO support
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
* @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
@ -364,7 +363,6 @@ typedef enum
COGL_FEATURE_TEXTURE_NPOT = (1 << 2),
COGL_FEATURE_TEXTURE_YUV = (1 << 3),
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
COGL_FEATURE_SHADERS_GLSL = (1 << 5),
COGL_FEATURE_OFFSCREEN = (1 << 6),
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),

View File

@ -756,10 +756,6 @@ cogl_material_get_user_program (CoglMaterial *material);
* meantime we hope this will handle most practical GLSL and ARBfp
* requirements.
*
* Also remember you need to check for either the
* %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
* using the cogl_program or cogl_shader API.
*
* Since: 1.4
* Deprecated: 1.16: Use #CoglSnippet api instead instead
*/

View File

@ -48,11 +48,6 @@ G_BEGIN_DECLS
* Cogl allows accessing the GL programmable pipeline in order to create
* vertex and fragment shaders.
*
* The shader source code can either be GLSL or ARBfp. If the source
* code is ARBfp, it must begin with the string !!ARBfp1.0. The
* application should check for the %COGL_FEATURE_SHADERS_GLSL or
* %COGL_FEATURE_SHADERS_ARBFP features before using shaders.
*
* When using GLSL Cogl provides replacement names for most of the
* builtin varyings and uniforms. It is recommended to use these names
* wherever possible to increase portability between OpenGL 2.0 and

View File

@ -673,22 +673,13 @@ get_max_activateable_texture_units (void)
#ifdef HAVE_COGL_GL
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED))
{
/* GL_MAX_TEXTURE_COORDS is provided for both GLSL and ARBfp. It
defines the number of texture coordinates that can be
uploaded (but doesn't necessarily relate to how many texture
images can be sampled) */
if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
/* Previously this code subtracted the value by one but there
was no explanation for why it did this and it doesn't seem
to make sense so it has been removed */
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_COORDS,
values + n_values++));
/* GL_MAX_TEXTURE_COORDS defines the number of texture coordinates
* that can be uploaded (but doesn't necessarily relate to how many
* texture images can be sampled) */
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_COORDS, values + n_values++));
/* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is defined for GLSL but
not ARBfp */
if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
values + n_values++));
GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
values + n_values++));
}
#endif /* HAVE_COGL_GL */

View File

@ -644,9 +644,6 @@ _cogl_pipeline_progend_glsl_start (CoglPipeline *pipeline)
_COGL_GET_CONTEXT (ctx, FALSE);
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
return FALSE;
user_program = cogl_pipeline_get_user_program (pipeline);
if (user_program &&
_cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL)

View File

@ -451,9 +451,6 @@ _cogl_driver_update_features (CoglContext *ctx,
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE);
flags |= COGL_FEATURE_SHADERS_GLSL;
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE);
flags |= COGL_FEATURE_POINT_SPRITE;
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_POINT_SPRITE, TRUE);

View File

@ -302,12 +302,11 @@ _cogl_driver_update_features (CoglContext *context,
gl_minor,
gl_extensions);
flags |= COGL_FEATURE_SHADERS_GLSL | COGL_FEATURE_OFFSCREEN;
flags |= COGL_FEATURE_OFFSCREEN;
/* Note GLES 2 core doesn't support mipmaps for npot textures or
* repeat modes other than CLAMP_TO_EDGE. */
flags |= COGL_FEATURE_TEXTURE_NPOT_BASIC;
flags |= COGL_FEATURE_DEPTH_RANGE;
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_GLSL, TRUE);
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE);
COGL_FLAGS_SET (context->features,
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);

View File

@ -66,12 +66,6 @@ check_flags (TestFlags flags,
return FALSE;
}
if (flags & TEST_REQUIREMENT_GLSL &&
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))
{
return FALSE;
}
if (flags & TEST_REQUIREMENT_OFFSCREEN &&
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_OFFSCREEN))
{