PIPE_FORMAT_R32G32B32A32_USCALED
};
+static GLuint uint_types_int[4] = {
+ PIPE_FORMAT_R32_UINT,
+ PIPE_FORMAT_R32G32_UINT,
+ PIPE_FORMAT_R32G32B32_UINT,
+ PIPE_FORMAT_R32G32B32A32_UINT
+};
+
static GLuint int_types_norm[4] = {
PIPE_FORMAT_R32_SNORM,
PIPE_FORMAT_R32G32_SNORM,
PIPE_FORMAT_R32G32B32A32_SSCALED
};
+static GLuint int_types_int[4] = {
+ PIPE_FORMAT_R32_SINT,
+ PIPE_FORMAT_R32G32_SINT,
+ PIPE_FORMAT_R32G32B32_SINT,
+ PIPE_FORMAT_R32G32B32A32_SINT
+};
+
static GLuint ushort_types_norm[4] = {
PIPE_FORMAT_R16_UNORM,
PIPE_FORMAT_R16G16_UNORM,
PIPE_FORMAT_R16G16B16A16_USCALED
};
+static GLuint ushort_types_int[4] = {
+ PIPE_FORMAT_R16_UINT,
+ PIPE_FORMAT_R16G16_UINT,
+ PIPE_FORMAT_R16G16B16_UINT,
+ PIPE_FORMAT_R16G16B16A16_UINT
+};
+
static GLuint short_types_norm[4] = {
PIPE_FORMAT_R16_SNORM,
PIPE_FORMAT_R16G16_SNORM,
PIPE_FORMAT_R16G16B16A16_SSCALED
};
+static GLuint short_types_int[4] = {
+ PIPE_FORMAT_R16_SINT,
+ PIPE_FORMAT_R16G16_SINT,
+ PIPE_FORMAT_R16G16B16_SINT,
+ PIPE_FORMAT_R16G16B16A16_SINT
+};
+
static GLuint ubyte_types_norm[4] = {
PIPE_FORMAT_R8_UNORM,
PIPE_FORMAT_R8G8_UNORM,
PIPE_FORMAT_R8G8B8A8_USCALED
};
+static GLuint ubyte_types_int[4] = {
+ PIPE_FORMAT_R8_UINT,
+ PIPE_FORMAT_R8G8_UINT,
+ PIPE_FORMAT_R8G8B8_UINT,
+ PIPE_FORMAT_R8G8B8A8_UINT
+};
+
static GLuint byte_types_norm[4] = {
PIPE_FORMAT_R8_SNORM,
PIPE_FORMAT_R8G8_SNORM,
PIPE_FORMAT_R8G8B8A8_SSCALED
};
+static GLuint byte_types_int[4] = {
+ PIPE_FORMAT_R8_SINT,
+ PIPE_FORMAT_R8G8_SINT,
+ PIPE_FORMAT_R8G8B8_SINT,
+ PIPE_FORMAT_R8G8B8A8_SINT
+};
+
static GLuint fixed_types[4] = {
PIPE_FORMAT_R32_FIXED,
PIPE_FORMAT_R32G32_FIXED,
*/
enum pipe_format
st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
- GLboolean normalized)
+ GLboolean normalized, GLboolean integer)
{
assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
type == GL_FIXED || type == GL_HALF_FLOAT ||
if (type == GL_INT_2_10_10_10_REV ||
type == GL_UNSIGNED_INT_2_10_10_10_REV) {
assert(size == 4);
+ assert(!integer);
if (format == GL_BGRA) {
if (type == GL_INT_2_10_10_10_REV) {
return PIPE_FORMAT_B8G8R8A8_UNORM;
}
- if (normalized) {
+ if (integer) {
+ switch (type) {
+ case GL_INT: return int_types_int[size-1];
+ case GL_SHORT: return short_types_int[size-1];
+ case GL_BYTE: return byte_types_int[size-1];
+ case GL_UNSIGNED_INT: return uint_types_int[size-1];
+ case GL_UNSIGNED_SHORT: return ushort_types_int[size-1];
+ case GL_UNSIGNED_BYTE: return ubyte_types_int[size-1];
+ default: assert(0); return 0;
+ }
+ }
+ else if (normalized) {
switch (type) {
case GL_DOUBLE: return double_types[size-1];
case GL_FLOAT: return float_types[size-1];
velements[attr].src_format = st_pipe_vertex_format(array->Type,
array->Size,
array->Format,
- array->Normalized);
+ array->Normalized,
+ array->Integer);
assert(velements[attr].src_format);
if (!usingVBO) {
velements[attr].src_format = st_pipe_vertex_format(array->Type,
array->Size,
array->Format,
- array->Normalized);
+ array->Normalized,
+ array->Integer);
assert(velements[attr].src_format);
}