diff options
Diffstat (limited to 'source/blender/draw/intern/draw_manager.h')
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 6d384c599d8..4f71e665390 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -188,6 +188,7 @@ typedef enum { DRW_CMD_DRAW_INSTANCE = 2, DRW_CMD_DRAW_INSTANCE_RANGE = 3, DRW_CMD_DRAW_PROCEDURAL = 4, + DRW_CMD_DRAW_INDIRECT = 5, /* Compute Commands. */ DRW_CMD_COMPUTE = 8, @@ -203,7 +204,7 @@ typedef enum { /* Needs to fit in 4bits */ } eDRWCommandType; -#define DRW_MAX_DRAW_CMD_TYPE DRW_CMD_DRAW_PROCEDURAL +#define DRW_MAX_DRAW_CMD_TYPE DRW_CMD_DRAW_INDIRECT typedef struct DRWCommandDraw { GPUBatch *batch; @@ -232,6 +233,12 @@ typedef struct DRWCommandDrawInstanceRange { uint inst_count; } DRWCommandDrawInstanceRange; +typedef struct DRWCommandDrawIndirect { + GPUBatch *batch; + DRWResourceHandle handle; + GPUStorageBuf *indirect_buf; +} DRWCommandDrawIndirect; + typedef struct DRWCommandCompute { int groups_x_len; int groups_y_len; @@ -286,6 +293,7 @@ typedef union DRWCommand { DRWCommandDrawInstance instance; DRWCommandDrawInstanceRange instance_range; DRWCommandDrawProcedural procedural; + DRWCommandDrawIndirect draw_indirect; DRWCommandCompute compute; DRWCommandComputeRef compute_ref; DRWCommandComputeIndirect compute_indirect; @@ -369,7 +377,7 @@ struct DRWUniform { /* DRW_UNIFORM_INT_COPY */ int ivalue[4]; /* DRW_UNIFORM_BLOCK_OBATTRS */ - struct GPUUniformAttrList *uniform_attrs; + const struct GPUUniformAttrList *uniform_attrs; }; int location; /* Uniform location or binding point for textures and UBO's. */ uint8_t type; /* #DRWUniformType */ @@ -395,7 +403,7 @@ struct DRWShadingGroup { DRWResourceHandle pass_handle; /* Memblock key to parent pass. */ /* Set of uniform attributes used by this shader. */ - struct GPUUniformAttrList *uniform_attrs; + const struct GPUUniformAttrList *uniform_attrs; }; /* This struct is used after cache populate if using the Z sorting. * It will not conflict with the above struct. */ @@ -493,20 +501,6 @@ typedef struct DRWCommandSmallChunk { BLI_STATIC_ASSERT_ALIGN(DRWCommandChunk, 16); #endif -/* ------------- DRAW DEBUG ------------ */ - -typedef struct DRWDebugLine { - struct DRWDebugLine *next; /* linked list */ - float pos[2][3]; - float color[4]; -} DRWDebugLine; - -typedef struct DRWDebugSphere { - struct DRWDebugSphere *next; /* linked list */ - float mat[4][4]; - float color[4]; -} DRWDebugSphere; - /* ------------- Memory Pools ------------ */ /* Contains memory pools information */ @@ -533,10 +527,12 @@ typedef struct DRWData { void *volume_grids_ubos; /* VolumeUniformBufPool */ /** List of smoke textures to free after drawing. */ ListBase smoke_textures; - /** Texture pool to reuse temp texture across engines. */ - /* TODO(@fclem): The pool could be shared even between view-ports. */ + /** + * Texture pool to reuse temp texture across engines. + * TODO(@fclem): The pool could be shared even between view-ports. + */ struct DRWTexturePool *texture_pool; - /** Per stereo view data. Contains engine data and default framebuffers. */ + /** Per stereo view data. Contains engine data and default frame-buffers. */ struct DRWViewData *view_data[2]; /** Per draw-call curves object data. */ struct CurvesUniformBufPool *curves_ubos; @@ -646,11 +642,7 @@ typedef struct DRWManager { GPUDrawList *draw_list; - struct { - /* TODO(@fclem): optimize: use chunks. */ - DRWDebugLine *lines; - DRWDebugSphere *spheres; - } debug; + DRWDebugModule *debug; } DRWManager; extern DRWManager DST; /* TODO: get rid of this and allow multi-threaded rendering. */ @@ -665,6 +657,9 @@ void drw_state_set(DRWState state); void drw_debug_draw(void); void drw_debug_init(void); +void drw_debug_module_free(DRWDebugModule *module); +GPUStorageBuf *drw_debug_gpu_draw_buf_get(void); +GPUStorageBuf *drw_debug_gpu_print_buf_get(void); eDRWCommandType command_type_get(const uint64_t *command_type_bits, int index); @@ -683,9 +678,10 @@ void drw_resource_buffer_finish(DRWData *vmempool); GPUBatch *drw_cache_procedural_points_get(void); GPUBatch *drw_cache_procedural_lines_get(void); GPUBatch *drw_cache_procedural_triangles_get(void); +GPUBatch *drw_cache_procedural_triangle_strips_get(void); void drw_uniform_attrs_pool_update(struct GHash *table, - struct GPUUniformAttrList *key, + const struct GPUUniformAttrList *key, DRWResourceHandle *handle, struct Object *ob, struct Object *dupli_parent, @@ -698,6 +694,9 @@ bool drw_engine_data_engines_data_validate(GPUViewport *viewport, void **engine_ void drw_engine_data_cache_release(GPUViewport *viewport); void drw_engine_data_free(GPUViewport *viewport); +void DRW_manager_begin_sync(void); +void DRW_manager_end_sync(void); + #ifdef __cplusplus } #endif |