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.
This commit is contained in:
parent
c2089ae53c
commit
0c6b29ee43
Notes:
blender-bot
2023-02-14 08:40:26 +01:00
Referenced by issue #94672, Workbench shadow shading incorrect results with GPU subdivision
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue