GPUState: Use explicit depth test enum
This commit is contained in:
@@ -1314,15 +1314,15 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
/* annotations - temporary drawing buffer (3d space) */
|
||||
/* XXX: Or should we use a proper draw/overlay engine for this case? */
|
||||
if (do_annotations) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
/* XXX: as scene->gpd is not copied for COW yet */
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
drw_debug_draw();
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_POST_VIEW);
|
||||
|
||||
/* Callback can be nasty and do whatever they want with the state.
|
||||
@@ -1331,11 +1331,11 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
|
||||
/* needed so gizmo isn't obscured */
|
||||
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
DRW_draw_gizmo_3d();
|
||||
}
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
drw_engines_draw_text();
|
||||
|
||||
DRW_draw_region_info();
|
||||
@@ -1343,7 +1343,7 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
/* annotations - temporary drawing buffer (screenspace) */
|
||||
/* XXX: Or should we use a proper draw/overlay engine for this case? */
|
||||
if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (do_annotations)) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
/* XXX: as scene->gpd is not copied for COW yet */
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, false);
|
||||
}
|
||||
@@ -1351,18 +1351,18 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
|
||||
/* Draw 2D after region info so we can draw on top of the camera passepartout overlay.
|
||||
* 'DRW_draw_region_info' sets the projection in pixel-space. */
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
DRW_draw_gizmo_2d();
|
||||
}
|
||||
|
||||
if (G.debug_value > 20 && G.debug_value < 30) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
/* local coordinate visible rect inside region, to accommodate overlapping ui */
|
||||
const rcti *rect = ED_region_visible_rect(DST.draw_ctx.region);
|
||||
DRW_stats_draw(rect);
|
||||
}
|
||||
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2438,7 +2438,7 @@ void DRW_draw_depth_object(
|
||||
|
||||
GPU_framebuffer_bind(fbl->depth_only_fb);
|
||||
GPU_framebuffer_clear_depth(fbl->depth_only_fb, 1.0f);
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
const float(*world_clip_planes)[4] = NULL;
|
||||
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
|
||||
@@ -2485,7 +2485,7 @@ void DRW_draw_depth_object(
|
||||
}
|
||||
|
||||
GPU_matrix_set(rv3d->viewmat);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
GPU_framebuffer_restore();
|
||||
DRW_opengl_context_disable();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void DRW_draw_cursor(void)
|
||||
|
||||
GPU_color_mask(true, true, true, true);
|
||||
GPU_depth_mask(false);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
if (is_cursor_visible(draw_ctx, scene, view_layer)) {
|
||||
int co[2];
|
||||
|
||||
@@ -419,7 +419,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPU_line_smooth(true);
|
||||
GPU_line_width(3.0f);
|
||||
@@ -441,7 +441,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
|
||||
immEnd();
|
||||
|
||||
/* Reset defaults */
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
GPU_line_smooth(false);
|
||||
|
||||
|
||||
@@ -84,13 +84,13 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info,
|
||||
* since it causes issues leaving the GL state modified. */
|
||||
#if 0
|
||||
GPU_face_culling(GPU_CULL_BACK);
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
#endif
|
||||
|
||||
GPU_batch_draw(batch);
|
||||
|
||||
#if 0
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
GPU_face_culling(GPU_CULL_NONE);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -556,7 +556,7 @@ static void annotation_draw_strokes(const bGPDframe *gpf,
|
||||
const int no_xray = (dflag & GP_DRAWDATA_NO_XRAY);
|
||||
|
||||
if (no_xray) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
/* first arg is normally rv3d->dist, but this isn't
|
||||
* available here and seems to work quite well without */
|
||||
@@ -574,7 +574,7 @@ static void annotation_draw_strokes(const bGPDframe *gpf,
|
||||
}
|
||||
|
||||
if (no_xray) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_polygon_offset(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw)
|
||||
const int no_xray = (tgpw->dflag & GP_DRAWDATA_NO_XRAY);
|
||||
|
||||
if (no_xray) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
/* first arg is normally rv3d->dist, but this isn't
|
||||
* available here and seems to work quite well without */
|
||||
@@ -393,7 +393,7 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw)
|
||||
}
|
||||
}
|
||||
if (no_xray) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_polygon_offset(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ static void knife_init_colors(KnifeColors *colors)
|
||||
static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
|
||||
{
|
||||
const KnifeTool_OpData *kcd = arg;
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_matrix_push_projection();
|
||||
GPU_polygon_offset(1.0f, 1.0f);
|
||||
@@ -1222,7 +1222,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v
|
||||
GPU_matrix_pop_projection();
|
||||
|
||||
/* Reset default */
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -159,7 +159,7 @@ void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const fl
|
||||
return;
|
||||
}
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_mul(matrix);
|
||||
@@ -197,7 +197,7 @@ void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const fl
|
||||
GPU_matrix_pop();
|
||||
|
||||
/* Reset default */
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
static void view3d_preselect_mesh_edgering_update_verts_from_edge(
|
||||
|
||||
@@ -133,7 +133,7 @@ void EDBM_preselect_elem_draw(struct EditMesh_PreSelElem *psel, const float matr
|
||||
return;
|
||||
}
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_mul(matrix);
|
||||
@@ -204,7 +204,7 @@ void EDBM_preselect_elem_draw(struct EditMesh_PreSelElem *psel, const float matr
|
||||
GPU_matrix_pop();
|
||||
|
||||
/* Reset default */
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
static void view3d_preselect_mesh_elem_update_from_vert(struct EditMesh_PreSelElem *psel,
|
||||
|
||||
@@ -566,7 +566,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups,
|
||||
|
||||
if (load_tex(brush, vc, zoom, col, primary)) {
|
||||
GPU_color_mask(true, true, true, true);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
|
||||
GPU_matrix_push();
|
||||
@@ -693,7 +693,7 @@ static bool paint_draw_cursor_overlay(
|
||||
float center[2];
|
||||
|
||||
GPU_color_mask(true, true, true, true);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
if (ups->draw_anchored) {
|
||||
copy_v2_v2(center, ups->anchored_initial_mouse);
|
||||
@@ -776,7 +776,7 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups,
|
||||
|
||||
ePaintOverlayControlFlags flags = BKE_paint_get_overlay_flags();
|
||||
eGPUBlend blend_state = GPU_blend_get();
|
||||
bool depth_test = GPU_depth_test_enabled();
|
||||
eGPUDepthTest depth_test = GPU_depth_test_get();
|
||||
|
||||
/* Translate to region. */
|
||||
GPU_matrix_push();
|
||||
@@ -1147,9 +1147,9 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr,
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.6f);
|
||||
|
||||
/* Cursor normally draws on top, but for this part we need depth tests. */
|
||||
const bool depth_test = GPU_depth_test_enabled();
|
||||
const eGPUDepthTest depth_test = GPU_depth_test_get();
|
||||
if (!depth_test) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
GPU_line_width(1.0f);
|
||||
@@ -1163,7 +1163,7 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr,
|
||||
|
||||
/* Restore depth test value. */
|
||||
if (!depth_test) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
|
||||
srgb_to_linearrgb_v3_v3(col, col);
|
||||
GPU_clear_color(col[0], col[1], col[2], 1.0f);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
image_user_refresh_scene(C, sima);
|
||||
|
||||
|
||||
@@ -1738,7 +1738,7 @@ void drawnodespace(const bContext *C, ARegion *region)
|
||||
UI_view2d_view_ortho(v2d);
|
||||
UI_ThemeClearColor(TH_BACK);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
/* XXX snode->cursor set in coordspace for placing new nodes, used for drawing noodles too */
|
||||
UI_view2d_region_to_view(®ion->v2d,
|
||||
|
||||
@@ -1772,7 +1772,7 @@ void sequencer_draw_preview(const bContext *C,
|
||||
|
||||
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
||||
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
|
||||
sequencer_preview_clear();
|
||||
|
||||
@@ -1618,7 +1618,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *region)
|
||||
GPU_pass_cache_garbage_collect();
|
||||
|
||||
/* No depth test for drawing action zones afterwards. */
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
v3d->flag |= V3D_INVALID_BACKBUF;
|
||||
}
|
||||
@@ -2321,12 +2321,12 @@ void ED_view3d_draw_depth_gpencil(Depsgraph *depsgraph, Scene *scene, ARegion *r
|
||||
|
||||
GPU_clear(GPU_DEPTH_BIT);
|
||||
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
||||
DRW_draw_depth_loop_gpencil(depsgraph, region, v3d, viewport);
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
|
||||
/* *********************** customdata **************** */
|
||||
|
||||
@@ -586,23 +586,23 @@ static void draw_primitive_view(const struct bContext *C, ARegion *UNUSED(region
|
||||
UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, color);
|
||||
|
||||
const bool use_depth = !XRAY_ENABLED(ipd->v3d);
|
||||
const bool depth_test_enabled = GPU_depth_test_enabled();
|
||||
const eGPUDepthTest depth_test_enabled = GPU_depth_test_get();
|
||||
|
||||
if (use_depth) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
color[3] = 0.15f;
|
||||
draw_primitive_view_impl(C, ipd, color);
|
||||
}
|
||||
|
||||
if (use_depth) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
color[3] = 1.0f;
|
||||
draw_primitive_view_impl(C, ipd, color);
|
||||
|
||||
if (use_depth) {
|
||||
if (depth_test_enabled == false) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ int view3d_opengl_select(ViewContext *vc,
|
||||
wm, vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, NULL, &rect);
|
||||
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
/* If in xray mode, we select the wires in priority. */
|
||||
@@ -1165,7 +1165,7 @@ int view3d_opengl_select(ViewContext *vc,
|
||||
wm, vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, NULL, NULL);
|
||||
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
|
||||
DRW_opengl_context_disable();
|
||||
|
||||
@@ -785,7 +785,6 @@ void drawConstraint(TransInfo *t)
|
||||
else {
|
||||
if (tc->mode & CON_SELECT) {
|
||||
float vec[3];
|
||||
int depth_test_enabled;
|
||||
|
||||
convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1]));
|
||||
add_v3_v3(vec, t->center_global);
|
||||
@@ -794,9 +793,9 @@ void drawConstraint(TransInfo *t)
|
||||
drawLine(t, t->center_global, t->spacemtx[1], 'Y', 0);
|
||||
drawLine(t, t->center_global, t->spacemtx[2], 'Z', 0);
|
||||
|
||||
depth_test_enabled = GPU_depth_test_enabled();
|
||||
eGPUDepthTest depth_test_enabled = GPU_depth_test_get();
|
||||
if (depth_test_enabled) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
|
||||
const uint shdr_pos = GPU_vertformat_attr_add(
|
||||
@@ -821,7 +820,7 @@ void drawConstraint(TransInfo *t)
|
||||
immUnbindProgram();
|
||||
|
||||
if (depth_test_enabled) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +842,6 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
|
||||
if (t->flag & T_PROP_EDIT) {
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
float tmat[4][4], imat[4][4];
|
||||
int depth_test_enabled;
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
|
||||
copy_m4_m4(tmat, rv3d->viewmat);
|
||||
@@ -873,9 +871,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
|
||||
GPU_matrix_scale_2f(1.0f, (ysize / xsize) * (xmask / ymask));
|
||||
}
|
||||
|
||||
depth_test_enabled = GPU_depth_test_enabled();
|
||||
eGPUDepthTest depth_test_enabled = GPU_depth_test_get();
|
||||
if (depth_test_enabled) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
@@ -899,7 +897,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
|
||||
immUnbindProgram();
|
||||
|
||||
if (depth_test_enabled) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
GPU_matrix_pop();
|
||||
|
||||
@@ -1343,7 +1343,7 @@ void drawDial3d(const TransInfo *t)
|
||||
BLI_assert(axis_idx >= MAN_AXIS_RANGE_ROT_START && axis_idx < MAN_AXIS_RANGE_ROT_END);
|
||||
gizmo_get_axis_color(axis_idx, NULL, color, color);
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPU_line_smooth(true);
|
||||
|
||||
@@ -1359,7 +1359,7 @@ void drawDial3d(const TransInfo *t)
|
||||
});
|
||||
|
||||
GPU_line_smooth(false);
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1147,7 +1147,7 @@ void drawEdgeSlide(TransInfo *t)
|
||||
|
||||
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
@@ -1266,7 +1266,7 @@ void drawEdgeSlide(TransInfo *t)
|
||||
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
static void edge_slide_snap_apply(TransInfo *t, float *value)
|
||||
|
||||
@@ -390,7 +390,7 @@ void drawVertSlide(TransInfo *t)
|
||||
const int alpha_shade = -160;
|
||||
int i;
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
@@ -485,7 +485,7 @@ void drawVertSlide(TransInfo *t)
|
||||
|
||||
GPU_matrix_pop();
|
||||
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
const float *loc_prev = NULL;
|
||||
const float *normal = NULL;
|
||||
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
if (!BLI_listbase_is_empty(&t->tsnap.points)) {
|
||||
@@ -228,7 +228,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
ED_gizmotypes_snap_3d_draw_util(
|
||||
rv3d, loc_prev, loc_cur, normal, col, activeCol, t->tsnap.snapElem);
|
||||
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
|
||||
@@ -451,13 +451,13 @@ static void draw_uvs(SpaceImage *sima,
|
||||
GPU_batch_program_set_builtin(batch->edges, shader);
|
||||
|
||||
/* Inner Line. Use depth test to insure selection is drawn on top. */
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
GPU_line_width(1.0f);
|
||||
GPU_batch_uniform_4fv(batch->edges, "edgeColor", col1);
|
||||
GPU_batch_uniform_4fv(batch->edges, "selectColor", col2);
|
||||
GPU_batch_uniform_1f(batch->edges, "dashWidth", dash_width);
|
||||
GPU_batch_draw(batch->edges);
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
GPU_provoking_vertex(GPU_VERTEX_LAST);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ typedef enum eGPUBlend {
|
||||
|
||||
typedef enum eGPUDepthTest {
|
||||
GPU_DEPTH_NONE = 0,
|
||||
GPU_DEPTH_ALWAYS,
|
||||
GPU_DEPTH_ALWAYS, /* Used to draw to the depth buffer without really testing. */
|
||||
GPU_DEPTH_LESS,
|
||||
GPU_DEPTH_LESS_EQUAL,
|
||||
GPU_DEPTH_LESS_EQUAL, /* Default. */
|
||||
GPU_DEPTH_EQUAL,
|
||||
GPU_DEPTH_GREATER,
|
||||
GPU_DEPTH_GREATER_EQUAL,
|
||||
@@ -106,11 +106,10 @@ extern "C" {
|
||||
|
||||
void GPU_blend(eGPUBlend blend);
|
||||
void GPU_face_culling(eGPUFaceCullTest culling);
|
||||
void GPU_front_facing(bool invert);
|
||||
void GPU_depth_test(eGPUDepthTest test);
|
||||
void GPU_provoking_vertex(eGPUProvokingVertex vert);
|
||||
void GPU_front_facing(bool invert);
|
||||
void GPU_depth_range(float near, float far);
|
||||
void GPU_depth_test(bool enable);
|
||||
bool GPU_depth_test_enabled(void);
|
||||
void GPU_scissor_test(bool enable);
|
||||
void GPU_line_smooth(bool enable);
|
||||
void GPU_line_width(float width);
|
||||
@@ -144,6 +143,7 @@ void GPU_stencil_write_mask_set(uint write_mask);
|
||||
void GPU_stencil_compare_mask_set(uint compare_mask);
|
||||
|
||||
eGPUBlend GPU_blend_get(void);
|
||||
eGPUDepthTest GPU_depth_test_get(void);
|
||||
eGPUWriteMask GPU_write_mask_get(void);
|
||||
|
||||
void GPU_flush(void);
|
||||
|
||||
@@ -287,7 +287,7 @@ typedef struct GPUPickState {
|
||||
int viewport[4];
|
||||
int scissor[4];
|
||||
eGPUWriteMask write_mask;
|
||||
bool depth_test;
|
||||
eGPUDepthTest depth_test;
|
||||
} GPUPickState;
|
||||
|
||||
static GPUPickState g_pick_state = {0};
|
||||
@@ -311,7 +311,7 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
|
||||
/* Restrict OpenGL operations for when we don't have cache */
|
||||
if (ps->is_cached == false) {
|
||||
ps->write_mask = GPU_write_mask_get();
|
||||
ps->depth_test = GPU_depth_test_enabled();
|
||||
ps->depth_test = GPU_depth_test_get();
|
||||
GPU_scissor_get(ps->scissor);
|
||||
|
||||
/* disable writing to the framebuffer */
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct GPUQueryState {
|
||||
int viewport[4];
|
||||
int scissor[4];
|
||||
eGPUWriteMask write_mask;
|
||||
bool depth_test;
|
||||
eGPUDepthTest depth_test;
|
||||
} GPUQueryState;
|
||||
|
||||
static GPUQueryState g_query_state = {0};
|
||||
@@ -91,7 +91,7 @@ void gpu_select_query_begin(
|
||||
glGenQueries(g_query_state.num_of_queries, g_query_state.queries);
|
||||
|
||||
g_query_state.write_mask = GPU_write_mask_get();
|
||||
g_query_state.depth_test = GPU_depth_test_enabled();
|
||||
g_query_state.depth_test = GPU_depth_test_get();
|
||||
GPU_scissor_get(g_query_state.scissor);
|
||||
|
||||
/* disable writing to the framebuffer */
|
||||
|
||||
@@ -74,10 +74,9 @@ void GPU_provoking_vertex(eGPUProvokingVertex vert)
|
||||
SET_IMMUTABLE_STATE(provoking_vert, vert);
|
||||
}
|
||||
|
||||
/* TODO explicit depth test. */
|
||||
void GPU_depth_test(bool enable)
|
||||
void GPU_depth_test(eGPUDepthTest test)
|
||||
{
|
||||
SET_IMMUTABLE_STATE(depth_test, (enable) ? GPU_DEPTH_LESS_EQUAL : GPU_DEPTH_NONE);
|
||||
SET_IMMUTABLE_STATE(depth_test, test);
|
||||
}
|
||||
|
||||
void GPU_line_smooth(bool enable)
|
||||
@@ -240,10 +239,10 @@ eGPUWriteMask GPU_write_mask_get()
|
||||
return (eGPUWriteMask)state.write_mask;
|
||||
}
|
||||
|
||||
bool GPU_depth_test_enabled()
|
||||
eGPUDepthTest GPU_depth_test_get()
|
||||
{
|
||||
GPUState &state = GPU_context_active_get()->state_manager->state;
|
||||
return state.depth_test != GPU_DEPTH_NONE;
|
||||
return (eGPUDepthTest)state.depth_test;
|
||||
}
|
||||
|
||||
void GPU_scissor_get(int coords[4])
|
||||
|
||||
@@ -470,10 +470,10 @@ static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBas
|
||||
}
|
||||
else {
|
||||
if (is_depth) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
else {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
is_depth_prev = is_depth;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBas
|
||||
}
|
||||
|
||||
if (is_depth_prev) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,10 +534,10 @@ static void gizmo_draw_select_3d_loop(const bContext *C,
|
||||
}
|
||||
else {
|
||||
if (is_depth) {
|
||||
GPU_depth_test(true);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
else {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
is_depth_prev = is_depth;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ static void gizmo_draw_select_3d_loop(const bContext *C,
|
||||
}
|
||||
|
||||
if (is_depth_prev) {
|
||||
GPU_depth_test(false);
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
if (is_depth_skip_prev) {
|
||||
GPU_depth_mask(true);
|
||||
|
||||
Reference in New Issue
Block a user