diff options
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_deferred.c | 5 | ||||
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 14 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_mesh_mode.c | 80 |
3 files changed, 51 insertions, 48 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 44bc35bfc41..68f93a51425 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -641,10 +641,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) } DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); - if (draw_ctx->rv3d && - (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && - draw_ctx->rv3d->clipbb) - { + if (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb) { GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND); grp = DRW_shgroup_create(shader, psl->background_pass); wpd->world_clip_planes_batch = DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 4280359976e..22d740bd512 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -291,16 +291,20 @@ typedef enum { DRW_STATE_CULL_FRONT = (1 << 9), DRW_STATE_WIRE = (1 << 10), DRW_STATE_POINT = (1 << 11), - DRW_STATE_OFFSET_POSITIVE = (1 << 12), /* Polygon offset. Does not work with lines and points. */ - DRW_STATE_OFFSET_NEGATIVE = (1 << 13), /* Polygon offset. Does not work with lines and points. */ + /** Polygon offset. Does not work with lines and points. */ + DRW_STATE_OFFSET_POSITIVE = (1 << 12), + /** Polygon offset. Does not work with lines and points. */ + DRW_STATE_OFFSET_NEGATIVE = (1 << 13), /* DRW_STATE_STIPPLE_4 = (1 << 14), */ /* Not used */ DRW_STATE_BLEND = (1 << 15), DRW_STATE_ADDITIVE = (1 << 16), DRW_STATE_MULTIPLY = (1 << 17), /* DRW_STATE_TRANSMISSION = (1 << 18), */ /* Not used */ DRW_STATE_CLIP_PLANES = (1 << 19), - DRW_STATE_ADDITIVE_FULL = (1 << 20), /* Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */ - DRW_STATE_BLEND_PREMUL = (1 << 21), /* Use that if color is already premult by alpha. */ + /** Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */ + DRW_STATE_ADDITIVE_FULL = (1 << 20), + /** Use that if color is already premult by alpha. */ + DRW_STATE_BLEND_PREMUL = (1 << 21), DRW_STATE_WIRE_SMOOTH = (1 << 22), DRW_STATE_TRANS_FEEDBACK = (1 << 23), DRW_STATE_BLEND_OIT = (1 << 24), @@ -598,7 +602,7 @@ typedef struct DRWContextState { eDRW_ShaderSlot shader_slot; - /* Last resort (some functions take this as an arg so we can't easily avoid). + /** Last resort (some functions take this as an arg so we can't easily avoid). * May be NULL when used for selection or depth buffer. */ const struct bContext *evil_C; diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 48a3d003a37..fcc841f2ff5 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -364,68 +364,70 @@ static DRWPass *edit_mesh_create_overlay_pass( "Edit Mesh Face Overlay Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_POINT | statemod); + DRWShadingGroup *grp; + 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", 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); - DRW_shgroup_state_disable(*r_lverts_shgrp, DRW_STATE_BLEND); + grp = *r_lverts_shgrp = DRW_shgroup_create(sh_data->overlay_lvert, pass); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1); + DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH); + DRW_shgroup_state_disable(grp, DRW_STATE_BLEND); if (rv3d->rflag & RV3D_CLIPPING) { - DRW_shgroup_world_clip_planes_from_rv3d(*r_lverts_shgrp, rv3d); + DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d); } - *r_verts_shgrp = DRW_shgroup_create(sh_data->overlay_vert, pass); - 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); - DRW_shgroup_state_disable(*r_verts_shgrp, DRW_STATE_BLEND); + grp = *r_verts_shgrp = DRW_shgroup_create(sh_data->overlay_vert, pass); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1); + DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH); + DRW_shgroup_state_disable(grp, DRW_STATE_BLEND); if (rv3d->rflag & RV3D_CLIPPING) { - DRW_shgroup_world_clip_planes_from_rv3d(*r_verts_shgrp, rv3d); + DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d); } } 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", 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); + grp = *r_facedot_shgrp = DRW_shgroup_create(sh_data->overlay_facedot, pass); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1); + DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH); if (rv3d->rflag & RV3D_CLIPPING) { - DRW_shgroup_world_clip_planes_from_rv3d(*r_facedot_shgrp, rv3d); + DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d); } } - *r_face_shgrp = DRW_shgroup_create(tri_sh, pass); - 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); - DRW_shgroup_uniform_ivec4(*r_face_shgrp, "dataMask", data_mask, 1); - DRW_shgroup_uniform_bool_copy(*r_face_shgrp, "doEdges", do_edges); + grp = *r_face_shgrp = DRW_shgroup_create(tri_sh, pass); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_float(grp, "faceAlphaMod", face_alpha, 1); + DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1); + DRW_shgroup_uniform_ivec4(grp, "dataMask", data_mask, 1); + DRW_shgroup_uniform_bool_copy(grp, "doEdges", do_edges); if (!fast_mode) { - DRW_shgroup_uniform_bool_copy(*r_face_shgrp, "isXray", xray); + DRW_shgroup_uniform_bool_copy(grp, "isXray", xray); } else { /* To be able to use triple load. */ - DRW_shgroup_state_enable(*r_face_shgrp, DRW_STATE_FIRST_VERTEX_CONVENTION); + DRW_shgroup_state_enable(grp, DRW_STATE_FIRST_VERTEX_CONVENTION); } if (rv3d->rflag & RV3D_CLIPPING) { - DRW_shgroup_world_clip_planes_from_rv3d(*r_face_shgrp, rv3d); + DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d); } /* Cage geom needs to be offseted to avoid Z-fighting. */ - *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp); - 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", 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); - DRW_shgroup_uniform_bool_copy(*r_ledges_shgrp, "doEdges", do_edges); + grp = *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp); + DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE); + + grp = *r_ledges_shgrp = DRW_shgroup_create(ledge_sh, pass); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1); + DRW_shgroup_uniform_ivec4(grp, "dataMask", data_mask, 1); + DRW_shgroup_uniform_bool_copy(grp, "doEdges", do_edges); if (rv3d->rflag & RV3D_CLIPPING) { - DRW_shgroup_world_clip_planes_from_rv3d(*r_ledges_shgrp, rv3d); + DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d); } return pass; |