diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-02-09 16:47:45 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-02-09 16:50:51 +0000 |
commit | c7552652ca01fe76af98315fedb43f9efb978691 (patch) | |
tree | 43d8ccdac92cf95d1da83cf62edd886a4f438e9c | |
parent | 2590a79ce86b1a6e7bf1018c25ddbdeb7b38b9d2 (diff) |
glstate: Fix default arrayStride computation.
I don't know of any particular case where this causes problems reading
uniforms, but this does cause problems reading vertex attributes in a
follow up commit.
-rw-r--r-- | retrace/glstate_shaders.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/retrace/glstate_shaders.cpp b/retrace/glstate_shaders.cpp index 71d577f9..c5faf4a9 100644 --- a/retrace/glstate_shaders.cpp +++ b/retrace/glstate_shaders.cpp @@ -202,30 +202,21 @@ resolveUniformName(const GLchar *name, GLint size) struct AttribDesc { - GLenum type; - GLenum size; - - GLenum elemType; - GLint elemStride; - - GLint numCols; - GLint numRows; - - GLsizei rowStride; - GLsizei colStride; - - GLsizei arrayStride; - - AttribDesc() : - type(GL_NONE), - size(0), - elemType(GL_NONE), - elemStride(0), - numCols(0), - numRows(0), - rowStride(0), - colStride(0), - arrayStride(0) + GLenum type = GL_NONE; + GLenum size = 0; + + GLenum elemType = GL_NONE; + GLint elemStride = 0; + + GLint numCols = 0; + GLint numRows = 0; + + GLsizei rowStride = 0; + GLsizei colStride = 0; + + GLsizei arrayStride = 0; + + AttribDesc(void) {} AttribDesc(GLenum _type, @@ -248,15 +239,19 @@ struct AttribDesc matrix_stride = numRows * elemStride; } colStride = matrix_stride; + if (!array_stride) { + arrayStride = numCols * colStride; + } } else { colStride = elemStride; if (!matrix_stride) { matrix_stride = numCols * elemStride; } rowStride = matrix_stride; + if (!array_stride) { + arrayStride = numRows * rowStride; + } } - - arrayStride = array_stride ? array_stride : size * matrix_stride; } inline |