remove duplicate pieces of code.
authorAapo Tahkola <aet@rasterburn.org>
Tue, 22 Aug 2006 22:27:32 +0000 (22:27 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Tue, 22 Aug 2006 22:27:32 +0000 (22:27 +0000)
src/mesa/drivers/dri/r300/r300_maos.c
src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c

index cba3fd372905f9b949e1c71f87dd8211d20043dd..5cbdab8d70abb3aa925128eb0dec455c70f0c567 100644 (file)
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "colormac.h"
 #include "imports.h"
 #include "macros.h"
+#include "image.h"
 
 #include "swrast_setup/swrast_setup.h"
 #include "math/m_translate.h"
@@ -289,26 +290,6 @@ static GLuint t_vir0_size(struct dt *dt)
        return 0;
 }
 
-static GLuint comp_bytes(struct dt *dt)
-{
-       switch (dt->type) {
-       case GL_UNSIGNED_BYTE:
-               return 1;
-       
-       case GL_SHORT:
-               return 2;
-       
-       case GL_FLOAT:
-               return 4;
-       
-       default:
-               assert(0);
-               break;
-       }
-       
-       return 0;
-}
-
 static GLuint t_aos_size(struct dt *dt)
 {
        switch (dt->type) {
@@ -520,7 +501,7 @@ int r300EmitArrays(GLcontext *ctx)
                
                rmesa->state.aos[i].aos_size = t_aos_size(&VB->AttribPtr[tab[i]]);
                
-               comp_size = comp_bytes(&VB->AttribPtr[tab[i]]);
+               comp_size = _mesa_sizeof_type(VB->AttribPtr[tab[i]].type);
                
 #if MESA_LITTLE_ENDIAN
                for (fix = 0; fix <= 4 - VB->AttribPtr[tab[i]].size; fix++) {
index 7f539b437760256524bf066faebe51ef3ceee63d..a7db8dae63bf3e6d7cce160f644b44519402b9b0 100644 (file)
@@ -44,6 +44,7 @@
 #include "vtxfmt.h"
 #include "api_validate.h"
 #include "state.h"
+#include "image.h"
 
 #define CONV_VB(a, b) rvb->AttribPtr[(a)].size = vb->b->size, \
                        rvb->AttribPtr[(a)].type = GL_FLOAT, \
@@ -344,22 +345,6 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G
        _mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
 }
 
-static int elt_bytes(GLenum type)
-{
-       switch (type) {
-       case GL_UNSIGNED_BYTE:
-               return 1;
-       case GL_UNSIGNED_SHORT:
-               return 2;
-       case GL_UNSIGNED_INT:
-               return 4;
-       default:
-               _mesa_problem(NULL, "bad elt type in %s", __FUNCTION__);
-               return 0;
-       }
-       return 0;
-}
-
 static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *c_indices)
 {
        GET_CURRENT_CONTEXT(ctx);
@@ -378,15 +363,12 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
                    mode == GL_QUADS ||
                    mode == GL_TRIANGLES) {
                        
-                       if (!_mesa_validate_DrawRangeElements( ctx, mode, min, max, count, type, indices ))
-                               return;
-                       
                        while (count) {
                                i = r300_get_num_verts(rmesa, MIN2(count, 65535), mode);
                                
                                radeonDrawRangeElements(mode, min, max, i, type, indices);
                                
-                               indices += i * elt_bytes(type);
+                               indices += i * _mesa_sizeof_type(type);
                                count -= i;
                        }
                        return ;