[Mesa-dev] [PATCH 12/14] meta: Return if pixels == null and no pixel unpack buffer set

Anuj Phogat anuj.phogat at gmail.com
Mon Feb 23 14:36:49 PST 2015


This patch avoids the unnecessary texture upload when glTexImage{1,2,3}D()
calls allocate a texture with pixels = null and we use
_mesa_meta_pbo_TexSubImage() path.

Texture upload is also avoided when glTexSubImage{1,2,3}D() calls
have pixels = null and use mesa_meta_pbo_TexSubImage() path.

We should get some speedup in above  cases.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/common/meta_tex_subimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
index 8b26ba7..f00aae9 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -151,7 +151,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
    /* XXX: This should probably be passed in from somewhere */
    const char *where = "_mesa_meta_pbo_TexSubImage";
 
-   if (!_mesa_is_bufferobj(packing->BufferObj) && !create_pbo)
+   if (!_mesa_is_bufferobj(packing->BufferObj) &&
+       (!create_pbo || pixels == NULL))
       return false;
 
    if (format == GL_DEPTH_COMPONENT ||
-- 
1.9.3



More information about the mesa-dev mailing list