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>2021-10-05 10:36:11 +0300
committerJeroen Bakker <jeroen@blender.org>2021-10-05 10:39:54 +0300
commit1d49293b80446b89b5b12fa0eeefaf14e5051e48 (patch)
tree72e007ea9d498576ad9b48050f81f38994aa0d98 /source/blender/draw/intern/draw_manager.h
parent08511b1c3de0338314940397083adaba4e9cf492 (diff)
DRW: Move buffer & temp textures & framebuffer management to DrawManager
This is a necessary step for EEVEE's new arch. This moves more data to the draw manager. This makes it easier to have the render or draw engines manage their own data. This makes more sense and cleans-up what the GPUViewport holds Also rewrites the Texture pool manager to be in C++. This also move the DefaultFramebuffer/TextureList and the engine related data to a new `DRWViewData` struct. This struct manages the per view (as in stereo view) engine data. There is a bit of cleanup in the way the draw manager is setup. We now use a temporary DRWData instead of creating a dummy viewport. Development: fclem, jbakker Differential Revision: https://developer.blender.org/D11966
Diffstat (limited to 'source/blender/draw/intern/draw_manager.h')
-rw-r--r--source/blender/draw/intern/draw_manager.h59
1 files changed, 52 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index c09126c98ef..1bb1ee06354 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -98,6 +98,17 @@ struct Object;
/* ------------ Data Structure --------------- */
/**
+ * Data structure to for registered draw engines that can store draw manager
+ * specific data.
+ */
+typedef struct DRWRegisteredDrawEngine {
+ void /*DRWRegisteredDrawEngine*/ *next, *prev;
+ DrawEngineType *draw_engine;
+ /** Index of the type in the lists. Index is used for dupli data. */
+ int index;
+} DRWRegisteredDrawEngine;
+
+/**
* Data structure containing all drawcalls organized by passes and materials.
* DRWPass > DRWShadingGroup > DRWCall > DRWCallState
* > DRWUniform
@@ -495,6 +506,35 @@ typedef struct DRWDebugSphere {
float color[4];
} DRWDebugSphere;
+/* ------------- Memory Pools ------------ */
+
+/* Contains memory pools information */
+typedef struct DRWData {
+ /** Instance data. */
+ DRWInstanceDataList *idatalist;
+ /** Mempools for drawcalls. */
+ struct BLI_memblock *commands;
+ struct BLI_memblock *commands_small;
+ struct BLI_memblock *callbuffers;
+ struct BLI_memblock *obmats;
+ struct BLI_memblock *obinfos;
+ struct BLI_memblock *cullstates;
+ struct BLI_memblock *shgroups;
+ struct BLI_memblock *uniforms;
+ struct BLI_memblock *views;
+ struct BLI_memblock *passes;
+ struct BLI_memblock *images;
+ struct GPUUniformBuf **matrices_ubo;
+ struct GPUUniformBuf **obinfos_ubo;
+ struct GHash *obattrs_ubo_pool;
+ uint ubo_len;
+ /** Texture pool to reuse temp texture across engines. */
+ /* TODO(fclem) the pool could be shared even between viewports. */
+ struct DRWTexturePool *texture_pool;
+ /** Per stereo view data. Contains engine data and default framebuffers. */
+ struct DRWViewData *view_data[2];
+} DRWData;
+
/* ------------- DRAW MANAGER ------------ */
typedef struct DupliKey {
@@ -509,8 +549,10 @@ typedef struct DupliKey {
typedef struct DRWManager {
/* TODO: clean up this struct a bit. */
/* Cache generation */
- ViewportMemoryPool *vmempool;
- DRWInstanceDataList *idatalist;
+ /* TODO(fclem) Rename to data. */
+ DRWData *vmempool;
+ /** Active view data structure for one of the 2 stereo view. Not related to DRWView. */
+ struct DRWViewData *view_data_active;
/* State of the object being evaluated if already allocated. */
DRWResourceHandle ob_handle;
/** True if current DST.ob_state has its matching DRWObjectInfos init. */
@@ -567,10 +609,6 @@ typedef struct DRWManager {
/* Convenience pointer to text_store owned by the viewport */
struct DRWTextStore **text_store_p;
- ListBase enabled_engines; /* RenderEngineType */
- void **vedata_array; /* ViewportEngineData */
- int enabled_engine_count; /* Length of enabled_engines list. */
-
bool buffer_finish_called; /* Avoid bad usage of DRW_render_instance_buffer_finish */
DRWView *view_default;
@@ -627,7 +665,7 @@ void drw_batch_cache_validate(Object *ob);
void drw_batch_cache_generate_requested(struct Object *ob);
void drw_batch_cache_generate_requested_delayed(Object *ob);
-void drw_resource_buffer_finish(ViewportMemoryPool *vmempool);
+void drw_resource_buffer_finish(DRWData *vmempool);
/* Procedural Drawing */
GPUBatch *drw_cache_procedural_points_get(void);
@@ -641,6 +679,13 @@ void drw_uniform_attrs_pool_update(struct GHash *table,
struct Object *dupli_parent,
struct DupliObject *dupli_source);
+double *drw_engine_data_cache_time_get(GPUViewport *viewport);
+void *drw_engine_data_engine_data_create(GPUViewport *viewport, void *engine_type);
+void *drw_engine_data_engine_data_get(GPUViewport *viewport, void *engine_handle);
+bool drw_engine_data_engines_data_validate(GPUViewport *viewport, void **engine_handle_array);
+void drw_engine_data_cache_release(GPUViewport *viewport);
+void drw_engine_data_free(GPUViewport *viewport);
+
#ifdef __cplusplus
}
#endif