From 67113aa9f0265dd7a9dc3826b7017558ccedb063 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 14 Jun 2012 18:22:56 +0000 Subject: [PATCH] gpu: do not convert integers in vertex streams to floats. --- src/gpu/vertexbuffer.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/gpu/vertexbuffer.cpp b/src/gpu/vertexbuffer.cpp index f5fe3e81..3881bcae 100644 --- a/src/gpu/vertexbuffer.cpp +++ b/src/gpu/vertexbuffer.cpp @@ -358,15 +358,24 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attr1, if (type_index < 0 || type_index >= sizeof(tlut) / sizeof(*tlut)) type_index = 0; - /* Normalize unsigned bytes by default, because it's usually - * some color information. */ - GLboolean normalize = (tlut[type_index].type == GL_UNSIGNED_BYTE) - || (tlut[type_index].type == GL_BYTE); # if !defined __CELLOS_LV2__ - glVertexAttribPointer((GLint)reg, tlut[type_index].size, - tlut[type_index].type, normalize, - stride, (GLvoid const *)(uintptr_t)offset); + if (type_index <= 12) + { + /* Normalize unsigned bytes by default, because it's usually + * some color information. */ + GLboolean normalize = (tlut[type_index].type == GL_UNSIGNED_BYTE) + || (tlut[type_index].type == GL_BYTE); + glVertexAttribPointer((GLint)reg, tlut[type_index].size, + tlut[type_index].type, normalize, + stride, (GLvoid const *)(uintptr_t)offset); + } + else + { + glVertexAttribIPointer((GLint)reg, tlut[type_index].size, + tlut[type_index].type, + stride, (GLvoid const *)(uintptr_t)offset); + } # else switch (usage) {