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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2022-01-16 09:31:12 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2022-01-16 09:31:26 +0300
commit3574f2730d2a42cda2881d26209b8dc53b1d2047 (patch)
treedfd1aa439249d44ce10de737aea5259db70781c8 /source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
parentb87d87b1d3c8400e4ee4ea3f0763df64c8ca7fc0 (diff)
Cleanup: deduplicate GPU subdiv data extraction loops
This puts the loop over the final subdivision quads outside of the mesh iteration callback. This can also allow for easier parallel execution in the future if need be.
Diffstat (limited to 'source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc')
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
index f125593cff2..59db4ca6445 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
@@ -198,25 +198,24 @@ static void extract_lines_adjacency_init_subdiv(const DRWSubdivCache *subdiv_cac
static void extract_lines_adjacency_iter_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *UNUSED(mr),
- void *_data)
+ void *_data,
+ uint subdiv_quad_index)
{
MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
- for (uint i = 0; i < subdiv_cache->num_subdiv_quads; i++) {
- const uint loop_index = i * 4;
- const uint l0 = loop_index + 0;
- const uint l1 = loop_index + 1;
- const uint l2 = loop_index + 2;
- const uint l3 = loop_index + 3;
+ const uint loop_index = subdiv_quad_index * 4;
+ const uint l0 = loop_index + 0;
+ const uint l1 = loop_index + 1;
+ const uint l2 = loop_index + 2;
+ const uint l3 = loop_index + 3;
- const uint v0 = subdiv_cache->subdiv_loop_subdiv_vert_index[l0];
- const uint v1 = subdiv_cache->subdiv_loop_subdiv_vert_index[l1];
- const uint v2 = subdiv_cache->subdiv_loop_subdiv_vert_index[l2];
- const uint v3 = subdiv_cache->subdiv_loop_subdiv_vert_index[l3];
+ const uint v0 = subdiv_cache->subdiv_loop_subdiv_vert_index[l0];
+ const uint v1 = subdiv_cache->subdiv_loop_subdiv_vert_index[l1];
+ const uint v2 = subdiv_cache->subdiv_loop_subdiv_vert_index[l2];
+ const uint v3 = subdiv_cache->subdiv_loop_subdiv_vert_index[l3];
- lines_adjacency_triangle(v0, v1, v2, l0, l1, l2, data);
- lines_adjacency_triangle(v0, v2, v3, l0, l2, l3, data);
- }
+ lines_adjacency_triangle(v0, v1, v2, l0, l1, l2, data);
+ lines_adjacency_triangle(v0, v2, v3, l0, l2, l3, data);
}
static void extract_lines_adjacency_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),