diff options
author | Eric Anholt <[email protected]> | 2014-03-17 16:26:42 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-04-15 14:34:22 -0700 |
commit | cd808ac848227b850a80c1adbb43ce57ca7d673a (patch) | |
tree | ec6dc850e427bf7a4984edefe0e6df362b39e4f8 /src | |
parent | 4cc42805e72d7edba0599f4d45099b4ed97ec185 (diff) |
meta: Move bind_fbo_image() code back to meta.c, to reuse it elsewhere.
I need to do the same code again for CopyTexSubImage().
v2: Drop incorrect, not-terribly-useful comment (review by Ken)
Reviewed-by: Ian Romanick <[email protected]> (v1)
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 30 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_generate_mipmap.c | 36 |
3 files changed, 36 insertions, 34 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index acf927b09a0..ca5d851fff1 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -93,6 +93,36 @@ static void meta_glsl_clear_cleanup(struct clear_state *clear); static void meta_decompress_cleanup(struct decompress_state *decompress); static void meta_drawpix_cleanup(struct drawpix_state *drawpix); +void +_mesa_meta_bind_fbo_image(struct gl_texture_object *texObj, GLenum target, + GLuint level, GLuint layer) +{ + switch (target) { + case GL_TEXTURE_1D: + _mesa_FramebufferTexture1D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + target, + texObj->Name, + level); + break; + case GL_TEXTURE_1D_ARRAY: + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_3D: + _mesa_FramebufferTextureLayer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + texObj->Name, + level, + layer); + break; + default: /* 2D / cube */ + _mesa_FramebufferTexture2D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + target, + texObj->Name, + level); + } +} + GLuint _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 1177ced3aaa..ea05ea5ea97 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -504,4 +504,8 @@ _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table); void _mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); +void +_mesa_meta_bind_fbo_image(struct gl_texture_object *texObj, GLenum target, + GLuint level, GLuint layer); + #endif /* META_H */ diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index d62819c4c22..7c7f64d7368 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -44,38 +44,6 @@ #include "main/viewport.h" #include "drivers/common/meta.h" -/** - * Bind a particular texture level/layer to mipmap->FBO's GL_COLOR_ATTACHMENT0. - */ -static void -bind_fbo_image(struct gl_texture_object *texObj, GLenum target, - GLuint level, GLuint layer) -{ - switch (target) { - case GL_TEXTURE_1D: - _mesa_FramebufferTexture1D(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - target, - texObj->Name, - level); - break; - case GL_TEXTURE_1D_ARRAY: - case GL_TEXTURE_2D_ARRAY: - case GL_TEXTURE_3D: - _mesa_FramebufferTextureLayer(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - texObj->Name, - level, - layer); - break; - default: /* 2D / cube */ - _mesa_FramebufferTexture2D(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - target, - texObj->Name, - level); - } -} /** * Check if the call to _mesa_meta_GenerateMipmap() will require a @@ -135,7 +103,7 @@ fallback_required(struct gl_context *ctx, GLenum target, _mesa_GenFramebuffers(1, &mipmap->FBO); _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); - bind_fbo_image(texObj, target, srcLevel, 0); + _mesa_meta_bind_fbo_image(texObj, target, srcLevel, 0); status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -347,7 +315,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_DYNAMIC_DRAW_ARB); - bind_fbo_image(texObj, faceTarget, dstLevel, layer); + _mesa_meta_bind_fbo_image(texObj, faceTarget, dstLevel, layer); /* sanity check */ if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) != |