render pipeline support for normalized intergers

This commit is contained in:
Andrew Meadows 2017-03-24 10:35:58 -07:00
parent 60bc76e1c4
commit fcf18cba91
3 changed files with 18 additions and 10 deletions

View file

@ -99,8 +99,13 @@ void GL41Backend::updateInput() {
GLboolean isNormalized = attrib._element.isNormalized(); GLboolean isNormalized = attrib._element.isNormalized();
for (size_t locNum = 0; locNum < locationCount; ++locNum) { for (size_t locNum = 0; locNum < locationCount; ++locNum) {
if (attrib._element.isInteger()) {
glVertexAttribIPointer(slot + (GLuint)locNum, count, type, stride,
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
} else {
glVertexAttribPointer(slot + (GLuint)locNum, count, type, isNormalized, stride, glVertexAttribPointer(slot + (GLuint)locNum, count, type, isNormalized, stride,
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum)); reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
}
#ifdef GPU_STEREO_DRAWCALL_INSTANCED #ifdef GPU_STEREO_DRAWCALL_INSTANCED
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1)); glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1));
#else #else

View file

@ -61,8 +61,11 @@ void GL45Backend::updateInput() {
_input._attributeActivation.set(attriNum); _input._attributeActivation.set(attriNum);
glEnableVertexAttribArray(attriNum); glEnableVertexAttribArray(attriNum);
} }
if (attrib._element.isInteger()) {
glVertexAttribIFormat(attriNum, count, type, offset + locNum * perLocationSize);
} else {
glVertexAttribFormat(attriNum, count, type, isNormalized, offset + locNum * perLocationSize); glVertexAttribFormat(attriNum, count, type, isNormalized, offset + locNum * perLocationSize);
// TODO: Support properly the IAttrib version }
glVertexAttribBinding(attriNum, attrib._channel); glVertexAttribBinding(attriNum, attrib._channel);
} }

View file

@ -75,12 +75,12 @@ static const bool TYPE_IS_INTEGER[NUM_TYPES] = {
true, true,
// Normalized values // Normalized values
true, false,
true, false,
true, false,
true, false,
true, false,
true false
}; };
// Dimension of an Element // Dimension of an Element