Blender V4.3
denoiser_oidn_gpu.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#if defined(WITH_OPENIMAGEDENOISE)
8
11# include "util/thread.h"
12# include "util/unique_ptr.h"
13
15
16/* Implementation of a GPU denoiser which uses OpenImageDenoise library. */
17class OIDNDenoiserGPU : public DenoiserGPU {
18 friend class OIDNDenoiseContext;
19
20 public:
21 /* Forwardly declared state which might be using compile-flag specific fields, such as
22 * OpenImageDenoise device and filter handles. */
23 class State;
24
25 OIDNDenoiserGPU(Device *denoiser_device, const DenoiseParams &params);
26 ~OIDNDenoiserGPU();
27
28 virtual bool denoise_buffer(const BufferParams &buffer_params,
29 RenderBuffers *render_buffers,
30 const int num_samples,
31 bool allow_inplace_modification) override;
32
33 static bool is_device_supported(const DeviceInfo &device);
34
35 protected:
36 enum class ExecMode {
37 SYNC,
38 ASYNC,
39 };
40
41 virtual uint get_device_type_mask() const override;
42
43 /* Create OIDN denoiser descriptor if needed.
44 * Will do nothing if the current OIDN descriptor is usable for the given parameters.
45 * If the OIDN denoiser descriptor did re-allocate here it is left unconfigured. */
46 virtual bool denoise_create_if_needed(DenoiseContext &context) override;
47
48 /* Configure existing OIDN denoiser descriptor for the use for the given task. */
49 virtual bool denoise_configure_if_needed(DenoiseContext &context) override;
50
51 /* Run configured denoiser. */
52 virtual bool denoise_run(const DenoiseContext &context, const DenoisePass &pass) override;
53
54 OIDNFilter create_filter();
55 bool commit_and_execute_filter(OIDNFilter filter, ExecMode mode = ExecMode::SYNC);
56
57 void set_filter_pass(OIDNFilter filter,
58 const char *name,
60 int format,
61 int width,
62 int height,
63 size_t offset_in_bytes,
64 size_t pixel_stride_in_bytes,
65 size_t row_stride_in_bytes);
66
67 /* Delete all allocated OIDN objects. */
68 void release_all_resources();
69
70 OIDNDevice oidn_device_ = nullptr;
71 OIDNFilter oidn_filter_ = nullptr;
72 OIDNFilter albedo_filter_ = nullptr;
73 OIDNFilter normal_filter_ = nullptr;
74
75 bool is_configured_ = false;
76 int2 configured_size_ = make_int2(0, 0);
77
78 vector<uint8_t> custom_weights;
79
80 bool use_pass_albedo_ = false;
81 bool use_pass_normal_ = false;
83
84 /* Filter memory usage limit if we ran out of memory with OIDN's default limit. */
85 int max_mem_ = 768;
86};
87
89
90#endif
unsigned int uint
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
virtual bool denoise_run(const DenoiseContext &context, const DenoisePass &pass)=0
virtual bool denoise_create_if_needed(DenoiseContext &context)=0
virtual bool denoise_buffer(const BufferParams &buffer_params, RenderBuffers *render_buffers, const int num_samples, bool allow_inplace_modification) override
virtual bool denoise_configure_if_needed(DenoiseContext &context)=0
virtual uint get_device_type_mask() const =0
DenoiserQuality
Definition denoise.h:43
@ DENOISER_QUALITY_HIGH
Definition denoise.h:44
#define CCL_NAMESPACE_END
ccl_device_forceinline int2 make_int2(const int x, const int y)
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
format
uint64_t device_ptr
Definition util/types.h:45
PointerRNA * ptr
Definition wm_files.cc:4126