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>2018-12-08 22:10:20 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-10 21:02:17 +0300
commit1d92888ee8e8abf7ba40c1875dedc84e0138be2c (patch)
tree55e75bdd89e785906c048a794a2d976960dcf204 /source/blender/draw/intern/draw_cache_impl.h
parent33cc3344a26d674c1283c5fd8c007a63f0d8a5fc (diff)
DRW: Batch Cache: Add batch request system
This makes it possible for engines to ask for batches and only fill their data after all engine populate functions have run. This means that, when creating the batches data we already know all the batches that are needed for this redraw and the needed data. This allows for less redundant data preparation and better attrib masking. Ideally, we should run all viewports populate function before executing the batch construction but this is not the scope of this patch. Conversion from the old request method will be progressive and both can coexist (see uses of mesh_create_pos_and_nor()).
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl.h')
-rw-r--r--source/blender/draw/intern/draw_cache_impl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h
index 287b29ff1ba..4581f5c1f1d 100644
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@ -124,6 +124,8 @@ void DRW_mesh_weight_state_copy(struct DRW_MeshWeightState *wstate_dst, const st
bool DRW_mesh_weight_state_compare(const struct DRW_MeshWeightState *a, const struct DRW_MeshWeightState *b);
/* Mesh */
+void DRW_mesh_batch_cache_create_requested(struct Object *ob);
+
struct GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(
struct Mesh *me, struct GPUMaterial **gpumat_array, uint gpumat_array_len, bool use_hide,
char **auto_layer_names, int **auto_layer_is_srgb, int *auto_layer_count);
@@ -213,4 +215,15 @@ struct GPUBatch *DRW_particles_batch_cache_get_edit_inner_points(
struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
+/* Common */
+#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? value : 0)
+#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? value : 0)
+
+struct GPUBatch *DRW_batch_request(struct GPUBatch **batch);
+bool DRW_batch_requested(struct GPUBatch *batch, int prim_type);
+void DRW_ibo_request(struct GPUBatch *batch, struct GPUIndexBuf **ibo);
+bool DRW_ibo_requested(struct GPUIndexBuf *ibo);
+void DRW_vbo_request(struct GPUBatch *batch, struct GPUVertBuf **vbo);
+bool DRW_vbo_requested(struct GPUVertBuf *vbo);
+
#endif /* __DRAW_CACHE_IMPL_H__ */