summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-04-14 15:22:49 +0100
committerJosé Fonseca <[email protected]>2011-04-14 19:51:45 +0100
commit6881cfc7f7b425f52ae631936cc53d409f208fa1 (patch)
treef1645ea3551cbce1088516a7887c4672cbebe15f /src/mesa
parent78e90bf2474b89dcc7cc199ddb360745e93720c6 (diff)
mesa/st: Avoid spurious transfers when creating fbo textures without image data.
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. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c7
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 914c06b7023..43c24ae957f 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;