Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-08-07 13:39:35 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-07 14:38:06 +0300
commitc889d93c80c52603a501b6b76f6e251b7a6112d2 (patch)
treee39563837bc237f92b1ad5a9e429b41fe69a6e4c /source/blender/gpu
parent326e137a8cfaac6587a83d4c61d2889832926827 (diff)
Cleanup: GPU, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/gpu` module. No functional changes.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_batch_presets.c12
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c5
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c40
-rw-r--r--source/blender/gpu/intern/gpu_element.cc11
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc14
-rw-r--r--source/blender/gpu/intern/gpu_material.c7
-rw-r--r--source/blender/gpu/intern/gpu_material_library.c13
-rw-r--r--source/blender/gpu/intern/gpu_matrix.cc10
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c14
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.c5
-rw-r--r--source/blender/gpu/intern/gpu_shader.cc5
-rw-r--r--source/blender/gpu/intern/gpu_shader_interface.cc13
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc161
-rw-r--r--source/blender/gpu/intern/gpu_uniformbuffer.cc9
-rw-r--r--source/blender/gpu/intern/gpu_vertex_format.cc5
-rw-r--r--source/blender/gpu/intern/gpu_viewport.c5
16 files changed, 152 insertions, 177 deletions
diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c
index 7f842d4d508..3d9b4326c7e 100644
--- a/source/blender/gpu/intern/gpu_batch_presets.c
+++ b/source/blender/gpu/intern/gpu_batch_presets.c
@@ -129,12 +129,11 @@ GPUBatch *GPU_batch_preset_sphere(int lod)
if (lod == 0) {
return g_presets_3d.batch.sphere_low;
}
- else if (lod == 1) {
+ if (lod == 1) {
return g_presets_3d.batch.sphere_med;
}
- else {
- return g_presets_3d.batch.sphere_high;
- }
+
+ return g_presets_3d.batch.sphere_high;
}
GPUBatch *GPU_batch_preset_sphere_wire(int lod)
@@ -145,9 +144,8 @@ GPUBatch *GPU_batch_preset_sphere_wire(int lod)
if (lod == 0) {
return g_presets_3d.batch.sphere_wire_low;
}
- else {
- return g_presets_3d.batch.sphere_wire_med;
- }
+
+ return g_presets_3d.batch.sphere_wire_med;
}
/** \} */
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 10d5a860f6a..5a36e5ffdec 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1083,9 +1083,8 @@ GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool
if (wires) {
return (fast && buffers->lines_fast) ? buffers->lines_fast : buffers->lines;
}
- else {
- return (fast && buffers->triangles_fast) ? buffers->triangles_fast : buffers->triangles;
- }
+
+ return (fast && buffers->triangles_fast) ? buffers->triangles_fast : buffers->triangles;
}
bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers)
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 8947365d666..08d2779043e 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -220,63 +220,61 @@ static const char *gpu_builtin_name(eGPUBuiltin builtin)
if (builtin == GPU_VIEW_MATRIX) {
return "unfviewmat";
}
- else if (builtin == GPU_OBJECT_MATRIX) {
+ if (builtin == GPU_OBJECT_MATRIX) {
return "unfobmat";
}
- else if (builtin == GPU_INVERSE_VIEW_MATRIX) {
+ if (builtin == GPU_INVERSE_VIEW_MATRIX) {
return "unfinvviewmat";
}
- else if (builtin == GPU_INVERSE_OBJECT_MATRIX) {
+ if (builtin == GPU_INVERSE_OBJECT_MATRIX) {
return "unfinvobmat";
}
- else if (builtin == GPU_LOC_TO_VIEW_MATRIX) {
+ if (builtin == GPU_LOC_TO_VIEW_MATRIX) {
return "unflocaltoviewmat";
}
- else if (builtin == GPU_INVERSE_LOC_TO_VIEW_MATRIX) {
+ if (builtin == GPU_INVERSE_LOC_TO_VIEW_MATRIX) {
return "unfinvlocaltoviewmat";
}
- else if (builtin == GPU_VIEW_POSITION) {
+ if (builtin == GPU_VIEW_POSITION) {
return "varposition";
}
- else if (builtin == GPU_WORLD_NORMAL) {
+ if (builtin == GPU_WORLD_NORMAL) {
return "varwnormal";
}
- else if (builtin == GPU_VIEW_NORMAL) {
+ if (builtin == GPU_VIEW_NORMAL) {
return "varnormal";
}
- else if (builtin == GPU_OBJECT_COLOR) {
+ if (builtin == GPU_OBJECT_COLOR) {
return "unfobjectcolor";
}
- else if (builtin == GPU_AUTO_BUMPSCALE) {
+ if (builtin == GPU_AUTO_BUMPSCALE) {
return "unfobautobumpscale";
}
- else if (builtin == GPU_CAMERA_TEXCO_FACTORS) {
+ if (builtin == GPU_CAMERA_TEXCO_FACTORS) {
return "unfcameratexfactors";
}
- else if (builtin == GPU_PARTICLE_SCALAR_PROPS) {
+ if (builtin == GPU_PARTICLE_SCALAR_PROPS) {
return "unfparticlescalarprops";
}
- else if (builtin == GPU_PARTICLE_LOCATION) {
+ if (builtin == GPU_PARTICLE_LOCATION) {
return "unfparticleco";
}
- else if (builtin == GPU_PARTICLE_VELOCITY) {
+ if (builtin == GPU_PARTICLE_VELOCITY) {
return "unfparticlevel";
}
- else if (builtin == GPU_PARTICLE_ANG_VELOCITY) {
+ if (builtin == GPU_PARTICLE_ANG_VELOCITY) {
return "unfparticleangvel";
}
- else if (builtin == GPU_OBJECT_INFO) {
+ if (builtin == GPU_OBJECT_INFO) {
return "unfobjectinfo";
}
- else if (builtin == GPU_BARYCENTRIC_TEXCO) {
+ if (builtin == GPU_BARYCENTRIC_TEXCO) {
return "unfbarycentrictex";
}
- else if (builtin == GPU_BARYCENTRIC_DIST) {
+ if (builtin == GPU_BARYCENTRIC_DIST) {
return "unfbarycentricdist";
}
- else {
- return "";
- }
+ return "";
}
static void codegen_set_unique_ids(GPUNodeGraph *graph)
diff --git a/source/blender/gpu/intern/gpu_element.cc b/source/blender/gpu/intern/gpu_element.cc
index 9f104ab3fec..449d119267d 100644
--- a/source/blender/gpu/intern/gpu_element.cc
+++ b/source/blender/gpu/intern/gpu_element.cc
@@ -280,7 +280,7 @@ static uint index_range(const uint values[], uint value_len, uint *min_out, uint
if (value == RESTART_INDEX) {
continue;
}
- else if (value < min_value) {
+ if (value < min_value) {
min_value = value;
}
else if (value > max_value) {
@@ -292,11 +292,10 @@ static uint index_range(const uint values[], uint value_len, uint *min_out, uint
*max_out = 0;
return 0;
}
- else {
- *min_out = min_value;
- *max_out = max_value;
- return max_value - min_value;
- }
+
+ *min_out = min_value;
+ *max_out = max_value;
+ return max_value - min_value;
}
static void squeeze_indices_short(GPUIndexBufBuilder *builder,
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 056a449ac6d..13df2268221 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -127,9 +127,8 @@ static GPUTexture *framebuffer_get_depth_tex(GPUFrameBuffer *fb)
if (fb->attachments[GPU_FB_DEPTH_ATTACHMENT].tex) {
return fb->attachments[GPU_FB_DEPTH_ATTACHMENT].tex;
}
- else {
- return fb->attachments[GPU_FB_DEPTH_STENCIL_ATTACHMENT].tex;
- }
+
+ return fb->attachments[GPU_FB_DEPTH_STENCIL_ATTACHMENT].tex;
}
static GPUTexture *framebuffer_get_color_tex(GPUFrameBuffer *fb, int slot)
@@ -190,9 +189,8 @@ GPUFrameBuffer *GPU_framebuffer_active_get(void)
if (ctx) {
return gpu_context_active_framebuffer_get(ctx);
}
- else {
- return 0;
- }
+
+ return 0;
}
static void gpu_framebuffer_current_set(GPUFrameBuffer *fb)
@@ -261,7 +259,7 @@ static void gpu_framebuffer_texture_attach_ex(
if ((attachment->tex == tex) && (attachment->mip == mip) && (attachment->layer == layer)) {
return; /* Exact same texture already bound here. */
}
- else if (attachment->tex != NULL) {
+ if (attachment->tex != NULL) {
GPU_framebuffer_texture_detach(fb, attachment->tex);
}
@@ -414,7 +412,7 @@ static void gpu_framebuffer_update_attachments(GPUFrameBuffer *fb)
if (GPU_FB_ATTACHEMENT_IS_DIRTY(fb->dirty_flag, type) == false) {
continue;
}
- else if (fb->attachments[type].tex != NULL) {
+ if (fb->attachments[type].tex != NULL) {
gpu_framebuffer_attachment_attach(&fb->attachments[type], type);
fb->multisample = (GPU_texture_samples(fb->attachments[type].tex) > 0);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index f3477b6f3a4..8d2003591e4 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -311,12 +311,11 @@ static float eval_profile(float r, short falloff_type, float sharpness, float pa
if (falloff_type == SHD_SUBSURFACE_BURLEY || falloff_type == SHD_SUBSURFACE_RANDOM_WALK) {
return burley_profile(r, param) / BURLEY_TRUNCATE_CDF;
}
- else if (falloff_type == SHD_SUBSURFACE_CUBIC) {
+ if (falloff_type == SHD_SUBSURFACE_CUBIC) {
return cubic_profile(r, param, sharpness);
}
- else {
- return gaussian_profile(r, param);
- }
+
+ return gaussian_profile(r, param);
}
/* Resolution for each sample of the precomputed kernel profile */
diff --git a/source/blender/gpu/intern/gpu_material_library.c b/source/blender/gpu/intern/gpu_material_library.c
index 42cd9673ac2..e0165e1fa83 100644
--- a/source/blender/gpu/intern/gpu_material_library.c
+++ b/source/blender/gpu/intern/gpu_material_library.c
@@ -678,14 +678,13 @@ char *gpu_str_skip_token(char *str, char *token, int max)
if (ELEM(*str, ' ', '(', ')', ',', ';', '\t', '\n', '\r')) {
break;
}
- else {
- if (token && len < max - 1) {
- *token = *str;
- token++;
- len++;
- }
- str++;
+
+ if (token && len < max - 1) {
+ *token = *str;
+ token++;
+ len++;
}
+ str++;
}
if (token) {
diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc
index c15bb1fba19..4174f498402 100644
--- a/source/blender/gpu/intern/gpu_matrix.cc
+++ b/source/blender/gpu/intern/gpu_matrix.cc
@@ -590,9 +590,8 @@ const float (*GPU_matrix_model_view_get(float m[4][4]))[4]
copy_m4_m4(m, ModelView);
return m;
}
- else {
- return ModelView;
- }
+
+ return ModelView;
}
const float (*GPU_matrix_projection_get(float m[4][4]))[4]
@@ -601,9 +600,8 @@ const float (*GPU_matrix_projection_get(float m[4][4]))[4]
copy_m4_m4(m, Projection);
return m;
}
- else {
- return Projection;
- }
+
+ return Projection;
}
const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4]
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 3025b5d66da..0f6f29fab40 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -204,12 +204,11 @@ static int depth_id_cmp(const void *v1, const void *v2)
if (d1->id < d2->id) {
return -1;
}
- else if (d1->id > d2->id) {
+ if (d1->id > d2->id) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static int depth_cmp(const void *v1, const void *v2)
@@ -218,12 +217,11 @@ static int depth_cmp(const void *v1, const void *v2)
if (d1->depth < d2->depth) {
return -1;
}
- else if (d1->depth > d2->depth) {
+ if (d1->depth > d2->depth) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
/* depth sorting */
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 70ad2f6759e..f67c9c36a6b 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -147,9 +147,8 @@ bool gpu_select_query_load_id(uint id)
g_query_state.index++;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
}
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index 2b54e733bf5..76c439b86b5 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -539,9 +539,8 @@ static const char *string_join_array_maybe_alloc(const char **str_arr, bool *r_i
if (is_alloc) {
return BLI_string_join_arrayN(str_arr, i);
}
- else {
- return str_arr[0];
- }
+
+ return str_arr[0];
}
/**
diff --git a/source/blender/gpu/intern/gpu_shader_interface.cc b/source/blender/gpu/intern/gpu_shader_interface.cc
index 4586b1ce814..7ac4365dd91 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.cc
+++ b/source/blender/gpu/intern/gpu_shader_interface.cc
@@ -157,13 +157,12 @@ GPU_INLINE const GPUShaderInput *input_lookup(const GPUShaderInterface *shaderfa
}
return NULL; /* not found */
}
- else {
- /* This is a bit dangerous since we could have a hash collision.
- * where the asked uniform that does not exist has the same hash
- * as a real uniform. */
- BLI_assert(match(name, shaderface->name_buffer + inputs[i].name_offset));
- return inputs + i;
- }
+
+ /* This is a bit dangerous since we could have a hash collision.
+ * where the asked uniform that does not exist has the same hash
+ * as a real uniform. */
+ BLI_assert(match(name, shaderface->name_buffer + inputs[i].name_offset));
+ return inputs + i;
}
}
return NULL; /* not found */
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index 49812abe605..5d86f3d16a3 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -312,31 +312,28 @@ static eGPUDataFormat gpu_get_data_format_from_tex_format(eGPUTextureFormat tex_
if (ELEM(tex_format, GPU_DEPTH_COMPONENT24, GPU_DEPTH_COMPONENT16, GPU_DEPTH_COMPONENT32F)) {
return GPU_DATA_FLOAT;
}
- else if (ELEM(tex_format, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8)) {
+ if (ELEM(tex_format, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8)) {
return GPU_DATA_UNSIGNED_INT_24_8;
}
- else {
- /* Integer formats */
- if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R8UI, GPU_R16UI, GPU_R32UI)) {
- if (ELEM(tex_format, GPU_R8UI, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
- return GPU_DATA_UNSIGNED_INT;
- }
- else {
- return GPU_DATA_INT;
- }
- }
- /* Byte formats */
- else if (ELEM(tex_format, GPU_R8)) {
- return GPU_DATA_UNSIGNED_BYTE;
- }
- /* Special case */
- else if (ELEM(tex_format, GPU_R11F_G11F_B10F)) {
- return GPU_DATA_10_11_11_REV;
- }
- else {
- return GPU_DATA_FLOAT;
+
+ /* Integer formats */
+ if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R8UI, GPU_R16UI, GPU_R32UI)) {
+ if (ELEM(tex_format, GPU_R8UI, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
+ return GPU_DATA_UNSIGNED_INT;
}
+
+ return GPU_DATA_INT;
+ }
+ /* Byte formats */
+ if (ELEM(tex_format, GPU_R8)) {
+ return GPU_DATA_UNSIGNED_BYTE;
}
+ /* Special case */
+ if (ELEM(tex_format, GPU_R11F_G11F_B10F)) {
+ return GPU_DATA_10_11_11_REV;
+ }
+
+ return GPU_DATA_FLOAT;
}
/* Definitely not complete, edit according to the gl specification. */
@@ -347,51 +344,50 @@ static GLenum gpu_get_gl_dataformat(eGPUTextureFormat data_type,
*format_flag |= GPU_FORMAT_DEPTH;
return GL_DEPTH_COMPONENT;
}
- else if (ELEM(data_type, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8)) {
+ if (ELEM(data_type, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8)) {
*format_flag |= GPU_FORMAT_DEPTH | GPU_FORMAT_STENCIL;
return GL_DEPTH_STENCIL;
}
- else {
- /* Integer formats */
- if (ELEM(data_type, GPU_R8UI, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
- *format_flag |= GPU_FORMAT_INTEGER;
- switch (gpu_get_component_count(data_type)) {
- case 1:
- return GL_RED_INTEGER;
- break;
- case 2:
- return GL_RG_INTEGER;
- break;
- case 3:
- return GL_RGB_INTEGER;
- break;
- case 4:
- return GL_RGBA_INTEGER;
- break;
- }
- }
- else if (ELEM(data_type, GPU_R8)) {
- *format_flag |= GPU_FORMAT_FLOAT;
- return GL_RED;
+ /* Integer formats */
+ if (ELEM(data_type, GPU_R8UI, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
+ *format_flag |= GPU_FORMAT_INTEGER;
+
+ switch (gpu_get_component_count(data_type)) {
+ case 1:
+ return GL_RED_INTEGER;
+ break;
+ case 2:
+ return GL_RG_INTEGER;
+ break;
+ case 3:
+ return GL_RGB_INTEGER;
+ break;
+ case 4:
+ return GL_RGBA_INTEGER;
+ break;
}
- else {
- *format_flag |= GPU_FORMAT_FLOAT;
+ }
+ else if (ELEM(data_type, GPU_R8)) {
+ *format_flag |= GPU_FORMAT_FLOAT;
+ return GL_RED;
+ }
+ else {
+ *format_flag |= GPU_FORMAT_FLOAT;
- switch (gpu_get_component_count(data_type)) {
- case 1:
- return GL_RED;
- break;
- case 2:
- return GL_RG;
- break;
- case 3:
- return GL_RGB;
- break;
- case 4:
- return GL_RGBA;
- break;
- }
+ switch (gpu_get_component_count(data_type)) {
+ case 1:
+ return GL_RED;
+ break;
+ case 2:
+ return GL_RG;
+ break;
+ case 3:
+ return GL_RGB;
+ break;
+ case 4:
+ return GL_RGBA;
+ break;
}
}
@@ -667,31 +663,30 @@ static bool gpu_texture_check_capacity(
return true;
}
- else {
- switch (proxy) {
- case GL_PROXY_TEXTURE_1D:
- glTexImage1D(proxy, 0, internalformat, tex->w, 0, data_format, data_type, NULL);
- break;
- case GL_PROXY_TEXTURE_1D_ARRAY:
- case GL_PROXY_TEXTURE_2D:
- case GL_PROXY_TEXTURE_CUBE_MAP:
- glTexImage2D(proxy, 0, internalformat, tex->w, tex->h, 0, data_format, data_type, NULL);
- break;
- case GL_PROXY_TEXTURE_2D_ARRAY:
- case GL_PROXY_TEXTURE_3D:
- glTexImage3D(
- proxy, 0, internalformat, tex->w, tex->h, tex->d, 0, data_format, data_type, NULL);
- break;
- case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
- glTexImage3D(
- proxy, 0, internalformat, tex->w, tex->h, tex->d * 6, 0, data_format, data_type, NULL);
- break;
- }
- int width = 0;
- glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &width);
- return (width > 0);
+ switch (proxy) {
+ case GL_PROXY_TEXTURE_1D:
+ glTexImage1D(proxy, 0, internalformat, tex->w, 0, data_format, data_type, NULL);
+ break;
+ case GL_PROXY_TEXTURE_1D_ARRAY:
+ case GL_PROXY_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ glTexImage2D(proxy, 0, internalformat, tex->w, tex->h, 0, data_format, data_type, NULL);
+ break;
+ case GL_PROXY_TEXTURE_2D_ARRAY:
+ case GL_PROXY_TEXTURE_3D:
+ glTexImage3D(
+ proxy, 0, internalformat, tex->w, tex->h, tex->d, 0, data_format, data_type, NULL);
+ break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
+ glTexImage3D(
+ proxy, 0, internalformat, tex->w, tex->h, tex->d * 6, 0, data_format, data_type, NULL);
+ break;
}
+ int width = 0;
+ glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &width);
+
+ return (width > 0);
}
/* This tries to allocate video memory for a given texture
diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.cc b/source/blender/gpu/intern/gpu_uniformbuffer.cc
index 846ab6c8560..f0724ce7c9a 100644
--- a/source/blender/gpu/intern/gpu_uniformbuffer.cc
+++ b/source/blender/gpu/intern/gpu_uniformbuffer.cc
@@ -132,7 +132,7 @@ static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
BLI_assert(!"mat3 not supported in UBO");
continue;
}
- else if (input->type > MAX_UBO_GPU_TYPE) {
+ if (input->type > MAX_UBO_GPU_TYPE) {
BLI_assert(!"GPU type not supported in UBO");
continue;
}
@@ -140,10 +140,9 @@ static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
if (input->type == cur_type) {
continue;
}
- else {
- inputs_lookup[input->type] = link;
- cur_type = input->type;
- }
+
+ inputs_lookup[input->type] = link;
+ cur_type = input->type;
}
/* If there is no GPU_VEC3 there is no need for alignment. */
diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc
index a59a6a468ce..2e8017660d0 100644
--- a/source/blender/gpu/intern/gpu_vertex_format.cc
+++ b/source/blender/gpu/intern/gpu_vertex_format.cc
@@ -114,9 +114,8 @@ static uint attr_align(const GPUVertAttr *a)
if (a->comp_len == 3 && c <= 2) {
return 4 * c; /* AMD HW can't fetch these well, so pad it out (other vendors too?) */
}
- else {
- return c; /* most fetches are ok if components are naturally aligned */
- }
+
+ return c; /* most fetches are ok if components are naturally aligned */
}
uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len)
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index 81315ec1f92..ba938349761 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -912,9 +912,8 @@ GPUTexture *GPU_viewport_color_texture(GPUViewport *viewport, int view)
if (viewport->active_view == view) {
return dtxl->color;
}
- else {
- return dtxl->color_stereo;
- }
+
+ return dtxl->color_stereo;
}
return NULL;