[Mesa-dev] [PATCH 3/9] mesa: use gl_buffer_index in a few places

Brian Paul brianp at vmware.com
Tue Feb 23 23:45:19 UTC 2016


---
 src/mesa/main/buffers.c | 6 +++---
 src/mesa/main/buffers.h | 3 ++-
 src/mesa/main/context.c | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 3ca4b66..2c4a138 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -174,7 +174,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
  * renderbuffer (a BUFFER_* value).
  * return -1 for an invalid buffer.
  */
-static GLint
+static gl_buffer_index
 read_buffer_enum_to_index(GLenum buffer)
 {
    switch (buffer) {
@@ -675,7 +675,7 @@ _mesa_update_draw_buffers(struct gl_context *ctx)
  */
 void
 _mesa_readbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-                 GLenum buffer, GLint bufferIndex)
+                 GLenum buffer, gl_buffer_index bufferIndex)
 {
    if ((fb == ctx->ReadBuffer) && _mesa_is_winsys_fbo(fb)) {
       /* Only update the per-context READ_BUFFER state if we're bound to
@@ -701,7 +701,7 @@ _mesa_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
                   GLenum buffer, const char *caller)
 {
    GLbitfield supportedMask;
-   GLint srcBuffer;
+   gl_buffer_index srcBuffer;
 
    FLUSH_VERTICES(ctx, 0);
 
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index 5aa79fd..c30cb75 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -34,6 +34,7 @@
 
 
 #include "glheader.h"
+#include "mtypes.h"
 
 struct gl_context;
 struct gl_framebuffer;
@@ -66,7 +67,7 @@ _mesa_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
 
 extern void
 _mesa_readbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-                 GLenum buffer, GLint bufferIndex);
+                 GLenum buffer, gl_buffer_index bufferIndex);
 
 extern void
 _mesa_update_draw_buffers(struct gl_context *ctx);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 9388a1c..a6d8939 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1601,7 +1601,6 @@ static void
 handle_first_current(struct gl_context *ctx)
 {
    GLenum buffer;
-   GLint bufferIndex;
 
    if (ctx->Version == 0) {
       /* probably in the process of tearing down the context */
@@ -1627,6 +1626,7 @@ handle_first_current(struct gl_context *ctx)
       }
 
       if (ctx->ReadBuffer != _mesa_get_incomplete_framebuffer()) {
+         gl_buffer_index bufferIndex;
          if (ctx->ReadBuffer->Visual.doubleBufferMode) {
             buffer = GL_BACK;
             bufferIndex = BUFFER_BACK_LEFT;
-- 
1.9.1



More information about the mesa-dev mailing list