Mesa (master): i965: reuse _mesa_sizeof_type for index buffer types.

Eric Anholt anholt at kemper.freedesktop.org
Fri Jan 25 18:25:35 UTC 2013


Module: Mesa
Branch: master
Commit: 8fe43b6dc96c36bc45332c67d8f84849b5060800
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fe43b6dc96c36bc45332c67d8f84849b5060800

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jan 22 17:39:36 2013 -0800

i965: reuse _mesa_sizeof_type for index buffer types.

The core Mesa code has just one more case than this (GL_BITMAP), so I
don't see any cause to special-case it.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_draw_upload.c |   26 ++------------------------
 1 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 0775148..1c8ade5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -32,6 +32,7 @@
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/macros.h"
+#include "main/glformats.h"
 
 #include "brw_draw.h"
 #include "brw_defines.h"
@@ -332,29 +333,6 @@ get_surface_type(struct intel_context *intel, GLenum type, GLuint size,
    }
 }
 
-
-static GLuint get_size( GLenum type )
-{
-   switch (type) {
-   case GL_DOUBLE: return sizeof(GLdouble);
-   case GL_FLOAT: return sizeof(GLfloat);
-   case GL_HALF_FLOAT: return sizeof(GLhalfARB);
-   case GL_INT: return sizeof(GLint);
-   case GL_SHORT: return sizeof(GLshort);
-   case GL_BYTE: return sizeof(GLbyte);
-   case GL_UNSIGNED_INT: return sizeof(GLuint);
-   case GL_UNSIGNED_SHORT: return sizeof(GLushort);
-   case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
-   case GL_FIXED: return sizeof(GLuint);
-   /* packed formats: always have 4 components, and element size is
-    * 4 bytes, so pretend each component is 1 byte.
-    */
-   case GL_INT_2_10_10_10_REV: return sizeof(GLbyte);
-   case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLubyte);
-   default: assert(0); return 0;
-   }
-}
-
 static GLuint get_index_type(GLenum type)
 {
    switch (type) {
@@ -821,7 +799,7 @@ static void brw_upload_indices(struct brw_context *brw)
    if (index_buffer == NULL)
       return;
 
-   ib_type_size = get_size(index_buffer->type);
+   ib_type_size = _mesa_sizeof_type(index_buffer->type);
    ib_size = ib_type_size * index_buffer->count;
    bufferobj = index_buffer->obj;
 




More information about the mesa-commit mailing list