diff options
Diffstat (limited to 'source/blender/draw')
31 files changed, 344 insertions, 332 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_bloom.c b/source/blender/draw/engines/eevee/eevee_bloom.c index 8be9c637fbc..2ec6f841409 100644 --- a/source/blender/draw/engines/eevee/eevee_bloom.c +++ b/source/blender/draw/engines/eevee/eevee_bloom.c @@ -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; diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 60c6175f4fa..b9f7624552c 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -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); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 6d68e609f03..adbe165354a 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -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; diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 54bf59234b3..1cb9a957211 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -364,8 +364,8 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, 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); @@ -385,8 +385,8 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, #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); @@ -405,8 +405,8 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, 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); @@ -1111,18 +1111,18 @@ void EEVEE_lightbake_filter_glossy( #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)(target_size * target_size) * pinfo->invsamples_ct) / log(2); + pinfo->samples_len_inv = 1.0f / pinfo->samples_len; + pinfo->lodfactor = bias + 0.5f * log((float)(target_size * target_size) * pinfo->samples_len_inv) / log(2); GPU_framebuffer_ensure_config(&fb, { GPU_ATTACHMENT_NONE, @@ -1157,10 +1157,10 @@ void EEVEE_lightbake_filter_diffuse( 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 = GPU_texture_width(light_cache->grid_tx.tex) / size[0]; @@ -1170,8 +1170,8 @@ void EEVEE_lightbake_filter_diffuse( #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)(target_size * target_size) * pinfo->invsamples_ct) / log(2); + pinfo->samples_len_inv = 1.0f / pinfo->samples_len; + pinfo->lodfactor = bias + 0.5f * log((float)(target_size * target_size) * pinfo->samples_len_inv) / log(2); pinfo->lod_rt_max = floorf(log2f(target_size)) - 2.0f; #else pinfo->shres = 32; /* Less texture fetches & reduce branches */ @@ -1207,8 +1207,8 @@ void EEVEE_lightbake_filter_visibility( EEVEE_LightProbesInfo *pinfo = sldata->probes; LightCache *light_cache = vedata->stl->g_data->light_cache; - 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 = vis_size; pinfo->visibility_range = vis_range; pinfo->visibility_blur = vis_blur; diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index 1e11f224231..0f0d9d281c9 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -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)); @@ -334,7 +334,7 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob) /* Step 1 find all lamps in the scene and setup them */ if (linfo->num_light >= MAX_LIGHT) { - printf("Too many lamps in the scene !!!\n"); + printf("Too many lights in the scene !!!\n"); } else { Lamp *la = (Lamp *)ob->data; @@ -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); } } diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 4c403b93f3e..2e568d97c07 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -57,9 +57,9 @@ void EEVEE_lookdev_cache_init( EEVEE_TextureList *txl = vedata->txl; const DRWContextState *draw_ctx = DRW_context_state_get(); View3D *v3d = draw_ctx->v3d; - if (LOOK_DEV_MODE_ENABLED(v3d)) { - StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_INTERNAL | STUDIOLIGHT_ORIENTATION_WORLD); - if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { + if (LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)) { + StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE); + if (sl && (sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); GPUTexture *tex = NULL; diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index fba377cbcaf..20d755d2245 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -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); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index c9149d3bcf8..e2a875dca1f 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -98,7 +98,8 @@ extern struct DrawEngineType draw_engine_eevee_type; #define OVERLAY_ENABLED(v3d) ((v3d) && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) #define LOOK_DEV_MODE_ENABLED(v3d) ((v3d) && (v3d->drawtype == OB_MATERIAL)) #define LOOK_DEV_OVERLAY_ENABLED(v3d) (LOOK_DEV_MODE_ENABLED(v3d) && OVERLAY_ENABLED(v3d) && (v3d->overlay.flag & V3D_OVERLAY_LOOK_DEV)) -#define USE_SCENE_LIGHT(v3d) ((!v3d) || (!LOOK_DEV_MODE_ENABLED(v3d)) || ((LOOK_DEV_MODE_ENABLED(v3d) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHT)))) +#define USE_SCENE_LIGHT(v3d) ((!v3d) || (!LOOK_DEV_MODE_ENABLED(v3d)) || ((LOOK_DEV_MODE_ENABLED(v3d) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS)))) +#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d) (LOOK_DEV_MODE_ENABLED(v3d) && !(v3d->shading.flag & V3D_SHADING_SCENE_WORLD)) #define OCTAHEDRAL_SIZE_FROM_CUBESIZE(cube_size) ((int)ceilf(sqrtf((cube_size * cube_size) * 6.0f))) #define MIN_CUBE_LOD_LEVEL 3 @@ -359,14 +360,14 @@ 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. */ #define MAX_LIGHTBITS_FIELDS (MAX_LIGHT / 8) typedef struct EEVEE_LightBits { - unsigned char fields[MAX_LIGHTBITS_FIELDS]; + uchar fields[MAX_LIGHTBITS_FIELDS]; } EEVEE_LightBits; typedef struct EEVEE_ShadowCaster { @@ -386,8 +387,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; @@ -451,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; @@ -558,7 +559,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]; diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl index 948392bd8ee..d8c8f22ed1c 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl @@ -6,24 +6,24 @@ #ifdef DOUBLE_MANIFOLD # ifdef USE_INVOC_EXT -# define invoc_ct 2 +# define invoc_len 2 # else -# define vert_ct 6 +# define vert_len 6 # endif #else # ifdef USE_INVOC_EXT -# define invoc_ct 2 +# define invoc_len 2 # else -# define vert_ct 6 +# define vert_len 6 # endif #endif #ifdef USE_INVOC_EXT -layout(triangles, invocations = invoc_ct) in; +layout(triangles, invocations = invoc_len) in; layout(triangle_strip, max_vertices = 3) out; #else layout(triangles) in; -layout(triangle_strip, max_vertices = vert_ct) out; +layout(triangle_strip, max_vertices = vert_len) out; #endif uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57); diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl index 5a31aa34932..7418f86a58e 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl @@ -6,24 +6,24 @@ #ifdef DOUBLE_MANIFOLD # ifdef USE_INVOC_EXT -# define invoc_ct 2 +# define invoc_len 2 # else -# define vert_ct 8 +# define vert_len 8 # endif #else # ifdef USE_INVOC_EXT -# define invoc_ct 1 +# define invoc_len 1 # else -# define vert_ct 4 +# define vert_len 4 # endif #endif #ifdef USE_INVOC_EXT -layout(lines_adjacency, invocations = invoc_ct) in; +layout(lines_adjacency, invocations = invoc_len) in; layout(triangle_strip, max_vertices = 4) out; #else layout(lines_adjacency) in; -layout(triangle_strip, max_vertices = vert_ct) out; +layout(triangle_strip, max_vertices = vert_len) out; #endif uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index f420a4a24b3..4d1b8269494 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -347,9 +347,9 @@ 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, unsigned int point_count, float (*obmat)[4]); -void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, unsigned int line_count, float (*obmat)[4]); -void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, unsigned int tria_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); void DRW_shgroup_call_object_add_ex(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, struct Object *ob, bool bypass_culling); #define DRW_shgroup_call_object_add(shgroup, geom, ob) DRW_shgroup_call_object_add_ex(shgroup, geom, ob, false) @@ -513,7 +513,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. */ diff --git a/source/blender/draw/intern/draw_anim_viz.c b/source/blender/draw/intern/draw_anim_viz.c index 42c36ab3662..e634710980a 100644 --- a/source/blender/draw/intern/draw_anim_viz.c +++ b/source/blender/draw/intern/draw_anim_viz.c @@ -149,12 +149,12 @@ static void MPATH_cache_init(void *vedata) MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl; { - DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS; + DRWState state = DRW_STATE_WRITE_COLOR; psl->lines = DRW_pass_create("Motionpath Line Pass", state); } { - DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_POINT; + DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_POINT; psl->points = DRW_pass_create("Motionpath Point Pass", state); } } @@ -256,7 +256,7 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl, bool show_kf_no = (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) != 0; if ((avs->path_viewflag & (MOTIONPATH_VIEW_FNUMS)) || (show_kf_no && show_keyframes)) { int i; - unsigned char col[4], col_kf[4]; + uchar col[4], col_kf[4]; UI_GetThemeColor3ubv(TH_TEXT_HI, col); UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col_kf); col[3] = col_kf[3] = 255; diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 3faf8a352b2..9bc8b70b67c 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -514,7 +514,7 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan) } /* This function is for brightening/darkening a given color (like UI_GetThemeColorShade3ubv()) */ -static void cp_shade_color3ub(unsigned char cp[3], const int offset) +static void cp_shade_color3ub(uchar cp[3], const int offset) { int r, g, b; @@ -549,7 +549,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const case PCHAN_COLOR_NORMAL: { if (bcolor) { - unsigned char cp[4] = {255}; + uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { copy_v3_v3_char((char *)cp, bcolor->active); @@ -591,7 +591,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const if (bcolor) { float solid_bcolor[3]; - rgb_uchar_to_float(solid_bcolor, (unsigned char *)bcolor->solid); + rgb_uchar_to_float(solid_bcolor, (uchar *)bcolor->solid); interp_v3_v3v3(fcolor, fcolor, solid_bcolor, 1.0f); } @@ -600,7 +600,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const case PCHAN_COLOR_CONSTS: { if ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) { - unsigned char cp[4]; + uchar cp[4]; if (constflag & PCHAN_HAS_TARGET) rgba_char_args_set((char *)cp, 255, 150, 0, 80); else if (constflag & PCHAN_HAS_IK) rgba_char_args_set((char *)cp, 255, 255, 0, 80); else if (constflag & PCHAN_HAS_SPLINEIK) rgba_char_args_set((char *)cp, 200, 255, 0, 80); @@ -618,7 +618,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const case PCHAN_COLOR_SPHEREBONE_BASE: { if (bcolor) { - unsigned char cp[4] = {255}; + uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { copy_v3_v3_char((char *)cp, bcolor->active); @@ -649,7 +649,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const case PCHAN_COLOR_SPHEREBONE_END: { if (bcolor) { - unsigned char cp[4] = {255}; + uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { copy_v3_v3_char((char *)cp, bcolor->active); @@ -683,7 +683,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const { /* inner part in background color or constraint */ if ((constflag) && ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS))) { - unsigned char cp[4]; + uchar cp[4]; if (constflag & PCHAN_HAS_TARGET) rgba_char_args_set((char *)cp, 255, 150, 0, 255); else if (constflag & PCHAN_HAS_IK) rgba_char_args_set((char *)cp, 255, 255, 0, 255); else if (constflag & PCHAN_HAS_SPLINEIK) rgba_char_args_set((char *)cp, 200, 255, 0, 255); @@ -695,7 +695,7 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const else { if (bcolor) { const char *cp = bcolor->solid; - rgb_uchar_to_float(fcolor, (unsigned char *)cp); + rgb_uchar_to_float(fcolor, (uchar *)cp); fcolor[3] = 204.f / 255.f; } else { @@ -1588,7 +1588,7 @@ static void draw_armature_edit(Object *ob) /* Draw names of bone */ if (show_text && (arm->flag & ARM_DRAWNAMES)) { - unsigned char color[4]; + uchar color[4]; UI_GetThemeColor4ubv((eBone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, color); float vec[3]; @@ -1702,7 +1702,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) /* Draw names of bone */ if (show_text && (arm->flag & ARM_DRAWNAMES)) { - unsigned char color[4]; + uchar color[4]; UI_GetThemeColor4ubv((arm->flag & ARM_POSEMODE) && (bone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, color); float vec[3]; diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index a8d2c2a3642..2251285be74 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -164,7 +164,7 @@ static Gwn_VertBuf *fill_arrows_vbo(const float scale) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -211,7 +211,7 @@ static Gwn_VertBuf *sphere_wire_vbo(const float rad) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -263,7 +263,7 @@ Gwn_Batch *DRW_cache_fullscreen_quad_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, uvs; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -291,7 +291,7 @@ Gwn_Batch *DRW_cache_quad_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, uvs; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -344,7 +344,7 @@ Gwn_Batch *DRW_cache_cube_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -369,7 +369,7 @@ Gwn_Batch *DRW_cache_circle_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -400,7 +400,7 @@ Gwn_Batch *DRW_cache_square_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -427,7 +427,7 @@ Gwn_Batch *DRW_cache_single_line_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -452,7 +452,7 @@ Gwn_Batch *DRW_cache_single_line_endpoints_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -476,7 +476,7 @@ Gwn_Batch *DRW_cache_screenspace_circle_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -613,7 +613,7 @@ Gwn_Batch *DRW_cache_plain_axes_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -644,7 +644,7 @@ Gwn_Batch *DRW_cache_single_arrow_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -700,7 +700,7 @@ Gwn_Batch *DRW_cache_empty_cone_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -752,7 +752,7 @@ Gwn_Batch *DRW_cache_axis_names_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* Using 3rd component as axis indicator */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -810,7 +810,7 @@ Gwn_Batch *DRW_cache_image_plane_get(void) const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; static Gwn_VertFormat format = { 0 }; static struct { uint pos, texCoords; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.texCoords = GWN_vertformat_attr_add(&format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -831,7 +831,7 @@ Gwn_Batch *DRW_cache_image_plane_wire_get(void) const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); @@ -854,7 +854,7 @@ Gwn_Batch *DRW_cache_field_wind_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -891,7 +891,7 @@ Gwn_Batch *DRW_cache_field_force_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -929,7 +929,7 @@ Gwn_Batch *DRW_cache_field_vortex_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -966,7 +966,7 @@ Gwn_Batch *DRW_cache_field_tube_limit_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1015,7 +1015,7 @@ Gwn_Batch *DRW_cache_field_cone_limit_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1070,7 +1070,7 @@ Gwn_Batch *DRW_cache_lamp_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -1102,7 +1102,7 @@ Gwn_Batch *DRW_cache_lamp_shadows_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -1133,7 +1133,7 @@ Gwn_Batch *DRW_cache_lamp_sunrays_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -1168,7 +1168,7 @@ Gwn_Batch *DRW_cache_lamp_area_square_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1201,7 +1201,7 @@ Gwn_Batch *DRW_cache_lamp_area_disk_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1235,7 +1235,7 @@ Gwn_Batch *DRW_cache_lamp_hemi_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1313,7 +1313,7 @@ Gwn_Batch *DRW_cache_lamp_spot_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, n1, n2; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -1372,7 +1372,7 @@ Gwn_Batch *DRW_cache_lamp_spot_square_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1410,7 +1410,7 @@ Gwn_Batch *DRW_cache_speaker_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1483,7 +1483,7 @@ Gwn_Batch *DRW_cache_lightprobe_cube_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1528,7 +1528,7 @@ Gwn_Batch *DRW_cache_lightprobe_grid_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1581,7 +1581,7 @@ Gwn_Batch *DRW_cache_lightprobe_planar_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1709,7 +1709,7 @@ Gwn_Batch *DRW_cache_bone_octahedral_get(void) static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor, snor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.snor = GWN_vertformat_attr_add(&format, "snor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -1875,7 +1875,7 @@ Gwn_Batch *DRW_cache_bone_box_get(void) static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor, snor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.snor = GWN_vertformat_attr_add(&format, "snor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -1942,7 +1942,7 @@ Gwn_Batch *DRW_cache_bone_envelope_solid_get(void) static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -1989,7 +1989,7 @@ Gwn_Batch *DRW_cache_bone_envelope_outline_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos0, pos1, pos2; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos0 = GWN_vertformat_attr_add(&format, "pos0", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.pos1 = GWN_vertformat_attr_add(&format, "pos1", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.pos2 = GWN_vertformat_attr_add(&format, "pos2", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -2045,7 +2045,7 @@ Gwn_Batch *DRW_cache_bone_point_get(void) static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2081,7 +2081,7 @@ Gwn_Batch *DRW_cache_bone_point_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -2115,7 +2115,7 @@ Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos0, pos1; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos0 = GWN_vertformat_attr_add(&format, "pos0", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.pos1 = GWN_vertformat_attr_add(&format, "pos1", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -2172,7 +2172,7 @@ Gwn_Batch *DRW_cache_bone_stick_get(void) /* Position Only 2D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, flag; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.flag = GWN_vertformat_attr_add(&format, "flag", GWN_COMP_U32, 1, GWN_FETCH_INT); } @@ -2314,7 +2314,7 @@ Gwn_Batch *DRW_cache_bone_arrows_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint axis, pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.axis = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); attr_id.pos = GWN_vertformat_attr_add(&format, "screenPos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.col = GWN_vertformat_attr_add(&format, "colorAxis", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -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); } @@ -2456,7 +2456,7 @@ Gwn_Batch *DRW_cache_camera_get(void) if (!SHC.drw_camera) { static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); } @@ -2489,7 +2489,7 @@ Gwn_Batch *DRW_cache_camera_frame_get(void) static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); } @@ -2515,7 +2515,7 @@ Gwn_Batch *DRW_cache_camera_tria_get(void) if (!SHC.drw_camera_tria) { static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); } @@ -2552,7 +2552,7 @@ Gwn_Batch *DRW_cache_single_vert_get(void) /* Position Only 3D format */ static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2985,9 +2985,9 @@ Gwn_Batch *DRW_cache_particles_get_prim(int type) case PART_DRAW_CROSS: if (!SHC.drw_particle_cross) { static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, axis_id; + static uint pos_id, axis_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -3032,9 +3032,9 @@ Gwn_Batch *DRW_cache_particles_get_prim(int type) case PART_DRAW_AXIS: if (!SHC.drw_particle_axis) { static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, axis_id; + static uint pos_id, axis_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -3083,9 +3083,9 @@ Gwn_Batch *DRW_cache_particles_get_prim(int type) int axis = -1; static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, axis_id; + static uint pos_id, axis_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -3125,24 +3125,24 @@ 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; - unsigned char red[3] = {255, 0, 0}; - unsigned char white[3] = {255, 255, 255}; + uchar red[3] = {255, 0, 0}; + uchar white[3] = {255, 255, 255}; static Gwn_VertFormat format = { 0 }; static struct { uint pos, color; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); attr_id.color = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } 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) { @@ -3161,7 +3161,7 @@ Gwn_Batch *DRW_cache_cursor_get(bool crosshair_lines) GWN_indexbuf_add_generic_vert(&elb, 0); if (crosshair_lines) { - unsigned char crosshair_color[3]; + uchar crosshair_color[3]; UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color); GWN_indexbuf_add_primitive_restart(&elb); diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c index 1bf34953dc6..4de1dfd24f5 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.c +++ b/source/blender/draw/intern/draw_cache_impl_curve.c @@ -503,7 +503,7 @@ static Gwn_VertBuf *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, Cur if (cache->wire.verts == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -581,7 +581,7 @@ static Gwn_VertBuf *curve_batch_cache_get_normal_verts(CurveRenderData *rdata, C if (cache->normal.verts == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -675,7 +675,7 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu) if (cache->overlay.verts == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT); @@ -743,7 +743,7 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu) static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT); @@ -850,7 +850,7 @@ static Gwn_Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, C EditFont *ef = rdata->text.edit_font; static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -924,7 +924,7 @@ static Gwn_Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, C if (cache->text.cursor == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index 3eecff024a1..8d187af0501 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -122,7 +122,7 @@ Gwn_VertBuf *DRW_displist_vertbuf_calc_pos_with_normals(ListBase *lb) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -228,7 +228,7 @@ Gwn_Batch **DRW_displist_batch_calc_tri_pos_normals_and_uv_split_by_material(Lis static Gwn_VertFormat shaded_triangles_format = { 0 }; static struct { uint pos, nor, uv; } attr_id; - if (shaded_triangles_format.attrib_ct == 0) { + if (shaded_triangles_format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&shaded_triangles_format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&shaded_triangles_format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c index 6046d9854fb..99dce2d7343 100644 --- a/source/blender/draw/intern/draw_cache_impl_lattice.c +++ b/source/blender/draw/intern/draw_cache_impl_lattice.c @@ -507,7 +507,7 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt) if (cache->overlay_verts == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT); diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index eafcfb007e7..7a72622cb9e 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -116,10 +116,10 @@ typedef struct EdgeAdjacentVerts { } EdgeAdjacentVerts; typedef struct EdgeDrawAttr { - unsigned char v_flag; - unsigned char e_flag; - unsigned char crease; - unsigned char bweight; + uchar v_flag; + uchar e_flag; + uchar crease; + uchar bweight; } EdgeDrawAttr; typedef struct MeshRenderData { @@ -1349,9 +1349,9 @@ enum { * (see gpu_shader_edit_mesh_overlay_geom.glsl) */ }; -static unsigned char mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *efa) +static uchar mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *efa) { - unsigned char fflag = 0; + uchar fflag = 0; if (efa == rdata->efa_act) fflag |= VFLAG_FACE_ACTIVE; @@ -1397,10 +1397,10 @@ static void mesh_render_data_edge_flag( } } -static unsigned char mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *eve) +static uchar mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *eve) { - unsigned char vflag = 0; + uchar vflag = 0; /* Current vertex */ if (eve == rdata->eve_act) @@ -1417,8 +1417,8 @@ static void add_overlay_tri( const uint pos_id, const uint vnor_id, const uint lnor_id, const uint data_id, const BMLoop **bm_looptri, const int base_vert_idx) { - unsigned char fflag; - unsigned char vflag; + uchar fflag; + uchar vflag; if (vbo_pos) { /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */ @@ -1528,7 +1528,7 @@ static void add_overlay_loose_vert( } if (vbo_data) { - unsigned char vflag[4] = {0, 0, 0, 0}; + uchar vflag[4] = {0, 0, 0, 0}; vflag[0] = mesh_render_data_vertex_flag(rdata, eve); GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag); } @@ -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 */ @@ -2159,7 +2159,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active( static Gwn_VertFormat format = { 0 }; static struct { uint uv; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.uv = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -2222,7 +2222,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_ex( if (*r_vbo == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2374,7 +2374,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_facedot_pos_with_normals_and_flag( if (cache->ed_fcenter_pos_with_nor_and_sel == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.data = GWN_vertformat_attr_add(&format, "norAndFlag", GWN_COMP_I10, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2418,7 +2418,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_edges_visible( if (cache->ed_edge_pos == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2463,7 +2463,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_verts_visible( if (cache->ed_vert_pos == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2513,7 +2513,7 @@ static Gwn_VertBuf *mesh_create_facedot_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2561,7 +2561,7 @@ static Gwn_VertBuf *mesh_create_edges_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2611,7 +2611,7 @@ static Gwn_VertBuf *mesh_create_verts_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2671,7 +2671,7 @@ static Gwn_VertBuf *mesh_create_tri_weights( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2731,7 +2731,7 @@ static Gwn_VertBuf *mesh_create_tri_vert_colors( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2791,7 +2791,7 @@ static Gwn_VertBuf *mesh_create_tri_select_id( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2847,7 +2847,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order( if (cache->pos_in_order == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* Normal is padded so that the vbo can be used as a buffer texture */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -2886,8 +2886,8 @@ static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order( static Gwn_VertFormat *edit_mesh_overlay_pos_format(uint *r_pos_id) { static Gwn_VertFormat format_pos = { 0 }; - static unsigned pos_id; - if (format_pos.attrib_ct == 0) { + static uint pos_id; + if (format_pos.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format_pos, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } *r_pos_id = pos_id; @@ -2898,8 +2898,8 @@ static Gwn_VertFormat *edit_mesh_overlay_nor_format(uint *r_vnor_id, uint *r_lno { static Gwn_VertFormat format_nor = { 0 }; static Gwn_VertFormat format_nor_loop = { 0 }; - static unsigned vnor_id, vnor_loop_id, lnor_id; - if (format_nor.attrib_ct == 0) { + static uint vnor_id, vnor_loop_id, lnor_id; + if (format_nor.attr_len == 0) { vnor_id = GWN_vertformat_attr_add(&format_nor, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); vnor_loop_id = GWN_vertformat_attr_add(&format_nor_loop, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); lnor_id = GWN_vertformat_attr_add(&format_nor_loop, "lnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -2918,8 +2918,8 @@ static Gwn_VertFormat *edit_mesh_overlay_nor_format(uint *r_vnor_id, uint *r_lno static Gwn_VertFormat *edit_mesh_overlay_data_format(uint *r_data_id) { static Gwn_VertFormat format_flag = { 0 }; - static unsigned data_id; - if (format_flag.attrib_ct == 0) { + static uint data_id; + if (format_flag.attr_len == 0) { data_id = GWN_vertformat_attr_add(&format_flag, "data", GWN_COMP_U8, 4, GWN_FETCH_INT); } *r_data_id = data_id; @@ -3420,7 +3420,7 @@ static Gwn_VertBuf *mesh_batch_cache_create_edges_overlay_texture_buf(MeshRender int j, j_next; for (j = 2, j_next = 0; j_next < 3; j = j_next++) { MEdge *ed = &medge[mloop[mlt->tri[j]].e]; - unsigned int tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v}; + uint tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v}; if (((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) || ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0]))) @@ -3657,7 +3657,7 @@ static Gwn_VertBuf *mesh_create_edge_pos_with_sel( static Gwn_VertFormat format = { 0 }; static struct { uint pos, sel; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.sel = GWN_vertformat_attr_add(&format, "select", GWN_COMP_U8, 1, GWN_FETCH_INT); } @@ -3744,7 +3744,7 @@ static Gwn_VertBuf *mesh_create_vert_pos_with_overlay_data( static Gwn_VertFormat format = { 0 }; static struct { uint data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_I8, 1, GWN_FETCH_INT); } @@ -3997,7 +3997,7 @@ Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me) /* create batch from DM */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, n1, n2; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -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; diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 28693b47c89..df67d34d566 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -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); @@ -263,7 +263,7 @@ static void ensure_seg_pt_count( } } -static void particle_pack_mcol(MCol *mcol, unsigned short r_scol[3]) +static void particle_pack_mcol(MCol *mcol, ushort r_scol[3]) { /* Convert to linear ushort and swizzle */ r_scol[0] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->b]); @@ -573,7 +573,7 @@ static int particle_batch_cache_fill_segments( } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ - unsigned short scol[4]; + ushort scol[4]; particle_pack_mcol( (is_simple && is_child) ? &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], @@ -600,7 +600,7 @@ static int particle_batch_cache_fill_segments( } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ - unsigned short scol[4]; + ushort scol[4]; particle_pack_mcol( (is_simple && is_child) ? &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], @@ -734,7 +734,7 @@ static int particle_batch_cache_fill_strands_data( copy_v2_v2(t_uv, uv[k]); } for (int k = 0; k < num_col_layers; k++) { - unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k); + ushort *scol = (ushort *)GWN_vertbuf_raw_step(col_step + k); particle_pack_mcol( (is_simple && is_child) ? &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], @@ -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) { @@ -1196,7 +1196,7 @@ static void particle_batch_cache_ensure_pos( } static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, rot_id, val_id; + static uint pos_id, rot_id, val_id; int i, curr_point; ParticleData *pa; ParticleKey state; @@ -1219,7 +1219,7 @@ static void particle_batch_cache_ensure_pos( GWN_VERTBUF_DISCARD_SAFE(point_cache->pos); - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); rot_id = GWN_vertformat_attr_add(&format, "rot", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); @@ -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); } } @@ -1420,18 +1420,18 @@ static void particle_batch_cache_ensure_edit_inner_pos( } static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, color_id; + static uint pos_id, color_id; GWN_VERTBUF_DISCARD_SAFE(cache->edit_inner_pos); - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); } 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( @@ -1491,18 +1491,18 @@ static void particle_batch_cache_ensure_edit_tip_pos( } static Gwn_VertFormat format = { 0 }; - static unsigned pos_id, color_id; + static uint pos_id, color_id; GWN_VERTBUF_DISCARD_SAFE(cache->edit_tip_pos); - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* initialize vertex format */ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); } 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); diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 8320ae55179..6ede573199f 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -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; diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h index 2e6c9a0d3c1..17acd7e6259 100644 --- a/source/blender/draw/intern/draw_hair_private.h +++ b/source/blender/draw/intern/draw_hair_private.h @@ -31,7 +31,7 @@ #define __DRAW_HAIR_PRIVATE_H__ #define MAX_LAYER_NAME_CT 3 /* u0123456789, u, a0123456789 */ -#define MAX_LAYER_NAME_LEN DECIMAL_DIGITS_BOUND(unsigned int) + 2 +#define MAX_LAYER_NAME_LEN DECIMAL_DIGITS_BOUND(uint) + 2 #define MAX_THICKRES 2 /* see eHairType */ #define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */ @@ -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( diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index 3e4f812af27..e322d4780d5 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -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_len) { + 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_len) { + uint size = vert_len + BUFFER_VERTS_CHUNK - 1; size = size - size % BUFFER_VERTS_CHUNK; GWN_vertbuf_data_resize(ibuf->vert, size); } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 26e5365a6fd..30f7742fd35 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1370,9 +1370,12 @@ void DRW_draw_render_loop_ex( drw_engines_cache_init(); drw_engines_world_update(scene); + const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { - drw_engines_cache_populate(ob); + if ((object_type_exclude_viewport & (1 << ob->type)) == 0) { + drw_engines_cache_populate(ob); + } } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END; @@ -1645,12 +1648,17 @@ void DRW_render_object_iter( void *vedata, RenderEngine *engine, struct Depsgraph *depsgraph, void (*callback)(void *vedata, Object *ob, RenderEngine *engine, struct Depsgraph *depsgraph)) { + const DRWContextState *draw_ctx = DRW_context_state_get(); + DRW_hair_init(); + const int object_type_exclude_viewport = draw_ctx->v3d ? draw_ctx->v3d->object_type_exclude_viewport : 0; DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { - DST.ob_state = NULL; - callback(vedata, ob, engine, depsgraph); + if ((object_type_exclude_viewport & (1 << ob->type)) == 0) { + DST.ob_state = NULL; + callback(vedata, ob, engine, depsgraph); + } } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END } @@ -1840,6 +1848,9 @@ void DRW_draw_select_loop( #endif } else { + const int object_type_exclude_select = ( + v3d->object_type_exclude_viewport | v3d->object_type_exclude_select + ); bool filter_exclude = false; DEG_OBJECT_ITER_BEGIN( depsgraph, ob, @@ -1847,8 +1858,9 @@ void DRW_draw_select_loop( DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI) { - if ((ob->base_flag & BASE_SELECTABLE) != 0) { - + if ((ob->base_flag & BASE_SELECTABLE) && + (object_type_exclude_select & (1 << ob->type)) == 0) + { if (object_filter_fn != NULL) { if (ob->base_flag & BASE_FROMDUPLI) { /* pass (use previous filter_exclude value) */ @@ -2020,9 +2032,12 @@ void DRW_draw_depth_loop( drw_engines_cache_init(); drw_engines_world_update(scene); + const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { - drw_engines_cache_populate(ob); + if ((object_type_exclude_viewport & (1 << ob->type)) == 0) { + drw_engines_cache_populate(ob); + } } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END; diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 9954754990f..6eae3459c2b 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -106,8 +106,8 @@ typedef struct DRWCallState { DRWCallVisibilityFn *visibility_cb; void *user_data; - unsigned char flag; - unsigned char cache_id; /* Compared with DST.state_cache_id to see if matrices are still valid. */ + uchar flag; + uchar cache_id; /* Compared with DST.state_cache_id to see if matrices are still valid. */ uint16_t matflag; /* Which matrices to compute. */ /* Culling: Using Bounding Sphere for now for faster culling. * Not ideal for planes. */ @@ -308,7 +308,7 @@ typedef struct DRWManager { DRWInstanceData *object_instance_data[MAX_INSTANCE_DATA_SIZE]; /* State of the object being evaluated if already allocated. */ DRWCallState *ob_state; - unsigned char state_cache_id; /* Could be larger but 254 view changes is already a lot! */ + uchar state_cache_id; /* Could be larger but 254 view changes is already a lot! */ /* Rendering state */ GPUShader *shader; diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index db4e16d362a..c259633982e 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -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]) @@ -553,7 +553,7 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at { #ifdef USE_GPU_SELECT if (G.f & G_PICKSEL) { - if (shgroup->instance_count == shgroup->inst_selectid->vertex_ct) { + if (shgroup->instance_count == shgroup->inst_selectid->vertex_len) { GWN_vertbuf_data_resize(shgroup->inst_selectid, shgroup->instance_count + 32); } GWN_vertbuf_attr_set(shgroup->inst_selectid, 0, shgroup->instance_count, &DST.select_id); @@ -564,7 +564,7 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at UNUSED_VARS_NDEBUG(attr_len); for (int i = 0; i < attr_len; ++i) { - if (shgroup->instance_count == shgroup->instance_vbo->vertex_ct) { + if (shgroup->instance_count == shgroup->instance_vbo->vertex_len) { GWN_vertbuf_data_resize(shgroup->instance_vbo, shgroup->instance_count + 32); } GWN_vertbuf_attr_set(shgroup->instance_vbo, i, shgroup->instance_count, attr[i]); @@ -651,7 +651,7 @@ static void drw_shgroup_instance_init( shgroup->instance_geom = batch; #ifndef NDEBUG - shgroup->attribs_count = format->attrib_ct; + shgroup->attribs_count = format->attr_len; #endif DRW_instancing_buffer_request(DST.idatalist, format, batch, shgroup, @@ -662,7 +662,7 @@ static void drw_shgroup_instance_init( /* Not actually used for rendering but alloced in one chunk. * Plus we don't have to care about ownership. */ static Gwn_VertFormat inst_select_format = {0}; - if (inst_select_format.attrib_ct == 0) { + if (inst_select_format.attr_len == 0) { GWN_vertformat_attr_add(&inst_select_format, "selectId", GWN_COMP_I32, 1, GWN_FETCH_INT); } Gwn_Batch *batch_dummy; /* Not used */ @@ -679,7 +679,7 @@ static void drw_shgroup_batching_init( drw_shgroup_init(shgroup, shader); #ifndef NDEBUG - shgroup->attribs_count = (format != NULL) ? format->attrib_ct : 0; + shgroup->attribs_count = (format != NULL) ? format->attr_len : 0; #endif BLI_assert(format != NULL); @@ -698,7 +698,7 @@ static void drw_shgroup_batching_init( if (G.f & G_PICKSEL) { /* Not actually used for rendering but alloced in one chunk. */ static Gwn_VertFormat inst_select_format = {0}; - if (inst_select_format.attrib_ct == 0) { + if (inst_select_format.attr_len == 0) { GWN_vertformat_attr_add(&inst_select_format, "selectId", GWN_COMP_I32, 1, GWN_FETCH_INT); } Gwn_Batch *batch; /* Not used */ diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 03692fd9475..5957643d090 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -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) diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 1f385b958b8..977374a00c5 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -46,7 +46,7 @@ typedef struct ViewCachedString { struct ViewCachedString *next, *prev; float vec[3]; union { - unsigned char ub[4]; + uchar ub[4]; int pack; } col; short sco[2]; @@ -79,7 +79,7 @@ void DRW_text_cache_add( const float co[3], const char *str, const int str_len, short xoffs, short flag, - const unsigned char col[4]) + const uchar col[4]) { int alloc_len; ViewCachedString *vos; diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h index a675a200924..14c33be4cf8 100644 --- a/source/blender/draw/intern/draw_manager_text.h +++ b/source/blender/draw/intern/draw_manager_text.h @@ -34,7 +34,7 @@ void DRW_text_cache_add( const float co[3], const char *str, const int str_len, short xoffs, short flag, - const unsigned char col[4]); + const uchar col[4]); void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar); diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 347932619b9..59ae8a918f9 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -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,19 +104,19 @@ 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( ARegion *ar, double x0, double y0, double dx, int skip_mod, - unsigned pos, unsigned col, GLubyte col_value[3]) + uint pos, uint col, GLubyte col_value[3]) { /* skip every skip_mod lines relative to each axis; they will be overlaid by another drawgrid_draw * always skip exact x0 & y0 axes; they will be drawn later in color @@ -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; @@ -220,7 +220,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - unsigned char col[3], col2[3]; + uchar col[3], col2[3]; UI_GetThemeColor3ubv(TH_GRID, col); if (unit->system) { @@ -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); @@ -369,17 +369,17 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) bool show_axis_y = (v3d->gridflag & V3D_SHOW_Y) != 0; bool show_axis_z = (v3d->gridflag & V3D_SHOW_Z) != 0; - unsigned char col_grid[3], col_axis[3]; + uchar col_grid[3], col_axis[3]; glLineWidth(1.0f); UI_GetThemeColor3ubv(TH_GRID, col_grid); if (show_floor) { - const unsigned vertex_ct = 2 * (gridlines * 4 + 2); + const uint vertex_len = 2 * (gridlines * 4 + 2); const int sublines = v3d->gridsubdiv; - unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3]; + uchar col_bg[3], col_grid_emphasise[3], col_grid_light[3]; Gwn_VertFormat *format = immVertexFormat(); uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -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); @@ -583,9 +583,9 @@ void DRW_draw_background(void) glDisable(GL_DEPTH_TEST); Gwn_VertFormat *format = immVertexFormat(); - unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); - unsigned char col_hi[3], col_lo[3]; + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uchar col_hi[3], col_lo[3]; gpuPushMatrix(); gpuLoadIdentity(); diff --git a/source/blender/draw/modes/edit_mesh_mode_text.c b/source/blender/draw/modes/edit_mesh_mode_text.c index def96e79eba..56a015d0e6b 100644 --- a/source/blender/draw/modes/edit_mesh_mode_text.c +++ b/source/blender/draw/modes/edit_mesh_mode_text.c @@ -63,7 +63,7 @@ void DRW_edit_mesh_mode_text_measure_stats( char numstr[32]; /* Stores the measurement display text here */ size_t numstr_len; const char *conv_float; /* Use a float conversion matching the grid size */ - unsigned char col[4] = {0, 0, 0, 255}; /* color of the text to draw */ + uchar col[4] = {0, 0, 0, 255}; /* color of the text to draw */ float area; /* area of the face */ float grid = unit->system ? unit->scale_length : v3d->grid; const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 332c480aa89..2ac16906102 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -2129,10 +2129,6 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) return; } - if (v3d->overlay.object_type_exclude & (1 << ob->type)) { - return; - } - bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0); bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0); @@ -2278,7 +2274,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) if ((ob->dtx & OB_DRAWNAME) && DRW_state_show_text()) { struct DRWTextStore *dt = DRW_text_cache_ensure(); - unsigned char color[4]; + uchar color[4]; UI_GetThemeColor4ubv(theme_id, color); DRW_text_cache_add( |