Cleanup: rename 'ct' to 'len' for size vars

This commit is contained in:
2018-07-08 12:45:53 +02:00
parent 6d72d3c862
commit 392ed710d6
17 changed files with 164 additions and 164 deletions

View File

@@ -132,9 +132,9 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
/* determine the iteration count */
const float minDim = (float)MIN2(blitsize[0], blitsize[1]);
const float maxIter = (radius - 8.0f) + log(minDim) / log(2);
const int maxIterInt = effects->bloom_iteration_ct = (int)maxIter;
const int maxIterInt = effects->bloom_iteration_len = (int)maxIter;
CLAMP(effects->bloom_iteration_ct, 1, MAX_BLOOM_STEP);
CLAMP(effects->bloom_iteration_len, 1, MAX_BLOOM_STEP);
effects->bloom_sample_scale = 0.5f + maxIter - (float)maxIterInt;
effects->bloom_curve_threshold[0] = threshold - knee;
@@ -146,7 +146,7 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
/* Downsample buffers */
copy_v2_v2_int(texsize, blitsize);
for (int i = 0; i < effects->bloom_iteration_ct; ++i) {
for (int i = 0; i < effects->bloom_iteration_len; ++i) {
texsize[0] /= 2; texsize[1] /= 2;
texsize[0] = MAX2(texsize[0], 2);
@@ -165,7 +165,7 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
/* Upsample buffers */
copy_v2_v2_int(texsize, blitsize);
for (int i = 0; i < effects->bloom_iteration_ct - 1; ++i) {
for (int i = 0; i < effects->bloom_iteration_len - 1; ++i) {
texsize[0] /= 2; texsize[1] /= 2;
texsize[0] = MAX2(texsize[0], 2);
@@ -291,7 +291,7 @@ void EEVEE_bloom_draw(EEVEE_Data *vedata)
last = effects->bloom_downsample[0];
for (int i = 1; i < effects->bloom_iteration_ct; ++i) {
for (int i = 1; i < effects->bloom_iteration_len; ++i) {
copy_v2_v2(effects->unf_source_texel_size, effects->downsamp_texel_size[i - 1]);
effects->unf_source_buffer = last;
@@ -303,7 +303,7 @@ void EEVEE_bloom_draw(EEVEE_Data *vedata)
}
/* Upsample and accumulate */
for (int i = effects->bloom_iteration_ct - 2; i >= 0; --i) {
for (int i = effects->bloom_iteration_len - 2; i >= 0; --i) {
copy_v2_v2(effects->unf_source_texel_size, effects->downsamp_texel_size[i]);
effects->unf_source_buffer = effects->bloom_downsample[i];
effects->unf_base_buffer = last;

View File

@@ -208,8 +208,8 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_
/* This create an empty batch of N triangles to be positioned
* by the vertex shader 0.4ms against 6ms with instancing */
const float *viewport_size = DRW_viewport_size_get();
const int sprite_ct = ((int)viewport_size[0] / 2) * ((int)viewport_size[1] / 2); /* brackets matters */
grp = DRW_shgroup_empty_tri_batch_create(e_data.dof_scatter_sh, psl->dof_scatter, sprite_ct);
const int sprite_len = ((int)viewport_size[0] / 2) * ((int)viewport_size[1] / 2); /* brackets matters */
grp = DRW_shgroup_empty_tri_batch_create(e_data.dof_scatter_sh, psl->dof_scatter, sprite_len);
DRW_shgroup_uniform_texture_ref(grp, "nearBuffer", &effects->dof_down_near);
DRW_shgroup_uniform_texture_ref(grp, "farBuffer", &effects->dof_down_far);

View File

@@ -191,10 +191,10 @@ static void eevee_draw_background(void *vedata)
/* Number of iteration: needed for all temporal effect (SSR, volumetrics)
* when using opengl render. */
int loop_ct = (DRW_state_is_image_render() &&
int loop_len = (DRW_state_is_image_render() &&
(stl->effects->enabled_effects & (EFFECT_VOLUMETRIC | EFFECT_SSR)) != 0) ? 4 : 1;
while (loop_ct--) {
while (loop_len--) {
float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float clear_depth = 1.0f;
uint clear_stencil = 0xFF;

View File

@@ -127,12 +127,12 @@ 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_len = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
int texel_ct = (int)ceilf((float)total_samples / (float)(layer_ct - 1));
r_size[0] = visibility_size * max_ii(1, min_ii(texel_ct, (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;
int texel_len = (int)ceilf((float)total_samples / (float)(layer_len - 1));
r_size[0] = visibility_size * max_ii(1, min_ii(texel_len, (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
r_size[1] = visibility_size * max_ii(1, (texel_len / (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
r_size[2] = layer_len;
}
static struct GPUTexture *create_hammersley_sample_texture(int samples)
@@ -480,8 +480,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_filter_glossy_sh, psl->probe_glossy_compute);
DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1);
DRW_shgroup_uniform_float(grp, "roughnessSquared", &pinfo->roughness, 1);
DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
@@ -501,8 +501,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
#ifdef IRRADIANCE_SH_L2
DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1);
#else
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1);
DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
@@ -521,8 +521,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1);
DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1);
DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->samples_len_inv, 1);
DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1);
DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1);
DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1);
@@ -1100,18 +1100,18 @@ static void glossy_filter_probe(
#if 1 /* Variable Sample count (fast) */
switch (i) {
case 0: pinfo->samples_ct = 1.0f; break;
case 1: pinfo->samples_ct = 16.0f; break;
case 2: pinfo->samples_ct = 32.0f; break;
case 3: pinfo->samples_ct = 64.0f; break;
default: pinfo->samples_ct = 128.0f; break;
case 0: pinfo->samples_len = 1.0f; break;
case 1: pinfo->samples_len = 16.0f; break;
case 2: pinfo->samples_len = 32.0f; break;
case 3: pinfo->samples_len = 64.0f; break;
default: pinfo->samples_len = 128.0f; break;
}
#else /* Constant Sample count (slow) */
pinfo->samples_ct = 1024.0f;
pinfo->samples_len = 1024.0f;
#endif
pinfo->invsamples_ct = 1.0f / pinfo->samples_ct;
pinfo->lodfactor = bias + 0.5f * log((float)(pinfo->target_size * pinfo->target_size) * pinfo->invsamples_ct) / log(2);
pinfo->samples_len_inv = 1.0f / pinfo->samples_len;
pinfo->lodfactor = bias + 0.5f * log((float)(pinfo->target_size * pinfo->target_size) * pinfo->samples_len_inv) / log(2);
GPU_framebuffer_ensure_config(&sldata->probe_filter_fb, {
GPU_ATTACHMENT_NONE,
@@ -1147,10 +1147,10 @@ static void diffuse_filter_probe(
int size[2] = {3, 3};
#elif defined(IRRADIANCE_CUBEMAP)
int size[2] = {8, 8};
pinfo->samples_ct = 1024.0f;
pinfo->samples_len = 1024.0f;
#elif defined(IRRADIANCE_HL2)
int size[2] = {3, 2};
pinfo->samples_ct = 1024.0f;
pinfo->samples_len = 1024.0f;
#endif
int cell_per_row = pool_size[0] / size[0];
@@ -1160,8 +1160,8 @@ static void diffuse_filter_probe(
#ifndef IRRADIANCE_SH_L2
/* Tweaking parameters to balance perf. vs precision */
const float bias = 0.0f;
pinfo->invsamples_ct = 1.0f / pinfo->samples_ct;
pinfo->lodfactor = bias + 0.5f * log((float)(pinfo->target_size * pinfo->target_size) * pinfo->invsamples_ct) / log(2);
pinfo->samples_len_inv = 1.0f / pinfo->samples_len;
pinfo->lodfactor = bias + 0.5f * log((float)(pinfo->target_size * pinfo->target_size) * pinfo->samples_len_inv) / log(2);
pinfo->lod_rt_max = floorf(log2f(pinfo->target_size)) - 2.0f;
#else
pinfo->shres = 32; /* Less texture fetches & reduce branches */
@@ -1188,8 +1188,8 @@ static void diffuse_filter_probe(
/* World irradiance have no visibility */
if (offset > 0) {
/* Compute visibility */
pinfo->samples_ct = 512.0f; /* TODO refine */
pinfo->invsamples_ct = 1.0f / pinfo->samples_ct;
pinfo->samples_len = 512.0f; /* TODO refine */
pinfo->samples_len_inv = 1.0f / pinfo->samples_len;
pinfo->shres = common_data->prb_irradiance_vis_size;
pinfo->visibility_range = vis_range;
pinfo->visibility_blur = vis_blur;

View File

@@ -235,9 +235,9 @@ static GPUShader *eevee_lights_get_store_sh(int shadow_method, bool high_blur, b
return *shader;
}
static DRWPass *eevee_lights_cube_store_pass_get(EEVEE_PassList *psl, EEVEE_ViewLayerData *sldata, int shadow_method, int shadow_samples_ct)
static DRWPass *eevee_lights_cube_store_pass_get(EEVEE_PassList *psl, EEVEE_ViewLayerData *sldata, int shadow_method, int shadow_samples_len)
{
bool high_blur = shadow_samples_ct > 16;
bool high_blur = shadow_samples_len > 16;
DRWPass **pass = (high_blur) ? &psl->shadow_cube_store_pass : &psl->shadow_cube_store_high_pass;
if (*pass == NULL) {
EEVEE_LampsInfo *linfo = sldata->lamps;
@@ -252,9 +252,9 @@ static DRWPass *eevee_lights_cube_store_pass_get(EEVEE_PassList *psl, EEVEE_View
return *pass;
}
static DRWPass *eevee_lights_cascade_store_pass_get(EEVEE_PassList *psl, EEVEE_ViewLayerData *sldata, int shadow_method, int shadow_samples_ct)
static DRWPass *eevee_lights_cascade_store_pass_get(EEVEE_PassList *psl, EEVEE_ViewLayerData *sldata, int shadow_method, int shadow_samples_len)
{
bool high_blur = shadow_samples_ct > 16;
bool high_blur = shadow_samples_len > 16;
DRWPass **pass = (high_blur) ? &psl->shadow_cascade_store_pass : &psl->shadow_cascade_store_high_pass;
if (*pass == NULL) {
EEVEE_LampsInfo *linfo = sldata->lamps;
@@ -280,8 +280,8 @@ void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
linfo->num_light = 0;
linfo->num_cube_layer = 0;
linfo->num_cascade_layer = 0;
linfo->gpu_cube_ct = linfo->gpu_cascade_ct = linfo->gpu_shadow_ct = 0;
linfo->cpu_cube_ct = linfo->cpu_cascade_ct = 0;
linfo->gpu_cube_len = linfo->gpu_cascade_len = linfo->gpu_shadow_len = 0;
linfo->cpu_cube_len = linfo->cpu_cascade_len = 0;
memset(linfo->light_ref, 0, sizeof(linfo->light_ref));
memset(linfo->shadow_cube_ref, 0, sizeof(linfo->shadow_cube_ref));
memset(linfo->shadow_cascade_ref, 0, sizeof(linfo->shadow_cascade_ref));
@@ -361,56 +361,56 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
int sh_nbr = 1; /* TODO : MSM */
int cascade_nbr = la->cascade_count;
if ((linfo->gpu_cascade_ct + sh_nbr) <= MAX_SHADOW_CASCADE) {
if ((linfo->gpu_cascade_len + sh_nbr) <= MAX_SHADOW_CASCADE) {
/* Save Light object. */
linfo->shadow_cascade_ref[linfo->cpu_cascade_ct] = ob;
linfo->shadow_cascade_ref[linfo->cpu_cascade_len] = ob;
/* Store indices. */
EEVEE_ShadowCascadeData *data = &led->data.scad;
data->shadow_id = linfo->gpu_shadow_ct;
data->cascade_id = linfo->gpu_cascade_ct;
data->shadow_id = linfo->gpu_shadow_len;
data->cascade_id = linfo->gpu_cascade_len;
data->layer_id = linfo->num_cascade_layer;
/* Increment indices. */
linfo->gpu_shadow_ct += 1;
linfo->gpu_cascade_ct += sh_nbr;
linfo->gpu_shadow_len += 1;
linfo->gpu_cascade_len += sh_nbr;
linfo->num_cascade_layer += sh_nbr * cascade_nbr;
linfo->cpu_cascade_ct += 1;
linfo->cpu_cascade_len += 1;
}
}
else if (la->type == LA_SPOT || la->type == LA_LOCAL || la->type == LA_AREA) {
int sh_nbr = 1; /* TODO : MSM */
if ((linfo->gpu_cube_ct + sh_nbr) <= MAX_SHADOW_CUBE) {
if ((linfo->gpu_cube_len + sh_nbr) <= MAX_SHADOW_CUBE) {
/* Save Light object. */
linfo->shadow_cube_ref[linfo->cpu_cube_ct] = ob;
linfo->shadow_cube_ref[linfo->cpu_cube_len] = ob;
/* For light update tracking. */
if ((prev_cube_sh_id >= 0) &&
(prev_cube_sh_id < linfo->shcaster_backbuffer->count))
{
linfo->new_shadow_id[prev_cube_sh_id] = linfo->cpu_cube_ct;
linfo->new_shadow_id[prev_cube_sh_id] = linfo->cpu_cube_len;
}
led->prev_cube_shadow_id = linfo->cpu_cube_ct;
led->prev_cube_shadow_id = linfo->cpu_cube_len;
/* Saving lamp bounds for later. */
BLI_assert(linfo->cpu_cube_ct >= 0 && linfo->cpu_cube_ct < MAX_LIGHT);
copy_v3_v3(linfo->shadow_bounds[linfo->cpu_cube_ct].center, ob->obmat[3]);
linfo->shadow_bounds[linfo->cpu_cube_ct].radius = la->clipend;
BLI_assert(linfo->cpu_cube_len >= 0 && linfo->cpu_cube_len < MAX_LIGHT);
copy_v3_v3(linfo->shadow_bounds[linfo->cpu_cube_len].center, ob->obmat[3]);
linfo->shadow_bounds[linfo->cpu_cube_len].radius = la->clipend;
EEVEE_ShadowCubeData *data = &led->data.scd;
/* Store indices. */
data->shadow_id = linfo->gpu_shadow_ct;
data->cube_id = linfo->gpu_cube_ct;
data->shadow_id = linfo->gpu_shadow_len;
data->cube_id = linfo->gpu_cube_len;
data->layer_id = linfo->num_cube_layer;
/* Increment indices. */
linfo->gpu_shadow_ct += 1;
linfo->gpu_cube_ct += sh_nbr;
linfo->gpu_shadow_len += 1;
linfo->gpu_cube_len += sh_nbr;
linfo->num_cube_layer += sh_nbr;
linfo->cpu_cube_ct += 1;
linfo->cpu_cube_len += 1;
}
}
}
@@ -993,7 +993,7 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata)
for (i = 0; i < frontbuffer->count; i++, flag++, shcaster++) {
/* Run intersection checks to fill the bitfields. */
bsphere = linfo->shadow_bounds;
for (int j = 0; j < linfo->cpu_cube_ct; j++, bsphere++) {
for (int j = 0; j < linfo->cpu_cube_len; j++, bsphere++) {
bool iter = sphere_bbox_intersect(bsphere, &shcaster->bbox);
lightbits_set_single(&shcaster->bits, j, iter);
}
@@ -1139,19 +1139,19 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl)
filter_pixel_size = max_ff(0.0f, filter_pixel_size - 3.0f);
/* Compute number of concentric samples. Depends directly on filter size. */
float pix_size_sqr = filter_pixel_size * filter_pixel_size;
srd->shadow_samples_ct = min_ii(max_sample, 4 + 8 * (int)filter_pixel_size + 4 * (int)(pix_size_sqr));
srd->shadow_samples_len = min_ii(max_sample, 4 + 8 * (int)filter_pixel_size + 4 * (int)(pix_size_sqr));
}
else {
linfo->filter_size = 0.0f;
srd->shadow_samples_ct = 4;
srd->shadow_samples_len = 4;
}
srd->shadow_inv_samples_ct = 1.0f / (float)srd->shadow_samples_ct;
srd->shadow_samples_len_inv = 1.0f / (float)srd->shadow_samples_len;
DRW_uniformbuffer_update(sldata->shadow_render_ubo, srd);
GPU_framebuffer_texture_layer_attach(sldata->shadow_cube_store_fb, sldata->shadow_cube_pool, 0, evscd->layer_id, 0);
GPU_framebuffer_bind(sldata->shadow_cube_store_fb);
DRWPass *store_pass = eevee_lights_cube_store_pass_get(psl, sldata, linfo->shadow_method, srd->shadow_samples_ct);
DRWPass *store_pass = eevee_lights_cube_store_pass_get(psl, sldata, linfo->shadow_method, srd->shadow_samples_len);
DRW_draw_pass(store_pass);
led->need_update = false;
@@ -1240,20 +1240,20 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl)
filter_pixel_size = max_ff(0.0f, filter_pixel_size - 3.0f);
/* Compute number of concentric samples. Depends directly on filter size. */
float pix_size_sqr = filter_pixel_size * filter_pixel_size;
srd->shadow_samples_ct = min_ii(max_sample, 4 + 8 * (int)filter_pixel_size + 4 * (int)(pix_size_sqr));
srd->shadow_samples_len = min_ii(max_sample, 4 + 8 * (int)filter_pixel_size + 4 * (int)(pix_size_sqr));
}
else {
linfo->filter_size = 0.0f;
srd->shadow_samples_ct = 4;
srd->shadow_samples_len = 4;
}
srd->shadow_inv_samples_ct = 1.0f / (float)srd->shadow_samples_ct;
srd->shadow_samples_len_inv = 1.0f / (float)srd->shadow_samples_len;
DRW_uniformbuffer_update(sldata->shadow_render_ubo, &linfo->shadow_render_data);
int layer = evscd->layer_id + linfo->current_shadow_cascade;
GPU_framebuffer_texture_layer_attach(sldata->shadow_cascade_store_fb, sldata->shadow_cascade_pool, 0, layer, 0);
GPU_framebuffer_bind(sldata->shadow_cascade_store_fb);
DRWPass *store_pass = eevee_lights_cascade_store_pass_get(psl, sldata, linfo->shadow_method, srd->shadow_samples_ct);
DRWPass *store_pass = eevee_lights_cascade_store_pass_get(psl, sldata, linfo->shadow_method, srd->shadow_samples_len);
DRW_draw_pass(store_pass);
}
}

View File

@@ -115,8 +115,8 @@ static struct GPUTexture *create_ggx_lut_texture(int UNUSED(w), int UNUSED(h))
{
struct GPUTexture *tex;
struct GPUFrameBuffer *fb = NULL;
static float samples_ct = 8192.0f;
static float inv_samples_ct = 1.0f / 8192.0f;
static float samples_len = 8192.0f;
static float inv_samples_len = 1.0f / 8192.0f;
char *lib_str = BLI_string_joinN(
datatoc_bsdf_common_lib_glsl,
@@ -130,8 +130,8 @@ static struct GPUTexture *create_ggx_lut_texture(int UNUSED(w), int UNUSED(h))
DRWPass *pass = DRW_pass_create("LightProbe Filtering", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_float(grp, "sampleCount", &samples_ct, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &inv_samples_ct, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &samples_len, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &inv_samples_len, 1);
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter);
@@ -172,9 +172,9 @@ static struct GPUTexture *create_ggx_refraction_lut_texture(int w, int h)
struct GPUTexture *tex;
struct GPUTexture *hammersley = create_hammersley_sample_texture(8192);
struct GPUFrameBuffer *fb = NULL;
static float samples_ct = 8192.0f;
static float samples_len = 8192.0f;
static float a2 = 0.0f;
static float inv_samples_ct = 1.0f / 8192.0f;
static float inv_samples_len = 1.0f / 8192.0f;
char *frag_str = BLI_string_joinN(
datatoc_bsdf_common_lib_glsl,
@@ -192,8 +192,8 @@ static struct GPUTexture *create_ggx_refraction_lut_texture(int w, int h)
DRWPass *pass = DRW_pass_create("LightProbe Filtering", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_float(grp, "a2", &a2, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &samples_ct, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &inv_samples_ct, 1);
DRW_shgroup_uniform_float(grp, "sampleCount", &samples_len, 1);
DRW_shgroup_uniform_float(grp, "invSampleCount", &inv_samples_len, 1);
DRW_shgroup_uniform_texture(grp, "texHammersley", hammersley);
DRW_shgroup_uniform_texture(grp, "utilTex", e_data.util_tex);

View File

@@ -325,8 +325,8 @@ typedef struct EEVEE_ShadowRender {
float stored_texel_size;
float clip_near;
float clip_far;
int shadow_samples_ct;
float shadow_inv_samples_ct;
int shadow_samples_len;
float shadow_samples_len_inv;
} EEVEE_ShadowRender;
/* This is just a really long bitflag with special function to access it. */
@@ -352,8 +352,8 @@ typedef struct EEVEE_LampsInfo {
int num_light, cache_num_light;
int num_cube_layer, cache_num_cube_layer;
int num_cascade_layer, cache_num_cascade_layer;
int gpu_cube_ct, gpu_cascade_ct, gpu_shadow_ct;
int cpu_cube_ct, cpu_cascade_ct;
int gpu_cube_len, gpu_cascade_len, gpu_shadow_len;
int cpu_cube_len, cpu_cascade_len;
int update_flag;
int shadow_cube_size, shadow_cascade_size, shadow_method;
bool shadow_high_bitdepth;
@@ -452,8 +452,8 @@ typedef struct EEVEE_LightProbesInfo {
int layer;
float texel_size;
float padding_size;
float samples_ct;
float invsamples_ct;
float samples_len;
float samples_len_inv;
float near_clip;
float far_clip;
float roughness;
@@ -563,7 +563,7 @@ typedef struct EEVEE_EffectsInfo {
/* Other */
float prev_persmat[4][4];
/* Bloom */
int bloom_iteration_ct;
int bloom_iteration_len;
float source_texel_size[2];
float blit_texel_size[2];
float downsamp_texel_size[MAX_BLOOM_STEP][2];

View File

@@ -346,7 +346,7 @@ void DRW_shgroup_free(struct DRWShadingGroup *shgroup);
void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, float (*obmat)[4]);
void DRW_shgroup_call_range_add(
DRWShadingGroup *shgroup, struct Gwn_Batch *geom, float (*obmat)[4], uint v_sta, uint v_count);
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4]);
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_len, float (*obmat)[4]);
void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4]);
void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, uint tria_count, float (*obmat)[4]);
void DRW_shgroup_call_object_procedural_triangles_culled_add(DRWShadingGroup *shgroup, uint tria_count, struct Object *ob);
@@ -496,7 +496,7 @@ void DRW_state_lock(DRWState state);
void DRW_state_invert_facing(void);
void DRW_state_clip_planes_count_set(uint plane_ct);
void DRW_state_clip_planes_count_set(uint plane_len);
void DRW_state_clip_planes_reset(void);
/* Culling, return true if object is inside view frustum. */

View File

@@ -2349,26 +2349,26 @@ Gwn_Batch *DRW_cache_bone_arrows_get(void)
a = axis + 0.31f;
/* Axis name */
int axis_v_ct;
int axis_v_len;
float (*axis_verts)[2];
if (axis == 0) {
axis_verts = x_axis_name;
axis_v_ct = X_LEN;
axis_v_len = X_LEN;
}
else if (axis == 1) {
axis_verts = y_axis_name;
axis_v_ct = Y_LEN;
axis_v_len = Y_LEN;
}
else {
axis_verts = z_axis_name;
axis_v_ct = Z_LEN;
axis_v_len = Z_LEN;
}
/* Axis name shadows */
copy_v3_fl(c, 0.0f);
c[axis] = 0.3f;
for (int j = 0; j < SHADOW_RES; ++j) {
for (int i = 0; i < axis_v_ct; ++i) {
for (int i = 0; i < axis_v_len; ++i) {
float tmp[2];
add_v2_v2v2(tmp, axis_verts[i], axis_name_shadow[j]);
set_bone_axis_vert(vbo, attr_id.axis, attr_id.pos, attr_id.col,
@@ -2379,7 +2379,7 @@ Gwn_Batch *DRW_cache_bone_arrows_get(void)
/* Axis name */
copy_v3_fl(c, 0.1f);
c[axis] = 1.0f;
for (int i = 0; i < axis_v_ct; ++i) {
for (int i = 0; i < axis_v_len; ++i) {
set_bone_axis_vert(vbo, attr_id.axis, attr_id.pos, attr_id.col,
&v, &a, axis_verts[i], c);
}
@@ -3125,8 +3125,8 @@ Gwn_Batch *DRW_cache_cursor_get(bool crosshair_lines)
const float f20 = 1.0f;
const int segments = 16;
const int vert_ct = segments + 8;
const int index_ct = vert_ct + 5;
const int vert_len = segments + 8;
const int index_len = vert_len + 5;
uchar red[3] = {255, 0, 0};
uchar white[3] = {255, 255, 255};
@@ -3139,10 +3139,10 @@ Gwn_Batch *DRW_cache_cursor_get(bool crosshair_lines)
}
Gwn_IndexBufBuilder elb;
GWN_indexbuf_init_ex(&elb, GWN_PRIM_LINE_STRIP, index_ct, vert_ct, true);
GWN_indexbuf_init_ex(&elb, GWN_PRIM_LINE_STRIP, index_len, vert_len, true);
Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
GWN_vertbuf_data_alloc(vbo, vert_ct);
GWN_vertbuf_data_alloc(vbo, vert_len);
int v = 0;
for (int i = 0; i < segments; ++i) {

View File

@@ -1634,7 +1634,7 @@ typedef struct MeshBatchCache {
* set srgb conversion for auto attribs.*/
char *auto_layer_names;
int *auto_layer_is_srgb;
int auto_layer_ct;
int auto_layer_len;
/* settings to determine if cache is invalid */
bool is_maybe_dirty;
@@ -1947,22 +1947,22 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata,
uint auto_names_len = 0;
uint auto_ofs = 0;
uint auto_id = 0;
cache->auto_layer_ct = 0;
cache->auto_layer_len = 0;
for (uint i = 0; i < uv_len; i++) {
const char *attrib_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i);
auto_names_len += strlen(attrib_name) + 2; /* include null terminator and b prefix. */
cache->auto_layer_ct++;
cache->auto_layer_len++;
}
for (uint i = 0; i < vcol_len; i++) {
if (rdata->cd.layers.auto_vcol[i]) {
const char *attrib_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i);
auto_names_len += strlen(attrib_name) + 2; /* include null terminator and b prefix. */
cache->auto_layer_ct++;
cache->auto_layer_len++;
}
}
auto_names_len += 1; /* add an ultimate '\0' terminator */
cache->auto_layer_names = MEM_callocN(auto_names_len * sizeof(char), "Auto layer name buf");
cache->auto_layer_is_srgb = MEM_mallocN(cache->auto_layer_ct * sizeof(int), "Auto layer value buf");
cache->auto_layer_is_srgb = MEM_mallocN(cache->auto_layer_len * sizeof(int), "Auto layer value buf");
for (uint i = 0; i < uv_len; i++) {
/* UV */
@@ -4330,7 +4330,7 @@ Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded(
if (auto_layer_names) {
*auto_layer_names = cache->auto_layer_names;
*auto_layer_is_srgb = cache->auto_layer_is_srgb;
*auto_layer_count = cache->auto_layer_ct;
*auto_layer_count = cache->auto_layer_len;
}
return cache->shaded_triangles;

View File

@@ -66,8 +66,8 @@ static void particle_batch_cache_clear(ParticleSystem *psys);
typedef struct ParticlePointCache {
Gwn_VertBuf *pos;
Gwn_Batch *points;
int elems_count;
int point_count;
int elems_len;
int point_len;
} ParticlePointCache;
typedef struct ParticleBatchCache {
@@ -82,11 +82,11 @@ typedef struct ParticleBatchCache {
Gwn_VertBuf *edit_inner_pos;
Gwn_Batch *edit_inner_points;
int edit_inner_point_count;
int edit_inner_point_len;
Gwn_VertBuf *edit_tip_pos;
Gwn_Batch *edit_tip_points;
int edit_tip_point_count;
int edit_tip_point_len;
/* Settings to determine if cache is invalid. */
bool is_dirty;
@@ -225,9 +225,9 @@ static void count_cache_segment_keys(
for (int i = 0; i < num_path_cache_keys; i++) {
ParticleCacheKey *path = pathcache[i];
if (path->segments > 0) {
hair_cache->strands_count++;
hair_cache->elems_count += path->segments + 2;
hair_cache->point_count += path->segments + 1;
hair_cache->strands_len++;
hair_cache->elems_len += path->segments + 2;
hair_cache->point_len += path->segments + 1;
}
}
}
@@ -243,9 +243,9 @@ static void ensure_seg_pt_count(
return;
}
hair_cache->strands_count = 0;
hair_cache->elems_count = 0;
hair_cache->point_count = 0;
hair_cache->strands_len = 0;
hair_cache->elems_len = 0;
hair_cache->point_len = 0;
if (edit != NULL && edit->pathcache != NULL) {
count_cache_segment_keys(edit->pathcache, edit->totcached, hair_cache);
@@ -761,7 +761,7 @@ static void particle_batch_cache_ensure_procedural_final_points(
/* Create a destination buffer for the tranform feedback. Sized appropriately */
/* Thoses are points! not line segments. */
GWN_vertbuf_data_alloc(cache->final[subdiv].proc_buf, cache->final[subdiv].strands_res * cache->strands_count);
GWN_vertbuf_data_alloc(cache->final[subdiv].proc_buf, cache->final[subdiv].strands_res * cache->strands_len);
/* Create vbo immediatly to bind to texture buffer. */
GWN_vertbuf_use(cache->final[subdiv].proc_buf);
@@ -814,13 +814,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(
/* Strand Data */
cache->proc_strand_buf = GWN_vertbuf_create_with_format(&format_data);
GWN_vertbuf_data_alloc(cache->proc_strand_buf, cache->strands_count);
GWN_vertbuf_data_alloc(cache->proc_strand_buf, cache->strands_len);
GWN_vertbuf_attr_get_raw_data(cache->proc_strand_buf, data_id, &data_step);
/* UV layers */
for (int i = 0; i < cache->num_uv_layers; i++) {
cache->proc_uv_buf[i] = GWN_vertbuf_create_with_format(&format_uv);
GWN_vertbuf_data_alloc(cache->proc_uv_buf[i], cache->strands_count);
GWN_vertbuf_data_alloc(cache->proc_uv_buf[i], cache->strands_len);
GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]);
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i);
@@ -836,7 +836,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(
/* Vertex colors */
for (int i = 0; i < cache->num_col_layers; i++) {
cache->proc_col_buf[i] = GWN_vertbuf_create_with_format(&format_col);
GWN_vertbuf_data_alloc(cache->proc_col_buf[i], cache->strands_count);
GWN_vertbuf_data_alloc(cache->proc_col_buf[i], cache->strands_len);
GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]);
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i);
@@ -942,7 +942,7 @@ static void particle_batch_cache_ensure_procedural_indices(
int verts_per_hair = cache->final[subdiv].strands_res * thickness_res;
/* +1 for primitive restart */
int element_count = (verts_per_hair + 1) * cache->strands_count;
int element_count = (verts_per_hair + 1) * cache->strands_len;
Gwn_PrimType prim_type = (thickness_res == 1) ? GWN_PRIM_LINE_STRIP : GWN_PRIM_TRI_STRIP;
static Gwn_VertFormat format = { 0 };
@@ -997,7 +997,7 @@ static void particle_batch_cache_ensure_procedural_pos(
uint pos_id = GWN_vertformat_attr_add(&format, "posTime", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
cache->proc_point_buf = GWN_vertbuf_create_with_format(&format);
GWN_vertbuf_data_alloc(cache->proc_point_buf, cache->point_count);
GWN_vertbuf_data_alloc(cache->proc_point_buf, cache->point_len);
Gwn_VertBufRaw pos_step;
GWN_vertbuf_attr_get_raw_data(cache->proc_point_buf, pos_id, &pos_step);
@@ -1109,13 +1109,13 @@ static void particle_batch_cache_ensure_pos_and_seg(
}
hair_cache->pos = GWN_vertbuf_create_with_format(&format);
GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count);
GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_len);
Gwn_IndexBufBuilder elb;
GWN_indexbuf_init_ex(
&elb,
GWN_PRIM_LINE_STRIP,
hair_cache->elems_count, hair_cache->point_count,
hair_cache->elems_len, hair_cache->point_len,
true);
if (num_uv_layers || num_col_layers) {
@@ -1392,11 +1392,11 @@ static void ensure_edit_inner_points_count(
if (cache->edit_inner_pos != NULL) {
return;
}
cache->edit_inner_point_count = 0;
cache->edit_inner_point_len = 0;
for (int point_index = 0; point_index < edit->totpoint; point_index++) {
const PTCacheEditPoint *point = &edit->points[point_index];
BLI_assert(point->totkey >= 1);
cache->edit_inner_point_count += (point->totkey - 1);
cache->edit_inner_point_len += (point->totkey - 1);
}
}
@@ -1431,7 +1431,7 @@ static void particle_batch_cache_ensure_edit_inner_pos(
}
cache->edit_inner_pos = GWN_vertbuf_create_with_format(&format);
GWN_vertbuf_data_alloc(cache->edit_inner_pos, cache->edit_inner_point_count);
GWN_vertbuf_data_alloc(cache->edit_inner_pos, cache->edit_inner_point_len);
float selected_color[4], normal_color[4];
edit_colors_get(edit, selected_color, normal_color);
@@ -1479,7 +1479,7 @@ static void ensure_edit_tip_points_count(
if (cache->edit_tip_pos != NULL) {
return;
}
cache->edit_tip_point_count = edit->totpoint;
cache->edit_tip_point_len = edit->totpoint;
}
static void particle_batch_cache_ensure_edit_tip_pos(
@@ -1502,7 +1502,7 @@ static void particle_batch_cache_ensure_edit_tip_pos(
}
cache->edit_tip_pos = GWN_vertbuf_create_with_format(&format);
GWN_vertbuf_data_alloc(cache->edit_tip_pos, cache->edit_tip_point_count);
GWN_vertbuf_data_alloc(cache->edit_tip_pos, cache->edit_tip_point_len);
float selected_color[4], normal_color[4];
edit_colors_get(edit, selected_color, normal_color);

View File

@@ -137,14 +137,14 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(
/* Transform Feedback subdiv. */
if (need_ft_update) {
int final_points_ct = hair_cache->final[subdiv].strands_res * hair_cache->strands_count;
int final_points_len = hair_cache->final[subdiv].strands_res * hair_cache->strands_len;
GPUShader *tf_shader = hair_refine_shader_get(PART_REFINE_CATMULL_ROM);
DRWShadingGroup *tf_shgrp = DRW_shgroup_transform_feedback_create(tf_shader, g_tf_pass,
hair_cache->final[subdiv].proc_buf);
DRW_shgroup_uniform_texture(tf_shgrp, "hairPointBuffer", hair_cache->point_tex);
DRW_shgroup_uniform_texture(tf_shgrp, "hairStrandBuffer", hair_cache->strand_tex);
DRW_shgroup_uniform_int(tf_shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1);
DRW_shgroup_call_procedural_points_add(tf_shgrp, final_points_ct, NULL);
DRW_shgroup_call_procedural_points_add(tf_shgrp, final_points_len, NULL);
}
return shgrp;

View File

@@ -76,9 +76,9 @@ typedef struct ParticleHairCache {
ParticleHairFinalCache final[MAX_HAIR_SUBDIV];
int strands_count;
int elems_count;
int point_count;
int strands_len;
int elems_len;
int point_len;
} ParticleHairCache;
bool particles_ensure_procedural_data(

View File

@@ -213,10 +213,10 @@ void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist)
for (int i = 0; i < batching->alloc_size; i++, bbuf++) {
if (bbuf->shgroup != NULL) {
realloc_size = i + 1;
uint vert_ct = DRW_shgroup_get_instance_count(bbuf->shgroup);
vert_ct += (vert_ct == 0) ? 1 : 0; /* Do not realloc to 0 size buffer */
if (vert_ct + BUFFER_VERTS_CHUNK <= bbuf->vert->vertex_ct) {
uint size = vert_ct + BUFFER_VERTS_CHUNK - 1;
uint vert_len = DRW_shgroup_get_instance_count(bbuf->shgroup);
vert_len += (vert_len == 0) ? 1 : 0; /* Do not realloc to 0 size buffer */
if (vert_len + BUFFER_VERTS_CHUNK <= bbuf->vert->vertex_ct) {
uint size = vert_len + BUFFER_VERTS_CHUNK - 1;
size = size - size % BUFFER_VERTS_CHUNK;
GWN_vertbuf_data_resize(bbuf->vert, size);
}
@@ -245,10 +245,10 @@ void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist)
for (int i = 0; i < instancing->alloc_size; i++, ibuf++) {
if (ibuf->shgroup != NULL) {
realloc_size = i + 1;
uint vert_ct = DRW_shgroup_get_instance_count(ibuf->shgroup);
vert_ct += (vert_ct == 0) ? 1 : 0; /* Do not realloc to 0 size buffer */
if (vert_ct + BUFFER_VERTS_CHUNK <= ibuf->vert->vertex_ct) {
uint size = vert_ct + BUFFER_VERTS_CHUNK - 1;
uint vert_len = DRW_shgroup_get_instance_count(ibuf->shgroup);
vert_len += (vert_len == 0) ? 1 : 0; /* Do not realloc to 0 size buffer */
if (vert_len + BUFFER_VERTS_CHUNK <= ibuf->vert->vertex_ct) {
uint size = vert_len + BUFFER_VERTS_CHUNK - 1;
size = size - size % BUFFER_VERTS_CHUNK;
GWN_vertbuf_data_resize(ibuf->vert, size);
}

View File

@@ -412,9 +412,9 @@ static void drw_shgroup_call_procedural_add_ex(
BLI_LINKS_APPEND(&shgroup->calls, call);
}
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4])
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_len, float (*obmat)[4])
{
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat, NULL);
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_len, obmat, NULL);
}
void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4])

View File

@@ -419,10 +419,10 @@ void DRW_state_invert_facing(void)
* and if the shaders have support for it (see usage of gl_ClipDistance).
* Be sure to call DRW_state_clip_planes_reset() after you finish drawing.
**/
void DRW_state_clip_planes_count_set(uint plane_ct)
void DRW_state_clip_planes_count_set(uint plane_len)
{
BLI_assert(plane_ct <= MAX_CLIP_PLANES);
DST.num_clip_planes = plane_ct;
BLI_assert(plane_len <= MAX_CLIP_PLANES);
DST.num_clip_planes = plane_len;
}
void DRW_state_clip_planes_reset(void)

View File

@@ -79,7 +79,7 @@ void DRW_draw_region_info(void)
/* ************************* Grid ************************** */
static void gridline_range(double x0, double dx, double max, int *r_first, int *r_count)
static void gridline_range(double x0, double dx, double max, int *r_first, int *r_len)
{
/* determine range of gridlines that appear in this Area -- similar calc but separate ranges for x & y
* x0 is gridline 0, the axis in screen space
@@ -90,11 +90,11 @@ static void gridline_range(double x0, double dx, double max, int *r_first, int *
if (first <= last) {
*r_first = first;
*r_count = last - first + 1;
*r_len = last - first + 1;
}
else {
*r_first = 0;
*r_count = 0;
*r_len = 0;
}
}
@@ -104,14 +104,14 @@ static int gridline_count(ARegion *ar, double x0, double y0, double dx)
* dx is the frequency, shared by x & y directions
* pass in dx of smallest (highest precision) grid we want to draw */
int first, x_ct, y_ct;
int first, x_len, y_len;
gridline_range(x0, dx, ar->winx, &first, &x_ct);
gridline_range(y0, dx, ar->winy, &first, &y_ct);
gridline_range(x0, dx, ar->winx, &first, &x_len);
gridline_range(y0, dx, ar->winy, &first, &y_len);
int total_ct = x_ct + y_ct;
int total_len = x_len + y_len;
return total_ct;
return total_len;
}
static bool drawgrid_draw(
@@ -129,7 +129,7 @@ static bool drawgrid_draw(
const float y_max = (float)ar->winy;
int first, ct;
int x_ct = 0, y_ct = 0; /* count of lines actually drawn */
int x_len = 0, y_len = 0; /* count of lines actually drawn */
int lines_skipped_for_next_unit = 0;
/* draw vertical lines */
@@ -143,13 +143,13 @@ static bool drawgrid_draw(
continue;
}
if (x_ct == 0)
if (x_len == 0)
immAttrib3ub(col, col_value[0], col_value[1], col_value[2]);
float x = (float)(x0 + i * dx);
immVertex2f(pos, x, 0.0f);
immVertex2f(pos, x, y_max);
++x_ct;
++x_len;
}
/* draw horizontal lines */
@@ -163,13 +163,13 @@ static bool drawgrid_draw(
continue;
}
if (x_ct + y_ct == 0)
if (x_len + y_len == 0)
immAttrib3ub(col, col_value[0], col_value[1], col_value[2]);
float y = (float)(y0 + i * dx);
immVertex2f(pos, 0.0f, y);
immVertex2f(pos, x_max, y);
++y_ct;
++y_len;
}
return lines_skipped_for_next_unit > 0;
@@ -249,11 +249,11 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
*grid_unit = bUnit_GetNameDisplay(usys, i);
rv3d->gridview = (float)((scalar * (double)v3d->grid) / (double)unit->scale_length);
int gridline_ct = gridline_count(ar, x, y, dx_scalar);
if (gridline_ct == 0)
int gridline_len = gridline_count(ar, x, y, dx_scalar);
if (gridline_len == 0)
goto drawgrid_cleanup; /* nothing to draw */
immBegin(GWN_PRIM_LINES, gridline_ct * 2);
immBegin(GWN_PRIM_LINES, gridline_len * 2);
}
float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar);
@@ -302,11 +302,11 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
int gridline_ct = gridline_count(ar, x, y, dx);
if (gridline_ct == 0)
int gridline_len = gridline_count(ar, x, y, dx);
if (gridline_len == 0)
goto drawgrid_cleanup; /* nothing to draw */
immBegin(GWN_PRIM_LINES, gridline_ct * 2);
immBegin(GWN_PRIM_LINES, gridline_len * 2);
if (grids_to_draw == 2) {
UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2);
@@ -376,7 +376,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
UI_GetThemeColor3ubv(TH_GRID, col_grid);
if (show_floor) {
const uint vertex_ct = 2 * (gridlines * 4 + 2);
const uint vertex_len = 2 * (gridlines * 4 + 2);
const int sublines = v3d->gridsubdiv;
uchar col_bg[3], col_grid_emphasise[3], col_grid_light[3];
@@ -387,7 +387,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
immBegin(GWN_PRIM_LINES, vertex_ct);
immBegin(GWN_PRIM_LINES, vertex_len);
/* draw normal grid lines */
UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);