Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/draw/intern/draw_manager.c1
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c2
-rw-r--r--source/blender/editors/include/UI_resources.h5
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_region_hud.c3
-rw-r--r--source/blender/editors/interface/resources.c7
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/area.c5
-rw-r--r--source/blender/editors/screen/screen_draw.c4
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_clip/space_clip.c4
-rw-r--r--source/blender/editors/space_console/space_console.c1
-rw-r--r--source/blender/editors/space_file/space_file.c5
-rw-r--r--source/blender/editors/space_graph/space_graph.c10
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_draw.c1
-rw-r--r--source/blender/editors/space_info/space_info.c1
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/editors/space_node/node_draw.c4
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c1
-rw-r--r--source/blender/editors/space_script/space_script.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c7
-rw-r--r--source/blender/editors/space_text/space_text.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c1
-rw-r--r--source/blender/gpu/GPU_framebuffer.h1
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc14
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c4
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c6
-rw-r--r--source/blender/windowmanager/intern/wm_window.c5
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_draw.c2
33 files changed, 30 insertions, 86 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 5f3e981c92b..f6e65338fc7 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1593,7 +1593,6 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
* be to do that in the colormanagmeent shader. */
GPU_offscreen_bind(ofs, false);
GPU_clear_color(0.0f, 0.0f, 0.0f, 1.0f);
- GPU_clear(GPU_COLOR_BIT);
/* Premult Alpha over black background. */
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index ae9146b3a6a..eb4304a3746 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -455,7 +455,7 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
GPU_matrix_identity_set();
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
- GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
ED_view3d_update_viewmat(
tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->region, NULL, winmat, NULL, true);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 3f548f98e97..5e3c8feb333 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -431,12 +431,9 @@ void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3],
// (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color)
void UI_FontThemeColor(int fontid, int colorid);
-// clear the openGL ClearColor using the input colorid
+// clear the framebuffer using the input colorid
void UI_ThemeClearColor(int colorid);
-// clear the openGL ClearColor using the input colorid using optional transparency
-void UI_ThemeClearColorAlpha(int colorid, float alpha);
-
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 812aa25568a..4f3c36c0b3b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1442,10 +1442,6 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
void UI_panels_draw(const bContext *C, ARegion *region)
{
- if (region->alignment != RGN_ALIGN_FLOAT) {
- UI_ThemeClearColor(TH_BACK);
- }
-
/* Draw panels, selected on top. Also in reverse order, because
* UI blocks are added in reverse order and we need child panels
* to draw on top. */
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index 1773a7b3057..204653f047d 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -217,8 +217,7 @@ static void hud_region_draw(const bContext *C, ARegion *region)
{
UI_view2d_view_ortho(&region->v2d);
wmOrtho2_region_pixelspace(region);
- GPU_clear_color(0, 0, 0, 0.0f);
- GPU_clear(GPU_COLOR_BIT);
+ GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
if ((region->flag & RGN_FLAG_HIDDEN) == 0) {
ui_draw_menu_back(NULL,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 84fe3e13426..4c2b71514a4 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1474,13 +1474,6 @@ void UI_ThemeClearColor(int colorid)
GPU_clear_color(col[0], col[1], col[2], 1.0f);
}
-void UI_ThemeClearColorAlpha(int colorid, float alpha)
-{
- float col[3];
- UI_GetThemeColor3fv(colorid, col);
- GPU_clear_color(col[0], col[1], col[2], alpha);
-}
-
int UI_ThemeMenuShadowWidth(void)
{
bTheme *btheme = UI_GetTheme();
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 52a7b92217b..940ca963fc6 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -339,7 +339,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
GPU_offscreen_bind(oglrender->ofs, true);
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
- GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
GPU_matrix_reset();
wmOrtho2(0, scene->r.xsch, 0, scene->r.ysch);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 80fa5a7815d..921cc92299e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -351,11 +351,9 @@ static void region_draw_status_text(ScrArea *area, ARegion *region)
if (overlap) {
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
- GPU_clear(GPU_COLOR_BIT);
}
else {
UI_ThemeClearColor(TH_HEADER);
- GPU_clear(GPU_COLOR_BIT);
}
int fontid = BLF_set_default();
@@ -519,7 +517,6 @@ void ED_region_do_draw(bContext *C, ARegion *region)
if (area && area_is_pseudo_minimized(area)) {
UI_ThemeClearColor(TH_EDITOR_OUTLINE);
- GPU_clear(GPU_COLOR_BIT);
return;
}
/* optional header info instead? */
@@ -2529,11 +2526,9 @@ static void region_clear_color(const bContext *C, const ARegion *region, ThemeCo
float back[4];
UI_GetThemeColor4fv(colorid, back);
GPU_clear_color(back[3] * back[0], back[3] * back[1], back[3] * back[2], back[3]);
- GPU_clear(GPU_COLOR_BIT);
}
else {
UI_ThemeClearColor(colorid);
- GPU_clear(GPU_COLOR_BIT);
}
}
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 9bb14ee8c01..8ded845b008 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -606,8 +606,8 @@ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uin
GPUOffScreen *offscreen = GPU_offscreen_create(size_x, size_y, true, false, err_out);
GPU_offscreen_bind(offscreen, true);
- GPU_clear_color(0.0, 0.0, 0.0, 0.0);
- GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
+ GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
+ GPU_clear_depth(1.0f);
screen_preview_draw(screen, size_x, size_y);
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index db55eff8284..cd4197d1df8 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -191,7 +191,6 @@ static void action_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -278,7 +277,6 @@ static void action_channel_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index d27b80efd40..18df8774e09 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -926,7 +926,6 @@ static void clip_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
/* data... */
movieclip_main_area_set_view2d(C, region);
@@ -1054,7 +1053,6 @@ static void graph_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1099,7 +1097,6 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1172,7 +1169,6 @@ static void clip_channels_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 3a0125356f7..4b554e0c5c0 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -215,7 +215,6 @@ static void console_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index f520f91b89b..61d6d8bf678 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -449,7 +449,6 @@ static void file_main_region_draw(const bContext *C, ARegion *region)
FileSelectParams *params = ED_fileselect_get_params(sfile);
View2D *v2d = &region->v2d;
- float col[3];
/* Needed, because filelist is not initialized on loading */
if (!sfile->files || filelist_empty(sfile->files)) {
@@ -457,9 +456,7 @@ static void file_main_region_draw(const bContext *C, ARegion *region)
}
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- GPU_clear_color(col[0], col[1], col[2], 1.0f);
- GPU_clear(GPU_COLOR_BIT);
+ UI_ThemeClearColor(TH_BACK);
/* Allow dynamically sliders to be set, saves notifiers etc. */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 4e0f60544e6..a1e75e2b9b2 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -200,12 +200,9 @@ static void graph_main_region_draw(const bContext *C, ARegion *region)
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
View2D *v2d = &region->v2d;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- GPU_clear_color(col[0], col[1], col[2], 1.0f);
- GPU_clear(GPU_COLOR_BIT);
+ UI_ThemeClearColor(TH_BACK);
UI_view2d_view_ortho(v2d);
@@ -358,12 +355,9 @@ static void graph_channel_region_draw(const bContext *C, ARegion *region)
{
bAnimContext ac;
View2D *v2d = &region->v2d;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- GPU_clear_color(col[0], col[1], col[2], 1.0f);
- GPU_clear(GPU_COLOR_BIT);
+ UI_ThemeClearColor(TH_BACK);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 1f7929cea7b..a806e3e25d1 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -650,7 +650,6 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
GPU_framebuffer_bind(framebuffer_default);
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
- GPU_clear(GPU_COLOR_BIT);
GPU_framebuffer_bind(framebuffer_overlay);
@@ -661,7 +660,6 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
UI_GetThemeColor3fv(TH_BACK, col);
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(GPU_DEPTH_NONE);
image_user_refresh_scene(C, sima);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 72533b88406..595da97c75a 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -147,7 +147,6 @@ static int report_textview_begin(TextViewContext *tvc)
tvc->iter = reports->list.last;
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
tvc->iter_tmp = 0;
if (tvc->iter && report_textview_skip__internal(tvc)) {
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index b9153ec0cbd..8d3f21aefeb 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -142,7 +142,6 @@ static void info_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
/* quick way to avoid drawing if not bug enough */
if (region->winy < 16) {
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 7bbfe451eed..7a0cd35ece1 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -194,7 +194,6 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -238,7 +237,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 917bb8e75fd..56e53e79a8d 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1343,8 +1343,6 @@ static void node_draw_basis(const bContext *C,
}
}
- UI_ThemeClearColor(color_id);
-
UI_block_end(C, node->block);
UI_block_draw(C, node->block);
node->block = NULL;
@@ -1737,8 +1735,8 @@ void drawnodespace(const bContext *C, ARegion *region)
UI_view2d_view_ortho(v2d);
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
GPU_depth_test(GPU_DEPTH_NONE);
+ GPU_scissor_test(true);
/* XXX snode->cursor set in coordspace for placing new nodes, used for drawing noodles too */
UI_view2d_region_to_view(&region->v2d,
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 6854367d975..6a63c3c65c3 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -87,7 +87,6 @@ static void outliner_main_region_draw(const bContext *C, ARegion *region)
/* clear */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
draw_outliner(C);
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index 4d0c2b658c6..3c3f7dc1e8e 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -127,7 +127,6 @@ static void script_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 066ab3b1f23..bd4503dbe54 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1529,11 +1529,7 @@ static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
static void sequencer_preview_clear(void)
{
- float col[3];
-
- UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
- GPU_clear_color(col[0], col[1], col[2], 1.0f);
- GPU_clear(GPU_COLOR_BIT);
+ UI_ThemeClearColor(TH_SEQ_PREVIEW);
}
static void sequencer_preview_get_rect(rctf *preview,
@@ -2266,7 +2262,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
else {
GPU_clear_color(col[0], col[1], col[2], 0.0f);
}
- GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
/* Get timeline boundbox, needed for the scrollers. */
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index f6d00ec94bf..300f63761c0 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -296,7 +296,6 @@ static void text_main_region_draw(const bContext *C, ARegion *region)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- GPU_clear(GPU_COLOR_BIT);
// UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 4cc48dfd175..195199c45cd 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2319,7 +2319,7 @@ void ED_view3d_draw_depth_gpencil(Depsgraph *depsgraph, Scene *scene, ARegion *r
/* Setup view matrix. */
ED_view3d_draw_setup_view(NULL, NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL);
- GPU_clear(GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index d80e7f3c754..53f3694bf98 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -553,7 +553,6 @@ void ED_uvedit_draw_main(SpaceImage *sima,
view_layer, ((View3D *)NULL), &objects_len);
if (objects_len > 0) {
GPU_clear_depth(1.0f);
- GPU_clear(GPU_DEPTH_BIT);
}
/* go over all objects and create the batches + add their areas to the total */
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index 7103317e4d6..db25bbb7998 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -225,7 +225,6 @@ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs,
void GPU_clear_color(float red, float green, float blue, float alpha);
void GPU_clear_depth(float depth);
-void GPU_clear(eGPUFrameBufferBits flags);
void GPU_frontbuffer_read_pixels(
int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 305113d909d..88013640bfc 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -1117,18 +1117,22 @@ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs,
void GPU_clear_color(float red, float green, float blue, float alpha)
{
+ BLI_assert((GPU_write_mask_get() & GPU_WRITE_COLOR) != 0);
+
+ GPU_context_active_get()->state_manager->apply_state();
+
glClearColor(red, green, blue, alpha);
+ glClear(GL_COLOR_BUFFER_BIT);
}
void GPU_clear_depth(float depth)
{
- glClearDepth(depth);
-}
+ BLI_assert((GPU_write_mask_get() & GPU_WRITE_DEPTH) != 0);
-void GPU_clear(eGPUFrameBufferBits flags)
-{
GPU_context_active_get()->state_manager->apply_state();
- glClear(convert_buffer_bits_to_gl(flags));
+
+ glClearDepth(depth);
+ glClear(GL_DEPTH_BUFFER_BIT);
}
void GPU_frontbuffer_read_pixels(
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index f7fd1faeb1e..5ee97134015 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -339,7 +339,7 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
/* It's possible we don't want to clear depth buffer,
* so existing elements are masked by current z-buffer. */
- GPU_clear(GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
/* scratch buffer (read new values here) */
ps->gl.rect_depth_test = depth_buf_malloc(rect_len);
@@ -519,7 +519,7 @@ bool gpu_select_pick_load_id(uint id, bool end)
if (g_pick_state.mode == GPU_SELECT_PICK_ALL) {
/* we want new depths every time */
- GPU_clear(GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
}
}
}
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 2ca5cf39a90..45d52b22664 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -122,7 +122,7 @@ void gpu_select_query_begin(
else if (mode == GPU_SELECT_NEAREST_FIRST_PASS) {
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
GPU_depth_mask(true);
- GPU_clear(GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
}
else if (mode == GPU_SELECT_NEAREST_SECOND_PASS) {
GPU_depth_test(GPU_DEPTH_EQUAL);
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index ad08a085cf4..6c9bba0791c 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -720,8 +720,7 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
wm_draw_region_buffer_create(region, false, false);
wm_draw_region_bind(region, 0);
- GPU_clear_color(0, 0, 0, 0);
- GPU_clear(GPU_COLOR_BIT);
+ GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
ED_region_do_draw(C, region);
wm_draw_region_unbind(region);
@@ -744,7 +743,6 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
* If it becomes a problem we should clear only when window size changes. */
#if 0
GPU_clear_color(0, 0, 0, 0);
- GPU_clear(GPU_COLOR_BIT);
#endif
/* Blit non-overlapping area regions. */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 9d472ed4597..86d3f7f35dc 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -310,8 +310,7 @@ static void playanim_toscreen(
CLAMP(offs_x, 0.0f, 1.0f);
CLAMP(offs_y, 0.0f, 1.0f);
- GPU_clear_color(0.1, 0.1, 0.1, 0.0);
- GPU_clear(GPU_COLOR_BIT);
+ GPU_clear_color(0.1f, 0.1f, 0.1f, 0.0f);
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
@@ -1313,8 +1312,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
}
- GPU_clear_color(0.1, 0.1, 0.1, 0.0);
- GPU_clear(GPU_COLOR_BIT);
+ GPU_clear_color(0.1f, 0.1f, 0.1f, 0.0f);
int win_x, win_y;
playanim_window_get_size(&win_x, &win_y);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index ac00fc36a89..69c08427c4a 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -645,11 +645,10 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm,
GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
}
#endif
- /* until screens get drawn, make it nice gray */
- GPU_clear_color(0.55, 0.55, 0.55, 1.0f);
/* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */
if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
- GPU_clear(GPU_COLOR_BIT);
+ /* until screens get drawn, make it nice gray */
+ GPU_clear_color(0.55f, 0.55f, 0.55f, 1.0f);
}
/* needed here, because it's used before it reads userdef */
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
index 6f96d2ea6a0..5630d294e8d 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
@@ -126,7 +126,7 @@ void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata)
/* In case a framebuffer is still bound from drawing the last eye. */
GPU_framebuffer_restore();
/* Some systems have drawing glitches without this. */
- GPU_clear(GPU_DEPTH_BIT);
+ GPU_clear_depth(1.0f);
/* Draws the view into the surface_data->viewport's framebuffers */
ED_view3d_draw_offscreen_simple(draw_data->depsgraph,