Mesa (master): softpipe: check if so_target is NULL before accessing it
Roland Scheidegger
sroland at kemper.freedesktop.org
Fri Aug 30 21:20:24 UTC 2013
Module: Mesa
Branch: master
Commit: 81ab3e57bc049b280f9d41bdcbfd0a9f327f6bde
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=81ab3e57bc049b280f9d41bdcbfd0a9f327f6bde
Author: Roland Scheidegger <sroland at vmware.com>
Date: Fri Aug 30 16:34:26 2013 +0200
softpipe: check if so_target is NULL before accessing it
No idea if this is working right but copied straight from llvmpipe.
(Not only does this check the so_target but also use buffer->data instead
of buffer for the mapping.)
Just trying to get rid of a segfault testing something else...
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
Reviewed-by: Zack Rusin <zackr at vmware.com>
---
src/gallium/drivers/softpipe/sp_draw_arrays.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 6b06f70..4d56b1c 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -107,8 +107,11 @@ softpipe_draw_vbo(struct pipe_context *pipe,
for (i = 0; i < sp->num_so_targets; i++) {
- void *buf = softpipe_resource_data(sp->so_targets[i]->target.buffer);
- sp->so_targets[i]->mapping = buf;
+ void *buf = 0;
+ if (sp->so_targets[i]) {
+ buf = softpipe_resource(sp->so_targets[i]->target.buffer)->data;
+ sp->so_targets[i]->mapping = buf;
+ }
}
draw_set_mapped_so_targets(draw, sp->num_so_targets,
More information about the mesa-commit
mailing list