[Bf-blender-cvs] [739b3abc471] tmp-workbench-rewrite2: Use lowercase for static const properties

Miguel Pozo noreply at git.blender.org
Mon Oct 31 17:35:19 CET 2022


Commit: 739b3abc4719d0bd42e25487381973798b4e5118
Author: Miguel Pozo
Date:   Mon Oct 31 17:32:39 2022 +0100
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rB739b3abc4719d0bd42e25487381973798b4e5118

Use lowercase for static const properties

===================================================================

M	source/blender/draw/engines/workbench/workbench_effect_cavity.cc
M	source/blender/draw/engines/workbench/workbench_effect_dof.cc
M	source/blender/draw/engines/workbench/workbench_private.hh

===================================================================

diff --git a/source/blender/draw/engines/workbench/workbench_effect_cavity.cc b/source/blender/draw/engines/workbench/workbench_effect_cavity.cc
index 7aef123dd39..d1c5c7abffb 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_cavity.cc
+++ b/source/blender/draw/engines/workbench/workbench_effect_cavity.cc
@@ -24,7 +24,7 @@ void CavityEffect::init(const SceneState &scene_state, UniformBuffer<WorldData>
   curvature_enabled_ = scene_state.draw_curvature;
 
   const int ssao_samples = scene_state.scene->display.matcap_ssao_samples;
-  int sample_count = min_ii(max_ii(1, scene_state.aa_samples) * ssao_samples, MAX_SAMPLES);
+  int sample_count = min_ii(max_ii(1, scene_state.aa_samples) * ssao_samples, max_samples_);
   const int max_iter_count = sample_count / ssao_samples;
 
   if (scene_state.reset_taa) {
@@ -82,7 +82,7 @@ void CavityEffect::setup_resources(int iteration_samples, int total_samples)
     const float total_samples_inv = 1.0f / iteration_samples;
 
     /* Create blue noise jitter texture */
-    const int jitter_texel_count = JITTER_TEX_SIZE * JITTER_TEX_SIZE;
+    const int jitter_texel_count = jitter_tx_size_ * jitter_tx_size_;
     static float4 jitter[jitter_texel_count];
     for (int i = 0; i < jitter_texel_count; i++) {
       float phi = blue_noise[i][0] * 2.0f * M_PI;
@@ -96,7 +96,7 @@ void CavityEffect::setup_resources(int iteration_samples, int total_samples)
       jitter[i].w = blue_noise[i][1];
     }
 
-    jitter_tx.ensure_2d(GPU_RGBA16F, int2(JITTER_TEX_SIZE), jitter[0]);
+    jitter_tx.ensure_2d(GPU_RGBA16F, int2(jitter_tx_size_), jitter[0]);
   }
 }
 
diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.cc b/source/blender/draw/engines/workbench/workbench_effect_dof.cc
index fb56c9dd952..e72dd2e8cad 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_dof.cc
+++ b/source/blender/draw/engines/workbench/workbench_effect_dof.cc
@@ -59,9 +59,9 @@ static void square_to_circle(float x, float y, float &r, float &T)
 void DofPass::setup_samples()
 {
   float4 *sample = samples_buf_.begin();
-  for (int i = 0; i <= KERNEL_RADIUS; i++) {
-    for (int j = -KERNEL_RADIUS; j <= KERNEL_RADIUS; j++) {
-      for (int k = -KERNEL_RADIUS; k <= KERNEL_RADIUS; k++) {
+  for (int i = 0; i <= kernel_radius_; i++) {
+    for (int j = -kernel_radius_; j <= kernel_radius_; j++) {
+      for (int k = -kernel_radius_; k <= kernel_radius_; k++) {
         if (abs(j) > i || abs(k) > i) {
           continue;
         }
@@ -69,7 +69,7 @@ void DofPass::setup_samples()
           continue;
         }
 
-        float2 coord = float2(j, k) / float2(KERNEL_RADIUS);
+        float2 coord = float2(j, k) / float2(kernel_radius_);
         float r = 0;
         float T = 0;
         square_to_circle(coord.x, coord.y, r, T);
@@ -302,8 +302,8 @@ void DofPass::draw(Manager &manager, View &view, SceneResources &resources, int2
   blur_tx_.acquire(half_res, GPU_RGBA16F);
 
   downsample_fb_.ensure(GPU_ATTACHMENT_NONE,
-                       GPU_ATTACHMENT_TEXTURE(source_tx_),
-                       GPU_ATTACHMENT_TEXTURE(coc_halfres_tx_));
+                        GPU_ATTACHMENT_TEXTURE(source_tx_),
+                        GPU_ATTACHMENT_TEXTURE(coc_halfres_tx_));
   downsample_fb_.bind();
   manager.submit(down_ps_, view);
 
diff --git a/source/blender/draw/engines/workbench/workbench_private.hh b/source/blender/draw/engines/workbench/workbench_private.hh
index 25e16426f94..fcd57d2ea85 100644
--- a/source/blender/draw/engines/workbench/workbench_private.hh
+++ b/source/blender/draw/engines/workbench/workbench_private.hh
@@ -120,11 +120,11 @@ class CavityEffect {
   bool cavity_enabled_;
 
  public:
-  static const int JITTER_TEX_SIZE = 64;
-  static const int MAX_SAMPLES = 512;  // This value must be kept in sync with the one declared at
-                                       // workbench_composite_info.hh (cavity_samples)
+  static const int jitter_tx_size_ = 64;
+  static const int max_samples_ = 512;  // This value must be kept in sync with the one declared at
+                                        // workbench_composite_info.hh (cavity_samples)
 
-  UniformArrayBuffer<float4, MAX_SAMPLES> samples_buf;
+  UniformArrayBuffer<float4, max_samples_> samples_buf;
   /*TODO(Miguel Pozo): Move to SceneResources (Used by DoF too)*/
   Texture jitter_tx;
 
@@ -233,10 +233,10 @@ class TransparentDepthPass {
 class DofPass {
   bool enabled_ = false;
 
-  static const int KERNEL_RADIUS = 3;
-  static const int SAMPLES_LEN = (KERNEL_RADIUS * 2 + 1) * (KERNEL_RADIUS * 2 + 1);
+  static const int kernel_radius_ = 3;
+  static const int samples_len_ = (kernel_radius_ * 2 + 1) * (kernel_radius_ * 2 + 1);
 
-  UniformArrayBuffer<float4, SAMPLES_LEN> samples_buf_;
+  UniformArrayBuffer<float4, samples_len_> samples_buf_;
 
   Texture source_tx_;
   Texture coc_halfres_tx_;



More information about the Bf-blender-cvs mailing list