diff options
author | Brian Paul <brianp@vmware.com> | 2009-09-03 09:41:41 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-09-03 09:42:38 -0600 |
commit | 2f6d2a9e27f8582591dc60655f7d7b14d7552bbc (patch) | |
tree | 899c13067d3dd04223bf214e43209e32878cf041 /src/mesa/drivers/dri | |
parent | 848ab8be8c34b00b2afe6120882f8c29f047ced5 (diff) | |
download | external_mesa3d-2f6d2a9e27f8582591dc60655f7d7b14d7552bbc.zip external_mesa3d-2f6d2a9e27f8582591dc60655f7d7b14d7552bbc.tar.gz external_mesa3d-2f6d2a9e27f8582591dc60655f7d7b14d7552bbc.tar.bz2 |
mesa: change ctx->Driver.BufferData() to return GLboolean for success/failure
Return GL_FALSE if we failed to allocate the buffer. Then raise
GL_OUT_OF_MEMORY in core Mesa.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 9 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index ae6f306..c55c5c4 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -130,9 +130,10 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If data is NULL, * memory will be allocated, but no copy will occur. - * Called via glBufferDataARB(). + * Called via ctx->Driver.BufferData(). + * \return GL_TRUE for success, GL_FALSE if out of memory */ -static void +static GLboolean intel_bufferobj_data(GLcontext * ctx, GLenum target, GLsizeiptrARB size, @@ -167,15 +168,19 @@ intel_bufferobj_data(GLcontext * ctx, if (intel_obj->sys_buffer != NULL) { if (data != NULL) memcpy(intel_obj->sys_buffer, data, size); - return; + return GL_TRUE; } } #endif intel_bufferobj_alloc_buffer(intel, intel_obj); + if (!intel_obj->buffer) + return GL_FALSE; if (data != NULL) dri_bo_subdata(intel_obj->buffer, 0, size, data); } + + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index e8ae51e..a24b6da 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -78,9 +78,10 @@ radeonDeleteBufferObject(GLcontext * ctx, * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If data is NULL, * memory will be allocated, but no copy will occur. - * Called via glBufferDataARB(). + * Called via ctx->Driver.BufferData(). + * \return GL_TRUE for success, GL_FALSE if out of memory */ -static void +static GLboolean radeonBufferData(GLcontext * ctx, GLenum target, GLsizeiptrARB size, @@ -107,6 +108,9 @@ radeonBufferData(GLcontext * ctx, RADEON_GEM_DOMAIN_GTT, 0); + if (!radeon_obj->bo) + return GL_FALSE; + if (data != NULL) { radeon_bo_map(radeon_obj->bo, GL_TRUE); @@ -115,6 +119,7 @@ radeonBufferData(GLcontext * ctx, radeon_bo_unmap(radeon_obj->bo); } } + return GL_TRUE; } /** |