Skip to content

Commit 7bf16a8

Browse files
luckyxxlbaldurk
authored andcommitted
fix glVertexAttrib*f capture
1 parent 01674ec commit 7bf16a8

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4884,24 +4884,25 @@ bool WrappedOpenGL::Serialise_glVertexAttrib(SerialiserType &ser, GLuint index,
48844884

48854885
if(ser.IsWriting())
48864886
{
4887-
uint32_t byteCount = count;
4888-
4889-
if(attr == Attrib_GLbyte)
4890-
byteCount *= sizeof(char);
4891-
else if(attr == Attrib_GLshort)
4892-
byteCount *= sizeof(int16_t);
4893-
else if(attr == Attrib_GLint)
4894-
byteCount *= sizeof(int32_t);
4895-
else if(attr == Attrib_GLubyte)
4896-
byteCount *= sizeof(unsigned char);
4897-
else if(attr == Attrib_GLushort)
4898-
byteCount *= sizeof(uint16_t);
4899-
else if(attr == Attrib_GLuint || attr == Attrib_packed)
4900-
byteCount *= sizeof(uint32_t);
4887+
uint32_t byteCount = 0u;
4888+
4889+
switch(attr)
4890+
{
4891+
case Attrib_GLdouble: byteCount = sizeof(double) * count; break;
4892+
case Attrib_GLfloat: byteCount = sizeof(float) * count; break;
4893+
case Attrib_GLshort:
4894+
case Attrib_GLushort: byteCount = sizeof(int16_t) * count; break;
4895+
default:
4896+
case Attrib_GLbyte:
4897+
case Attrib_GLubyte: byteCount = sizeof(int8_t) * count; break;
4898+
case Attrib_GLint:
4899+
case Attrib_GLuint: byteCount = sizeof(int32_t) * count; break;
4900+
case Attrib_packed: byteCount = sizeof(uint32_t); break;
4901+
}
49014902

49024903
RDCEraseEl(v);
49034904

4904-
memcpy(v.f, value, byteCount);
4905+
memcpy(&v, value, byteCount);
49054906
}
49064907

49074908
// Serialise the array with the right type. We don't want to allocate new storage

0 commit comments

Comments
 (0)