From: Jason Ekstrand Date: Fri, 25 Jul 2014 21:07:49 +0000 (-0700) Subject: mesa/meta: Make _mesa_meta_bind_fbo_image also take a framebuffer target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80a8b020c02356ec59b0948b87bce9e97d1e14bd;p=mesa.git mesa/meta: Make _mesa_meta_bind_fbo_image also take a framebuffer target Signed-off-by: Jason Ekstrand Reviewed-by: Juha-Pekka Heikkila Reviewed-by: Neil Roberts --- diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index f8f0ee306ff..a1d06d4123b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -101,18 +101,18 @@ static void meta_decompress_cleanup(struct decompress_state *decompress); static void meta_drawpix_cleanup(struct drawpix_state *drawpix); void -_mesa_meta_bind_fbo_image(GLenum attachment, +_mesa_meta_bind_fbo_image(GLenum fboTarget, GLenum attachment, struct gl_texture_image *texImage, GLuint layer) { struct gl_texture_object *texObj = texImage->TexObject; int level = texImage->Level; - GLenum target = texObj->Target; + GLenum texTarget = texObj->Target; - switch (target) { + switch (texTarget) { case GL_TEXTURE_1D: - _mesa_FramebufferTexture1D(GL_FRAMEBUFFER, + _mesa_FramebufferTexture1D(fboTarget, attachment, - target, + texTarget, texObj->Name, level); break; @@ -121,19 +121,19 @@ _mesa_meta_bind_fbo_image(GLenum attachment, case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_TEXTURE_3D: - _mesa_FramebufferTextureLayer(GL_FRAMEBUFFER, + _mesa_FramebufferTextureLayer(fboTarget, attachment, texObj->Name, level, layer); break; default: /* 2D / cube */ - if (target == GL_TEXTURE_CUBE_MAP) - target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face; + if (texTarget == GL_TEXTURE_CUBE_MAP) + texTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face; - _mesa_FramebufferTexture2D(GL_FRAMEBUFFER, + _mesa_FramebufferTexture2D(fboTarget, attachment, - target, + texTarget, texObj->Name, level); } @@ -2802,17 +2802,20 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, if (rb->_BaseFormat == GL_DEPTH_STENCIL || rb->_BaseFormat == GL_DEPTH_COMPONENT) { - _mesa_meta_bind_fbo_image(GL_DEPTH_ATTACHMENT, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + texImage, zoffset); mask = GL_DEPTH_BUFFER_BIT; if (rb->_BaseFormat == GL_DEPTH_STENCIL && texImage->_BaseFormat == GL_DEPTH_STENCIL) { - _mesa_meta_bind_fbo_image(GL_STENCIL_ATTACHMENT, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + texImage, zoffset); mask |= GL_STENCIL_BUFFER_BIT; } _mesa_DrawBuffer(GL_NONE); } else { - _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + texImage, zoffset); mask = GL_COLOR_BUFFER_BIT; _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0); } @@ -3356,7 +3359,8 @@ cleartexsubimage_color(struct gl_context *ctx, GLenum datatype; GLenum status; - _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + texImage, zoffset); status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) @@ -3402,10 +3406,12 @@ cleartexsubimage_depth_stencil(struct gl_context *ctx, GLfloat depthValue; GLenum status; - _mesa_meta_bind_fbo_image(GL_DEPTH_ATTACHMENT, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + texImage, zoffset); if (texImage->_BaseFormat == GL_DEPTH_STENCIL) - _mesa_meta_bind_fbo_image(GL_STENCIL_ATTACHMENT, texImage, zoffset); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + texImage, zoffset); status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index b269dceedde..f12dc65d2a7 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -570,7 +570,7 @@ void _mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); void -_mesa_meta_bind_fbo_image(GLenum attachment, +_mesa_meta_bind_fbo_image(GLenum target, GLenum attachment, 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 4b1718df92e..8ffd8da3bde 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -104,7 +104,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(GL_COLOR_ATTACHMENT0, baseImage, 0); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, baseImage, 0); status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -327,7 +327,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(GL_COLOR_ATTACHMENT0, dstImage, layer); + _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dstImage, layer); /* sanity check */ if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) !=