i965/tex: Check if there is data to upload up-front
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 1 Jun 2017 00:04:13 +0000 (17:04 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Oct 2017 02:58:40 +0000 (19:58 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_tex_image.c

index 7396597d9f98b46873ac8100a7f6f363788f2998..69860e28e3b6d124f72d0ab322cc644af139704e 100644 (file)
@@ -296,6 +296,10 @@ intel_upload_tex(struct gl_context * ctx,
    struct intel_mipmap_tree *mt = intel_texture_image(texImage)->mt;
    bool ok;
 
+   /* Check that there is actually data to store. */
+   if (pixels == NULL && !_mesa_is_bufferobj(packing->BufferObj))
+      return;
+
    bool tex_busy = mt && brw_bo_busy(mt->bo);
 
    if (mt && mt->format == MESA_FORMAT_S_UINT8)