Cleanup: GPU: Remove Batch vao cache reset
This is done at drawtime automatically.
This commit is contained in:
Submodule release/datafiles/locale updated: a7bbfac76c...4af22e0492
Submodule release/scripts/addons updated: 82ed41ec63...25b00a0a52
@@ -43,7 +43,6 @@ void BLF_exit(void);
|
|||||||
void BLF_default_dpi(int dpi);
|
void BLF_default_dpi(int dpi);
|
||||||
void BLF_default_set(int fontid);
|
void BLF_default_set(int fontid);
|
||||||
int BLF_default(void); /* get default font ID so we can pass it to other functions */
|
int BLF_default(void); /* get default font ID so we can pass it to other functions */
|
||||||
void BLF_batch_reset(void); /* call when changing opengl context. */
|
|
||||||
|
|
||||||
void BLF_cache_clear(void);
|
void BLF_cache_clear(void);
|
||||||
|
|
||||||
|
@@ -125,11 +125,6 @@ void BLF_exit(void)
|
|||||||
blf_font_exit();
|
blf_font_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLF_batch_reset(void)
|
|
||||||
{
|
|
||||||
blf_batch_draw_vao_clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BLF_cache_clear(void)
|
void BLF_cache_clear(void)
|
||||||
{
|
{
|
||||||
FontBLF *font;
|
FontBLF *font;
|
||||||
|
@@ -113,13 +113,6 @@ static void blf_batch_draw_exit(void)
|
|||||||
GPU_BATCH_DISCARD_SAFE(g_batch.batch);
|
GPU_BATCH_DISCARD_SAFE(g_batch.batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blf_batch_draw_vao_clear(void)
|
|
||||||
{
|
|
||||||
if (g_batch.batch) {
|
|
||||||
GPU_batch_vao_cache_clear(g_batch.batch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void blf_batch_draw_begin(FontBLF *font)
|
void blf_batch_draw_begin(FontBLF *font)
|
||||||
{
|
{
|
||||||
if (g_batch.batch == NULL) {
|
if (g_batch.batch == NULL) {
|
||||||
|
@@ -30,7 +30,6 @@ struct ResultBLF;
|
|||||||
struct rctf;
|
struct rctf;
|
||||||
struct rcti;
|
struct rcti;
|
||||||
|
|
||||||
void blf_batch_draw_vao_clear(void);
|
|
||||||
void blf_batch_draw_begin(struct FontBLF *font);
|
void blf_batch_draw_begin(struct FontBLF *font);
|
||||||
void blf_batch_draw(void);
|
void blf_batch_draw(void);
|
||||||
|
|
||||||
|
@@ -152,18 +152,6 @@ void DRW_shape_cache_free(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DRW_shape_cache_reset(void)
|
|
||||||
{
|
|
||||||
uint i = sizeof(SHC) / sizeof(GPUBatch *);
|
|
||||||
GPUBatch **batch = (GPUBatch **)&SHC;
|
|
||||||
while (i--) {
|
|
||||||
if (*batch) {
|
|
||||||
GPU_batch_vao_cache_clear(*batch);
|
|
||||||
}
|
|
||||||
batch++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Procedural Batches
|
/** \name Procedural Batches
|
||||||
* \{ */
|
* \{ */
|
||||||
|
@@ -33,7 +33,6 @@ struct VolumeGrid;
|
|||||||
struct bGPDstroke;
|
struct bGPDstroke;
|
||||||
|
|
||||||
void DRW_shape_cache_free(void);
|
void DRW_shape_cache_free(void);
|
||||||
void DRW_shape_cache_reset(void);
|
|
||||||
|
|
||||||
/* 3D cursor */
|
/* 3D cursor */
|
||||||
struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines);
|
struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines);
|
||||||
|
@@ -72,8 +72,7 @@ BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo)
|
|||||||
*ibo = GPU_indexbuf_calloc();
|
*ibo = GPU_indexbuf_calloc();
|
||||||
}
|
}
|
||||||
if (batch != NULL) {
|
if (batch != NULL) {
|
||||||
GPU_batch_vao_cache_clear(batch);
|
GPU_batch_elembuf_set(batch, *ibo, false);
|
||||||
batch->elem = *ibo;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,8 +91,7 @@ BLI_INLINE void DRW_vbo_request(GPUBatch *batch, GPUVertBuf **vbo)
|
|||||||
if (batch != NULL) {
|
if (batch != NULL) {
|
||||||
/* HACK set first vbo if not init. */
|
/* HACK set first vbo if not init. */
|
||||||
if (batch->verts[0] == NULL) {
|
if (batch->verts[0] == NULL) {
|
||||||
GPU_batch_vao_cache_clear(batch);
|
GPU_batch_vertbuf_add(batch, *vbo);
|
||||||
batch->verts[0] = *vbo;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* HACK: bypass assert */
|
/* HACK: bypass assert */
|
||||||
|
@@ -2824,7 +2824,6 @@ void DRW_opengl_context_enable_ex(bool restore)
|
|||||||
if (!G.background) {
|
if (!G.background) {
|
||||||
immActivate();
|
immActivate();
|
||||||
}
|
}
|
||||||
BLF_batch_reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2888,13 +2887,11 @@ void DRW_gpu_render_context_enable(void *re_gpu_context)
|
|||||||
BLI_assert(!BLI_thread_is_main());
|
BLI_assert(!BLI_thread_is_main());
|
||||||
|
|
||||||
GPU_context_active_set(re_gpu_context);
|
GPU_context_active_set(re_gpu_context);
|
||||||
DRW_shape_cache_reset(); /* XXX fix that too. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needs to be called BEFORE DRW_opengl_render_context_disable() */
|
/* Needs to be called BEFORE DRW_opengl_render_context_disable() */
|
||||||
void DRW_gpu_render_context_disable(void *UNUSED(re_gpu_context))
|
void DRW_gpu_render_context_disable(void *UNUSED(re_gpu_context))
|
||||||
{
|
{
|
||||||
DRW_shape_cache_reset(); /* XXX fix that too. */
|
|
||||||
GPU_context_active_set(NULL);
|
GPU_context_active_set(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -642,7 +642,6 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
|
|||||||
// View2DScrollers *scrollers;
|
// View2DScrollers *scrollers;
|
||||||
float col[3];
|
float col[3];
|
||||||
|
|
||||||
GPU_batch_presets_reset();
|
|
||||||
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
||||||
GPUFrameBuffer *framebuffer_default, *framebuffer_overlay;
|
GPUFrameBuffer *framebuffer_default, *framebuffer_overlay;
|
||||||
|
|
||||||
|
@@ -1623,10 +1623,6 @@ void view3d_main_region_draw(const bContext *C, ARegion *region)
|
|||||||
BKE_image_free_old_gputextures(bmain);
|
BKE_image_free_old_gputextures(bmain);
|
||||||
GPU_pass_cache_garbage_collect();
|
GPU_pass_cache_garbage_collect();
|
||||||
|
|
||||||
/* XXX This is in order to draw UI batches with the DRW
|
|
||||||
* old context since we now use it for drawing the entire area. */
|
|
||||||
gpu_batch_presets_reset();
|
|
||||||
|
|
||||||
/* No depth test for drawing action zones afterwards. */
|
/* No depth test for drawing action zones afterwards. */
|
||||||
GPU_depth_test(false);
|
GPU_depth_test(false);
|
||||||
|
|
||||||
|
@@ -112,8 +112,6 @@ void GPU_batch_clear(GPUBatch *);
|
|||||||
|
|
||||||
void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
|
void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
|
||||||
|
|
||||||
void GPU_batch_vao_cache_clear(GPUBatch *);
|
|
||||||
|
|
||||||
void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo); /* Instancing */
|
void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo); /* Instancing */
|
||||||
void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo);
|
void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo);
|
||||||
|
|
||||||
|
@@ -46,11 +46,8 @@ struct GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize,
|
|||||||
void gpu_batch_presets_init(void);
|
void gpu_batch_presets_init(void);
|
||||||
void gpu_batch_presets_register(struct GPUBatch *preset_batch);
|
void gpu_batch_presets_register(struct GPUBatch *preset_batch);
|
||||||
bool gpu_batch_presets_unregister(struct GPUBatch *preset_batch);
|
bool gpu_batch_presets_unregister(struct GPUBatch *preset_batch);
|
||||||
void gpu_batch_presets_reset(void);
|
|
||||||
void gpu_batch_presets_exit(void);
|
void gpu_batch_presets_exit(void);
|
||||||
|
|
||||||
void GPU_batch_presets_reset(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -48,11 +48,6 @@
|
|||||||
|
|
||||||
using namespace blender::gpu;
|
using namespace blender::gpu;
|
||||||
|
|
||||||
void GPU_batch_vao_cache_clear(GPUBatch *UNUSED(batch))
|
|
||||||
{
|
|
||||||
/* TODO remove */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Creation & Deletion
|
/** \name Creation & Deletion
|
||||||
* \{ */
|
* \{ */
|
||||||
|
@@ -380,18 +380,6 @@ bool gpu_batch_presets_unregister(GPUBatch *preset_batch)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpu_batch_presets_reset(void)
|
|
||||||
{
|
|
||||||
BLI_mutex_lock(&g_presets_3d.mutex);
|
|
||||||
/* Reset vao caches for these every time we switch opengl context.
|
|
||||||
* This way they will draw correctly for each window. */
|
|
||||||
LISTBASE_FOREACH (LinkData *, link, &presets_list) {
|
|
||||||
GPUBatch *preset = link->data;
|
|
||||||
GPU_batch_vao_cache_clear(preset);
|
|
||||||
}
|
|
||||||
BLI_mutex_unlock(&g_presets_3d.mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gpu_batch_presets_exit(void)
|
void gpu_batch_presets_exit(void)
|
||||||
{
|
{
|
||||||
LinkData *link;
|
LinkData *link;
|
||||||
@@ -404,17 +392,4 @@ void gpu_batch_presets_exit(void)
|
|||||||
BLI_mutex_end(&g_presets_3d.mutex);
|
BLI_mutex_end(&g_presets_3d.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function only needs to be accessed externally because
|
|
||||||
* we are drawing UI batches with the DRW old context.
|
|
||||||
*
|
|
||||||
* And now we use it for drawing the entire area.
|
|
||||||
*
|
|
||||||
* XXX (Clément) - to cleanup in the upcoming 2.91 refactor.
|
|
||||||
**/
|
|
||||||
void GPU_batch_presets_reset()
|
|
||||||
{
|
|
||||||
gpu_batch_presets_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -56,8 +56,6 @@ void wm_surface_clear_drawable(void)
|
|||||||
WM_opengl_context_release(g_drawable->ghost_ctx);
|
WM_opengl_context_release(g_drawable->ghost_ctx);
|
||||||
GPU_context_active_set(NULL);
|
GPU_context_active_set(NULL);
|
||||||
|
|
||||||
BLF_batch_reset();
|
|
||||||
gpu_batch_presets_reset();
|
|
||||||
immDeactivate();
|
immDeactivate();
|
||||||
|
|
||||||
if (g_drawable->deactivate) {
|
if (g_drawable->deactivate) {
|
||||||
|
@@ -1112,8 +1112,6 @@ static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool acti
|
|||||||
void wm_window_clear_drawable(wmWindowManager *wm)
|
void wm_window_clear_drawable(wmWindowManager *wm)
|
||||||
{
|
{
|
||||||
if (wm->windrawable) {
|
if (wm->windrawable) {
|
||||||
BLF_batch_reset();
|
|
||||||
gpu_batch_presets_reset();
|
|
||||||
immDeactivate();
|
immDeactivate();
|
||||||
wm->windrawable = NULL;
|
wm->windrawable = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user