diff options
author | Nicolai Hähnle <[email protected]> | 2016-01-06 17:57:49 -0500 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-02-03 14:03:46 +0100 |
commit | 46b7a526f551e18a20d07220663652ba011e4fe6 (patch) | |
tree | 783b4c0aa58b16f055c3218d7a267ecc2a35e4d6 /src/mesa/main/bufferobj.c | |
parent | fd7229b4374d7bd8f296e1da4123e0d678d67699 (diff) |
mesa/main: bail earlier for size == 0 in _mesa_clear_buffer_sub_data
Note that the conversion of the clear data (when data != NULL) can fail due
to an out of memory condition, but it does not check any error conditions
mandated by the spec. Therefore, it is safe to skip when size == 0.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r-- | src/mesa/main/bufferobj.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 8dedc366ef2..2fcad6501ae 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1868,12 +1868,14 @@ _mesa_clear_buffer_sub_data(struct gl_context *ctx, return; } + /* Bail early. Negative size has already been checked. */ + if (size == 0) + return; + if (data == NULL) { /* clear to zeros, per the spec */ - if (size > 0) { - ctx->Driver.ClearBufferSubData(ctx, offset, size, - NULL, clearValueSize, bufObj); - } + ctx->Driver.ClearBufferSubData(ctx, offset, size, + NULL, clearValueSize, bufObj); return; } @@ -1882,10 +1884,8 @@ _mesa_clear_buffer_sub_data(struct gl_context *ctx, return; } - if (size > 0) { - ctx->Driver.ClearBufferSubData(ctx, offset, size, - clearValue, clearValueSize, bufObj); - } + ctx->Driver.ClearBufferSubData(ctx, offset, size, + clearValue, clearValueSize, bufObj); } void GLAPIENTRY |