diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-22 04:09:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-22 04:09:27 +0300 |
commit | 7f40d553f90358c5383100f4f5b5e2410dcd7369 (patch) | |
tree | dab3bd1aa664ea46101fa0e68de171e92fb0ff53 /source/blender/draw/modes | |
parent | c7768bcf4b116aa515890feed2f3019a2d9c55f4 (diff) |
Cleanp: use single global for draw manager
Add 'G_draw' for all draw manager globals,
avoids adding extern to each file.
Connection between `ts` and `globals_ubo` wasn't obvious,
now called `G_draw.block` & `G_draw.block_ubo`.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/edit_armature_mode.c | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_curve_mode.c | 10 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_lattice_mode.c | 8 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_mesh_mode.c | 28 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_metaball_mode.c | 6 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_text_mode.c | 10 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 73 | ||||
-rw-r--r-- | source/blender/draw/modes/overlay_mode.c | 26 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_texture_mode.c | 12 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_vertex_mode.c | 7 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_weight_mode.c | 13 | ||||
-rw-r--r-- | source/blender/draw/modes/particle_mode.c | 8 | ||||
-rw-r--r-- | source/blender/draw/modes/pose_mode.c | 1 |
13 files changed, 78 insertions, 126 deletions
diff --git a/source/blender/draw/modes/edit_armature_mode.c b/source/blender/draw/modes/edit_armature_mode.c index 02f208900e4..403702b3df3 100644 --- a/source/blender/draw/modes/edit_armature_mode.c +++ b/source/blender/draw/modes/edit_armature_mode.c @@ -33,7 +33,7 @@ #include "draw_mode_engines.h" -extern GlobalsUboStorage ts; + /* *********** LISTS *********** */ typedef struct EDIT_ARMATURE_PassList { diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index b3cb2cb3d80..a9f42e0ce73 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -42,8 +42,6 @@ /* If needed, contains all global/Theme colors * Add needed theme colors / values to DRW_globals_update() and update UBO * Not needed for constant color. */ -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ extern char datatoc_common_globals_lib_glsl[]; extern char datatoc_edit_curve_overlay_loosevert_vert_glsl[]; @@ -159,12 +157,12 @@ static void EDIT_CURVE_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE); grp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorWireEdit, 1); + DRW_shgroup_uniform_vec4(grp, "color", G_draw.block.colorWireEdit, 1); stl->g_data->wire_shgrp = grp; grp = DRW_shgroup_create(e_data.wire_normals_sh, psl->wire_pass); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorWireEdit, 1); + DRW_shgroup_uniform_vec4(grp, "color", G_draw.block.colorWireEdit, 1); DRW_shgroup_uniform_float_copy(grp, "normalSize", v3d->overlay.normals_length); stl->g_data->wire_normals_shgrp = grp; @@ -173,7 +171,7 @@ static void EDIT_CURVE_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND); grp = DRW_shgroup_create(e_data.overlay_edge_sh, psl->overlay_edge_pass); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_bool(grp, "showCurveHandles", &stl->g_data->show_handles, 1); stl->g_data->overlay_edge_shgrp = grp; @@ -184,7 +182,7 @@ static void EDIT_CURVE_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_POINT); grp = DRW_shgroup_create(e_data.overlay_vert_sh, psl->overlay_vert_pass); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); stl->g_data->overlay_vert_shgrp = grp; } } diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c index 1d4d4cd8362..4bfdf24ad61 100644 --- a/source/blender/draw/modes/edit_lattice_mode.c +++ b/source/blender/draw/modes/edit_lattice_mode.c @@ -35,12 +35,6 @@ #include "draw_mode_engines.h" -/* If needed, contains all global/Theme colors - * Add needed theme colors / values to DRW_globals_update() and update UBO - * Not needed for constant color. */ -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - extern char datatoc_common_globals_lib_glsl[]; extern char datatoc_edit_lattice_overlay_loosevert_vert_glsl[]; extern char datatoc_edit_lattice_overlay_frag_glsl[]; @@ -180,7 +174,7 @@ static void EDIT_LATTICE_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_POINT); stl->g_data->vert_shgrp = DRW_shgroup_create(e_data.overlay_vert_sh, psl->vert_pass); - DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo); } } diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index c31cd62262f..3f3316e2a2b 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -44,12 +44,6 @@ #include "BLI_dynstr.h" #include "BLI_string_utils.h" - -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - -extern struct GPUTexture *globals_weight_ramp; /* draw_common.c */ - extern char datatoc_common_world_clip_lib_glsl[]; extern char datatoc_paint_weight_vert_glsl[]; @@ -378,7 +372,7 @@ static DRWPass *edit_mesh_create_overlay_pass( if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) { *r_lverts_shgrp = DRW_shgroup_create(sh_data->overlay_lvert, pass); - DRW_shgroup_uniform_block(*r_lverts_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(*r_lverts_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_vec2(*r_lverts_shgrp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float(*r_lverts_shgrp, "edgeScale", edge_width_scale, 1); DRW_shgroup_state_enable(*r_lverts_shgrp, DRW_STATE_WRITE_DEPTH); @@ -388,7 +382,7 @@ static DRWPass *edit_mesh_create_overlay_pass( } *r_verts_shgrp = DRW_shgroup_create(sh_data->overlay_vert, pass); - DRW_shgroup_uniform_block(*r_verts_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(*r_verts_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_vec2(*r_verts_shgrp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float(*r_verts_shgrp, "edgeScale", edge_width_scale, 1); DRW_shgroup_state_enable(*r_verts_shgrp, DRW_STATE_WRITE_DEPTH); @@ -400,7 +394,7 @@ static DRWPass *edit_mesh_create_overlay_pass( if ((tsettings->selectmode & SCE_SELECT_FACE) != 0) { *r_facedot_shgrp = DRW_shgroup_create(sh_data->overlay_facedot, pass); - DRW_shgroup_uniform_block(*r_facedot_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(*r_facedot_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float(*r_facedot_shgrp, "edgeScale", edge_width_scale, 1); DRW_shgroup_state_enable(*r_facedot_shgrp, DRW_STATE_WRITE_DEPTH); if (rv3d->rflag & RV3D_CLIPPING) { @@ -409,7 +403,7 @@ static DRWPass *edit_mesh_create_overlay_pass( } *r_face_shgrp = DRW_shgroup_create(tri_sh, pass); - DRW_shgroup_uniform_block(*r_face_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(*r_face_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_vec2(*r_face_shgrp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float(*r_face_shgrp, "faceAlphaMod", face_alpha, 1); DRW_shgroup_uniform_float(*r_face_shgrp, "edgeScale", edge_width_scale, 1); @@ -431,7 +425,7 @@ static DRWPass *edit_mesh_create_overlay_pass( DRW_shgroup_state_enable(*r_face_cage_shgrp, DRW_STATE_OFFSET_NEGATIVE); *r_ledges_shgrp = DRW_shgroup_create(ledge_sh, pass); - DRW_shgroup_uniform_block(*r_ledges_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(*r_ledges_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_vec2(*r_ledges_shgrp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float(*r_ledges_shgrp, "edgeScale", edge_width_scale, 1); DRW_shgroup_uniform_ivec4(*r_ledges_shgrp, "dataMask", data_mask, 1); @@ -522,8 +516,8 @@ static void EDIT_MESH_cache_init(void *vedata) static float alpha = 1.0f; DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "opacity", &alpha, 1); - DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", globals_weight_ramp); - DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", G_draw.weight_ramp); + DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", G_draw.block_ubo); if (rv3d->rflag & RV3D_CLIPPING) { DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->fweights_shgrp, rv3d); } @@ -556,21 +550,21 @@ static void EDIT_MESH_cache_init(void *vedata) stl->g_data->fnormals_shgrp = DRW_shgroup_create(sh_data->normals_face, psl->normals); DRW_shgroup_uniform_float(stl->g_data->fnormals_shgrp, "normalSize", &size_normal, 1); - DRW_shgroup_uniform_vec4(stl->g_data->fnormals_shgrp, "color", ts.colorNormal, 1); + DRW_shgroup_uniform_vec4(stl->g_data->fnormals_shgrp, "color", G_draw.block.colorNormal, 1); if (rv3d->rflag & RV3D_CLIPPING) { DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->fnormals_shgrp, rv3d); } stl->g_data->vnormals_shgrp = DRW_shgroup_create(sh_data->normals, psl->normals); DRW_shgroup_uniform_float(stl->g_data->vnormals_shgrp, "normalSize", &size_normal, 1); - DRW_shgroup_uniform_vec4(stl->g_data->vnormals_shgrp, "color", ts.colorVNormal, 1); + DRW_shgroup_uniform_vec4(stl->g_data->vnormals_shgrp, "color", G_draw.block.colorVNormal, 1); if (rv3d->rflag & RV3D_CLIPPING) { DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->vnormals_shgrp, rv3d); } stl->g_data->lnormals_shgrp = DRW_shgroup_create(sh_data->normals_loop, psl->normals); DRW_shgroup_uniform_float(stl->g_data->lnormals_shgrp, "normalSize", &size_normal, 1); - DRW_shgroup_uniform_vec4(stl->g_data->lnormals_shgrp, "color", ts.colorLNormal, 1); + DRW_shgroup_uniform_vec4(stl->g_data->lnormals_shgrp, "color", G_draw.block.colorLNormal, 1); if (rv3d->rflag & RV3D_CLIPPING) { DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->lnormals_shgrp, rv3d); } @@ -605,7 +599,7 @@ static void EDIT_MESH_cache_init(void *vedata) "Front Face Color", DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND); stl->g_data->facefill_occluded_shgrp = DRW_shgroup_create(sh_data->overlay_facefill, psl->facefill_occlude); - DRW_shgroup_uniform_block(stl->g_data->facefill_occluded_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->facefill_occluded_shgrp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_ivec4(stl->g_data->facefill_occluded_shgrp, "dataMask", stl->g_data->data_mask, 1); if (rv3d->rflag & RV3D_CLIPPING) { DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->facefill_occluded_shgrp, rv3d); diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c index 912c30c1482..4901b0fadd3 100644 --- a/source/blender/draw/modes/edit_metaball_mode.c +++ b/source/blender/draw/modes/edit_metaball_mode.c @@ -41,12 +41,6 @@ #include "draw_mode_engines.h" -/* If needed, contains all global/Theme colors - * Add needed theme colors / values to DRW_globals_update() and update UBO - * Not needed for constant color. */ -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - /* *********** LISTS *********** */ /* All lists are per viewport specific datas. * They are all free when viewport changes engines diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c index 40cbd876473..de63ec82e6f 100644 --- a/source/blender/draw/modes/edit_text_mode.c +++ b/source/blender/draw/modes/edit_text_mode.c @@ -40,12 +40,6 @@ #include "draw_mode_engines.h" -/* If needed, contains all global/Theme colors - * Add needed theme colors / values to DRW_globals_update() and update UBO - * Not needed for constant color. */ -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - /* *********** LISTS *********** */ /* All lists are per viewport specific datas. * They are all free when viewport changes engines @@ -190,8 +184,8 @@ static void EDIT_TEXT_cache_init(void *vedata) psl->text_box_pass = DRW_pass_create( "Font Text Boxes", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH); - stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, ts.colorWire); - stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, ts.colorActive); + stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorWire); + stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorActive); } } diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 8644e028491..e99166107ac 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -79,10 +79,6 @@ #include "DEG_depsgraph_query.h" -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GPUTexture *globals_ramp; /* draw_common.c */ -extern GlobalsUboStorage ts; - extern char datatoc_object_outline_prepass_vert_glsl[]; extern char datatoc_object_outline_prepass_geom_glsl[]; extern char datatoc_object_outline_prepass_frag_glsl[]; @@ -679,7 +675,7 @@ static DRWShadingGroup *shgroup_points(DRWPass *pass, const float col[4], GPUSha { DRWShadingGroup *grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", col, 1); - DRW_shgroup_uniform_vec4(grp, "innerColor", ts.colorEditMeshMiddle, 1); + DRW_shgroup_uniform_vec4(grp, "innerColor", G_draw.block.colorEditMeshMiddle, 1); return grp; } @@ -957,6 +953,7 @@ static void DRW_shgroup_empty_image( static void OBJECT_cache_init(void *vedata) { + const GlobalsUboStorage *gb = &G_draw.block; OBJECT_PassList *psl = ((OBJECT_Data *)vedata)->psl; OBJECT_StorageList *stl = ((OBJECT_Data *)vedata)->stl; DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); @@ -1033,7 +1030,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_texture_ref(grp, "outlineId", &e_data.outlines_id_tx); DRW_shgroup_uniform_texture_ref(grp, "outlineDepth", &e_data.outlines_depth_tx); DRW_shgroup_uniform_texture_ref(grp, "sceneDepth", &dtxl->depth); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alphaOcclu", alphaOcclu); DRW_shgroup_uniform_int(grp, "idOffsets", &stl->g_data->id_ofs_active, 4); DRW_shgroup_call_add(grp, quad, NULL); @@ -1089,21 +1086,21 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_float_copy(grp, "lineKernel", grid_line_size); DRW_shgroup_uniform_float_copy(grp, "meshSize", e_data.grid_mesh_size); DRW_shgroup_uniform_float(grp, "gridOneOverLogSubdiv", &e_data.grid_settings[4], 1); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); DRW_shgroup_call_add(grp, geom, mat); grp = DRW_shgroup_create(e_data.grid_sh, psl->grid); DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.grid_flag, 1); DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.grid_axes, 1); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); DRW_shgroup_call_add(grp, geom, mat); grp = DRW_shgroup_create(e_data.grid_sh, psl->grid); DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.zpos_flag, 1); DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.zplane_axes, 1); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); DRW_shgroup_call_add(grp, geom, mat); } @@ -1252,23 +1249,23 @@ static void OBJECT_cache_init(void *vedata) /* Wires (for loose edges) */ sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); - sgl->wire = shgroup_wire(sgl->non_meshes, ts.colorWire, sh); - sgl->wire_select = shgroup_wire(sgl->non_meshes, ts.colorSelect, sh); - sgl->wire_transform = shgroup_wire(sgl->non_meshes, ts.colorTransform, sh); - sgl->wire_active = shgroup_wire(sgl->non_meshes, ts.colorActive, sh); + sgl->wire = shgroup_wire(sgl->non_meshes, gb->colorWire, sh); + sgl->wire_select = shgroup_wire(sgl->non_meshes, gb->colorSelect, sh); + sgl->wire_transform = shgroup_wire(sgl->non_meshes, gb->colorTransform, sh); + sgl->wire_active = shgroup_wire(sgl->non_meshes, gb->colorActive, sh); /* Wire (duplicator) */ - sgl->wire_dupli = shgroup_wire(sgl->non_meshes, ts.colorDupli, sh); - sgl->wire_dupli_select = shgroup_wire(sgl->non_meshes, ts.colorDupliSelect, sh); + sgl->wire_dupli = shgroup_wire(sgl->non_meshes, gb->colorDupli, sh); + sgl->wire_dupli_select = shgroup_wire(sgl->non_meshes, gb->colorDupliSelect, sh); /* Points (loose points) */ sh = e_data.loose_points_sh; - sgl->points = shgroup_points(sgl->non_meshes, ts.colorWire, sh); - sgl->points_select = shgroup_points(sgl->non_meshes, ts.colorSelect, sh); - sgl->points_transform = shgroup_points(sgl->non_meshes, ts.colorTransform, sh); - sgl->points_active = shgroup_points(sgl->non_meshes, ts.colorActive, sh); + sgl->points = shgroup_points(sgl->non_meshes, gb->colorWire, sh); + sgl->points_select = shgroup_points(sgl->non_meshes, gb->colorSelect, sh); + sgl->points_transform = shgroup_points(sgl->non_meshes, gb->colorTransform, sh); + sgl->points_active = shgroup_points(sgl->non_meshes, gb->colorActive, sh); /* Points (duplicator) */ - sgl->points_dupli = shgroup_points(sgl->non_meshes, ts.colorDupli, sh); - sgl->points_dupli_select = shgroup_points(sgl->non_meshes, ts.colorDupliSelect, sh); + sgl->points_dupli = shgroup_points(sgl->non_meshes, gb->colorDupli, sh); + sgl->points_dupli_select = shgroup_points(sgl->non_meshes, gb->colorDupliSelect, sh); DRW_shgroup_state_disable(sgl->points, DRW_STATE_BLEND); DRW_shgroup_state_disable(sgl->points_select, DRW_STATE_BLEND); DRW_shgroup_state_disable(sgl->points_transform, DRW_STATE_BLEND); @@ -1288,18 +1285,18 @@ static void OBJECT_cache_init(void *vedata) geom = DRW_cache_single_line_get(); sgl->lamp_buflimit = shgroup_distance_lines_instance(sgl->non_meshes, geom); - sgl->lamp_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, ts.colorLampNoAlpha, &ts.sizeLampCenter); + sgl->lamp_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, gb->colorLampNoAlpha, &gb->sizeLampCenter); geom = DRW_cache_lamp_get(); - sgl->lamp_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircle); + sgl->lamp_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle); geom = DRW_cache_lamp_shadows_get(); - sgl->lamp_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircleShadow); + sgl->lamp_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircleShadow); geom = DRW_cache_lamp_sunrays_get(); - sgl->lamp_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircle); + sgl->lamp_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle); - sgl->lamp_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, ts.colorLamp); - sgl->lamp_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, ts.colorLamp); + sgl->lamp_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, gb->colorLamp); + sgl->lamp_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, gb->colorLamp); geom = DRW_cache_screenspace_circle_get(); sgl->lamp_area_sphere = shgroup_instance_screen_aligned(sgl->non_meshes, geom); @@ -1334,8 +1331,8 @@ static void OBJECT_cache_init(void *vedata) /* -------- STIPPLES ------- */ /* Relationship Lines */ - sgl->relationship_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, ts.colorWire); - sgl->constraint_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, ts.colorGridAxisZ); + sgl->relationship_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, gb->colorWire); + sgl->constraint_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, gb->colorGridAxisZ); /* Force Field Curve Guide End (here because of stipple) */ /* TODO port to shader stipple */ @@ -1389,28 +1386,28 @@ static void OBJECT_cache_init(void *vedata) grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); DRW_shgroup_uniform_float(grp, "size", &size, 1); DRW_shgroup_uniform_float(grp, "outlineWidth", &outlineWidth, 1); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorActive, 1); - DRW_shgroup_uniform_vec4(grp, "outlineColor", ts.colorOutline, 1); + DRW_shgroup_uniform_vec4(grp, "color", gb->colorActive, 1); + DRW_shgroup_uniform_vec4(grp, "outlineColor", gb->colorOutline, 1); stl->g_data->center_active = grp; /* Select */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorSelect, 1); + DRW_shgroup_uniform_vec4(grp, "color", gb->colorSelect, 1); stl->g_data->center_selected = grp; /* Deselect */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorDeselect, 1); + DRW_shgroup_uniform_vec4(grp, "color", gb->colorDeselect, 1); stl->g_data->center_deselected = grp; /* Select (library) */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrarySelect, 1); + DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrarySelect, 1); stl->g_data->center_selected_lib = grp; /* Deselect (library) */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); - DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrary, 1); + DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrary, 1); stl->g_data->center_deselected_lib = grp; } @@ -2797,14 +2794,14 @@ static void OBJECT_cache_populate_particles(Object *ob, DRW_shgroup_uniform_vec3(shgrp, "outlineColor", ma ? &ma->specr : def_sec_col, 1); DRW_shgroup_uniform_float(shgrp, "pixel_size", DRW_viewport_pixelsize_get(), 1); DRW_shgroup_uniform_float(shgrp, "size", &part->draw_size, 1); - DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp); + DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp); DRW_shgroup_call_add(shgrp, geom, mat); break; case PART_DRAW_CROSS: shgrp = DRW_shgroup_instance_create( e_data.part_prim_sh, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CROSS), e_data.particle_format); - DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp); + DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp); DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1); DRW_shgroup_uniform_int(shgrp, "screen_space", &screen_space[0], 1); break; @@ -2812,7 +2809,7 @@ static void OBJECT_cache_populate_particles(Object *ob, shgrp = DRW_shgroup_instance_create( e_data.part_prim_sh, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CIRC), e_data.particle_format); - DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp); + DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp); DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1); DRW_shgroup_uniform_int(shgrp, "screen_space", &screen_space[1], 1); break; diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index 41f31d0b716..d84c2197800 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -91,8 +91,6 @@ extern char datatoc_overlay_face_wireframe_geom_glsl[]; extern char datatoc_overlay_face_wireframe_frag_glsl[]; extern char datatoc_gpu_shader_depth_only_frag_glsl[]; -extern struct GlobalsUboStorage ts; /* draw_common.c */ - static int OVERLAY_sh_data_index_from_rv3d(const RegionView3D *rv3d) { if (rv3d->rflag & RV3D_CLIPPING) { @@ -293,40 +291,40 @@ static void overlay_cache_populate(void *vedata, Object *ob) const float *rim_col = NULL; const float *wire_col = NULL; if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) { - rim_col = ts.colorDupli; - wire_col = ts.colorDupli; + rim_col = G_draw.block.colorDupli; + wire_col = G_draw.block.colorDupli; } else if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) { if (ob->base_flag & BASE_SELECTED) { if (G.moving & G_TRANSFORM_OBJ) { - rim_col = ts.colorTransform; + rim_col = G_draw.block.colorTransform; } else { - rim_col = ts.colorDupliSelect; + rim_col = G_draw.block.colorDupliSelect; } } else { - rim_col = ts.colorDupli; + rim_col = G_draw.block.colorDupli; } - wire_col = ts.colorDupli; + wire_col = G_draw.block.colorDupli; } else if ((ob->base_flag & BASE_SELECTED) && (!is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage)) { if (G.moving & G_TRANSFORM_OBJ) { - rim_col = ts.colorTransform; + rim_col = G_draw.block.colorTransform; } else if (ob == draw_ctx->obact) { - rim_col = ts.colorActive; + rim_col = G_draw.block.colorActive; } else { - rim_col = ts.colorSelect; + rim_col = G_draw.block.colorSelect; } - wire_col = ts.colorWire; + wire_col = G_draw.block.colorWire; } else { - rim_col = ts.colorWire; - wire_col = ts.colorWire; + rim_col = G_draw.block.colorWire; + wire_col = G_draw.block.colorWire; } BLI_assert(rim_col && wire_col); diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c index 757b43b6c04..726b620a24f 100644 --- a/source/blender/draw/modes/paint_texture_mode.c +++ b/source/blender/draw/modes/paint_texture_mode.c @@ -51,12 +51,6 @@ extern char datatoc_paint_face_vert_glsl[]; extern char datatoc_gpu_shader_uniform_color_frag_glsl[]; -/* If needed, contains all global/Theme colors - * Add needed theme colors / values to DRW_globals_update() and update UBO - * Not needed for constant color. */ -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - /* *********** LISTS *********** */ /* All lists are per viewport specific datas. * They are all free when viewport changes engines @@ -209,7 +203,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata) DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces); DRW_shgroup_uniform_texture(grp, "image", tex); DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_bool_copy(grp, "nearestInterp", interp == SHD_INTERP_CLOSEST); stl->g_data->shgroup_image_array[i] = grp; } @@ -227,7 +221,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata) DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces); DRW_shgroup_uniform_texture(grp, "image", tex); DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1); - DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_bool_copy(grp, "nearestInterp", imapaint->interp == IMAGEPAINT_INTERP_CLOSEST); stl->g_data->shgroup_image_array[0] = grp; } @@ -245,7 +239,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE); stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay); - DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", G_draw.block_ubo); } { diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c index db3cd463d65..658631ea1ed 100644 --- a/source/blender/draw/modes/paint_vertex_mode.c +++ b/source/blender/draw/modes/paint_vertex_mode.c @@ -38,9 +38,6 @@ #include "DEG_depsgraph_query.h" -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - extern char datatoc_paint_vertex_vert_glsl[]; extern char datatoc_paint_vertex_frag_glsl[]; extern char datatoc_paint_wire_vert_glsl[]; @@ -141,7 +138,7 @@ static void PAINT_VERTEX_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE); stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay); - DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", G_draw.block_ubo); } { @@ -161,7 +158,7 @@ static void PAINT_VERTEX_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE); stl->g_data->vert_shgrp = DRW_shgroup_create(e_data.vert_overlay_shader, psl->vert_overlay); - DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo); } } diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index 0d6b2edba93..87e832ef585 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -40,11 +40,6 @@ #include "DEG_depsgraph_query.h" -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ -extern struct GlobalsUboStorage ts; /* draw_common.c */ - -extern struct GPUTexture *globals_weight_ramp; /* draw_common.c */ - extern char datatoc_paint_face_vert_glsl[]; extern char datatoc_paint_weight_vert_glsl[]; extern char datatoc_paint_weight_frag_glsl[]; @@ -142,8 +137,8 @@ static void PAINT_WEIGHT_cache_init(void *vedata) DRW_shgroup_uniform_bool_copy(stl->g_data->fweights_shgrp, "drawContours", (v3d->overlay.wpaint_flag & V3D_OVERLAY_WPAINT_CONTOURS) != 0); DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "opacity", &v3d->overlay.weight_paint_mode_opacity, 1); - DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", globals_weight_ramp); - DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", G_draw.weight_ramp); + DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", G_draw.block_ubo); } { @@ -152,7 +147,7 @@ static void PAINT_WEIGHT_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE); stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay); - DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", G_draw.block_ubo); } { @@ -172,7 +167,7 @@ static void PAINT_WEIGHT_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE); stl->g_data->vert_shgrp = DRW_shgroup_create(e_data.vert_overlay_shader, psl->vert_overlay); - DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo); } } diff --git a/source/blender/draw/modes/particle_mode.c b/source/blender/draw/modes/particle_mode.c index 758218fe329..e861e021b27 100644 --- a/source/blender/draw/modes/particle_mode.c +++ b/source/blender/draw/modes/particle_mode.c @@ -50,8 +50,6 @@ extern char datatoc_particle_strand_vert_glsl[]; extern char datatoc_particle_strand_frag_glsl[]; extern char datatoc_common_globals_lib_glsl[]; -extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ - /* *********** LISTS *********** */ typedef struct PARTICLE_PassList { @@ -147,9 +145,9 @@ static void particle_cache_init(void *vedata) stl->g_data->inner_points_group = DRW_shgroup_create(e_data.points_shader, psl->psys_edit_pass); stl->g_data->tip_points_group = DRW_shgroup_create(e_data.points_shader, psl->psys_edit_pass); - DRW_shgroup_uniform_block(stl->g_data->strands_group, "globalsBlock", globals_ubo); - DRW_shgroup_uniform_block(stl->g_data->inner_points_group, "globalsBlock", globals_ubo); - DRW_shgroup_uniform_block(stl->g_data->tip_points_group, "globalsBlock", globals_ubo); + DRW_shgroup_uniform_block(stl->g_data->strands_group, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_block(stl->g_data->inner_points_group, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_block(stl->g_data->tip_points_group, "globalsBlock", G_draw.block_ubo); } static void particle_edit_cache_populate(void *vedata, diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c index 6ee6f59e5fa..e0923675eec 100644 --- a/source/blender/draw/modes/pose_mode.c +++ b/source/blender/draw/modes/pose_mode.c @@ -37,7 +37,6 @@ #include "draw_mode_engines.h" -extern GlobalsUboStorage ts; /* *********** LISTS *********** */ /* All lists are per viewport specific datas. |