Remove divisions
This commit is contained in:
parent
a3b1ca66c3
commit
43a8db9e9d
24
GL/draw.c
24
GL/draw.c
|
@ -104,7 +104,6 @@ static inline GLuint byte_size(GLenum type) {
|
|||
case GL_UNSIGNED_INT: return sizeof(GLuint);
|
||||
case GL_DOUBLE: return sizeof(GLdouble);
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLuint);
|
||||
case GL_INT_2_10_10_10_REV: return sizeof(GLint);
|
||||
case GL_FLOAT:
|
||||
default: return sizeof(GLfloat);
|
||||
}
|
||||
|
@ -777,7 +776,7 @@ static inline void _readNormalData(const GLuint first, const GLuint count, Verte
|
|||
|
||||
const void* nptr = ((GLubyte*) NORMAL_POINTER.ptr + (first * nstride));
|
||||
|
||||
if(NORMAL_POINTER.size == 3 || NORMAL_POINTER.type == GL_INT_2_10_10_10_REV) {
|
||||
if(NORMAL_POINTER.size == 3 || NORMAL_POINTER.type == GL_UNSIGNED_INT_2_10_10_10_REV) {
|
||||
switch(NORMAL_POINTER.type) {
|
||||
case GL_DOUBLE:
|
||||
case GL_FLOAT:
|
||||
|
@ -795,13 +794,15 @@ static inline void _readNormalData(const GLuint first, const GLuint count, Verte
|
|||
case GL_UNSIGNED_INT:
|
||||
_readVertexData3ui3fVE(nptr, count, nstride, extra->nxyz);
|
||||
break;
|
||||
case GL_INT_2_10_10_10_REV:
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
_readVertexData1i3f(nptr, count, nstride, extra->nxyz);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Invalid normal pointer type: %d\n", NORMAL_POINTER.type);
|
||||
assert(0 && "Not Implemented");
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Invalid normal pointer type or stride (%d or %d)\n", NORMAL_POINTER.type, NORMAL_POINTER.stride);
|
||||
assert(0 && "Not Implemented");
|
||||
}
|
||||
|
||||
|
@ -1529,10 +1530,25 @@ void APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const G
|
|||
void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer) {
|
||||
TRACE();
|
||||
|
||||
GLint validTypes[] = {
|
||||
GL_DOUBLE,
|
||||
GL_FLOAT,
|
||||
GL_BYTE,
|
||||
GL_UNSIGNED_BYTE,
|
||||
GL_INT,
|
||||
GL_UNSIGNED_INT,
|
||||
GL_UNSIGNED_INT_2_10_10_10_REV,
|
||||
0
|
||||
};
|
||||
|
||||
if(_glCheckValidEnum(type, validTypes, __func__) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NORMAL_POINTER.ptr = pointer;
|
||||
NORMAL_POINTER.stride = stride;
|
||||
NORMAL_POINTER.type = type;
|
||||
NORMAL_POINTER.size = (type == GL_INT_2_10_10_10_REV) ? 1 : 3;
|
||||
NORMAL_POINTER.size = (type == GL_UNSIGNED_INT_2_10_10_10_REV) ? 1 : 3;
|
||||
|
||||
_glRecalcFastPath();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void _glInitImmediateMode(GLuint initial_size) {
|
|||
|
||||
NORMAL_ATTRIB.ptr = NORMALS.data;
|
||||
NORMAL_ATTRIB.stride = 0;
|
||||
NORMAL_ATTRIB.type = GL_INT_2_10_10_10_REV;
|
||||
NORMAL_ATTRIB.type = GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||
NORMAL_ATTRIB.size = 1;
|
||||
|
||||
ST_ATTRIB.ptr = ST_COORDS.data;
|
||||
|
|
|
@ -336,7 +336,6 @@ __BEGIN_DECLS
|
|||
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
|
||||
|
||||
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
|
||||
#define GL_INT_2_10_10_10_REV 0x8D9F
|
||||
|
||||
#define GL_COLOR_INDEX 0x1900
|
||||
#define GL_RED 0x1903
|
||||
|
|
Loading…
Reference in New Issue
Block a user