[Mesa-dev] [PATCH] mesa/main: handle gl_buffer_index correctly
Francesco Ansanelli
francians at gmail.com
Tue Jun 28 17:31:31 UTC 2016
---
src/mesa/main/buffers.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index e8aedde..3ff6061 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -170,7 +170,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
* Helper routine used by glReadBuffer.
* Given a GLenum naming a color buffer, return the index of the corresponding
* renderbuffer (a BUFFER_* value).
- * return -1 for an invalid buffer.
+ * return ~0 for an invalid buffer.
*/
static gl_buffer_index
read_buffer_enum_to_index(GLenum buffer)
@@ -197,7 +197,7 @@ read_buffer_enum_to_index(GLenum buffer)
case GL_AUX1:
case GL_AUX2:
case GL_AUX3:
- return BUFFER_COUNT; /* invalid, but not -1 */
+ return BUFFER_COUNT; /* invalid, but not ~0 */
case GL_COLOR_ATTACHMENT0_EXT:
return BUFFER_COLOR0;
case GL_COLOR_ATTACHMENT1_EXT:
@@ -219,7 +219,7 @@ read_buffer_enum_to_index(GLenum buffer)
if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31)
return BUFFER_COUNT;
/* error */
- return -1;
+ return ~0;
}
}
@@ -722,11 +722,11 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
else {
/* general case / window-system framebuffer */
if (_mesa_is_gles3(ctx) && !is_legal_es3_readbuffer_enum(buffer))
- srcBuffer = -1;
+ srcBuffer = ~0;
else
srcBuffer = read_buffer_enum_to_index(buffer);
- if (srcBuffer == -1) {
+ if (srcBuffer == ~0u) {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(invalid buffer %s)", caller,
_mesa_enum_to_string(buffer));
--
1.7.9.5
More information about the mesa-dev
mailing list