aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-06-30 11:46:17 -0600
committerBrian Paul <[email protected]>2010-06-30 11:46:17 -0600
commit87d2c77ed3861390d2250788e8b654a504a78c28 (patch)
tree1dd34becbae2f85b8d6dba91fefece066875e8bf /src/gallium/auxiliary/draw/draw_pipe_pstipple.c
parent75acb896c6da758d03e86f8725d6ca0cb2c6ad82 (diff)
draw: fix out of memory handling in polygon stipple stage
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_pstipple.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index fff960c7eb5..ed9a53e154d 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -363,8 +363,12 @@ generate_pstip_fs(struct pstip_stage *pstip)
assert(pstip->fs->sampler_unit < PIPE_MAX_SAMPLERS);
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
-
+
FREE((void *)pstip_fs.tokens);
+
+ if (!pstip->fs->pstip_fs)
+ return FALSE;
+
return TRUE;
}
@@ -603,13 +607,16 @@ pstip_destroy(struct draw_stage *stage)
}
+/** Create a new polygon stipple drawing stage object */
static struct pstip_stage *
-draw_pstip_stage(struct draw_context *draw)
+draw_pstip_stage(struct draw_context *draw, struct pipe_context *pipe)
{
struct pstip_stage *pstip = CALLOC_STRUCT(pstip_stage);
if (pstip == NULL)
goto fail;
+ pstip->pipe = pipe;
+
pstip->stage.draw = draw;
pstip->stage.name = "pstip";
pstip->stage.next = NULL;
@@ -765,14 +772,12 @@ draw_install_pstipple_stage(struct draw_context *draw,
/*
* Create / install pgon stipple drawing / prim stage
*/
- pstip = draw_pstip_stage( draw );
+ pstip = draw_pstip_stage( draw, pipe );
if (pstip == NULL)
goto fail;
draw->pipeline.pstipple = &pstip->stage;
- pstip->pipe = pipe;
-
/* create special texture, sampler state */
if (!pstip_create_texture(pstip))
goto fail;