From patchwork Mon Jul 25 14:05:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 3103 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A2DFA23E54 for ; Mon, 25 Jul 2011 14:05:36 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id 69256A1849B for ; Mon, 25 Jul 2011 14:05:36 +0000 (UTC) Received: by mail-qy0-f173.google.com with SMTP id 10so1062982qyk.11 for ; Mon, 25 Jul 2011 07:05:36 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr3478822qcc.148.1311602736110; Mon, 25 Jul 2011 07:05:36 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs78181qcb; Mon, 25 Jul 2011 07:05:35 -0700 (PDT) Received: by 10.223.4.202 with SMTP id 10mr6833386fas.129.1311602735090; Mon, 25 Jul 2011 07:05:35 -0700 (PDT) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by mx.google.com with ESMTPS id o15si7048838fal.135.2011.07.25.07.05.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:05:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.161.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by mail-fx0-f44.google.com with SMTP id 6so6811099fxe.17 for ; Mon, 25 Jul 2011 07:05:34 -0700 (PDT) Received: by 10.223.72.80 with SMTP id l16mr6835724faj.33.1311602734674; Mon, 25 Jul 2011 07:05:34 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id w11sm3810443faj.14.2011.07.25.07.05.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:05:34 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 7/9] gl: Remove GL 1.x ARB shader implementation Date: Mon, 25 Jul 2011 17:05:11 +0300 Message-Id: <1311602713-6182-7-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602713-6182-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602713-6182-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis 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 --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;