summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-12-16 19:08:24 -0500
committerNat Goodspeed <nat@lindenlab.com>2016-12-16 19:08:24 -0500
commitc1ae63a872a90c234437bfc6f114964a65a1a562 (patch)
treed557df3f97e545eaa2a0d246f7f82388993aeef6
parenta4b0159d5710200b6284cce545f35c73505537e1 (diff)
DRTVWR-418: Work around dubious cast from S32 to GLvoid*
when passing -- something -- to glVertexAttribPointerARB() in LLVertexBuffer::setupVertexArray().
-rw-r--r--indra/llrender/llvertexbuffer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 59024b7730..b6fae1ad26 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1441,13 +1441,24 @@ void LLVertexBuffer::setupVertexArray()
//glVertexattribIPointer requires GLSL 1.30 or later
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
{
- glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (void*) mOffsets[i]);
+ glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (const GLvoid*) mOffsets[i]);
}
#endif
}
else
{
- glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], (void*) mOffsets[i]);
+ // nat 2016-12-16: With 64-bit clang compile, the compiler
+ // produces an error if we simply cast mOffsets[i] -- an S32
+ // -- to (GLvoid *), the type of the parameter. It correctly
+ // points out that there's no way an S32 could fit a real
+ // pointer value. Since I do not know what we're trying to
+ // achieve here, I'm going to grit my teeth and try to
+ // persuade the compiler we know what we're doing, until
+ // someone who actually does know fixes it better.
+ uintptr_t fake_offset(mOffsets[i]);
+ glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i],
+ attrib_normalized[i], sTypeSize[i],
+ reinterpret_cast<GLvoid*>(fake_offset));
}
}
else