[Mesa-dev] [PATCH 03/14] meta: Provide read access to blit shaders

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Apr 23 11:18:17 PDT 2015


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/common/meta.c | 17 ++++++++---------
 src/mesa/drivers/common/meta.h |  5 ++++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index cf99d95..8c69b5d 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -92,9 +92,6 @@
 static void
 meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl);
 
-static struct blit_shader *
-choose_blit_shader(GLenum target, struct blit_shader_table *table);
-
 static void cleanup_temp_texture(struct temp_texture *tex);
 static void meta_glsl_clear_cleanup(struct clear_state *clear);
 static void meta_decompress_cleanup(struct decompress_state *decompress);
@@ -240,14 +237,14 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx,
  *
  * \returns a handle to a shader program on success or zero on failure.
  */
-void
+const struct blit_shader *
 _mesa_meta_setup_blit_shader(struct gl_context *ctx,
                              GLenum target,
                              bool do_depth,
                              struct blit_shader_table *table)
 {
    char *vs_source, *fs_source;
-   struct blit_shader *shader = choose_blit_shader(target, table);
+   struct blit_shader *shader = _mesa_meta_choose_blit_shader(target, table);
    const char *vs_input, *vs_output, *fs_input, *vs_preprocess, *fs_preprocess;
    void *mem_ctx;
 
@@ -270,7 +267,7 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
 
    if (shader->shader_prog != 0) {
       _mesa_UseProgram(shader->shader_prog);
-      return;
+      return shader;
    }
 
    mem_ctx = ralloc_context(NULL);
@@ -306,6 +303,8 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
                                                        shader->type),
                                        &shader->shader_prog);
    ralloc_free(mem_ctx);
+
+   return shader;
 }
 
 /**
@@ -2615,9 +2614,9 @@ _mesa_meta_setup_texture_coords(GLenum faceTarget,
       assert(!"unexpected target in _mesa_meta_setup_texture_coords()");
    }
 }
-
-static struct blit_shader *
-choose_blit_shader(GLenum target, struct blit_shader_table *table)
+ 
+struct blit_shader *
+_mesa_meta_choose_blit_shader(GLenum target, struct blit_shader_table *table)
 {
    switch(target) {
    case GL_TEXTURE_1D:
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index e7d894d..d3bb3a5 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -634,7 +634,10 @@ _mesa_meta_setup_copypix_texture(struct gl_context *ctx,
                                  GLenum intFormat,
                                  GLenum filter);
 
-void
+struct blit_shader *
+_mesa_meta_choose_blit_shader(GLenum target, struct blit_shader_table *table);
+
+const struct blit_shader *
 _mesa_meta_setup_blit_shader(struct gl_context *ctx,
                              GLenum target,
                              bool do_depth,
-- 
1.9.3



More information about the mesa-dev mailing list