diff options
author | Eric Anholt <[email protected]> | 2014-02-03 15:58:03 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-02-12 15:38:58 -0800 |
commit | cd084aa297ff96832d3af4e6aa6df9a06be9375f (patch) | |
tree | 2723c4b455159601ee1bb46427a8dd76c00aebe8 /src/mesa/drivers | |
parent | 397b2c3966175de00e84d0de061c6ad10adb35f5 (diff) |
meta: Fold the texture setup into setup_copypix_texture().
There was this funny argument passed to setup for "did alloc decide we
need to allocate new texture storage?", which goes away if we don't have
the caller do alloc as a separate step.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 03811bd10ca..32328d4e334 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1539,17 +1539,20 @@ alloc_texture(struct temp_texture *tex, static void setup_copypix_texture(struct gl_context *ctx, struct temp_texture *tex, - GLboolean newTex, GLint srcX, GLint srcY, GLsizei width, GLsizei height, GLenum intFormat, GLenum filter) { + bool newTex; + _mesa_BindTexture(tex->Target, tex->TexObj); _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter); _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter); if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + newTex = alloc_texture(tex, width, height, intFormat); + /* copy framebuffer image to texture */ if (newTex) { /* create new tex image */ @@ -1942,8 +1945,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, * linear filtering along the edges. So, allocate the texture extended along * edges by one pixel in x, y directions. */ - newTex = alloc_texture(tex, srcW + 2, srcH + 2, rb_base_format); - setup_copypix_texture(ctx, tex, newTex, + setup_copypix_texture(ctx, tex, srcX - 1, srcY - 1, srcW + 2, srcH + 2, rb_base_format, filter); /* texcoords (after texture allocation!) */ @@ -2439,8 +2441,6 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, struct copypix_state *copypix = &ctx->Meta->CopyPix; struct temp_texture *tex = get_temp_texture(ctx); struct vertex verts[4]; - GLboolean newTex; - GLenum intFormat = GL_RGBA; if (type != GL_COLOR || ctx->_ImageTransferState || @@ -2465,11 +2465,13 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, setup_vertex_objects(©pix->VAO, ©pix->VBO, false, 3, 2, 0); - newTex = alloc_texture(tex, width, height, intFormat); - /* Silence valgrind warnings about reading uninitialized stack. */ memset(verts, 0, sizeof(verts)); + /* Alloc/setup texture */ + setup_copypix_texture(ctx, tex, srcX, srcY, width, height, + GL_RGBA, GL_NEAREST); + /* vertex positions, texcoords (after texture allocation!) */ { const GLfloat dstX0 = (GLfloat) dstX; @@ -2503,10 +2505,6 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); } - /* Alloc/setup texture */ - setup_copypix_texture(ctx, tex, newTex, srcX, srcY, width, height, - GL_RGBA, GL_NEAREST); - _mesa_set_enable(ctx, tex->Target, GL_TRUE); /* draw textured quad */ |