Added support for packed integer vertex attributes.

Signed-off-by: Jamie Madill Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2125 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent e7d4a247
...@@ -95,6 +95,8 @@ class VertexAttribute ...@@ -95,6 +95,8 @@ class VertexAttribute
case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort); case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
case GL_INT: return mSize * sizeof(GLint); case GL_INT: return mSize * sizeof(GLint);
case GL_UNSIGNED_INT: return mSize * sizeof(GLuint); case GL_UNSIGNED_INT: return mSize * sizeof(GLuint);
case GL_INT_2_10_10_10_REV: return 4;
case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
case GL_FIXED: return mSize * sizeof(GLfixed); case GL_FIXED: return mSize * sizeof(GLfixed);
case GL_HALF_FLOAT: return mSize * sizeof(GLhalf); case GL_HALF_FLOAT: return mSize * sizeof(GLhalf);
case GL_FLOAT: return mSize * sizeof(GLfloat); case GL_FLOAT: return mSize * sizeof(GLfloat);
......
...@@ -6818,6 +6818,8 @@ void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLbo ...@@ -6818,6 +6818,8 @@ void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLbo
case GL_HALF_FLOAT: case GL_HALF_FLOAT:
case GL_INT: case GL_INT:
case GL_UNSIGNED_INT: case GL_UNSIGNED_INT:
case GL_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_2_10_10_10_REV:
if (context && context->getClientVersion() < 3) if (context && context->getClientVersion() < 3)
{ {
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
...@@ -6835,6 +6837,11 @@ void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLbo ...@@ -6835,6 +6837,11 @@ void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLbo
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
{
return gl::error(GL_INVALID_OPERATION);
}
if (context) if (context)
{ {
context->setVertexAttribState(index, context->getArrayBuffer(), size, type, context->setVertexAttribState(index, context->getArrayBuffer(), size, type,
...@@ -7967,6 +7974,8 @@ void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLs ...@@ -7967,6 +7974,8 @@ void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLs
case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT:
case GL_INT: case GL_INT:
case GL_UNSIGNED_INT: case GL_UNSIGNED_INT:
case GL_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_2_10_10_10_REV:
break; break;
default: default:
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
...@@ -7977,6 +7986,11 @@ void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLs ...@@ -7977,6 +7986,11 @@ void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLs
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
{
return gl::error(GL_INVALID_OPERATION);
}
if (context) if (context)
{ {
context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true, context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true,
......
...@@ -59,10 +59,10 @@ class VertexBuffer11 : public VertexBuffer ...@@ -59,10 +59,10 @@ class VertexBuffer11 : public VertexBuffer
unsigned int outputElementSize; unsigned int outputElementSize;
}; };
static const unsigned int NUM_GL_FLOAT_VERTEX_ATTRIB_TYPES = 9; static const unsigned int NUM_GL_FLOAT_VERTEX_ATTRIB_TYPES = 11;
static const VertexConverter mFloatVertexTranslations[NUM_GL_FLOAT_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1] static const VertexConverter mFloatVertexTranslations[NUM_GL_FLOAT_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
static const unsigned int NUM_GL_INTEGER_VERTEX_ATTRIB_TYPES = 6; static const unsigned int NUM_GL_INTEGER_VERTEX_ATTRIB_TYPES = 8;
static const VertexConverter mIntegerVertexTranslations[NUM_GL_INTEGER_VERTEX_ATTRIB_TYPES][4]; // [GL types as enumerated by typeIndex()][size - 1] static const VertexConverter mIntegerVertexTranslations[NUM_GL_INTEGER_VERTEX_ATTRIB_TYPES][4]; // [GL types as enumerated by typeIndex()][size - 1]
static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute); static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment