GPU Texture: Use switch instead of if/else
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user