When true, this field indicates that double-precision floating point attribute values are not converted to single-precision floats. It is set to true by glVertexAttribLFormat and glVertexArrayAttribLFormat.
Based on a patch by Dave Airlie. --- src/mesa/main/arrayobj.c | 1 + src/mesa/main/mtypes.h | 2 ++ src/mesa/main/varray.c | 58 +++++++++++++++++++++++++++--------------------- src/mesa/main/varray.h | 1 + 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 87bc993..6735f11 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -259,6 +259,7 @@ init_array(struct gl_context *ctx, array->Enabled = GL_FALSE; array->Normalized = GL_FALSE; array->Integer = GL_FALSE; + array->Doubles = GL_FALSE; array->_ElementSize = size * _mesa_sizeof_type(type); array->VertexBinding = index; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f46f2b2..22823bb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1540,6 +1540,7 @@ struct gl_client_array GLboolean Enabled; /**< Enabled flag is a boolean */ GLboolean Normalized; /**< GL_ARB_vertex_program */ GLboolean Integer; /**< Integer-valued? */ + GLboolean Doubles; /**< double precision values are not converted to floats */ GLuint InstanceDivisor; /**< GL_ARB_instanced_arrays */ GLuint _ElementSize; /**< size of each element in bytes */ @@ -1571,6 +1572,7 @@ struct gl_vertex_attrib_array GLboolean Enabled; /**< Whether the array is enabled */ GLboolean Normalized; /**< Fixed-point values are normalized when converted to floats */ GLboolean Integer; /**< Fixed-point values are not converted to floats */ + GLboolean Doubles; /**< Double precision values are not converted to floats */ GLuint _ElementSize; /**< Size of each element in bytes */ GLuint VertexBinding; /**< Vertex buffer binding */ }; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 13b9c01..bbfe947 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -261,6 +261,7 @@ get_legal_types_mask(const struct gl_context *ctx) * \param type Datatype of each component (GL_FLOAT, GL_INT, etc) * \param normalized Whether integer types are converted to floats in [-1, 1] * \param integer Integer-valued values (will not be normalized to [-1, 1]) + * \param doubles Double values not reduced to floats * \param relativeOffset Offset of the first element relative to the binding offset. */ static bool @@ -270,7 +271,7 @@ update_array_format(struct gl_context *ctx, GLuint attrib, GLbitfield legalTypesMask, GLint sizeMin, GLint sizeMax, GLint size, GLenum type, - GLboolean normalized, GLboolean integer, + GLboolean normalized, GLboolean integer, GLboolean doubles, GLuint relativeOffset) { struct gl_vertex_attrib_array *array; @@ -387,6 +388,7 @@ update_array_format(struct gl_context *ctx, array->Format = format; array->Normalized = normalized; array->Integer = integer; + array->Doubles = doubles; array->RelativeOffset = relativeOffset; array->_ElementSize = elementSize; @@ -411,6 +413,7 @@ update_array_format(struct gl_context *ctx, * \param stride stride between elements, in elements * \param normalized are integer types converted to floats in [-1, 1]? * \param integer integer-valued values (will not be normalized to [-1,1]) + * \param doubles Double values not reduced to floats * \param ptr the address (or offset inside VBO) of the array data */ static void @@ -419,7 +422,7 @@ update_array(struct gl_context *ctx, GLuint attrib, GLbitfield legalTypesMask, GLint sizeMin, GLint sizeMax, GLint size, GLenum type, GLsizei stride, - GLboolean normalized, GLboolean integer, + GLboolean normalized, GLboolean integer, GLboolean doubles, const GLvoid *ptr) { struct gl_vertex_attrib_array *array; @@ -474,7 +477,8 @@ update_array(struct gl_context *ctx, if (!update_array_format(ctx, func, ctx->Array.VAO, attrib, legalTypesMask, sizeMin, - sizeMax, size, type, normalized, integer, 0)) { + sizeMax, size, type, normalized, + integer, doubles, 0)) { return; } @@ -508,7 +512,7 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS, legalTypes, 2, 4, - size, type, stride, GL_FALSE, GL_FALSE, ptr); + size, type, stride, GL_FALSE, GL_FALSE, GL_FALSE, ptr); } @@ -527,7 +531,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL, legalTypes, 3, 3, - 3, type, stride, GL_TRUE, GL_FALSE, ptr); + 3, type, stride, GL_TRUE, GL_FALSE, GL_FALSE, ptr); } @@ -549,7 +553,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0, legalTypes, sizeMin, BGRA_OR_4, - size, type, stride, GL_TRUE, GL_FALSE, ptr); + size, type, stride, GL_TRUE, GL_FALSE, GL_FALSE, ptr); } @@ -563,7 +567,7 @@ _mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr) update_array(ctx, "glFogCoordPointer", VERT_ATTRIB_FOG, legalTypes, 1, 1, - 1, type, stride, GL_FALSE, GL_FALSE, ptr); + 1, type, stride, GL_FALSE, GL_FALSE, GL_FALSE, ptr); } @@ -578,7 +582,7 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) update_array(ctx, "glIndexPointer", VERT_ATTRIB_COLOR_INDEX, legalTypes, 1, 1, - 1, type, stride, GL_FALSE, GL_FALSE, ptr); + 1, type, stride, GL_FALSE, GL_FALSE, GL_FALSE, ptr); } @@ -598,7 +602,7 @@ _mesa_SecondaryColorPointer(GLint size, GLenum type, update_array(ctx, "glSecondaryColorPointer", VERT_ATTRIB_COLOR1, legalTypes, 3, BGRA_OR_4, - size, type, stride, GL_TRUE, GL_FALSE, ptr); + size, type, stride, GL_TRUE, GL_FALSE, GL_FALSE, ptr); } @@ -620,7 +624,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit), legalTypes, sizeMin, 4, - size, type, stride, GL_FALSE, GL_FALSE, + size, type, stride, GL_FALSE, GL_FALSE, GL_FALSE, ptr); } @@ -637,7 +641,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) update_array(ctx, "glEdgeFlagPointer", VERT_ATTRIB_EDGEFLAG, legalTypes, 1, 1, - 1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr); + 1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, GL_FALSE, ptr); } @@ -657,7 +661,7 @@ _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr) update_array(ctx, "glPointSizePointer", VERT_ATTRIB_POINT_SIZE, legalTypes, 1, 1, - 1, type, stride, GL_FALSE, GL_FALSE, ptr); + 1, type, stride, GL_FALSE, GL_FALSE, GL_FALSE, ptr); } @@ -688,7 +692,7 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type, update_array(ctx, "glVertexAttribPointer", VERT_ATTRIB_GENERIC(index), legalTypes, 1, BGRA_OR_4, - size, type, stride, normalized, GL_FALSE, ptr); + size, type, stride, normalized, GL_FALSE, GL_FALSE, ptr); } @@ -716,7 +720,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, update_array(ctx, "glVertexAttribIPointer", VERT_ATTRIB_GENERIC(index), legalTypes, 1, 4, - size, type, stride, normalized, integer, ptr); + size, type, stride, normalized, integer, GL_FALSE, ptr); } @@ -1768,6 +1772,7 @@ _mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, static void vertex_attrib_format(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLboolean integer, + GLboolean doubles, GLbitfield legalTypes, GLsizei maxSize, GLuint relativeOffset, const char *func) { @@ -1806,7 +1811,7 @@ vertex_attrib_format(GLuint attribIndex, GLint size, GLenum type, update_array_format(ctx, func, ctx->Array.VAO, VERT_ATTRIB_GENERIC(attribIndex), legalTypes, 1, maxSize, size, type, - normalized, integer, relativeOffset); + normalized, integer, doubles, relativeOffset); } @@ -1815,7 +1820,7 @@ _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeOffset) { vertex_attrib_format(attribIndex, size, type, normalized, - GL_FALSE, ATTRIB_FORMAT_TYPES_MASK, + GL_FALSE, GL_FALSE, ATTRIB_FORMAT_TYPES_MASK, BGRA_OR_4, relativeOffset, "glVertexAttribFormat"); } @@ -1826,8 +1831,8 @@ _mesa_VertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type, GLuint relativeOffset) { vertex_attrib_format(attribIndex, size, type, GL_FALSE, - GL_TRUE, ATTRIB_IFORMAT_TYPES_MASK, 4, - relativeOffset, "glVertexAttribIFormat"); + GL_TRUE, GL_FALSE, ATTRIB_IFORMAT_TYPES_MASK, + 4, relativeOffset, "glVertexAttribIFormat"); } @@ -1836,14 +1841,15 @@ _mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type, GLuint relativeOffset) { vertex_attrib_format(attribIndex, size, type, GL_FALSE, - GL_FALSE, ATTRIB_LFORMAT_TYPES_MASK, 4, - relativeOffset, "glVertexAttribLFormat"); + GL_FALSE, GL_TRUE, ATTRIB_LFORMAT_TYPES_MASK, + 4, relativeOffset, "glVertexAttribLFormat"); } static void vertex_array_attrib_format(GLuint vaobj, GLuint attribIndex, GLint size, - GLenum type, GLboolean normalized, GLBoolean integer, + GLenum type, GLboolean normalized, + GLboolean integer, GLboolean doubles, GLbitfield legalTypes, GLsizei maxSize, GLuint relativeOffset, const char *func) { @@ -1879,7 +1885,7 @@ vertex_array_attrib_format(GLuint vaobj, GLuint attribIndex, GLint size, update_array_format(ctx, func, vao, VERT_ATTRIB_GENERIC(attribIndex), legalTypes, 1, maxSize, size, type, normalized, - integer, relativeOffset); + integer, doubles, relativeOffset); } @@ -1889,7 +1895,7 @@ _mesa_VertexArrayAttribFormat(GLuint vaobj, GLuint attribIndex, GLint size, GLuint relativeOffset) { vertex_array_attrib_format(vaobj, attribIndex, size, type, normalized, - GL_FALSE, ATTRIB_FORMAT_TYPES_MASK, + GL_FALSE, GL_FALSE, ATTRIB_FORMAT_TYPES_MASK, BGRA_OR_4, relativeOffset, "glVertexArrayAttribFormat"); } @@ -1901,7 +1907,7 @@ _mesa_VertexArrayAttribIFormat(GLuint vaobj, GLuint attribIndex, GLuint relativeOffset) { vertex_array_attrib_format(vaobj, attribIndex, size, type, GL_FALSE, - GL_TRUE, ATTRIB_IFORMAT_TYPES_MASK, + GL_TRUE, GL_FALSE, ATTRIB_IFORMAT_TYPES_MASK, 4, relativeOffset, "glVertexArrayAttribIFormat"); } @@ -1913,7 +1919,7 @@ _mesa_VertexArrayAttribLFormat(GLuint vaobj, GLuint attribIndex, GLuint relativeOffset) { vertex_array_attrib_format(vaobj, attribIndex, size, type, GL_FALSE, - GL_FALSE, ATTRIB_LFORMAT_TYPES_MASK, + GL_FALSE, GL_TRUE, ATTRIB_LFORMAT_TYPES_MASK, 4, relativeOffset, "glVertexArrayAttribLFormat"); } @@ -2093,6 +2099,7 @@ _mesa_copy_client_array(struct gl_context *ctx, dst->Enabled = src->Enabled; dst->Normalized = src->Normalized; dst->Integer = src->Integer; + dst->Doubles = src->Doubles; dst->InstanceDivisor = src->InstanceDivisor; dst->_ElementSize = src->_ElementSize; _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj); @@ -2110,6 +2117,7 @@ _mesa_copy_vertex_attrib_array(struct gl_context *ctx, dst->RelativeOffset = src->RelativeOffset; dst->Format = src->Format; dst->Integer = src->Integer; + dst->Doubles = src->Doubles; dst->Normalized = src->Normalized; dst->Ptr = src->Ptr; dst->Enabled = src->Enabled; diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 67823b7..c369ba4 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -68,6 +68,7 @@ _mesa_update_client_array(struct gl_context *ctx, dst->Enabled = src->Enabled; dst->Normalized = src->Normalized; dst->Integer = src->Integer; + dst->Doubles = src->Doubles; dst->InstanceDivisor = binding->InstanceDivisor; dst->_ElementSize = src->_ElementSize; _mesa_reference_buffer_object(ctx, &dst->BufferObj, binding->BufferObj); -- 1.8.5.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev