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:
authorClément Foucault <foucault.clem@gmail.com>2017-09-25 21:07:02 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-09-25 21:14:42 +0300
commit198c7d3687c16581a48701733c4fe4b511eaf149 (patch)
tree41ff532219804afff847ac234d3af0b07521a9e2 /source/blender/gpu/intern/gpu_viewport.c
parent98dd2a518be52b7f94c3a6f9345f19a0aebb2284 (diff)
DRW : Add new view_update mechanism.
This makes updates for the viewport cleaner and also add the possibility to add a new callback called when the scene is updated.
Diffstat (limited to 'source/blender/gpu/intern/gpu_viewport.c')
-rw-r--r--source/blender/gpu/intern/gpu_viewport.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index f80842364f3..bf255cfef6f 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -72,7 +72,9 @@ struct GPUViewport {
/* debug */
GPUTexture *debug_depth;
int size[2];
+
int samples;
+ int flag;
ListBase data; /* ViewportEngineData wrapped in LinkData */
unsigned int data_hash; /* If hash mismatch we free all ViewportEngineData in this viewport */
@@ -83,11 +85,27 @@ struct GPUViewport {
ListBase tex_pool; /* ViewportTempTexture list : Temporary textures shared across draw engines */
};
+enum {
+ DO_UPDATE = (1 << 0),
+};
+
static void gpu_viewport_buffers_free(FramebufferList *fbl, int fbl_len, TextureList *txl, int txl_len);
static void gpu_viewport_storage_free(StorageList *stl, int stl_len);
static void gpu_viewport_passes_free(PassList *psl, int psl_len);
static void gpu_viewport_texture_pool_free(GPUViewport *viewport);
+void GPU_viewport_tag_update(GPUViewport *viewport)
+{
+ viewport->flag |= DO_UPDATE;
+}
+
+bool GPU_viewport_do_update(GPUViewport *viewport)
+{
+ bool ret = (viewport->flag & DO_UPDATE);
+ viewport->flag &= ~DO_UPDATE;
+ return ret;
+}
+
GPUViewport *GPU_viewport_create(void)
{
GPUViewport *viewport = MEM_callocN(sizeof(GPUViewport), "GPUViewport");