Fix T73442 Overlay: Wireframe infront buggy in material shading mode

This was caused by the refactor. The wireframe was drawn with the incorrect
depth buffer.

Should be included in 2.82
This commit is contained in:
Clément Foucault 2020-02-11 18:37:21 +01:00
parent 5a2a888fa0
commit 77d23b0bd7
Notes: blender-bot 2023-04-29 23:11:52 +02:00
Referenced by issue #85061, Blender freezes, but does not crash
Referenced by issue #83420, Closing Preferences Panel crashes Blender
Referenced by issue #83272, Evee does not show textures in view port  or render properly
Referenced by issue #81908, Blender 2.90.1 lags and crashes unpredictably
Referenced by issue #77188, Bevel modifier with an odd number of bevel segments along material border causes strange material assignment
Referenced by issue #75911, Crash when switching to sculpt mode with multiresolution modifier is enabled
Referenced by issue #74905, Transform gizmos having low opacity behind meshes.
Referenced by issue #74424, Crash rendering animation
Referenced by issue #74407, Using MeshDeform Modifier and Amature Modifier at the same time,will cause deformed object not following bones.
Referenced by issue #74194, Crash when play after delete a grease pencil layer in dopesheet
Referenced by issue #74118, blender 2.82 Blender 2.82 (sub 7) - Ubuntu 14.04 LTS  -   immediate crash on startup
Referenced by issue #74111, Animation Playback Delayed With Time Remapping And AV-Sync
Referenced by issue #73894, Eevee render freezes the windows while it's rendering
Referenced by issue #73442, Material Preview and Render Preview Wireframe culling not working when "In Front" is toggled
Referenced by issue #65924, Cycles Render Crash Windows/AMD RX Vega
Referenced by issue #107473, Regression: Nodes: Selection of node affected on sorting -> correctness validation of links
1 changed files with 16 additions and 4 deletions

View File

@ -65,7 +65,7 @@ void OVERLAY_wireframe_cache_init(OVERLAY_Data *vedata)
GPUShader *wires_sh = use_select ? OVERLAY_shader_wireframe_select() :
OVERLAY_shader_wireframe();
for (int xray = 0; xray < 2; xray++) {
for (int xray = 0; xray < (is_material_shmode ? 1 : 2); xray++) {
/* Only do stencil test if stencil buffer is written by the render engine. */
DRWState stencil_state = is_material_shmode ? 0 : DRW_STATE_STENCIL_EQUAL;
DRWState state = DRW_STATE_FIRST_VERTEX_CONVENTION | DRW_STATE_WRITE_COLOR |
@ -104,6 +104,16 @@ void OVERLAY_wireframe_cache_init(OVERLAY_Data *vedata)
DRW_shgroup_uniform_bool_copy(grp, "useColoring", false);
DRW_shgroup_stencil_mask(grp, stencil_mask);
}
if (is_material_shmode) {
/* Make all drawcalls go into the non-xray shading groups. */
for (int use_coloring = 0; use_coloring < 2; use_coloring++) {
pd->wires_grp[1][use_coloring] = pd->wires_grp[0][use_coloring];
pd->wires_all_grp[1][use_coloring] = pd->wires_all_grp[0][use_coloring];
}
pd->wires_sculpt_grp[1] = pd->wires_sculpt_grp[0];
psl->wireframe_xray_ps = NULL;
}
}
void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
@ -237,8 +247,10 @@ void OVERLAY_wireframe_in_front_draw(OVERLAY_Data *data)
OVERLAY_PassList *psl = data->psl;
OVERLAY_PrivateData *pd = data->stl->pd;
DRW_view_set_active(pd->view_wires);
DRW_draw_pass(psl->wireframe_xray_ps);
if (psl->wireframe_xray_ps) {
DRW_view_set_active(pd->view_wires);
DRW_draw_pass(psl->wireframe_xray_ps);
DRW_view_set_active(NULL);
DRW_view_set_active(NULL);
}
}