GPUShader/DRW: Add Transform Feedback support.
authorClément Foucault <foucault.clem@gmail.com>
Wed, 16 May 2018 10:47:15 +0000 (12:47 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 16 May 2018 14:58:32 +0000 (16:58 +0200)
commita25856f2a802dae4e2c4c01e9b74d8c8a1769933
tree1ae725b9d04c36f4847c5bc08fb55f4a0f7a8aab
parenta3f4c72ec9d431f65bf9f50b7849e22e2f213ad0
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.
source/blender/draw/intern/DRW_render.h
source/blender/draw/intern/draw_manager.h
source/blender/draw/intern/draw_manager_data.c
source/blender/draw/intern/draw_manager_exec.c
source/blender/draw/intern/draw_manager_shader.c
source/blender/gpu/GPU_shader.h
source/blender/gpu/intern/gpu_shader.c
source/blender/gpu/intern/gpu_shader_private.h