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-06 18:23:37 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2022-01-06 18:25:09 +0300
commit0c6b29ee4378043493d1027e587a91a1e286dbb7 (patch)
tree373c5df4c7431f6f4a4541f8a51c5facac3db26c /source/blender/draw
parentc2089ae53ca36e83181573752eb7dd622494b63f (diff)
Fix T94672: incorrect Workbench shadows with GPU subdivision
The `lines_adjacency` IBO build in the GPU subdivision case was missing edges at the boundaries of open meshes. As it is used for the shadow pass, the shadows were then not clipped properly. This would also make X-Ray mode render differently in those cases. To fix this, we can simply reuse the buffer finalization routine from the non-subdivision case, as such edges are handled there.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh.h2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc6
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc2
5 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc
index 383a3b05b67..eed015bc212 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc
@@ -869,7 +869,7 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
}
if (extractor->finish_subdiv) {
- extractor->finish_subdiv(subdiv_cache, buffer, data);
+ extractor->finish_subdiv(subdiv_cache, &mr, cache, buffer, data);
}
}
MEM_freeN(data_stack);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.h b/source/blender/draw/intern/mesh_extractors/extract_mesh.h
index 35cc2cf986e..3e95d160b29 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh.h
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.h
@@ -229,6 +229,8 @@ typedef void(ExtractIterSubdivFn)(const struct DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *data);
typedef void(ExtractFinishSubdivFn)(const struct DRWSubdivCache *subdiv_cache,
+ const MeshRenderData *mr,
+ struct MeshBatchCache *cache,
void *buf,
void *data);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
index 6a1691e8634..5cb77426438 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
@@ -139,6 +139,8 @@ static void extract_edituv_tris_iter_subdiv(const DRWSubdivCache *subdiv_cache,
}
static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
+ const MeshRenderData *UNUSED(mr),
+ struct MeshBatchCache *UNUSED(cache),
void *buf,
void *_data)
{
@@ -282,6 +284,8 @@ static void extract_edituv_lines_iter_subdiv(const DRWSubdivCache *subdiv_cache,
}
static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
+ const MeshRenderData *UNUSED(mr),
+ struct MeshBatchCache *UNUSED(cache),
void *buf,
void *_data)
{
@@ -413,6 +417,8 @@ static void extract_edituv_points_iter_subdiv(const DRWSubdivCache *subdiv_cache
}
static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
+ const MeshRenderData *UNUSED(mr),
+ struct MeshBatchCache *UNUSED(cache),
void *buf,
void *_data)
{
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 dc3b170ddc2..f125593cff2 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
@@ -220,14 +220,12 @@ static void extract_lines_adjacency_iter_subdiv(const DRWSubdivCache *subdiv_cac
}
static void extract_lines_adjacency_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),
+ const MeshRenderData *mr,
+ struct MeshBatchCache *cache,
void *buf,
void *_data)
{
- GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
- MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
- GPU_indexbuf_build_in_place(&data->elb, ibo);
- BLI_edgehash_free(data->eh, nullptr);
- MEM_freeN(data->vert_to_loop);
+ extract_lines_adjacency_finish(mr, cache, buf, _data);
}
#undef NO_EDGE
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
index 19167772a42..3ea3e67a8da 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
@@ -216,6 +216,8 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
}
static void extract_points_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),
+ const MeshRenderData *UNUSED(mr),
+ struct MeshBatchCache *UNUSED(cache),
void *buf,
void *_userdata)
{