GPU Texture: Use switch instead of if/else

This commit is contained in:
Dalai Felinto
2017-08-22 12:30:03 +02:00
parent cc5e90f75d
commit 9457715d9a

View File

@@ -722,17 +722,20 @@ void GPU_texture_update(GPUTexture *tex, const float *pixels)
glBindTexture(tex->target, tex->bindcode); glBindTexture(tex->target, tex->bindcode);
if (tex->target == GL_TEXTURE_2D || switch (tex->target) {
tex->target == GL_TEXTURE_2D_MULTISAMPLE || case GL_TEXTURE_2D:
tex->target == GL_TEXTURE_1D_ARRAY) case GL_TEXTURE_2D_MULTISAMPLE:
{ case GL_TEXTURE_1D_ARRAY:
glTexSubImage2D(tex->target, 0, 0, 0, tex->w, tex->h, format, data_format, pixels); glTexSubImage2D(tex->target, 0, 0, 0, tex->w, tex->h, format, data_format, pixels);
} break;
else if (tex->target == GL_TEXTURE_1D) { case GL_TEXTURE_1D:
glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels); glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels);
} break;
else { /* GL_TEXTURE_3D */ case GL_TEXTURE_3D:
glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->d, format, data_format, pixels); 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); glBindTexture(tex->target, 0);