mirror of
https://github.com/love2d/love.git
synced 2026-08-21 05:00:08 +02:00
More verbose VertexIndex::getType() (using numeric_limits)
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
@@ -277,7 +278,8 @@ GLenum VertexIndex::getType(size_t s) const
|
|||||||
{
|
{
|
||||||
// Calculates if unsigned short is big enough to hold all the vertex indices.
|
// Calculates if unsigned short is big enough to hold all the vertex indices.
|
||||||
static const GLenum type_table[] = {GL_UNSIGNED_SHORT, GL_UNSIGNED_INT};
|
static const GLenum type_table[] = {GL_UNSIGNED_SHORT, GL_UNSIGNED_INT};
|
||||||
return type_table[int(GLushort(-1) < s * 4)];
|
return type_table[s * 4 > std::numeric_limits<GLushort>::max()];
|
||||||
|
// if buffer-size > max(GLushort) then GL_UNSIGNED_INT else GL_UNSIGNED_SHORT
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexBuffer *VertexIndex::getVertexBuffer() const
|
VertexBuffer *VertexIndex::getVertexBuffer() const
|
||||||
|
|||||||
Reference in New Issue
Block a user