summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-03-17 16:45:48 -0700
committerEric Anholt <[email protected]>2014-04-15 14:34:22 -0700
commitbb3f983d102bf09b8315f50494633bf489721a52 (patch)
treebd74ad40ec6c81f7e267539759e3c3a894b26d98 /src/mesa
parentcd808ac848227b850a80c1adbb43ce57ca7d673a (diff)
meta: Infer bind_fbo_image parameters from an incoming image.
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta.c10
-rw-r--r--src/mesa/drivers/common/meta.h3
-rw-r--r--src/mesa/drivers/common/meta_generate_mipmap.c6
3 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index ca5d851fff1..6dc71c9d542 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -94,9 +94,12 @@ 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)
+_mesa_meta_bind_fbo_image(struct gl_texture_image *texImage, GLuint layer)
{
+ struct gl_texture_object *texObj = texImage->TexObject;
+ int level = texImage->Level;
+ GLenum target = texObj->Target;
+
switch (target) {
case GL_TEXTURE_1D:
_mesa_FramebufferTexture1D(GL_FRAMEBUFFER,
@@ -115,6 +118,9 @@ _mesa_meta_bind_fbo_image(struct gl_texture_object *texObj, GLenum target,
layer);
break;
default: /* 2D / cube */
+ if (target == GL_TEXTURE_CUBE_MAP)
+ target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
+
_mesa_FramebufferTexture2D(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
target,
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index ea05ea5ea97..ad3da9cd8d4 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -505,7 +505,6 @@ 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);
+_mesa_meta_bind_fbo_image(struct gl_texture_image *texImage, 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 7c7f64d7368..deff6904ab7 100644
--- a/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -103,7 +103,7 @@ fallback_required(struct gl_context *ctx, GLenum target,
_mesa_GenFramebuffers(1, &mipmap->FBO);
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- _mesa_meta_bind_fbo_image(texObj, target, srcLevel, 0);
+ _mesa_meta_bind_fbo_image(baseImage, 0);
status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
@@ -249,6 +249,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
const struct gl_texture_image *srcImage;
+ struct gl_texture_image *dstImage;
const GLuint srcLevel = dstLevel - 1;
GLuint layer;
GLsizei srcWidth, srcHeight, srcDepth;
@@ -293,6 +294,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
*/
break;
}
+ dstImage = _mesa_select_tex_image(ctx, texObj, faceTarget, dstLevel);
/* limit minification to src level */
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
@@ -315,7 +317,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts),
verts, GL_DYNAMIC_DRAW_ARB);
- _mesa_meta_bind_fbo_image(texObj, faceTarget, dstLevel, layer);
+ _mesa_meta_bind_fbo_image(dstImage, layer);
/* sanity check */
if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) !=