summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 306cb6e27d2..34d71254b23 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -272,12 +272,14 @@ alloc_triangle(struct lp_scene *scene, unsigned nr_inputs, unsigned *tri_size)
tri = lp_scene_alloc_aligned( scene, bytes, 16 );
- inputs = (char *) (tri + 1);
- tri->inputs.a0 = (float (*)[4]) inputs;
- tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz);
- tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz);
+ if (tri) {
+ inputs = (char *) (tri + 1);
+ tri->inputs.a0 = (float (*)[4]) inputs;
+ tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz);
+ tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz);
- *tri_size = bytes;
+ *tri_size = bytes;
+ }
return tri;
}
@@ -341,6 +343,8 @@ do_triangle_ccw(struct lp_setup_context *setup,
print_triangle(setup, v1, v2, v3);
tri = alloc_triangle(scene, setup->fs.nr_inputs, &tri_bytes);
+ if (!tri)
+ return;
#ifdef DEBUG
tri->v[0][0] = v1[0][0];