summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2017-03-23 14:25:39 +0000
committerJulien Isorce <[email protected]>2017-03-28 18:27:55 +0100
commit7ee91af30074a4381e4353122319e3b4b3fe7cbd (patch)
tree78ed9f179b49f3ac4075492fbad6962df8902fdd /src/gallium
parent699cce3493364e8647a6fe8b9f7031fe9f645d8e (diff)
r600g: check NULL return from r600_aligned_buffer_create
Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/r600_state.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 6139bd2f05e..9ca113ac883 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -983,6 +983,11 @@ static void r600_init_color_surface(struct r600_context *rctx,
PIPE_USAGE_DEFAULT,
cmask.size, cmask.alignment);
+ if (unlikely(!rctx->dummy_cmask)) {
+ surf->color_initialized = false;
+ return;
+ }
+
/* Set the contents to 0xCC. */
ptr = pipe_buffer_map(&rctx->b.b, &rctx->dummy_cmask->b.b, PIPE_TRANSFER_WRITE, &transfer);
memset(ptr, 0xCC, cmask.size);
@@ -999,6 +1004,11 @@ static void r600_init_color_surface(struct r600_context *rctx,
r600_aligned_buffer_create(&rscreen->b.b, 0,
PIPE_USAGE_DEFAULT,
fmask.size, fmask.alignment);
+
+ if (unlikely(!rctx->dummy_fmask)) {
+ surf->color_initialized = false;
+ return;
+ }
}
r600_resource_reference(&surf->cb_buffer_fmask, rctx->dummy_fmask);