diff options
Diffstat (limited to 'source/blender/draw/engines')
3 files changed, 9 insertions, 8 deletions
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 91a4ca99f7e..afd219fb831 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl @@ -26,9 +26,10 @@ uniform vec2 nearFar; /* Near & far view depths values */ /* divide by sensor size to get the normalized size */ #define calculate_coc(zdepth) (dof_mul / zdepth - dof_bias) -#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \ - ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \ - : z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */ +#define linear_depth(z) \ + ((ProjectionMatrix[3][3] == 0.0) ? \ + (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \ + z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */ #define weighted_sum(a, b, c, d, e) (a * e.x + b * e.y + c * e.z + d * e.w) / max(1e-6, dot(e, vec4(1.0))); diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl index 5e4e594ecb5..1fb7a9cec46 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl @@ -31,9 +31,10 @@ float max_v4(vec4 v) { return max(max(v.x, v.y), max(v.z, v.w)); } /* divide by sensor size to get the normalized size */ #define calculate_coc(zdepth) (dof_aperturesize * (dof_distance / zdepth - 1.0) * dof_invsensorsize) -#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \ - ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \ - : (z * 2.0 - 1.0) * nearFar.y) +#define linear_depth(z) \ + ((ProjectionMatrix[3][3] == 0.0) ? \ + (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \ + (z * 2.0 - 1.0) * nearFar.y) const float MAX_COC_SIZE = 100.0; diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index dfd8152ae06..4afc692455c 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -264,8 +264,7 @@ static GPUShader *ensure_background_shader(WORKBENCH_PrivateData *wpd) static void select_deferred_shaders(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg) { - wpd->prepass_solid_sh - = ensure_deferred_prepass_shader(wpd, false, false, sh_cfg); + wpd->prepass_solid_sh = ensure_deferred_prepass_shader(wpd, false, false, sh_cfg); wpd->prepass_solid_hair_sh = ensure_deferred_prepass_shader(wpd, false, true, sh_cfg); wpd->prepass_texture_sh = ensure_deferred_prepass_shader(wpd, true, false, sh_cfg); wpd->prepass_texture_hair_sh = ensure_deferred_prepass_shader(wpd, true, true, sh_cfg); |