[mutter] cogl: Eliminate _cogl_gl_util_get_texture_target_string
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Eliminate _cogl_gl_util_get_texture_target_string
- Date: Thu, 18 Apr 2019 19:06:45 +0000 (UTC)
commit 2b9cd50e84c8db37386fa3e70e849fdc82217755
Author: Adam Jackson <ajax redhat com>
Date: Fri Mar 8 14:41:27 2019 -0500
cogl: Eliminate _cogl_gl_util_get_texture_target_string
Its results are effectively constant now. Fold them into the callers and
remove the function.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 25 +++++-------------
cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 7 +----
cogl/cogl/driver/gl/cogl-util-gl-private.h | 5 ----
cogl/cogl/driver/gl/cogl-util-gl.c | 33 ------------------------
4 files changed, 7 insertions(+), 63 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index 0628c4f46..e543498a2 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
@@ -233,14 +233,9 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
void *user_data)
{
CoglPipelineShaderState *shader_state = user_data;
- const char *target_string;
-
- _cogl_gl_util_get_texture_target_string (COGL_TEXTURE_TYPE_2D,
- &target_string, NULL);
g_string_append_printf (shader_state->header,
- "uniform sampler%s cogl_sampler%i;\n",
- target_string,
+ "uniform sampler2D cogl_sampler%i;\n",
layer->index);
return TRUE;
@@ -410,17 +405,12 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
{
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
CoglPipelineSnippetData snippet_data;
- const char *target_string, *tex_coord_swizzle;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (shader_state->unit_state[unit_index].sampled)
return;
- _cogl_gl_util_get_texture_target_string (COGL_TEXTURE_TYPE_2D,
- &target_string,
- &tex_coord_swizzle);
-
shader_state->unit_state[unit_index].sampled = TRUE;
g_string_append_printf (shader_state->header,
@@ -451,20 +441,18 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
{
g_string_append_printf (shader_state->header,
"vec4\n"
- "cogl_real_texture_lookup%i (sampler%s tex,\n"
+ "cogl_real_texture_lookup%i (sampler2D tex,\n"
" vec4 coords)\n"
"{\n"
" return ",
- layer->index,
- target_string);
+ layer->index);
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
g_string_append (shader_state->header,
"vec4 (1.0, 1.0, 1.0, 1.0);\n");
else
- g_string_append_printf (shader_state->header,
- "texture%s (tex, coords.%s);\n",
- target_string, tex_coord_swizzle);
+ g_string_append (shader_state->header,
+ "texture2D (tex, coords.st);\n");
g_string_append (shader_state->header, "}\n");
}
@@ -483,8 +471,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
snippet_data.return_variable = "cogl_texel";
snippet_data.arguments = "cogl_sampler, cogl_tex_coord";
snippet_data.argument_declarations =
- g_strdup_printf ("sampler%s cogl_sampler, vec4 cogl_tex_coord",
- target_string);
+ g_strdup ("sampler2D cogl_sampler, vec4 cogl_tex_coord");
snippet_data.source_buf = shader_state->header;
_cogl_pipeline_snippet_generate_code (&snippet_data);
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
index e27895602..77f2458e9 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
@@ -169,14 +169,9 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
void *user_data)
{
CoglPipelineShaderState *shader_state = user_data;
- const char *target_string;
-
- _cogl_gl_util_get_texture_target_string (COGL_TEXTURE_TYPE_2D,
- &target_string, NULL);
g_string_append_printf (shader_state->header,
- "uniform sampler%s cogl_sampler%i;\n",
- target_string,
+ "uniform sampler2D cogl_sampler%i;\n",
layer->index);
return TRUE;
diff --git a/cogl/cogl/driver/gl/cogl-util-gl-private.h b/cogl/cogl/driver/gl/cogl-util-gl-private.h
index 3dbc96b95..5c570bb92 100644
--- a/cogl/cogl/driver/gl/cogl-util-gl-private.h
+++ b/cogl/cogl/driver/gl/cogl-util-gl-private.h
@@ -85,11 +85,6 @@ _cogl_gl_util_clear_gl_errors (CoglContext *ctx);
gboolean
_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error);
-void
-_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
- const char **target_string_out,
- const char **swizzle_out);
-
/* Parses a GL version number stored in a string. @version_string must
* point to the beginning of the version number (ie, it can't point to
* the "OpenGL ES" part on GLES). The version number can be followed
diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c
index 36c63150c..6119b69e8 100644
--- a/cogl/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/cogl/driver/gl/cogl-util-gl.c
@@ -127,39 +127,6 @@ _cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error)
return FALSE;
}
-void
-_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
- const char **target_string_out,
- const char **swizzle_out)
-{
- const char *target_string, *tex_coord_swizzle;
-
- switch (texture_type)
- {
-#if 0 /* TODO */
- case COGL_TEXTURE_TYPE_1D:
- target_string = "1D";
- tex_coord_swizzle = "s";
- break;
-#endif
-
- case COGL_TEXTURE_TYPE_2D:
- target_string = "2D";
- tex_coord_swizzle = "st";
- break;
-
- default:
- target_string = "Unknown";
- tex_coord_swizzle = NULL;
- g_assert_not_reached ();
- }
-
- if (target_string_out)
- *target_string_out = target_string;
- if (swizzle_out)
- *swizzle_out = tex_coord_swizzle;
-}
-
gboolean
_cogl_gl_util_parse_gl_version (const char *version_string,
int *major_out,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]