Mesa (master): meta: Abort texture upload if pixels == null and no pixel unpack buffer set

Anuj Phogat aphogat at kemper.freedesktop.org
Mon Jun 15 16:20:54 UTC 2015


Module: Mesa
Branch: master
Commit: 8e9eec5cbf73bf977bc7e808a4e653737ee94c38
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e9eec5cbf73bf977bc7e808a4e653737ee94c38

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Fri May 15 06:01:15 2015 -0700

meta: Abort texture upload if pixels == null and no pixel unpack buffer set

in case of glTexImage{1,2,3}D(). Texture has already been allocated
at this point and we have no data to upload. With out this patch,
with create_pbo = true, we end up creating a temporary pbo and then
uploading uninitialzed texture data.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Neil Roberts <neil at linux.intel.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 6bd74e1..d2474f5 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,
    bool success = false;
    int z;
 
-   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 ||




More information about the mesa-commit mailing list