Cleanup: add missing braces to draw manager

This commit is contained in:
2019-01-25 07:10:13 +11:00
parent b1f3a86d99
commit a4fe338dd8
47 changed files with 265 additions and 136 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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
}