diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-26 23:55:09 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-27 00:50:29 +0300 |
commit | 2c2082cc6276c7805c983b2ca3656aa9552a6d8d (patch) | |
tree | 891a53bc4dc0f9bd7699f6b7b52c778817a79bfb /source/blender/gpu/intern/gpu_element.cc | |
parent | e76f64a5329d0e4f095f1beb8a9ab7ea42c0937a (diff) |
GPU: Fix MSVC compile errors
Diffstat (limited to 'source/blender/gpu/intern/gpu_element.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_element.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/gpu/intern/gpu_element.cc b/source/blender/gpu/intern/gpu_element.cc index 856a9ca515f..9f104ab3fec 100644 --- a/source/blender/gpu/intern/gpu_element.cc +++ b/source/blender/gpu/intern/gpu_element.cc @@ -26,6 +26,7 @@ #include "MEM_guardedalloc.h" #include "GPU_element.h" +#include "GPU_glew.h" #include "gpu_context_private.h" @@ -37,21 +38,18 @@ static GLenum convert_index_type_to_gl(GPUIndexBufType type) { - static const GLenum table[] = { - [GPU_INDEX_U16] = GL_UNSIGNED_SHORT, - [GPU_INDEX_U32] = GL_UNSIGNED_INT, - }; - return table[type]; +#if GPU_TRACK_INDEX_RANGE + return (type == GPU_INDEX_U32) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT; +#else + return GL_UNSIGNED_INT; +#endif } uint GPU_indexbuf_size_get(const GPUIndexBuf *elem) { #if GPU_TRACK_INDEX_RANGE - static const uint table[] = { - [GPU_INDEX_U16] = sizeof(GLushort), - [GPU_INDEX_U32] = sizeof(GLuint), - }; - return elem->index_len * table[elem->index_type]; + return elem->index_len * + ((elem->index_type == GPU_INDEX_U32) ? sizeof(GLuint) : sizeof(GLshort)); #else return elem->index_len * sizeof(GLuint); #endif |