[Mesa-dev] [PATCH 10/10] meta: Support BlitFramebuffer from all the other texture targets.

Kenneth Graunke kenneth at whitecape.org
Mon Mar 10 00:02:46 PDT 2014


On 03/04/2014 02:17 PM, Eric Anholt wrote:
> There's already code for them due to the GenerateMipmap path, so we just
> need to make sure we've got our coordinates present.
> ---
>  src/mesa/drivers/common/meta_blit.c | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
> index 550133f..a2046d8 100644
> --- a/src/mesa/drivers/common/meta_blit.c
> +++ b/src/mesa/drivers/common/meta_blit.c
> @@ -418,16 +418,6 @@ blitframebuffer_texture(struct gl_context *ctx,
>        srcLevel = readAtt->TextureLevel;
>        texObj = readAtt->Texture;
>        target = texObj->Target;
> -
> -      switch (target) {
> -      case GL_TEXTURE_2D:
> -      case GL_TEXTURE_RECTANGLE:
> -      case GL_TEXTURE_2D_MULTISAMPLE:
> -      case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> -         break;
> -      default:
> -         return false;
> -      }
>     } else if (ctx->Driver.BindRenderbufferTexImage) {
>        /* Otherwise, we need the driver to be able to bind a renderbuffer as
>         * a texture image.
> @@ -537,7 +527,9 @@ blitframebuffer_texture(struct gl_context *ctx,
>        struct vertex verts[4];
>        GLfloat s0, t0, s1, t1;
>  
> -      if (target == GL_TEXTURE_2D) {
> +      if (!(target == GL_TEXTURE_RECTANGLE_ARB ||
> +            target == GL_TEXTURE_2D_MULTISAMPLE ||
> +            target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) {

I think this might be a little easier to read as:
if (target != GL_TEXTURE_RECTANGLE &&
    target != GL_TEXTURE_2D_MULTISAMPLE &&
    target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {

or maybe:
bool unnormalized_coords =
   target == GL_TEXTURE_RECTANGLE ||
   target == GL_TEXTURE_2D_MULTISAMPLE ||
   target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;

if (!unnormalized_coords) {

But, whatever suits you is fine.  This patch is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

>           const struct gl_texture_image *texImage
>              = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
>           s0 = srcX0 / (float) texImage->Width;
> @@ -546,9 +538,6 @@ blitframebuffer_texture(struct gl_context *ctx,
>           t1 = srcY1 / (float) texImage->Height;
>        }
>        else {
> -         assert(target == GL_TEXTURE_RECTANGLE_ARB ||
> -                target == GL_TEXTURE_2D_MULTISAMPLE ||
> -                target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
>           s0 = (float) srcX0;
>           s1 = (float) srcX1;
>           t0 = (float) srcY0;
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140310/3de9b6a0/attachment.pgp>


More information about the mesa-dev mailing list