2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 02:50:24 +01:00
|
|
|
* limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __DEVICE_H__
|
|
|
|
|
#define __DEVICE_H__
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2018-01-19 10:59:58 +01:00
|
|
|
#include "bvh/bvh_params.h"
|
|
|
|
|
|
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 "device/device_denoise.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "device/device_memory.h"
|
|
|
|
|
|
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 "util/util_function.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/util_list.h"
|
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 "util/util_logging.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/util_stats.h"
|
|
|
|
|
#include "util/util_string.h"
|
2017-10-06 21:47:41 +02:00
|
|
|
#include "util/util_texture.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "util/util_thread.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/util_types.h"
|
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 "util/util_unique_ptr.h"
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/util_vector.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
2019-09-12 14:50:06 +02:00
|
|
|
class BVH;
|
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
|
|
|
class DeviceQueue;
|
2011-04-27 11:58:34 +00:00
|
|
|
class Progress;
|
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
|
|
|
class CPUKernels;
|
|
|
|
|
class CPUKernelThreadGlobals;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-01-04 18:06:32 +00:00
|
|
|
/* Device Types */
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
enum DeviceType {
|
2019-01-29 16:39:30 +01:00
|
|
|
DEVICE_NONE = 0,
|
2011-04-27 11:58:34 +00:00
|
|
|
DEVICE_CPU,
|
|
|
|
|
DEVICE_CUDA,
|
2019-09-12 14:50:06 +02:00
|
|
|
DEVICE_MULTI,
|
|
|
|
|
DEVICE_OPTIX,
|
2021-09-28 16:51:14 +02:00
|
|
|
DEVICE_HIP,
|
2020-10-28 19:55:41 +01:00
|
|
|
DEVICE_DUMMY,
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
2019-01-29 16:39:30 +01:00
|
|
|
enum DeviceTypeMask {
|
|
|
|
|
DEVICE_MASK_CPU = (1 << DEVICE_CPU),
|
|
|
|
|
DEVICE_MASK_CUDA = (1 << DEVICE_CUDA),
|
2019-09-12 14:50:06 +02:00
|
|
|
DEVICE_MASK_OPTIX = (1 << DEVICE_OPTIX),
|
2021-09-28 16:51:14 +02:00
|
|
|
DEVICE_MASK_HIP = (1 << DEVICE_HIP),
|
2019-01-29 16:39:30 +01:00
|
|
|
DEVICE_MASK_ALL = ~0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define DEVICE_MASK(type) (DeviceTypeMask)(1 << type)
|
|
|
|
|
|
2012-01-04 18:06:32 +00:00
|
|
|
class DeviceInfo {
|
|
|
|
|
public:
|
|
|
|
|
DeviceType type;
|
|
|
|
|
string description;
|
Cycles: Refactor Device selection to allow individual GPU compute device selection
Previously, it was only possible to choose a single GPU or all of that type (CUDA or OpenCL).
Now, a toggle button is displayed for every device.
These settings are tied to the PCI Bus ID of the devices, so they're consistent across hardware addition and removal (but not when swapping/moving cards).
From the code perspective, the more important change is that now, the compute device properties are stored in the Addon preferences of the Cycles addon, instead of directly in the User Preferences.
This allows for a cleaner implementation, removing the Cycles C API functions that were called by the RNA code to specify the enum items.
Note that this change is neither backwards- nor forwards-compatible, but since it's only a User Preference no existing files are broken.
Reviewers: #cycles, brecht
Reviewed By: #cycles, brecht
Subscribers: brecht, juicyfruit, mib2berlin, Blendify
Differential Revision: https://developer.blender.org/D2338
2016-11-07 02:33:53 +01:00
|
|
|
string id; /* used for user preferences, should stay fixed with changing hardware config */
|
2012-01-04 18:06:32 +00:00
|
|
|
int num;
|
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
|
|
|
bool display_device; /* GPU is used as a display device. */
|
|
|
|
|
bool has_nanovdb; /* Support NanoVDB volumes. */
|
|
|
|
|
bool has_half_images; /* Support half-float textures. */
|
|
|
|
|
bool has_osl; /* Support Open Shading Language. */
|
|
|
|
|
bool has_profiling; /* Supports runtime collection of profiling info. */
|
|
|
|
|
bool has_peer_memory; /* GPU has P2P access to memory of another GPU. */
|
|
|
|
|
bool has_gpu_queue; /* Device supports GPU queue. */
|
|
|
|
|
DenoiserTypeMask denoisers; /* Supported denoiser types. */
|
2017-10-21 18:58:59 +02:00
|
|
|
int cpu_threads;
|
2012-01-04 18:06:32 +00:00
|
|
|
vector<DeviceInfo> multi_devices;
|
2020-10-28 19:55:41 +01:00
|
|
|
string error_msg;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-01-04 18:06:32 +00:00
|
|
|
DeviceInfo()
|
|
|
|
|
{
|
|
|
|
|
type = DEVICE_CPU;
|
|
|
|
|
id = "CPU";
|
|
|
|
|
num = 0;
|
2017-10-21 18:58:59 +02:00
|
|
|
cpu_threads = 0;
|
2012-01-04 18:06:32 +00:00
|
|
|
display_device = false;
|
2017-11-03 20:21:19 +01:00
|
|
|
has_half_images = false;
|
2021-03-29 22:58:19 +02:00
|
|
|
has_nanovdb = false;
|
2017-10-20 05:08:26 +02:00
|
|
|
has_osl = false;
|
2018-11-29 02:06:30 +01:00
|
|
|
has_profiling = false;
|
2020-06-08 17:16:10 +02:00
|
|
|
has_peer_memory = false;
|
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
|
|
|
has_gpu_queue = false;
|
2020-05-31 23:49:10 +02:00
|
|
|
denoisers = DENOISER_NONE;
|
2012-01-04 18:06:32 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +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
|
|
|
bool operator==(const DeviceInfo &info) const
|
Cycles: Refactor Device selection to allow individual GPU compute device selection
Previously, it was only possible to choose a single GPU or all of that type (CUDA or OpenCL).
Now, a toggle button is displayed for every device.
These settings are tied to the PCI Bus ID of the devices, so they're consistent across hardware addition and removal (but not when swapping/moving cards).
From the code perspective, the more important change is that now, the compute device properties are stored in the Addon preferences of the Cycles addon, instead of directly in the User Preferences.
This allows for a cleaner implementation, removing the Cycles C API functions that were called by the RNA code to specify the enum items.
Note that this change is neither backwards- nor forwards-compatible, but since it's only a User Preference no existing files are broken.
Reviewers: #cycles, brecht
Reviewed By: #cycles, brecht
Subscribers: brecht, juicyfruit, mib2berlin, Blendify
Differential Revision: https://developer.blender.org/D2338
2016-11-07 02:33:53 +01:00
|
|
|
{
|
|
|
|
|
/* Multiple Devices with the same ID would be very bad. */
|
|
|
|
|
assert(id != info.id ||
|
|
|
|
|
(type == info.type && num == info.num && description == info.description));
|
|
|
|
|
return id == info.id;
|
|
|
|
|
}
|
2015-05-09 19:05:49 +05:00
|
|
|
};
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Device */
|
|
|
|
|
|
|
|
|
|
class Device {
|
2017-05-07 14:40:58 +02:00
|
|
|
friend class device_sub_ptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
protected:
|
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
|
|
|
Device(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_)
|
|
|
|
|
: info(info_), stats(stats_), profiler(profiler_)
|
2018-11-29 23:54:30 +01:00
|
|
|
{
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-22 20:49:33 +00:00
|
|
|
string error_msg;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-09-23 17:38:56 +02:00
|
|
|
virtual device_ptr mem_alloc_sub_ptr(device_memory & /*mem*/, size_t /*offset*/, size_t /*size*/)
|
2017-05-07 14:40:58 +02:00
|
|
|
{
|
|
|
|
|
/* Only required for devices that implement denoising. */
|
|
|
|
|
assert(false);
|
|
|
|
|
return (device_ptr)0;
|
|
|
|
|
}
|
|
|
|
|
virtual void mem_free_sub_ptr(device_ptr /*ptr*/){};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2020-06-05 16:39:57 +02:00
|
|
|
/* noexcept needed to silence TBB warning. */
|
|
|
|
|
virtual ~Device() noexcept(false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* info */
|
2012-01-26 19:07:01 +00:00
|
|
|
DeviceInfo info;
|
2012-01-04 18:06:32 +00:00
|
|
|
virtual const string &error_message()
|
|
|
|
|
{
|
|
|
|
|
return error_msg;
|
|
|
|
|
}
|
2012-12-23 12:53:58 +00:00
|
|
|
bool have_error()
|
|
|
|
|
{
|
|
|
|
|
return !error_message().empty();
|
|
|
|
|
}
|
2017-03-11 07:03:17 -05:00
|
|
|
virtual void set_error(const string &error)
|
|
|
|
|
{
|
|
|
|
|
if (!have_error()) {
|
|
|
|
|
error_msg = error;
|
|
|
|
|
}
|
|
|
|
|
fprintf(stderr, "%s\n", error.c_str());
|
|
|
|
|
fflush(stderr);
|
|
|
|
|
}
|
Cycles: Refactor Progress system to provide better estimates
The Progress system in Cycles had two limitations so far:
- It just counted tiles, but ignored their size. For example, when rendering a 600x500 image with 512x512 tiles, the right 88x500 tile would count for 50% of the progress, although it only covers 15% of the image.
- Scene update time was incorrectly counted as rendering time - therefore, the remaining time started very long and gradually decreased.
This patch fixes both problems:
First of all, the Progress now has a function to ignore time spans, and that is used to ignore scene update time.
The larger change is the tile size: Instead of counting samples per tile, so that the final value is num_samples*num_tiles, the code now counts every sample for every pixel, so that the final value is num_samples*num_pixels.
Along with that, some unused variables were removed from the Progress and Session classes.
Reviewers: brecht, sergey, #cycles
Subscribers: brecht, candreacchio, sergey
Differential Revision: https://developer.blender.org/D2214
2016-11-26 04:22:34 +01:00
|
|
|
virtual bool show_samples() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-10-31 11:46:52 +01:00
|
|
|
virtual BVHLayoutMask get_bvh_layout_mask() const = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-05 08:04:57 +00:00
|
|
|
/* statistics */
|
|
|
|
|
Stats &stats;
|
2018-11-29 23:30:17 +01:00
|
|
|
Profiler &profiler;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* constant memory */
|
|
|
|
|
virtual void const_copy_to(const char *name, void *host, size_t size) = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-06 10:17:58 +02:00
|
|
|
/* load/compile kernels, must be called before adding tasks */
|
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
|
|
|
virtual bool load_kernels(uint /*kernel_features*/)
|
2015-05-09 19:05:49 +05:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +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
|
|
|
/* GPU device only functions.
|
|
|
|
|
* These may not be used on CPU or multi-devices. */
|
2019-04-17 06:17:24 +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
|
|
|
/* Create new queue for executing kernels in. */
|
|
|
|
|
virtual unique_ptr<DeviceQueue> gpu_queue_create();
|
|
|
|
|
|
|
|
|
|
/* CPU device only functions.
|
|
|
|
|
* These may not be used on GPU or multi-devices. */
|
2019-09-12 14:50:06 +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
|
|
|
/* Get CPU kernel functions for native instruction set. */
|
|
|
|
|
virtual const CPUKernels *get_cpu_kernels() const;
|
|
|
|
|
/* Get kernel globals to pass to kernels. */
|
|
|
|
|
virtual void get_cpu_kernel_thread_globals(
|
|
|
|
|
vector<CPUKernelThreadGlobals> & /*kernel_thread_globals*/);
|
|
|
|
|
/* Get OpenShadingLanguage memory buffer. */
|
|
|
|
|
virtual void *get_cpu_osl_memory();
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-09-12 14:50:06 +02:00
|
|
|
/* acceleration structure building */
|
2020-12-10 14:18:25 +01:00
|
|
|
virtual void build_bvh(BVH *bvh, Progress &progress, bool refit);
|
2019-09-12 14:50:06 +02:00
|
|
|
|
2021-05-19 00:55:22 +02:00
|
|
|
/* OptiX specific destructor. */
|
2021-05-21 11:19:33 +02:00
|
|
|
virtual void release_optix_bvh(BVH * /*bvh*/){};
|
2021-05-19 00:55:22 +02:00
|
|
|
|
2012-09-04 13:29:07 +00:00
|
|
|
/* multi device */
|
2015-03-27 15:47:55 +05:00
|
|
|
virtual int device_number(Device * /*sub_device*/)
|
2019-04-17 06:17:24 +02:00
|
|
|
{
|
2015-03-27 15:47:55 +05:00
|
|
|
return 0;
|
2017-05-07 14:40:58 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-08 17:16:10 +02:00
|
|
|
virtual bool is_resident(device_ptr /*key*/, Device *sub_device)
|
|
|
|
|
{
|
|
|
|
|
/* Memory is always resident if this is not a multi device, regardless of whether the pointer
|
|
|
|
|
* is valid or not (since it may not have been allocated yet). */
|
|
|
|
|
return sub_device == this;
|
|
|
|
|
}
|
|
|
|
|
virtual bool check_peer_access(Device * /*peer_device*/)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/* Graphics resources interoperability.
|
|
|
|
|
*
|
|
|
|
|
* The interoperability comes here by the meaning that the device is capable of computing result
|
|
|
|
|
* directly into an OpenGL (or other graphics library) buffer. */
|
|
|
|
|
|
2021-09-22 14:48:01 +10:00
|
|
|
/* Check display is to be updated using graphics interoperability.
|
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
|
|
|
* The interoperability can not be used is it is not supported by the device. But the device
|
|
|
|
|
* might also force disable the interoperability if it detects that it will be slower than
|
|
|
|
|
* copying pixels from the render buffer. */
|
|
|
|
|
virtual bool should_use_graphics_interop()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Buffer denoising. */
|
|
|
|
|
|
|
|
|
|
/* Returns true if task is fully handled. */
|
|
|
|
|
virtual bool denoise_buffer(const DeviceDenoiseTask & /*task*/)
|
|
|
|
|
{
|
|
|
|
|
LOG(ERROR) << "Request buffer denoising from a device which does not support it.";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual DeviceQueue *get_denoise_queue()
|
|
|
|
|
{
|
|
|
|
|
LOG(ERROR) << "Request denoising queue from a device which does not support it.";
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sub-devices */
|
|
|
|
|
|
|
|
|
|
/* Run given callback for every individual device which will be handling rendering.
|
|
|
|
|
* For the single device the callback is called for the device itself. For the multi-device the
|
|
|
|
|
* callback is only called for the sub-devices. */
|
|
|
|
|
virtual void foreach_device(const function<void(Device *)> &callback)
|
|
|
|
|
{
|
|
|
|
|
callback(this);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* static */
|
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
|
|
|
static Device *create(const DeviceInfo &info, Stats &stats, Profiler &profiler);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
static DeviceType type_from_string(const char *name);
|
|
|
|
|
static string string_from_type(DeviceType type);
|
2019-01-29 16:39:30 +01:00
|
|
|
static vector<DeviceType> available_types();
|
|
|
|
|
static vector<DeviceInfo> available_devices(uint device_type_mask = DEVICE_MASK_ALL);
|
2020-10-28 19:55:41 +01:00
|
|
|
static DeviceInfo dummy_device(const string &error_msg = "");
|
2019-01-29 16:39:30 +01:00
|
|
|
static string device_capabilities(uint device_type_mask = DEVICE_MASK_ALL);
|
2017-10-21 18:58:59 +02:00
|
|
|
static DeviceInfo get_multi_device(const vector<DeviceInfo> &subdevices,
|
|
|
|
|
int threads,
|
|
|
|
|
bool background);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-12 16:00:48 +05:00
|
|
|
/* Tag devices lists for update. */
|
|
|
|
|
static void tag_update();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-07 03:40:41 +05:00
|
|
|
static void free_memory();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-21 01:09:59 +02:00
|
|
|
protected:
|
|
|
|
|
/* Memory allocation, only accessed through device_memory. */
|
|
|
|
|
friend class MultiDevice;
|
|
|
|
|
friend class DeviceServer;
|
|
|
|
|
friend class device_memory;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-21 01:09:59 +02:00
|
|
|
virtual void mem_alloc(device_memory &mem) = 0;
|
|
|
|
|
virtual void mem_copy_to(device_memory &mem) = 0;
|
2021-09-23 17:38:56 +02:00
|
|
|
virtual void mem_copy_from(device_memory &mem, size_t y, size_t w, size_t h, size_t elem) = 0;
|
2017-10-21 01:09:59 +02:00
|
|
|
virtual void mem_zero(device_memory &mem) = 0;
|
|
|
|
|
virtual void mem_free(device_memory &mem) = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-12 16:00:48 +05:00
|
|
|
private:
|
|
|
|
|
/* Indicted whether device types and devices lists were initialized. */
|
|
|
|
|
static bool need_types_update, need_devices_update;
|
2017-10-11 12:48:19 +05:00
|
|
|
static thread_mutex device_mutex;
|
2019-01-29 16:39:30 +01:00
|
|
|
static vector<DeviceInfo> cuda_devices;
|
2019-09-12 14:50:06 +02:00
|
|
|
static vector<DeviceInfo> optix_devices;
|
2019-01-29 16:39:30 +01:00
|
|
|
static vector<DeviceInfo> cpu_devices;
|
2021-09-28 16:51:14 +02:00
|
|
|
static vector<DeviceInfo> hip_devices;
|
2019-01-29 16:39:30 +01:00
|
|
|
static uint devices_initialized_mask;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif /* __DEVICE_H__ */
|