Fix T76131: Crash combing Hair using Python

Caused by rBe82827bf6ed5.

DRW_draw_depth_object calls DRW_mesh_batch_cache_create_requested with
NULL scene, but that is accessed later on...

Scene is actually available, so pass that around.

Maniphest Tasks: T76131

Differential Revision: https://developer.blender.org/D7540
This commit is contained in:
Philipp Oeser 2020-04-27 11:37:20 +02:00
parent 8f289196cf
commit 4fd005fefb
4 changed files with 6 additions and 4 deletions

View File

@ -118,7 +118,8 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
struct ARegion *region, struct ARegion *region,
struct View3D *v3d, struct View3D *v3d,
struct GPUViewport *viewport); struct GPUViewport *viewport);
void DRW_draw_depth_object(struct ARegion *region, void DRW_draw_depth_object(struct Scene *scene,
struct ARegion *region,
struct View3D *v3d, struct View3D *v3d,
struct GPUViewport *viewport, struct GPUViewport *viewport,
struct Object *object); struct Object *object);

View File

@ -4540,6 +4540,7 @@ static void extract_task_create(TaskPool *task_pool,
void *buf, void *buf,
int32_t *task_counter) int32_t *task_counter)
{ {
BLI_assert(scene != NULL);
const bool do_hq_normals = (scene->r.perf_flag & SCE_PERF_HQ_NORMALS) != 0; const bool do_hq_normals = (scene->r.perf_flag & SCE_PERF_HQ_NORMALS) != 0;
if (do_hq_normals && (extract == &extract_lnor)) { if (do_hq_normals && (extract == &extract_lnor)) {
extract = &extract_lnor_hq; extract = &extract_lnor_hq;

View File

@ -2430,7 +2430,7 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_
/** /**
* Clears the Depth Buffer and draws only the specified object. * Clears the Depth Buffer and draws only the specified object.
*/ */
void DRW_draw_depth_object(ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object) void DRW_draw_depth_object(Scene *scene, ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object)
{ {
RegionView3D *rv3d = region->regiondata; RegionView3D *rv3d = region->regiondata;
@ -2468,7 +2468,7 @@ void DRW_draw_depth_object(ARegion *region, View3D *v3d, GPUViewport *viewport,
batch = DRW_mesh_batch_cache_get_surface(me); batch = DRW_mesh_batch_cache_get_surface(me);
} }
DRW_mesh_batch_cache_create_requested(object, me, NULL, false, true); DRW_mesh_batch_cache_create_requested(object, me, scene, false, true);
const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED :
GPU_SHADER_CFG_DEFAULT; GPU_SHADER_CFG_DEFAULT;

View File

@ -2217,7 +2217,7 @@ void ED_view3d_backbuf_depth_validate(ViewContext *vc)
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) { if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) {
GPUViewport *viewport = WM_draw_region_get_viewport(region); GPUViewport *viewport = WM_draw_region_get_viewport(region);
DRW_draw_depth_object(vc->region, vc->v3d, viewport, obact_eval); DRW_draw_depth_object(vc->scene, vc->region, vc->v3d, viewport, obact_eval);
} }
vc->v3d->flag &= ~V3D_INVALID_BACKBUF; vc->v3d->flag &= ~V3D_INVALID_BACKBUF;