Mesa (master): radeonsi: handle constant buffer alloc failures
Marek Olšák
mareko at kemper.freedesktop.org
Thu Sep 24 17:51:28 UTC 2015
Module: Mesa
Branch: master
Commit: 6886c4192ca47056809b559ef7a319bb8a91834d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6886c4192ca47056809b559ef7a319bb8a91834d
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Sep 10 17:42:31 2015 +0200
radeonsi: handle constant buffer alloc failures
Cc: 11.0 <mesa-stable at lists.freedesktop.org>
Acked-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/gallium/drivers/radeonsi/si_descriptors.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 92a7068..b07ab3b 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -472,7 +472,8 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf
u_upload_alloc(sctx->b.uploader, 0, size, const_offset,
(struct pipe_resource**)rbuffer, &tmp);
- util_memcpy_cpu_to_le32(tmp, ptr, size);
+ if (rbuffer)
+ util_memcpy_cpu_to_le32(tmp, ptr, size);
}
static void si_set_constant_buffer(struct pipe_context *ctx, uint shader, uint slot,
@@ -504,6 +505,11 @@ static void si_set_constant_buffer(struct pipe_context *ctx, uint shader, uint s
si_upload_const_buffer(sctx,
(struct r600_resource**)&buffer, input->user_buffer,
input->buffer_size, &buffer_offset);
+ if (!buffer) {
+ /* Just unbind on failure. */
+ si_set_constant_buffer(ctx, shader, slot, NULL);
+ return;
+ }
va = r600_resource(buffer)->gpu_address + buffer_offset;
} else {
pipe_resource_reference(&buffer, input->buffer);
More information about the mesa-commit
mailing list