2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2017 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup draw_engine
|
2017-05-01 14:55:59 +02:00
|
|
|
*
|
|
|
|
|
* Base engine for external render engines.
|
|
|
|
|
* We use it for depth and non-mesh objects.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-01-05 11:16:57 -05:00
|
|
|
#include "DRW_engine.hh"
|
|
|
|
|
#include "DRW_render.hh"
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2025-01-22 19:37:38 +01:00
|
|
|
#include "BLI_string.h"
|
|
|
|
|
|
|
|
|
|
#include "BLT_translation.hh"
|
|
|
|
|
|
2017-05-01 14:55:59 +02:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_image.hh"
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "ED_screen.hh"
|
2025-03-13 13:47:02 +01:00
|
|
|
#include "ED_view3d.hh"
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2024-03-23 01:24:18 +01:00
|
|
|
#include "GPU_debug.hh"
|
|
|
|
|
#include "GPU_matrix.hh"
|
|
|
|
|
#include "GPU_state.hh"
|
2017-05-01 14:55:59 +02:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
#include "RE_engine.h"
|
|
|
|
|
#include "RE_pipeline.h"
|
|
|
|
|
|
2024-12-05 18:36:31 +01:00
|
|
|
#include "draw_command.hh"
|
2024-12-05 16:35:17 +01:00
|
|
|
#include "draw_view.hh"
|
2025-01-22 19:37:38 +01:00
|
|
|
#include "draw_view_data.hh"
|
|
|
|
|
|
2019-02-23 18:31:45 +11:00
|
|
|
#include "external_engine.h" /* own include */
|
|
|
|
|
|
2017-05-01 14:55:59 +02:00
|
|
|
/* Shaders */
|
|
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
namespace blender::draw::external {
|
|
|
|
|
class Instance : public DrawEngine {
|
2025-03-18 17:27:55 +01:00
|
|
|
const DRWContext *draw_ctx = nullptr;
|
|
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
blender::StringRefNull name_get() final
|
|
|
|
|
{
|
|
|
|
|
return "External";
|
|
|
|
|
}
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2025-03-18 17:27:55 +01:00
|
|
|
void init() final
|
|
|
|
|
{
|
|
|
|
|
draw_ctx = DRW_context_get();
|
|
|
|
|
}
|
2021-12-07 11:30:50 +01:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void begin_sync() final {}
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void object_sync(blender::draw::ObjectRef & /*ob_ref*/,
|
|
|
|
|
blender::draw::Manager & /*manager*/) final
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void end_sync() final {}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void draw_scene_do_v3d()
|
|
|
|
|
{
|
|
|
|
|
RegionView3D *rv3d = draw_ctx->rv3d;
|
|
|
|
|
ARegion *region = draw_ctx->region;
|
2022-09-05 11:48:06 -03:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
blender::draw::command::StateSet::set(DRW_STATE_WRITE_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* The external engine can use the OpenGL rendering API directly, so make sure the state is
|
|
|
|
|
* already applied. */
|
|
|
|
|
GPU_apply_state();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Create render engine. */
|
|
|
|
|
RenderEngine *render_engine = nullptr;
|
|
|
|
|
if (!rv3d->view_render) {
|
|
|
|
|
RenderEngineType *engine_type = ED_view3d_engine_type(draw_ctx->scene,
|
|
|
|
|
draw_ctx->v3d->shading.type);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
if (!(engine_type->view_update && engine_type->view_draw)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
rv3d->view_render = RE_NewViewRender(engine_type);
|
|
|
|
|
render_engine = RE_view_engine_get(rv3d->view_render);
|
|
|
|
|
engine_type->view_update(render_engine, draw_ctx->evil_C, draw_ctx->depsgraph);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
render_engine = RE_view_engine_get(rv3d->view_render);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Rendered draw. */
|
|
|
|
|
GPU_matrix_push_projection();
|
|
|
|
|
GPU_matrix_push();
|
|
|
|
|
ED_region_pixelspace(region);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Render result draw. */
|
|
|
|
|
const RenderEngineType *type = render_engine->type;
|
|
|
|
|
type->view_draw(render_engine, draw_ctx->evil_C, draw_ctx->depsgraph);
|
2020-10-22 01:19:10 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_bgl_end();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_matrix_pop();
|
|
|
|
|
GPU_matrix_pop_projection();
|
|
|
|
|
|
|
|
|
|
/* Set render info. */
|
|
|
|
|
if (render_engine->text[0] != '\0') {
|
|
|
|
|
STRNCPY(info, render_engine->text);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info[0] = '\0';
|
|
|
|
|
}
|
2017-05-04 15:46:09 +02:00
|
|
|
}
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Configure current matrix stack so that the external engine can use the same drawing code for
|
|
|
|
|
* both viewport and image editor drawing.
|
|
|
|
|
*
|
|
|
|
|
* The engine draws result in the pixel space, and is applying render offset. For image editor we
|
|
|
|
|
* need to switch from normalized space to pixel space, and "un-apply" offset. */
|
2025-03-18 17:27:55 +01:00
|
|
|
void external_image_space_matrix_set(const RenderEngine *engine)
|
2025-03-17 10:31:22 +01:00
|
|
|
{
|
|
|
|
|
BLI_assert(engine != nullptr);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
SpaceImage *space_image = (SpaceImage *)draw_ctx->space_data;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Apply current view as transformation matrix.
|
|
|
|
|
* This will configure drawing for normalized space with current zoom and pan applied. */
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
float4x4 view_matrix = blender::draw::View::default_get().viewmat();
|
|
|
|
|
float4x4 projection_matrix = blender::draw::View::default_get().winmat();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_matrix_projection_set(projection_matrix.ptr());
|
|
|
|
|
GPU_matrix_set(view_matrix.ptr());
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Switch from normalized space to pixel space. */
|
|
|
|
|
{
|
|
|
|
|
int width, height;
|
|
|
|
|
ED_space_image_get_size(space_image, &width, &height);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
const float width_inv = width ? 1.0f / width : 0.0f;
|
|
|
|
|
const float height_inv = height ? 1.0f / height : 0.0f;
|
|
|
|
|
GPU_matrix_scale_2f(width_inv, height_inv);
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Un-apply render offset. */
|
|
|
|
|
{
|
|
|
|
|
Render *render = engine->re;
|
|
|
|
|
rctf view_rect;
|
|
|
|
|
rcti render_rect;
|
|
|
|
|
RE_GetViewPlane(render, &view_rect, &render_rect);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_matrix_translate_2f(-render_rect.xmin, -render_rect.ymin);
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void draw_scene_do_image()
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = draw_ctx->scene;
|
|
|
|
|
Render *re = RE_GetSceneRender(scene);
|
|
|
|
|
RenderEngine *engine = RE_engine_get(re);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Is tested before enabling the drawing engine. */
|
|
|
|
|
BLI_assert(re != nullptr);
|
|
|
|
|
BLI_assert(engine != nullptr);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
blender::draw::command::StateSet::set(DRW_STATE_WRITE_COLOR);
|
2022-09-05 11:48:06 -03:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* The external engine can use the OpenGL rendering API directly, so make sure the state is
|
|
|
|
|
* already applied. */
|
|
|
|
|
GPU_apply_state();
|
2022-09-05 11:48:06 -03:00
|
|
|
|
2025-03-18 17:27:55 +01:00
|
|
|
const DefaultFramebufferList *dfbl = draw_ctx->viewport_framebuffer_list_get();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
/* Clear the depth buffer to the value used by the background overlay so that the overlay is
|
|
|
|
|
* not happening outside of the drawn image.
|
|
|
|
|
*
|
|
|
|
|
* NOTE: The external engine only draws color. The depth is taken care of using the depth pass
|
|
|
|
|
* which initialized the depth to the values expected by the background overlay. */
|
|
|
|
|
GPU_framebuffer_clear_depth(dfbl->default_fb, 1.0f);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_matrix_push_projection();
|
|
|
|
|
GPU_matrix_push();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
external_image_space_matrix_set(engine);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_debug_group_begin("External Engine");
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
const RenderEngineType *engine_type = engine->type;
|
|
|
|
|
BLI_assert(engine_type != nullptr);
|
|
|
|
|
BLI_assert(engine_type->draw != nullptr);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
engine_type->draw(engine, draw_ctx->evil_C, draw_ctx->depsgraph);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_debug_group_end();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
GPU_matrix_pop();
|
|
|
|
|
GPU_matrix_pop_projection();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
blender::draw::command::StateSet::set();
|
|
|
|
|
GPU_bgl_end();
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
RE_engine_draw_release(re);
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void draw_scene_do()
|
|
|
|
|
{
|
|
|
|
|
if (draw_ctx->v3d != nullptr) {
|
|
|
|
|
draw_scene_do_v3d();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (draw_ctx->space_data == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
const eSpace_Type space_type = eSpace_Type(draw_ctx->space_data->spacetype);
|
|
|
|
|
if (space_type == SPACE_IMAGE) {
|
|
|
|
|
draw_scene_do_image();
|
|
|
|
|
return;
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
void draw(blender::draw::Manager & /*manager*/) final
|
|
|
|
|
{
|
2025-03-18 17:27:55 +01:00
|
|
|
const DefaultFramebufferList *dfbl = draw_ctx->viewport_framebuffer_list_get();
|
2025-03-17 10:31:22 +01:00
|
|
|
|
|
|
|
|
/* Will be nullptr during OpenGL render.
|
|
|
|
|
* OpenGL render is used for quick preview (thumbnails or sequencer preview)
|
|
|
|
|
* where using the rendering engine to preview doesn't make so much sense. */
|
|
|
|
|
if (draw_ctx->evil_C) {
|
|
|
|
|
const float clear_col[4] = {0, 0, 0, 0};
|
|
|
|
|
/* This is to keep compatibility with external engine. */
|
|
|
|
|
/* TODO(fclem): remove it eventually. */
|
|
|
|
|
GPU_framebuffer_bind(dfbl->default_fb);
|
|
|
|
|
GPU_framebuffer_clear_color(dfbl->default_fb, clear_col);
|
|
|
|
|
|
|
|
|
|
DRW_submission_start();
|
|
|
|
|
draw_scene_do();
|
|
|
|
|
DRW_submission_end();
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
2025-03-17 10:31:22 +01:00
|
|
|
};
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
DrawEngine *Engine::create_instance()
|
2017-05-01 14:55:59 +02:00
|
|
|
{
|
2025-03-17 10:31:22 +01:00
|
|
|
return new Instance();
|
2017-05-01 14:55:59 +02:00
|
|
|
}
|
|
|
|
|
|
2025-03-17 10:31:22 +01:00
|
|
|
} // namespace blender::draw::external
|
|
|
|
|
|
|
|
|
|
/* Functions */
|
2017-05-01 14:55:59 +02:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: currently unused,
|
2019-05-01 10:35:46 +10:00
|
|
|
* we should not register unless we want to see this when debugging the view. */
|
2017-05-01 14:55:59 +02:00
|
|
|
|
|
|
|
|
RenderEngineType DRW_engine_viewport_external_type = {
|
2023-07-18 14:18:10 +10:00
|
|
|
/*next*/ nullptr,
|
|
|
|
|
/*prev*/ nullptr,
|
2025-03-17 10:31:22 +01:00
|
|
|
/*idname*/ "BLENDER_EXTERNAL",
|
2023-07-18 14:18:10 +10:00
|
|
|
/*name*/ N_("External"),
|
|
|
|
|
/*flag*/ RE_INTERNAL | RE_USE_STEREO_VIEWPORT,
|
|
|
|
|
/*update*/ nullptr,
|
|
|
|
|
/*render*/ nullptr,
|
|
|
|
|
/*render_frame_finish*/ nullptr,
|
|
|
|
|
/*draw*/ nullptr,
|
|
|
|
|
/*bake*/ nullptr,
|
|
|
|
|
/*view_update*/ nullptr,
|
|
|
|
|
/*view_draw*/ nullptr,
|
|
|
|
|
/*update_script_node*/ nullptr,
|
|
|
|
|
/*update_render_passes*/ nullptr,
|
2025-03-17 10:31:22 +01:00
|
|
|
/*draw_engine*/ nullptr,
|
2023-07-18 14:18:10 +10:00
|
|
|
/*rna_ext*/
|
|
|
|
|
{
|
|
|
|
|
/*data*/ nullptr,
|
|
|
|
|
/*srna*/ nullptr,
|
|
|
|
|
/*call*/ nullptr,
|
|
|
|
|
},
|
2017-05-01 14:55:59 +02:00
|
|
|
};
|
|
|
|
|
|
2025-03-18 17:27:55 +01:00
|
|
|
bool DRW_engine_external_acquire_for_image_editor(const DRWContext *draw_ctx)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
{
|
|
|
|
|
const SpaceLink *space_data = draw_ctx->space_data;
|
|
|
|
|
Scene *scene = draw_ctx->scene;
|
|
|
|
|
|
2023-07-13 14:39:32 +02:00
|
|
|
if (space_data == nullptr) {
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-13 14:39:32 +02:00
|
|
|
const eSpace_Type space_type = eSpace_Type(draw_ctx->space_data->spacetype);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
if (space_type != SPACE_IMAGE) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-03 08:36:28 +10:00
|
|
|
SpaceImage *space_image = (SpaceImage *)space_data;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
const Image *image = ED_space_image(space_image);
|
2023-07-13 14:39:32 +02:00
|
|
|
if (image == nullptr || image->type != IMA_TYPE_R_RESULT) {
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (image->render_slot != image->last_render_slot) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Render is allocated on main thread, so it is safe to access it from here. */
|
|
|
|
|
Render *re = RE_GetSceneRender(scene);
|
|
|
|
|
|
2023-07-13 14:39:32 +02:00
|
|
|
if (re == nullptr) {
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RE_engine_draw_acquire(re);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 16:01:33 +02:00
|
|
|
void DRW_engine_external_free(RegionView3D *rv3d)
|
|
|
|
|
{
|
|
|
|
|
if (rv3d->view_render) {
|
|
|
|
|
/* Free engine with DRW context enabled, as this may clean up per-context
|
|
|
|
|
* resources like VAOs. */
|
|
|
|
|
DRW_gpu_context_enable_ex(true);
|
|
|
|
|
RE_FreeViewRender(rv3d->view_render);
|
|
|
|
|
rv3d->view_render = nullptr;
|
|
|
|
|
DRW_gpu_context_disable_ex(true);
|
|
|
|
|
}
|
|
|
|
|
}
|