Browse Source

GL: extend to size_t before casting to a pointer for glDrawElements().

Fixes the last MSVC C4312 occurence.
pull/638/head
Vladimír Vondruš 2 years ago
parent
commit
7b920e768a
  1. 16
      src/Magnum/GL/Mesh.cpp

16
src/Magnum/GL/Mesh.cpp

@ -900,7 +900,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawRangeElementsBaseVertexImplementation
#endif
(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), baseVertex);
(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), baseVertex);
/* Indexed mesh */
} else
@ -911,7 +911,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawElementsBaseVertexImplementation
#endif
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), baseVertex);
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), baseVertex);
}
#else
CORRADE_ASSERT_UNREACHABLE("GL::AbstractShaderProgram::draw(): indexed mesh draw with base vertex specification possible only since WebGL 2.0", );
@ -922,7 +922,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#ifndef MAGNUM_TARGET_GLES2
/* Indexed mesh with specified range */
if(indexEnd) {
glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset));
glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)));
/* Indexed mesh */
} else
@ -931,7 +931,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
static_cast<void>(indexEnd);
#endif
{
glDrawElements(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset));
glDrawElements(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)));
}
}
@ -971,7 +971,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawElementsInstancedBaseVertexBaseInstanceImplementation
#endif
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), instanceCount, baseVertex, baseInstance);
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), instanceCount, baseVertex, baseInstance);
/* Indexed mesh with base vertex */
} else {
@ -980,7 +980,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawElementsInstancedBaseVertexImplementation
#endif
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), instanceCount, baseVertex);
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), instanceCount, baseVertex);
}
#else
CORRADE_ASSERT_UNREACHABLE("GL::AbstractShaderProgram::draw(): instanced indexed mesh draw with base vertex specification possible only since OpenGL ES 3.0", );
@ -996,7 +996,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawElementsInstancedBaseInstanceImplementation
#endif
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), instanceCount, baseInstance);
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), instanceCount, baseInstance);
/* Instanced mesh */
} else
@ -1007,7 +1007,7 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
#else
state.drawElementsInstancedImplementation
#endif
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexByteOffset), instanceCount);
(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast<GLvoid*>(std::size_t(indexByteOffset)), instanceCount);
}
}
}

Loading…
Cancel
Save