Blender Git Commit Log
Git Commits -> Revision ab183dd
Revision ab183dd by Kévin Dietrich (subdivision_work) June 8, 2021, 02:42 (GMT) |
Subdivision: basic GPU subdivision for OpenGL This implements GPU subdivision via OpenSubDiv for OpenGL based render engines. At the moment only uniform subdivision is supported. Adaptive subdivision still lacks a way to render triangles from the subdivision patches. The GPUBatch is extended with a new VBO and a new IBO to gather subdivided points and indices. This allows to render the subdivided surface and the original control cage in edit mode without disrupting too much the code. To generate triangles from the subdivided index buffer, a compute shader is used. Although, at the moment normals are not computed there so a CPU fallback is used, where data is read from the GPU, processed on the CPU to generate triangles and normals, and then sent back to the GPU. To compute normals, a secondary compute shader might be used. This is not ideal for performance, but allows to validate that subdivision is indeed performed properly on the GPU. Attributes (including UVs and vertex colors) are not supported yet. For performance, some proper caching mechanism will need to be used. There currently is some logic to cache the subdivision structures that can be reused between updates. However, it is deactivated as it does not properly detect when changes occur, and causes crashes in edit mode. Performance can be further improved by reducing data transfer to the GPU, since OpenSubDiv asks us to allocate buffers big enough for the refined and coarse mesh we also allocate such buffer on the host, and transfer the entier buffer worth of data to the device, although only the coarse part need to be truly allocated on the host and sent to the device. This will require some change to the vertex buffer structure. |
Commit Details:
Full Hash: ab183dde948be8a63f7e1449aa9a32cb65236bbf
Parent Commit: 0b22e86
Lines Changed: +1118, -32
2 Added Paths:
/source/blender/draw/intern/draw_subdivision.cc (+927, -0) (View)
/source/blender/draw/intern/draw_subdivision.h (+41, -0) (View)
/source/blender/draw/intern/draw_subdivision.h (+41, -0) (View)
21 Modified Paths:
/source/blender/blenkernel/BKE_mesh.h (+4, -0) (Diff)
/source/blender/blenkernel/BKE_subdiv.h (+4, -0) (Diff)
/source/blender/blenkernel/intern/mesh_runtime.c (+11, -0) (Diff)
/source/blender/blenkernel/intern/subdiv_converter.h (+0, -4) (Diff)
/source/blender/draw/CMakeLists.txt (+5, -0) (Diff)
/source/blender/draw/intern/draw_cache_extract.h (+6, -4) (Diff)
/source/blender/draw/intern/draw_cache_impl_mesh.c (+44, -23) (Diff)
/source/blender/draw/intern/draw_manager.c (+4, -0) (Diff)
/source/blender/gpu/GPU_index_buffer.h (+2, -0) (Diff)
/source/blender/gpu/GPU_primitive.h (+2, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer.cc (+5, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer_private.hh (+15, -0) (Diff)
/source/blender/gpu/intern/gpu_vertex_buffer.cc (+5, -0) (Diff)
/source/blender/gpu/intern/gpu_vertex_buffer_private.hh (+2, -0) (Diff)
/source/blender/gpu/opengl/gl_batch.cc (+15, -0) (Diff)
/source/blender/gpu/opengl/gl_batch.hh (+3, -0) (Diff)
/source/blender/gpu/opengl/gl_index_buffer.hh (+11, -0) (Diff)
/source/blender/gpu/opengl/gl_primitive.hh (+3, -0) (Diff)
/source/blender/gpu/opengl/gl_vertex_buffer.cc (+1, -0) (Diff)
/source/blender/gpu/opengl/gl_vertex_buffer.hh (+6, -0) (Diff)
/source/blender/makesdna/DNA_mesh_types.h (+2, -1) (Diff)
/source/blender/blenkernel/BKE_subdiv.h (+4, -0) (Diff)
/source/blender/blenkernel/intern/mesh_runtime.c (+11, -0) (Diff)
/source/blender/blenkernel/intern/subdiv_converter.h (+0, -4) (Diff)
/source/blender/draw/CMakeLists.txt (+5, -0) (Diff)
/source/blender/draw/intern/draw_cache_extract.h (+6, -4) (Diff)
/source/blender/draw/intern/draw_cache_impl_mesh.c (+44, -23) (Diff)
/source/blender/draw/intern/draw_manager.c (+4, -0) (Diff)
/source/blender/gpu/GPU_index_buffer.h (+2, -0) (Diff)
/source/blender/gpu/GPU_primitive.h (+2, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer.cc (+5, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer_private.hh (+15, -0) (Diff)
/source/blender/gpu/intern/gpu_vertex_buffer.cc (+5, -0) (Diff)
/source/blender/gpu/intern/gpu_vertex_buffer_private.hh (+2, -0) (Diff)
/source/blender/gpu/opengl/gl_batch.cc (+15, -0) (Diff)
/source/blender/gpu/opengl/gl_batch.hh (+3, -0) (Diff)
/source/blender/gpu/opengl/gl_index_buffer.hh (+11, -0) (Diff)
/source/blender/gpu/opengl/gl_primitive.hh (+3, -0) (Diff)
/source/blender/gpu/opengl/gl_vertex_buffer.cc (+1, -0) (Diff)
/source/blender/gpu/opengl/gl_vertex_buffer.hh (+6, -0) (Diff)
/source/blender/makesdna/DNA_mesh_types.h (+2, -1) (Diff)