diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:10:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:12:13 +0300 |
commit | a4fe338dd8c6822d27b8858bae5fa9a54972719c (patch) | |
tree | 9a6b671702a7cf41e98efef72e78c7cc54974111 /source/blender/draw/engines/eevee | |
parent | b1f3a86d999b6742d783de5a11d7de0c54cf5891 (diff) |
Cleanup: add missing braces to draw manager
Diffstat (limited to 'source/blender/draw/engines/eevee')
14 files changed, 58 insertions, 29 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 93162c6eae2..0420e85ee70 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -514,8 +514,9 @@ wmJob *EEVEE_lightbake_job_create( EEVEE_LightBake *lbake = NULL; /* only one render job at a time */ - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) { return NULL; + } wmJob *wm_job = WM_jobs_get(wm, win, scene, "Bake Lighting", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_LIGHT_BAKE); diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 3199fc430cf..601073a7be2 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -78,15 +78,18 @@ bool EEVEE_lightprobes_obj_visibility_cb(bool vis_in, void *user_data) EEVEE_ObjectEngineData *oed = (EEVEE_ObjectEngineData *)user_data; /* test disabled if group is NULL */ - if (oed->test_data->collection == NULL) + if (oed->test_data->collection == NULL) { return vis_in; + } - if (oed->test_data->cached == false) + if (oed->test_data->cached == false) { oed->ob_vis_dirty = true; + } /* early out, don't need to compute ob_vis yet. */ - if (vis_in == false) + if (vis_in == false) { return vis_in; + } if (oed->ob_vis_dirty) { oed->ob_vis_dirty = false; diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index af3531e9a6c..57a93a27ca0 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -457,8 +457,9 @@ void EEVEE_lights_cache_shcaster_material_add( DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - if (alpha_threshold != NULL) + if (alpha_threshold != NULL) { DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1); + } DRW_shgroup_call_object_add(grp, geom, ob); } @@ -599,8 +600,9 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) float light_attenuation_radius_get(Lamp *la, float light_threshold) { - if (la->mode & LA_CUSTOM_ATTENUATION) + if (la->mode & LA_CUSTOM_ATTENUATION) { return la->att_dist; + } /* Compute max light power. */ float power = max_fff(la->r, la->g, la->b); diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 6786bf7e911..527fa515deb 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -784,8 +784,9 @@ struct GPUMaterial *EEVEE_material_mesh_depth_get( options |= VAR_MAT_CLIP; } - if (is_shadow) + if (is_shadow) { options |= VAR_MAT_SHADOW; + } GPUMaterial *mat = DRW_shader_find_from_material(ma, engine, options, true); if (mat) { @@ -1485,8 +1486,9 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld shgrp_depth_array[i] = NULL; shgrp_depth_clip_array[i] = NULL; - if (ma == NULL) + if (ma == NULL) { ma = &defmaterial; + } switch (ma->blend_method) { case MA_BM_SOLID: @@ -1536,8 +1538,9 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld EEVEE_ObjectEngineData *oedata = NULL; Material *ma = give_current_material(ob, i + 1); - if (ma == NULL) + if (ma == NULL) { ma = &defmaterial; + } /* Do not render surface if we are rendering a volume object * and do not have a surface closure. */ diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c index 373618102e5..6e2cac6dbce 100644 --- a/source/blender/draw/engines/eevee/eevee_render.c +++ b/source/blender/draw/engines/eevee/eevee_render.c @@ -288,8 +288,9 @@ static void eevee_render_result_normal( EEVEE_PrivateData *g_data = stl->g_data; /* Only read the center texel. */ - if (stl->effects->taa_current_sample > 1) + if (stl->effects->taa_current_sample > 1) { return; + } if ((view_layer->passflag & SCE_PASS_NORMAL) != 0) { RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_NORMAL, viewname); @@ -336,8 +337,9 @@ static void eevee_render_result_z( EEVEE_PrivateData *g_data = stl->g_data; /* Only read the center texel. */ - if (stl->effects->taa_current_sample > 1) + if (stl->effects->taa_current_sample > 1) { return; + } if ((view_layer->passflag & SCE_PASS_Z) != 0) { RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_Z, viewname); diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index a54cefc5b85..28ffe37abf1 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -244,8 +244,9 @@ float line_unit_sphere_intersect_dist(vec3 lineorigin, vec3 linedirection) float dist = 1e15; float determinant = b * b - a * c; - if (determinant >= 0) + if (determinant >= 0) { dist = (sqrt(determinant) - b) / a; + } return dist; } diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl index 27517ebd86e..067b0786e34 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl @@ -108,15 +108,17 @@ layout(location = 1) out float fragAlpha; void main(void) { /* Discard to avoid bleeding onto the next layer */ - if (int(gl_FragCoord.x) * edge.x + edge.y > 0) + if (int(gl_FragCoord.x) * edge.x + edge.y > 0) { discard; + } /* Circle Dof */ float dist = length(particlecoord); /* Ouside of bokeh shape */ - if (dist > 1.0) + if (dist > 1.0) { discard; + } /* Regular Polygon Dof */ if (bokeh_sides.x > 0.0) { @@ -134,8 +136,9 @@ void main(void) dist /= r; /* Ouside of bokeh shape */ - if (dist > 1.0) + if (dist > 1.0) { discard; + } } fragColor = color; diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl index b8a86f8d742..d44cf5e3518 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl @@ -91,8 +91,9 @@ void main() /* Early out */ /* We can't do discard because we don't clear the render target. */ - if (depth == 1.0) + if (depth == 1.0) { return; + } vec2 uvs = vec2(fullres_texel) / vec2(textureSize(depthBuffer, 0)); @@ -105,16 +106,18 @@ void main() vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba; /* Early out */ - if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) + if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) { return; + } float roughness = speccol_roughness.a; float roughnessSquared = max(1e-3, roughness * roughness); float a2 = roughnessSquared * roughnessSquared; /* Early out */ - if (roughness > ssrMaxRoughness + 0.2) + if (roughness > ssrMaxRoughness + 0.2) { return; + } vec4 rand = texelFetch(utilTex, ivec3(halfres_texel % LUT_SIZE, 2), 0); @@ -394,8 +397,9 @@ void main() float depth = textureLod(depthBuffer, uvs, 0.0).r; /* Early out */ - if (depth == 1.0) + if (depth == 1.0) { discard; + } /* Using world space */ vec3 viewPosition = get_view_space_from_depth(uvs, depth); /* Needed for viewCameraVec */ @@ -406,8 +410,9 @@ void main() vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba; /* Early out */ - if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) + if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) { discard; + } float roughness = speccol_roughness.a; float roughnessSquared = max(1e-3, roughness * roughness); diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl index fb18af494b4..5a73950746d 100644 --- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl @@ -52,8 +52,9 @@ float shadow_test(ShadowSample moments, float dist, ShadowData sd) { float p = 0.0; - if (dist <= moments.x) + if (dist <= moments.x) { p = 1.0; + } float variance = moments.y - (moments.x * moments.x); variance = max(variance, sd.sh_bias / 10.0); diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl index 5a72244cfbe..bd51546eadf 100644 --- a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl @@ -9,8 +9,9 @@ void main() float dist_sqr = dot(quadCoord, quadCoord); /* Discard outside the circle. */ - if (dist_sqr > 1.0) + if (dist_sqr > 1.0) { discard; + } vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr))); vec3 world_ref = mat3(ViewMatrixInverse) * reflect(vec3(0.0, 0.0, -1.0), view_nor); diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl index fd8eb157aa5..fe0e173ba3d 100644 --- a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl @@ -9,8 +9,9 @@ void main() float dist_sqr = dot(quadCoord, quadCoord); /* Discard outside the circle. */ - if (dist_sqr > 1.0) + if (dist_sqr > 1.0) { discard; + } vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr))); vec3 world_nor = mat3(ViewMatrixInverse) * view_nor; diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl index 5631957ca31..6fb8ebc719e 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl @@ -217,8 +217,9 @@ void CLOSURE_NAME( float l_vis = light_visibility(ld, worldPosition, viewPosition, viewNormal, l_vector); - if (l_vis < 1e-8) + if (l_vis < 1e-8) { continue; + } vec3 l_color_vis = ld.l_color * l_vis; diff --git a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl index 11c223a45d6..b042b7fab45 100644 --- a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl @@ -93,10 +93,12 @@ vec3 solve_cubic(vec4 coefs) float x_3d = 2.0 * sqrt(-C_d) * cos(theta + (2.0 / 3.0) * M_PI); float xs; - if (x_1d + x_3d < 2.0 * C) + if (x_1d + x_3d < 2.0 * C) { xs = x_1d; - else + } + else { xs = x_3d; + } xsc = vec2(-D, xs + C); } @@ -279,8 +281,9 @@ float ltc_evaluate_disk(vec3 N, vec3 V, mat3 Minv, vec3 disk_points[3]) /* Now find front facing ellipse with same solid angle. */ vec3 V3 = normalize(cross(V1, V2)); - if (dot(C, V3) < 0.0) + if (dot(C, V3) < 0.0) { V3 *= -1.0; + } float L = dot(V3, C); float x0 = dot(V1, C) / L; diff --git a/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl b/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl index 6b6ab0c0bcc..bbc49fea6ba 100644 --- a/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl @@ -75,12 +75,14 @@ void main() #if defined(USE_ALPHA_HASH) /* Hashed Alpha Testing */ - if (cl.opacity < hashed_alpha_threshold(worldPosition)) + if (cl.opacity < hashed_alpha_threshold(worldPosition)) { discard; + } #elif defined(USE_ALPHA_CLIP) /* Alpha clip */ - if (cl.opacity <= alphaThreshold) + if (cl.opacity <= alphaThreshold) { discard; + } #endif #endif } |