Fix T88859: Assert when changing view modes
The `loose_lines`' ibo was not being initialized.
This commit is contained in:
parent
1a912462f4
commit
2cd1bc3aa7
|
@ -777,7 +777,6 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
|||
* +-----> | extract_task2_loop_3 |
|
||||
* +----------------------+
|
||||
*/
|
||||
const bool do_lines_loose_subbuffer = mbc->ibo.lines_loose != nullptr;
|
||||
const bool do_hq_normals = (scene->r.perf_flag & SCE_PERF_HQ_NORMALS) != 0 ||
|
||||
GPU_use_hq_normals_workaround();
|
||||
|
||||
|
@ -787,8 +786,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
|||
#define EXTRACT_ADD_REQUESTED(type, type_lowercase, name) \
|
||||
do { \
|
||||
if (DRW_##type_lowercase##_requested(mbc->type_lowercase.name)) { \
|
||||
const MeshExtract *extractor = mesh_extract_override_get( \
|
||||
&extract_##name, do_hq_normals, do_lines_loose_subbuffer); \
|
||||
const MeshExtract *extractor = mesh_extract_override_get(&extract_##name, do_hq_normals); \
|
||||
extractors.append(extractor); \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -818,7 +816,22 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
|||
EXTRACT_ADD_REQUESTED(VBO, vbo, skin_roots);
|
||||
|
||||
EXTRACT_ADD_REQUESTED(IBO, ibo, tris);
|
||||
EXTRACT_ADD_REQUESTED(IBO, ibo, lines);
|
||||
if (DRW_ibo_requested(mbc->ibo.lines)) {
|
||||
const MeshExtract *extractor;
|
||||
if (mbc->ibo.lines_loose != nullptr) {
|
||||
/* Update #lines_loose ibo. */
|
||||
extractor = &extract_lines_with_lines_loose;
|
||||
}
|
||||
else {
|
||||
extractor = &extract_lines;
|
||||
}
|
||||
extractors.append(extractor);
|
||||
}
|
||||
else if (DRW_ibo_requested(mbc->ibo.lines_loose)) {
|
||||
/* Note: #ibo.lines must have been created first. */
|
||||
const MeshExtract *extractor = &extract_lines_loose_only;
|
||||
extractors.append(extractor);
|
||||
}
|
||||
EXTRACT_ADD_REQUESTED(IBO, ibo, points);
|
||||
EXTRACT_ADD_REQUESTED(IBO, ibo, fdots);
|
||||
EXTRACT_ADD_REQUESTED(IBO, ibo, lines_paint_mask);
|
||||
|
|
|
@ -94,24 +94,12 @@ static const MeshExtract *mesh_extract_override_hq_normals(const MeshExtract *ex
|
|||
return extractor;
|
||||
}
|
||||
|
||||
static const MeshExtract *mesh_extract_override_loose_lines(const MeshExtract *extractor)
|
||||
{
|
||||
if (extractor == &extract_lines) {
|
||||
return &extract_lines_with_lines_loose;
|
||||
}
|
||||
return extractor;
|
||||
}
|
||||
|
||||
const MeshExtract *mesh_extract_override_get(const MeshExtract *extractor,
|
||||
const bool do_hq_normals,
|
||||
const bool do_lines_loose_subbuffer)
|
||||
const bool do_hq_normals)
|
||||
{
|
||||
if (do_hq_normals) {
|
||||
extractor = mesh_extract_override_hq_normals(extractor);
|
||||
}
|
||||
if (do_lines_loose_subbuffer) {
|
||||
extractor = mesh_extract_override_loose_lines(extractor);
|
||||
}
|
||||
return extractor;
|
||||
}
|
||||
|
||||
|
@ -386,7 +374,7 @@ const MeshExtract extract_lines = {
|
|||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Loose Edges Sub Buffer
|
||||
/** \name Extract Lines and Loose Edges Sub Buffer
|
||||
* \{ */
|
||||
|
||||
static void extract_lines_loose_subbuffer(const MeshRenderData *mr, struct MeshBatchCache *cache)
|
||||
|
@ -424,6 +412,28 @@ const MeshExtract extract_lines_with_lines_loose = {
|
|||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Loose Edges Sub Buffer
|
||||
* \{ */
|
||||
|
||||
static void *extract_lines_loose_only_init(const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buf)
|
||||
{
|
||||
BLI_assert(buf == cache->final.ibo.lines_loose);
|
||||
UNUSED_VARS_NDEBUG(buf);
|
||||
extract_lines_loose_subbuffer(mr, cache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const MeshExtract extract_lines_loose_only = {
|
||||
.init = extract_lines_loose_only_init,
|
||||
.data_type = 0,
|
||||
.use_threading = false,
|
||||
.mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines_loose)};
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Point Indices
|
||||
* \{ */
|
||||
|
|
|
@ -463,8 +463,7 @@ void mesh_render_data_update_looptris(MeshRenderData *mr,
|
|||
void *mesh_extract_buffer_get(const MeshExtract *extractor, MeshBufferCache *mbc);
|
||||
eMRIterType mesh_extract_iter_type(const MeshExtract *ext);
|
||||
const MeshExtract *mesh_extract_override_get(const MeshExtract *extractor,
|
||||
const bool do_hq_normals,
|
||||
const bool do_lines_loose_subbuffer);
|
||||
const bool do_hq_normals);
|
||||
/*
|
||||
* Total number of extractions types.
|
||||
*/
|
||||
|
@ -473,6 +472,7 @@ const MeshExtract *mesh_extract_override_get(const MeshExtract *extractor,
|
|||
extern const MeshExtract extract_tris;
|
||||
extern const MeshExtract extract_lines;
|
||||
extern const MeshExtract extract_lines_with_lines_loose;
|
||||
extern const MeshExtract extract_lines_loose_only;
|
||||
extern const MeshExtract extract_points;
|
||||
extern const MeshExtract extract_fdots;
|
||||
extern const MeshExtract extract_lines_paint_mask;
|
||||
|
|
Loading…
Reference in New Issue