diff mbox

[7/9] gl: Remove GL 1.x ARB shader implementation

Message ID 1311602713-6182-7-git-send-email-alexandros.frantzis@linaro.org
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 25, 2011, 2:05 p.m. UTC
From: Alexandros Frantzis <alexandros.frantzis@linaro.org>

Shaders for GL 1.x ARB are served by the same implementation as GL 2.x and therefore
a dedicated ARB implementation is not needed any more.
---
 src/cairo-gl-shaders.c |  187 ------------------------------------------------
 1 files changed, 0 insertions(+), 187 deletions(-)
diff mbox

Patch

diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index 909b681..a89c42b 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -110,179 +110,6 @@  _cairo_gl_shader_compile (cairo_gl_context_t *ctx,
 			  cairo_gl_var_type_t mask,
 			  const char *fragment_text);
 
-/* ARB_shader_objects / ARB_vertex_shader / ARB_fragment_shader extensions
-   API. */
-static void
-compile_shader_arb (cairo_gl_context_t *ctx, GLuint *shader,
-		    GLenum type, const char *text)
-{
-    const char* strings[1] = { text };
-    GLint gl_status;
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-
-    *shader = dispatch->CreateShader (type);
-    dispatch->ShaderSource (*shader, 1, strings, 0);
-    dispatch->CompileShader (*shader);
-    dispatch->GetShaderiv (*shader, GL_COMPILE_STATUS, &gl_status);
-    if (gl_status == GL_FALSE) {
-        GLint log_size;
-        dispatch->GetShaderiv (*shader, GL_INFO_LOG_LENGTH, &log_size);
-        if (0 < log_size) {
-            char *log = _cairo_malloc (log_size);
-            GLint chars;
-
-            log[log_size - 1] = '\0';
-            dispatch->GetShaderInfoLog (*shader, log_size, &chars, log);
-            printf ("OpenGL shader compilation failed.  Shader:\n"
-                    "%s\n"
-                    "OpenGL compilation log:\n"
-                    "%s\n",
-                    text, log);
-
-            free (log);
-        } else {
-            printf ("OpenGL shader compilation failed.\n");
-        }
-
-	ASSERT_NOT_REACHED;
-    }
-}
-
-static void
-link_shader_arb (cairo_gl_context_t *ctx, GLuint *program, GLuint vert, GLuint frag)
-{
-    GLint gl_status;
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-
-    *program = dispatch->CreateProgram ();
-    dispatch->AttachShader (*program, vert);
-    dispatch->AttachShader (*program, frag);
-    dispatch->LinkProgram (*program);
-    dispatch->GetProgramiv (*program, GL_LINK_STATUS, &gl_status);
-    if (gl_status == GL_FALSE) {
-        GLint log_size;
-        dispatch->GetProgramiv (*program, GL_INFO_LOG_LENGTH, &log_size);
-        if (0 < log_size) {
-            char *log = _cairo_malloc (log_size);
-            GLint chars;
-
-            log[log_size - 1] = '\0';
-            dispatch->GetProgramInfoLog (*program, log_size, &chars, log);
-            printf ("OpenGL shader link failed:\n%s\n", log);
-
-            free (log);
-        } else {
-            printf ("OpenGL shader link failed.\n");
-        }
-
-	ASSERT_NOT_REACHED;
-    }
-}
-
-static void
-destroy_shader_arb (cairo_gl_context_t *ctx, GLuint shader)
-{
-    ctx->dispatch.DeleteShader (shader);
-}
-
-static void
-destroy_program_arb (cairo_gl_context_t *ctx, GLuint shader)
-{
-    ctx->dispatch.DeleteProgram (shader);
-}
-
-static void
-bind_float_arb (cairo_gl_context_t *ctx,
-		cairo_gl_shader_t *shader,
-		const char *name,
-		float value)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    assert (location != -1);
-    dispatch->Uniform1f (location, value);
-}
-
-static void
-bind_vec2_arb (cairo_gl_context_t *ctx,
-	       cairo_gl_shader_t *shader,
-	       const char *name,
-	       float value0,
-	       float value1)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    assert (location != -1);
-    dispatch->Uniform2f (location, value0, value1);
-}
-
-static void
-bind_vec3_arb (cairo_gl_context_t *ctx,
-	       cairo_gl_shader_t *shader,
-	       const char *name,
-	       float value0,
-	       float value1,
-	       float value2)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    assert (location != -1);
-    dispatch->Uniform3f (location, value0, value1, value2);
-}
-
-static void
-bind_vec4_arb (cairo_gl_context_t *ctx,
-	       cairo_gl_shader_t *shader,
-	       const char *name,
-	       float value0,
-	       float value1,
-	       float value2,
-	       float value3)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    assert (location != -1);
-    dispatch->Uniform4f (location, value0, value1, value2, value3);
-}
-
-static void
-bind_matrix_arb (cairo_gl_context_t *ctx,
-		 cairo_gl_shader_t *shader,
-		 const char *name,
-		 cairo_matrix_t* m)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    float gl_m[16] = {
-        m->xx, m->xy, m->x0,
-        m->yx, m->yy, m->y0,
-        0,     0,     1
-    };
-    assert (location != -1);
-    dispatch->UniformMatrix3fv (location, 1, GL_TRUE, gl_m);
-}
-
-static void
-bind_texture_arb (cairo_gl_context_t *ctx,
-		  cairo_gl_shader_t *shader,
-		  const char *name,
-		  cairo_gl_tex_t tex_unit)
-{
-    cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-    GLint location = dispatch->GetUniformLocation (shader->program, name);
-    assert (location != -1);
-    dispatch->Uniform1i (location, tex_unit);
-}
-
-static void
-use_program_arb (cairo_gl_context_t *ctx, cairo_gl_shader_t *shader)
-{
-    if (shader)
-	ctx->dispatch.UseProgram (shader->program);
-    else
-	ctx->dispatch.UseProgram (0);
-}
-
 /* OpenGL Core 2.0 API. */
 static void
 compile_shader_core_2_0 (cairo_gl_context_t *ctx, GLuint *shader,
@@ -469,20 +296,6 @@  static const cairo_gl_shader_impl_t shader_impl_core_2_0 = {
     use_program_core_2_0,
 };
 
-static const cairo_gl_shader_impl_t shader_impl_arb = {
-    compile_shader_arb,
-    link_shader_arb,
-    destroy_shader_arb,
-    destroy_program_arb,
-    bind_float_arb,
-    bind_vec2_arb,
-    bind_vec3_arb,
-    bind_vec4_arb,
-    bind_matrix_arb,
-    bind_texture_arb,
-    use_program_arb,
-};
-
 typedef struct _cairo_shader_cache_entry {
     cairo_cache_entry_t base;