Fix #112632: crash batch generating previews with Cycles #112971

Merged
Clément Foucault merged 1 commits from brecht/blender:fix-112632 into blender-v4.0-release 2023-09-28 16:13:20 +02:00
2 changed files with 13 additions and 4 deletions

View File

@ -205,13 +205,17 @@ void GPU_render_end()
{
GPUBackend *backend = GPUBackend::get();
BLI_assert(backend);
backend->render_end();
if (backend) {
backend->render_end();
}
}
void GPU_render_step()
{
GPUBackend *backend = GPUBackend::get();
BLI_assert(backend);
backend->render_step();
if (backend) {
backend->render_step();
}
}
/** \} */

View File

@ -2459,7 +2459,10 @@ void RE_RenderAnim(Render *re,
void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
{
/* Ensure within GPU render boundary. */
GPU_render_begin();
const bool use_gpu = GPU_backend_get_type() != GPU_BACKEND_NONE;
if (use_gpu) {
GPU_render_begin();
}
Object *camera;
int winx, winy;
@ -2483,7 +2486,9 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
}
/* Close GPU render boundary. */
GPU_render_end();
if (use_gpu) {
GPU_render_end();
}
}
/* NOTE: repeated win/disprect calc... solve that nicer, also in compo. */