Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_vertex_format.cc
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void GPU_vertformat_copy(GPUVertFormat *dest, const GPUVertFormat *src) | void GPU_vertformat_copy(GPUVertFormat *dest, const GPUVertFormat *src) | ||||
| { | { | ||||
| /* copy regular struct fields */ | /* copy regular struct fields */ | ||||
| memcpy(dest, src, sizeof(GPUVertFormat)); | memcpy(dest, src, sizeof(GPUVertFormat)); | ||||
| } | } | ||||
| GLenum convert_comp_type_to_gl(GPUVertCompType type) | |||||
| { | |||||
| switch (type) { | |||||
| case GPU_COMP_I8: | |||||
| return GL_BYTE; | |||||
| case GPU_COMP_U8: | |||||
| return GL_UNSIGNED_BYTE; | |||||
| case GPU_COMP_I16: | |||||
| return GL_SHORT; | |||||
| case GPU_COMP_U16: | |||||
| return GL_UNSIGNED_SHORT; | |||||
| case GPU_COMP_I32: | |||||
| return GL_INT; | |||||
| case GPU_COMP_U32: | |||||
| return GL_UNSIGNED_INT; | |||||
| case GPU_COMP_F32: | |||||
| return GL_FLOAT; | |||||
| case GPU_COMP_I10: | |||||
| return GL_INT_2_10_10_10_REV; | |||||
| default: | |||||
| BLI_assert(0); | |||||
| return GL_FLOAT; | |||||
| } | |||||
| } | |||||
| static uint comp_sz(GPUVertCompType type) | static uint comp_sz(GPUVertCompType type) | ||||
| { | { | ||||
| #if TRUST_NO_ONE | #if TRUST_NO_ONE | ||||
| assert(type <= GPU_COMP_F32); /* other types have irregular sizes (not bytes) */ | assert(type <= GPU_COMP_F32); /* other types have irregular sizes (not bytes) */ | ||||
| #endif | #endif | ||||
| const GLubyte sizes[] = {1, 1, 2, 2, 4, 4, 4}; | const GLubyte sizes[] = {1, 1, 2, 2, 4, 4, 4}; | ||||
| return sizes[type]; | return sizes[type]; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 313 Lines • Show Last 20 Lines | |||||