summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-02-11 16:08:51 -0800
committerEric Anholt <[email protected]>2014-02-12 15:38:57 -0800
commitb719aa39026826b8262d74fffdc58a75cc6a107e (patch)
tree549c673708207627b4b884513197ac8421dcca9c /src
parentb424da4be07ab8d34986e6f3824c679b623df952 (diff)
meta: Simplify the blit shader setup steps.
The only thing that wants to track the glsl_sampler structure is the shader string generator. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8569391179b..2b87d3f6ec4 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -453,12 +453,18 @@ link_program_with_debug(struct gl_context *ctx, GLuint program)
* \returns a handle to a shader program on success or zero on failure.
*/
static GLuint
-setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler)
+setup_blit_shader(struct gl_context *ctx,
+ GLenum target,
+ struct sampler_table *table)
{
const char *vs_source;
char *fs_source;
GLuint vs, fs;
void *const mem_ctx = ralloc_context(NULL);
+ struct glsl_sampler *sampler =
+ setup_texture_sampler(target, table);
+
+ assert(sampler != NULL);
if (sampler->shader_prog != 0)
return sampler->shader_prog;
@@ -1667,18 +1673,12 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
struct blit_state *blit,
GLenum target)
{
- struct glsl_sampler *sampler;
-
/* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */
assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D);
setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
- /* Generate a relevant fragment shader program for the texture target */
- sampler = setup_texture_sampler(target, &blit->samplers);
- assert(sampler != NULL);
-
- setup_shader_for_sampler(ctx, sampler);
+ setup_blit_shader(ctx, target, &blit->samplers);
}
/**
@@ -3432,15 +3432,10 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
struct gen_mipmap_state *mipmap,
GLenum target)
{
- struct glsl_sampler *sampler;
-
setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true, 2, 3, 0);
- /* Generate a fragment shader program appropriate for the texture target */
- sampler = setup_texture_sampler(target, &mipmap->samplers);
- assert(sampler != NULL);
-
- mipmap->ShaderProg = setup_shader_for_sampler(ctx, sampler);
+ mipmap->ShaderProg = setup_blit_shader(ctx, target,
+ &mipmap->samplers);
}
@@ -3943,16 +3938,10 @@ decompress_texture_image(struct gl_context *ctx,
}
if (use_glsl_version) {
- struct glsl_sampler *sampler;
-
setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
2, 4, 0);
- /* Generate a relevant fragment shader program for the texture target */
- sampler = setup_texture_sampler(target, &decompress->samplers);
- assert(sampler != NULL);
-
- shaderProg = setup_shader_for_sampler(ctx, sampler);
+ shaderProg = setup_blit_shader(ctx, target, &decompress->samplers);
} else {
setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
}