diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-08-22 13:30:03 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-08-22 13:30:03 +0300 |
commit | 9457715d9a6feb574d9f33246842079a9cb15288 (patch) | |
tree | d49c2752f05aebaa0a7e817398a3c54b5cfa176a /source/blender/gpu/intern | |
parent | cc5e90f75d71d8e9debb740164f09d28bf501492 (diff) |
GPU Texture: Use switch instead of if/else
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index e8d488afbdd..25e54633552 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -722,17 +722,20 @@ void GPU_texture_update(GPUTexture *tex, const float *pixels) glBindTexture(tex->target, tex->bindcode); - if (tex->target == GL_TEXTURE_2D || - tex->target == GL_TEXTURE_2D_MULTISAMPLE || - tex->target == GL_TEXTURE_1D_ARRAY) - { - glTexSubImage2D(tex->target, 0, 0, 0, tex->w, tex->h, format, data_format, pixels); - } - else if (tex->target == GL_TEXTURE_1D) { - glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels); - } - else { /* GL_TEXTURE_3D */ - glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->d, format, data_format, pixels); + switch (tex->target) { + case GL_TEXTURE_2D: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_1D_ARRAY: + glTexSubImage2D(tex->target, 0, 0, 0, tex->w, tex->h, format, data_format, pixels); + break; + case GL_TEXTURE_1D: + glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels); + break; + case GL_TEXTURE_3D: + glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->d, format, data_format, pixels); + break; + default: + BLI_assert(!"tex->target mode not supported"); } glBindTexture(tex->target, 0); |