Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> On 05/09/2014 01:28 AM, Topi Pohjolainen wrote: > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > --- > src/mesa/drivers/common/meta.h | 7 ++++ > src/mesa/drivers/common/meta_blit.c | 70 > +++++++++++++++++++++---------------- > 2 files changed, 47 insertions(+), 30 deletions(-) > > diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h > index fdd8714..70b87a1 100644 > --- a/src/mesa/drivers/common/meta.h > +++ b/src/mesa/drivers/common/meta.h > @@ -395,6 +395,13 @@ _mesa_meta_end(struct gl_context *ctx); > extern GLboolean > _mesa_meta_in_progress(struct gl_context *ctx); > > +extern GLboolean > +_mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, > + struct gl_renderbuffer *rb, > + GLuint *tex, > + struct gl_texture_object **texObj, > + GLenum *target); > + > extern void > _mesa_meta_BlitFramebuffer(struct gl_context *ctx, > GLint srcX0, GLint srcY0, GLint srcX1, GLint > srcY1, > diff --git a/src/mesa/drivers/common/meta_blit.c > b/src/mesa/drivers/common/meta_blit.c > index 14ecf8f..9c8231b 100644 > --- a/src/mesa/drivers/common/meta_blit.c > +++ b/src/mesa/drivers/common/meta_blit.c > @@ -392,38 +392,16 @@ blitframebuffer_texture(struct gl_context *ctx, > texObj = readAtt->Texture; > target = texObj->Target; > } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) { > - /* Otherwise, we need the driver to be able to bind a renderbuffer as > - * a texture image. > - */ > - struct gl_texture_image *texImage; > - > - if (rb->NumSamples > 1) > - target = GL_TEXTURE_2D_MULTISAMPLE; > - else > - target = GL_TEXTURE_2D; > - > - _mesa_GenTextures(1, &tempTex); > - _mesa_BindTexture(target, tempTex); > - srcLevel = 0; > - texObj = _mesa_lookup_texture(ctx, tempTex); > - texImage = _mesa_get_tex_image(ctx, texObj, target, srcLevel); > - > - if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) { > - _mesa_DeleteTextures(1, &tempTex); > + if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, > + &tempTex, &texObj, &target)) > return false; > - } else { > - if (ctx->Driver.FinishRenderTexture && > - !rb->NeedsFinishRenderTexture) { > - rb->NeedsFinishRenderTexture = true; > - ctx->Driver.FinishRenderTexture(ctx, rb); > - } > > - if (_mesa_is_winsys_fbo(readFb)) { > - GLint temp = srcY0; > - srcY0 = rb->Height - srcY1; > - srcY1 = rb->Height - temp; > - flipY = -flipY; > - } > + srcLevel = 0; > + if (_mesa_is_winsys_fbo(readFb)) { > + GLint temp = srcY0; > + srcY0 = rb->Height - srcY1; > + srcY1 = rb->Height - temp; > + flipY = -flipY; > } > } else { > GLenum tex_base_format; > @@ -603,6 +581,38 @@ blitframebuffer_texture(struct gl_context *ctx, > return true; > } > > +GLboolean > +_mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, > + struct gl_renderbuffer *rb, > + GLuint *tex, > + struct gl_texture_object **texObj, > + GLenum *target) > +{ > + struct gl_texture_image *texImage; > + > + if (rb->NumSamples > 1) > + *target = GL_TEXTURE_2D_MULTISAMPLE; > + else > + *target = GL_TEXTURE_2D; > + > + _mesa_GenTextures(1, tex); > + _mesa_BindTexture(*target, *tex); > + *texObj = _mesa_lookup_texture(ctx, *tex); > + texImage = _mesa_get_tex_image(ctx, *texObj, *target, 0); > + > + if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) { > + _mesa_DeleteTextures(1, tex); > + return false; > + } > + > + if (ctx->Driver.FinishRenderTexture && !rb->NeedsFinishRenderTexture) { > + rb->NeedsFinishRenderTexture = true; > + ctx->Driver.FinishRenderTexture(ctx, rb); > + } > + > + return true; > +} > + > /** > * Meta implementation of ctx->Driver.BlitFramebuffer() in terms > * of texture mapping and polygon rendering. >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev