Cleanup: macro hygiene, line length

This commit is contained in:
Campbell Barton 2018-12-21 10:46:26 +11:00
parent 217727cb35
commit 7a26e930a8
Notes: blender-bot 2023-02-14 04:20:43 +01:00
Referenced by issue #59828, Crash in OGL drawcode with a specific shader
Referenced by issue #59820, Keyframe convenience not working
Referenced by issue #59821, No motion blur with eevee CPU
Referenced by issue #59792, unlocated crash
Referenced by issue #59770, Array/Skin-Modifier-Combo causes crash
Referenced by issue #59762, GUI render issues - blender-softwaregl crashes
Referenced by issue #59735, Wrong vertices are selected in edit mode, solid view
2 changed files with 28 additions and 19 deletions

View File

@ -78,7 +78,8 @@ struct GPUBatch *DRW_curve_batch_cache_get_wireframes_face(struct Curve *cu);
/* Metaball */
struct GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(struct Object *ob);
struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(struct Object *ob, struct MetaBall *mb, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(
struct Object *ob, struct MetaBall *mb, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
struct GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(struct Object *ob);
/* DispList */
@ -184,12 +185,12 @@ struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
/* Common */
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? value : 0)
#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? value : 0)
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? (value) : 0)
#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? (value) : 0)
/* Test and assign NULL if test fails */
#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? v : NULL))
#define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? v : NULL))
#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL))
#define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? (v) : NULL))
struct GPUBatch *DRW_batch_request(struct GPUBatch **batch);
bool DRW_batch_requested(struct GPUBatch *batch, int prim_type);

View File

@ -495,8 +495,8 @@ static void mesh_render_calc_normals_loop_and_poly(const Mesh *me, const float s
}
static void mesh_cd_extract_auto_layers_names_and_srgb(
Mesh *me, const ushort cd_lused[CD_NUMTYPES],
char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len)
Mesh *me, const ushort cd_lused[CD_NUMTYPES],
char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len)
{
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
@ -1015,7 +1015,7 @@ static MeshRenderData *mesh_render_data_create_ex(
&rdata->cd.output.ldata, me->totloop,
&rdata->cd.output.tangent_mask);
/* If we store tangents in the mesh, set temporary. */
/* If we store tangents in the mesh, set temporary. */
#if 0
CustomData_set_layer_flag(cd_ldata, CD_TANGENT, CD_FLAG_TEMPORARY);
#endif
@ -2413,7 +2413,7 @@ static void mesh_batch_cache_clear_selective(Mesh *me, GPUVertBuf *vert)
BLI_assert(vert != NULL);
if (ELEM(vert, cache->pos_with_normals, cache->pos_with_normals_visible_only,
cache->pos_with_normals_edit, cache->pos_with_normals_visible_only_edit))
cache->pos_with_normals_edit, cache->pos_with_normals_visible_only_edit))
{
GPU_BATCH_DISCARD_SAFE(cache->triangles_with_normals);
GPU_BATCH_DISCARD_SAFE(cache->triangles_with_weights);
@ -4208,9 +4208,11 @@ static void mesh_create_surf_tris(MeshRenderData *rdata, GPUIndexBuf *ibo, const
if (BM_elem_flag_test(bm_face, BM_ELEM_HIDDEN)) {
continue;
}
GPU_indexbuf_add_tri_verts(&elb, BM_elem_index_get(bm_looptri[0]->v),
BM_elem_index_get(bm_looptri[1]->v),
BM_elem_index_get(bm_looptri[2]->v));
GPU_indexbuf_add_tri_verts(
&elb,
BM_elem_index_get(bm_looptri[0]->v),
BM_elem_index_get(bm_looptri[1]->v),
BM_elem_index_get(bm_looptri[2]->v));
}
}
else {
@ -4373,9 +4375,11 @@ static void mesh_create_loops_tris(
continue;
}
int mat = (ibo_len > 1) ? bm_face->mat_nr : 0;
GPU_indexbuf_add_tri_verts(&elb[mat], BM_elem_index_get(bm_looptri[0]),
BM_elem_index_get(bm_looptri[1]),
BM_elem_index_get(bm_looptri[2]));
GPU_indexbuf_add_tri_verts(
&elb[mat],
BM_elem_index_get(bm_looptri[0]),
BM_elem_index_get(bm_looptri[1]),
BM_elem_index_get(bm_looptri[2]));
}
}
else {
@ -5273,8 +5277,10 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
const DRWContextState *draw_ctx = DRW_context_state_get();
const int mode = CTX_data_mode_enum_ex(draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
const bool use_hide = (ob->type == OB_MESH) && ((is_paint_mode && (ob == draw_ctx->obact)) ||
((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob)));
const bool use_hide = (
(ob->type == OB_MESH) &&
((is_paint_mode && (ob == draw_ctx->obact)) ||
((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
bool use_face_sel = false;
/* Tex paint face select */
@ -5526,8 +5532,10 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
DRW_vbo_requested(cache->edit.lnor) ||
DRW_ibo_requested(cache->ibo.edit_verts_points))
{
mesh_create_edit_tris_and_verts(rdata, cache->edit.data, cache->edit.pos_nor,
cache->edit.lnor, cache->ibo.edit_verts_points);
mesh_create_edit_tris_and_verts(
rdata,
cache->edit.data, cache->edit.pos_nor,
cache->edit.lnor, cache->ibo.edit_verts_points);
}
if (DRW_vbo_requested(cache->edit.data_ledges) || DRW_vbo_requested(cache->edit.pos_nor_ledges)) {
mesh_create_edit_loose_edges(rdata, cache->edit.data_ledges, cache->edit.pos_nor_ledges);