On 04/14/2011 11:08 AM, jfons...@vmware.com wrote:
From: José Fonseca<jfons...@vmware.com>

We could actually try to do an early return both for gallium textures and
malloc memory textures, but I'm not sure exactly which situations
stImage->pt is NULL, and whether texImage->Data == NULL would be acceptible
or not.
---
  src/mesa/state_tracker/st_cb_texture.c |    7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 914c06b..43c24ae 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -600,7 +600,12 @@ st_TexImage(struct gl_context * ctx,
      * memory or malloc space for it.
      */
     if (stImage->pt) {
-      /* Store the image in the gallium texture memory buffer */
+      if (!pixels) {
+         /* We've allocated texture resource, but have no pixel data - all 
done. */
+         goto done;
+      }
+
+      /* Store the image in the gallium transfer object */
        if (format == GL_DEPTH_COMPONENT&&
            util_format_is_depth_and_stencil(stImage->pt->format))
           transfer_usage = PIPE_TRANSFER_READ_WRITE;

Reviewed-by: Brian Paul <bri...@vmware.com>


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to