[Bf-blender-cvs] [18159bd6c44] temp-pbvh-split: Cleanup: use '_num' / '_count' suffix instead of '_ct'

Campbell Barton noreply at git.blender.org
Fri Jun 3 01:16:27 CEST 2022


Commit: 18159bd6c4438e2f15e3ca0823322a947426c28a
Author: Campbell Barton
Date:   Wed May 11 13:19:56 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB18159bd6c4438e2f15e3ca0823322a947426c28a

Cleanup: use '_num' / '_count' suffix instead of '_ct'

Use num & count (for counters), in drawing code, see: T85728.

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

M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/draw/engines/gpencil/gpencil_render.c
M	source/blender/draw/engines/overlay/overlay_gpencil.c
M	source/blender/draw/engines/workbench/workbench_render.c
M	source/blender/draw/engines/workbench/workbench_volume.c
M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_manager.h
M	source/blender/draw/intern/draw_manager_data.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 4f562dd9804..0b9909a904b 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -95,7 +95,7 @@ typedef struct EEVEE_LightBake {
   /** Target layer to store the data to. */
   int layer;
   /** Sample count for the convolution. */
-  float samples_ct, invsamples_ct;
+  float samples_count, invsamples_count;
   /** Sampling bias during convolution step. */
   float lod_factor;
   /** Max cube-map LOD to sample when convolving. */
@@ -282,14 +282,14 @@ static void irradiance_pool_size_get(int visibility_size, int total_samples, int
                     (visibility_size / IRRADIANCE_SAMPLE_SIZE_Y);
 
   /* The irradiance itself take one layer, hence the +1 */
-  int layer_ct = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
+  int layer_count = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
 
-  int texel_ct = (int)ceilf((float)total_samples / (float)(layer_ct - 1));
+  int texel_count = (int)ceilf((float)total_samples / (float)(layer_count - 1));
   r_size[0] = visibility_size *
-              max_ii(1, min_ii(texel_ct, (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
+              max_ii(1, min_ii(texel_count, (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
   r_size[1] = visibility_size *
-              max_ii(1, (texel_ct / (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
-  r_size[2] = layer_ct;
+              max_ii(1, (texel_count / (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
+  r_size[2] = layer_count;
 }
 
 static bool EEVEE_lightcache_validate(const LightCache *light_cache,
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c
index 19afdb3de5a..c7ef8677336 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -61,10 +61,10 @@ void GPENCIL_render_init(GPENCIL_Data *vedata,
     /* Depth need to be remapped to [0..1] range. */
     pix_z = MEM_dupallocN(pix_z);
 
-    int pix_ct = rpass_z_src->rectx * rpass_z_src->recty;
+    int pix_num = rpass_z_src->rectx * rpass_z_src->recty;
 
     if (DRW_view_is_persp_get(view)) {
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         pix_z[i] = (-winmat[3][2] / -pix_z[i]) - winmat[2][2];
         pix_z[i] = clamp_f(pix_z[i] * 0.5f + 0.5f, 0.0f, 1.0f);
       }
@@ -74,7 +74,7 @@ void GPENCIL_render_init(GPENCIL_Data *vedata,
       float near = DRW_view_near_distance_get(view);
       float far = DRW_view_far_distance_get(view);
       float range_inv = 1.0f / fabsf(far - near);
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         pix_z[i] = (pix_z[i] + near) * range_inv;
         pix_z[i] = clamp_f(pix_z[i], 0.0f, 1.0f);
       }
@@ -172,11 +172,11 @@ static void GPENCIL_render_result_z(struct RenderLayer *rl,
     float winmat[4][4];
     DRW_view_winmat_get(NULL, winmat, false);
 
-    int pix_ct = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
+    int pix_num = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
 
     /* Convert GPU depth [0..1] to view Z [near..far] */
     if (DRW_view_is_persp_get(NULL)) {
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         if (rp->rect[i] == 1.0f) {
           rp->rect[i] = 1e10f; /* Background */
         }
@@ -192,7 +192,7 @@ static void GPENCIL_render_result_z(struct RenderLayer *rl,
       float far = DRW_view_far_distance_get(NULL);
       float range = fabsf(far - near);
 
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         if (rp->rect[i] == 1.0f) {
           rp->rect[i] = 1e10f; /* Background */
         }
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index 072d32c41cd..9531b0dd983 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -297,7 +297,7 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
     }
 
     const int gridlines = (gpd->grid.lines <= 0) ? 1 : gpd->grid.lines;
-    int line_ct = gridlines * 4 + 2;
+    const int line_count = gridlines * 4 + 2;
 
     DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
     state |= (grid_xray) ? DRW_STATE_DEPTH_ALWAYS : DRW_STATE_DEPTH_LESS_EQUAL;
@@ -311,8 +311,8 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
     DRW_shgroup_uniform_vec3_copy(grp, "xAxis", mat[0]);
     DRW_shgroup_uniform_vec3_copy(grp, "yAxis", mat[1]);
     DRW_shgroup_uniform_vec3_copy(grp, "origin", mat[3]);
-    DRW_shgroup_uniform_int_copy(grp, "halfLineCount", line_ct / 2);
-    DRW_shgroup_call_procedural_lines(grp, NULL, line_ct);
+    DRW_shgroup_uniform_int_copy(grp, "halfLineCount", line_count / 2);
+    DRW_shgroup_call_procedural_lines(grp, NULL, line_count);
   }
 }
 
diff --git a/source/blender/draw/engines/workbench/workbench_render.c b/source/blender/draw/engines/workbench/workbench_render.c
index 1279682e899..e5dcf6c5624 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -115,11 +115,11 @@ static void workbench_render_result_z(struct RenderLayer *rl,
     float winmat[4][4];
     DRW_view_winmat_get(NULL, winmat, false);
 
-    int pix_ct = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
+    int pix_num = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
 
     /* Convert ogl depth [0..1] to view Z [near..far] */
     if (DRW_view_is_persp_get(NULL)) {
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         if (rp->rect[i] == 1.0f) {
           rp->rect[i] = 1e10f; /* Background */
         }
@@ -135,7 +135,7 @@ static void workbench_render_result_z(struct RenderLayer *rl,
       float far = DRW_view_far_distance_get(NULL);
       float range = fabsf(far - near);
 
-      for (int i = 0; i < pix_ct; i++) {
+      for (int i = 0; i < pix_num; i++) {
         if (rp->rect[i] == 1.0f) {
           rp->rect[i] = 1e10f; /* Background */
         }
diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c
index 2c902e9b627..ce7773e7439 100644
--- a/source/blender/draw/engines/workbench/workbench_volume.c
+++ b/source/blender/draw/engines/workbench/workbench_volume.c
@@ -124,12 +124,12 @@ static void workbench_volume_modifier_cache_populate(WORKBENCH_Data *vedata,
     double noise_ofs;
     BLI_halton_1d(3, 0.0, wpd->taa_sample, &noise_ofs);
     float dim[3], step_length, max_slice;
-    float slice_ct[3] = {fds->res[0], fds->res[1], fds->res[2]};
-    mul_v3_fl(slice_ct, max_ff(0.001f, fds->slice_per_voxel));
-    max_slice = max_fff(slice_ct[0], slice_ct[1], slice_ct[2]);
+    float slice_count[3] = {fds->res[0], fds->res[1], fds->res[2]};
+    mul_v3_fl(slice_count, max_ff(0.001f, fds->slice_per_voxel));
+    max_slice = max_fff(slice_count[0], slice_count[1], slice_count[2]);
     BKE_object_dimensions_get(ob, dim);
-    invert_v3(slice_ct);
-    mul_v3_v3(dim, slice_ct);
+    invert_v3(slice_count);
+    mul_v3_v3(dim, slice_count);
     step_length = len_v3(dim);
 
     grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
@@ -273,12 +273,12 @@ static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata,
     float step_length, max_slice;
     int resolution[3];
     GPU_texture_get_mipmap_size(grid->texture, 0, resolution);
-    float slice_ct[3] = {resolution[0], resolution[1], resolution[2]};
-    mul_v3_fl(slice_ct, max_ff(0.001f, 5.0f));
-    max_slice = max_fff(slice_ct[0], slice_ct[1], slice_ct[2]);
-    invert_v3(slice_ct);
-    mul_v3_v3(slice_ct, world_size);
-    step_length = len_v3(slice_ct);
+    float slice_count[3] = {resolution[0], resolution[1], resolution[2]};
+    mul_v3_fl(slice_count, max_ff(0.001f, 5.0f));
+    max_slice = max_fff(slice_count[0], slice_count[1], slice_count[2]);
+    invert_v3(slice_count);
+    mul_v3_v3(slice_count, world_size);
+    step_length = len_v3(slice_count);
 
     /* Set uniforms. */
     grp = DRW_shgroup_create(sh, vedata->psl->volume_ps);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 6b40c1b08c4..0a447288e9b 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -431,12 +431,12 @@ void DRW_shgroup_call_ex(DRWShadingGroup *shgroup,
   DRW_shgroup_call_ex(shgroup, ob, NULL, geom, true, NULL)
 
 void DRW_shgroup_call_range(
-    DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint v_sta, uint v_ct);
+    DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint v_sta, uint v_num);
 /**
  * A count of 0 instance will use the default number of instance in the batch.
  */
 void DRW_shgroup_call_instance_range(
-    DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint i_sta, uint i_ct);
+    DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint i_sta, uint i_num);
 
 void DRW_shgroup_call_compute(DRWShadingGroup *shgroup,
                               int groups_x_len,
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 4bbcf6eaf42..f71d88342f1 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -529,7 +529,7 @@ static void drw_manager_init(DRWManager *dst, GPUViewport *viewport, const int s
   dst->view_data_active = dst->vmempool->view_data[view];
   dst->resource_handle = 0;
   dst->pass_handle = 0;
-  dst->primary_view_ct = 0;
+  dst->primary_view_num = 0;
 
   drw_viewport_data_reset(dst->vmempool);
 
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index 7a9585262ff..2d0837370b2 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -617,7 +617,7 @@ typedef struct DRWManager {
   DRWView *view_default;
   DRWView *view_activ

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list