[Mesa-dev] [PATCH 2/4] meta: use non-ARB shader/program create/delete functions

Brian Paul brianp at vmware.com
Sat Mar 8 17:10:44 PST 2014


The non-ARB versions take GLuint ids, not GLhandleARB.
---
 src/mesa/drivers/common/meta.c      |   54 +++++++++++++++++------------------
 src/mesa/drivers/common/meta_blit.c |    6 ++--
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index cde34f9..61c67d5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -101,7 +101,7 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
    GLint ok, size;
    GLchar *info;
 
-   shader = _mesa_CreateShaderObjectARB(target);
+   shader = _mesa_CreateShader(target);
    _mesa_ShaderSource(shader, 1, &source, NULL);
    _mesa_CompileShader(shader);
 
@@ -111,13 +111,13 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
 
    _mesa_GetShaderiv(shader, GL_INFO_LOG_LENGTH, &size);
    if (size == 0) {
-      _mesa_DeleteObjectARB(shader);
+      _mesa_DeleteShader(shader);
       return 0;
    }
 
    info = malloc(size);
    if (!info) {
-      _mesa_DeleteObjectARB(shader);
+      _mesa_DeleteShader(shader);
       return 0;
    }
 
@@ -128,7 +128,7 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
 		 info, source);
 
    free(info);
-   _mesa_DeleteObjectARB(shader);
+   _mesa_DeleteShader(shader);
 
    return 0;
 }
@@ -242,11 +242,11 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
    vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
    fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
 
-   shader->shader_prog = _mesa_CreateProgramObjectARB();
+   shader->shader_prog = _mesa_CreateProgram();
    _mesa_AttachShader(shader->shader_prog, fs);
-   _mesa_DeleteObjectARB(fs);
+   _mesa_DeleteShader(fs);
    _mesa_AttachShader(shader->shader_prog, vs);
-   _mesa_DeleteObjectARB(vs);
+   _mesa_DeleteShader(vs);
    _mesa_BindAttribLocation(shader->shader_prog, 0, "position");
    _mesa_BindAttribLocation(shader->shader_prog, 1, "texcoords");
    _mesa_meta_link_program_with_debug(ctx, shader->shader_prog);
@@ -1498,27 +1498,27 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
    if (clear->ShaderProg != 0)
       return;
 
-   vs = _mesa_CreateShaderObjectARB(GL_VERTEX_SHADER);
+   vs = _mesa_CreateShader(GL_VERTEX_SHADER);
    _mesa_ShaderSource(vs, 1, &vs_source, NULL);
    _mesa_CompileShader(vs);
 
    if (_mesa_has_geometry_shaders(ctx)) {
-      gs = _mesa_CreateShaderObjectARB(GL_GEOMETRY_SHADER);
+      gs = _mesa_CreateShader(GL_GEOMETRY_SHADER);
       _mesa_ShaderSource(gs, 1, &gs_source, NULL);
       _mesa_CompileShader(gs);
    }
 
-   fs = _mesa_CreateShaderObjectARB(GL_FRAGMENT_SHADER);
+   fs = _mesa_CreateShader(GL_FRAGMENT_SHADER);
    _mesa_ShaderSource(fs, 1, &fs_source, NULL);
    _mesa_CompileShader(fs);
 
-   clear->ShaderProg = _mesa_CreateProgramObjectARB();
+   clear->ShaderProg = _mesa_CreateProgram();
    _mesa_AttachShader(clear->ShaderProg, fs);
-   _mesa_DeleteObjectARB(fs);
+   _mesa_DeleteShader(fs);
    if (gs != 0)
       _mesa_AttachShader(clear->ShaderProg, gs);
    _mesa_AttachShader(clear->ShaderProg, vs);
-   _mesa_DeleteObjectARB(vs);
+   _mesa_DeleteShader(vs);
    _mesa_BindAttribLocation(clear->ShaderProg, 0, "position");
    _mesa_LinkProgram(clear->ShaderProg);
 
@@ -1559,13 +1559,13 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
                                                 fs_int_source);
       ralloc_free(shader_source_mem_ctx);
 
-      clear->IntegerShaderProg = _mesa_CreateProgramObjectARB();
+      clear->IntegerShaderProg = _mesa_CreateProgram();
       _mesa_AttachShader(clear->IntegerShaderProg, fs);
-      _mesa_DeleteObjectARB(fs);
+      _mesa_DeleteShader(fs);
       if (gs != 0)
          _mesa_AttachShader(clear->IntegerShaderProg, gs);
       _mesa_AttachShader(clear->IntegerShaderProg, vs);
-      _mesa_DeleteObjectARB(vs);
+      _mesa_DeleteShader(vs);
       _mesa_BindAttribLocation(clear->IntegerShaderProg, 0, "position");
 
       /* Note that user-defined out attributes get automatically assigned
@@ -1585,7 +1585,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
       }
    }
    if (gs != 0)
-      _mesa_DeleteObjectARB(gs);
+      _mesa_DeleteShader(gs);
 }
 
 static void
@@ -1597,11 +1597,11 @@ meta_glsl_clear_cleanup(struct clear_state *clear)
    clear->VAO = 0;
    _mesa_DeleteBuffers(1, &clear->VBO);
    clear->VBO = 0;
-   _mesa_DeleteObjectARB(clear->ShaderProg);
+   _mesa_DeleteProgram(clear->ShaderProg);
    clear->ShaderProg = 0;
 
    if (clear->IntegerShaderProg) {
-      _mesa_DeleteObjectARB(clear->IntegerShaderProg);
+      _mesa_DeleteProgram(clear->IntegerShaderProg);
       clear->IntegerShaderProg = 0;
    }
 }
@@ -2679,14 +2679,14 @@ choose_blit_shader(GLenum target, struct blit_shader_table *table)
 void
 _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table)
 {
-   _mesa_DeleteObjectARB(table->sampler_1d.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_2d.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_3d.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_rect.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_cubemap.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_1d_array.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_2d_array.shader_prog);
-   _mesa_DeleteObjectARB(table->sampler_cubemap_array.shader_prog);
+   _mesa_DeleteProgram(table->sampler_1d.shader_prog);
+   _mesa_DeleteProgram(table->sampler_2d.shader_prog);
+   _mesa_DeleteProgram(table->sampler_3d.shader_prog);
+   _mesa_DeleteProgram(table->sampler_rect.shader_prog);
+   _mesa_DeleteProgram(table->sampler_cubemap.shader_prog);
+   _mesa_DeleteProgram(table->sampler_1d_array.shader_prog);
+   _mesa_DeleteProgram(table->sampler_2d_array.shader_prog);
+   _mesa_DeleteProgram(table->sampler_cubemap_array.shader_prog);
 
    table->sampler_1d.shader_prog = 0;
    table->sampler_2d.shader_prog = 0;
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 907c2cd..31e494f 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -325,11 +325,11 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
    vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
    fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
 
-   blit->msaa_shaders[shader_index] = _mesa_CreateProgramObjectARB();
+   blit->msaa_shaders[shader_index] = _mesa_CreateProgram();
    _mesa_AttachShader(blit->msaa_shaders[shader_index], fs);
-   _mesa_DeleteObjectARB(fs);
+   _mesa_DeleteShader(fs);
    _mesa_AttachShader(blit->msaa_shaders[shader_index], vs);
-   _mesa_DeleteObjectARB(vs);
+   _mesa_DeleteShader(vs);
    _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 0, "position");
    _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 1, "texcoords");
    _mesa_meta_link_program_with_debug(ctx, blit->msaa_shaders[shader_index]);
-- 
1.7.10.4



More information about the mesa-dev mailing list