diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-16 13:47:15 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-16 17:58:32 +0300 |
commit | a25856f2a802dae4e2c4c01e9b74d8c8a1769933 (patch) | |
tree | 1ae725b9d04c36f4847c5bc08fb55f4a0f7a8aab /source/blender/draw/intern/draw_manager.h | |
parent | a3f4c72ec9d431f65bf9f50b7849e22e2f213ad0 (diff) |
GPUShader/DRW: Add Transform Feedback support.
This is a usefull feature that can be used to do a lot of precomputation on
the GPU instead of the CPU.
Implementation is simple and only covers the most usefull case.
How to use:
- Create shader with transform feedback.
- Create a pass with DRW_STATE_TRANS_FEEDBACK.
- Create a target Gwn_VertBuf (make sure it's big enough).
- Create a shading group with DRW_shgroup_transform_feedback_create().
- Add your draw calls to the shading group.
- Render your pass normaly.
Current limitation:
- Only one output buffer.
- Cannot pause/resume tfb rendering to interleave with normal drawcalls.
- Cannot get the number of verts drawn.
Diffstat (limited to 'source/blender/draw/intern/draw_manager.h')
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index e71da41f118..0f9a68552fe 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -193,6 +193,7 @@ typedef enum { DRW_SHG_TRIANGLE_BATCH, DRW_SHG_INSTANCE, DRW_SHG_INSTANCE_EXTERNAL, + DRW_SHG_FEEDBACK_TRANSFORM, } DRWShadingGroupType; struct DRWShadingGroup { @@ -206,6 +207,10 @@ struct DRWShadingGroup { struct { /* DRW_SHG_NORMAL */ DRWCall *first, *last; /* Linked list of DRWCall or DRWCallDynamic depending of type */ } calls; + struct { /* DRW_SHG_FEEDBACK_TRANSFORM */ + DRWCall *first, *last; /* Linked list of DRWCall or DRWCallDynamic depending of type */ + struct Gwn_VertBuf *tfeedback_target; /* Transform Feedback target. */ + }; struct { /* DRW_SHG_***_BATCH */ struct Gwn_Batch *batch_geom; /* Result of call batching */ struct Gwn_VertBuf *batch_vbo; |