diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-29 10:44:22 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-29 10:44:22 +0200 |
commit | 6991e9b43d0954018e1a82fa4cb28af42632ae92 (patch) | |
tree | 4082eccdb747de8953f8a0812dc8111b31d90b81 /drivers/gles3 | |
parent | 5bcd019ee9151b9040dc91e2aa4aef4cbbaa25fe (diff) | |
parent | ea1848ce0a5f03c3a9f7e0a221350f4f4044bb08 (diff) |
Merge pull request #66583 from bruvzg/constexpr
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings.
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 85b35639ec..39617167ef 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2043,7 +2043,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, } break; } - if (p_pass_mode == PASS_MODE_COLOR || p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) { + if constexpr (p_pass_mode == PASS_MODE_COLOR || p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) { glActiveTexture(GL_TEXTURE0 + config->max_texture_image_units - 2); GLuint texture_to_bind = texture_storage->get_texture(texture_storage->texture_gl_get_default(GLES3::DEFAULT_GL_TEXTURE_CUBEMAP_BLACK))->tex_id; if (p_render_data->environment.is_valid()) { @@ -2074,7 +2074,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, GLES3::SceneMaterialData *material_data; void *mesh_surface; - if (p_pass_mode == PASS_MODE_SHADOW) { + if constexpr (p_pass_mode == PASS_MODE_SHADOW) { shader = surf->shader_shadow; material_data = surf->material_shadow; mesh_surface = surf->surface_shadow; @@ -2088,7 +2088,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, continue; } - if (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) { + if constexpr (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT) { if (scene_state.current_depth_test != shader->depth_test) { if (shader->depth_test == GLES3::SceneShaderData::DEPTH_TEST_DISABLED) { glDisable(GL_DEPTH_TEST); @@ -2115,9 +2115,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, scene_state.current_depth_draw = shader->depth_draw; } - if (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT || p_pass_mode == PASS_MODE_COLOR_ADDITIVE) { + if constexpr (p_pass_mode == PASS_MODE_COLOR_TRANSPARENT || p_pass_mode == PASS_MODE_COLOR_ADDITIVE) { GLES3::SceneShaderData::BlendMode desired_blend_mode; - if (p_pass_mode == PASS_MODE_COLOR_ADDITIVE) { + if constexpr (p_pass_mode == PASS_MODE_COLOR_ADDITIVE) { desired_blend_mode = GLES3::SceneShaderData::BLEND_MODE_ADD; } else { desired_blend_mode = shader->blend_mode; @@ -2241,9 +2241,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, if (prev_shader != shader || prev_variant != instance_variant) { material_storage->shaders.scene_shader.version_bind_shader(shader->version, instance_variant); float opaque_prepass_threshold = 0.0; - if (p_pass_mode == PASS_MODE_DEPTH) { + if constexpr (p_pass_mode == PASS_MODE_DEPTH) { opaque_prepass_threshold = 0.99; - } else if (p_pass_mode == PASS_MODE_SHADOW) { + } else if constexpr (p_pass_mode == PASS_MODE_SHADOW) { opaque_prepass_threshold = 0.1; } |