25#ifdef WITH_OPENIMAGEDENOISE
26# include <OpenImageDenoise/oidn.hpp>
37 .compositor_domain_priority(0);
43 .compositor_domain_priority(2);
47 .compositor_domain_priority(1);
61#ifndef WITH_OPENIMAGEDENOISE
62 uiItemL(layout,
RPT_(
"Disabled, built without OpenImageDenoise"), ICON_ERROR);
67 uiItemL(layout,
RPT_(
"Disabled, CPU with SSE4.2 is required"), ICON_ERROR);
87 return !context->is_canceled();
104#ifdef WITH_OPENIMAGEDENOISE
105 oidn::DeviceRef device = oidn::newDevice(oidn::DeviceType::CPU);
108 const int width = input_image.
domain().
size.x;
109 const int height = input_image.
domain().
size.y;
110 const int pixel_stride =
sizeof(
float) * 4;
117 oidn::FilterRef
filter = device.newFilter(
"RT");
118 filter.setImage(
"color",
color, oidn::Format::Float3, width, height, 0, pixel_stride);
119 filter.setImage(
"output",
color, oidn::Format::Float3, width, height, 0, pixel_stride);
126 float *albedo =
nullptr;
129 albedo =
static_cast<float *
>(
GPU_texture_read(input_albedo, data_format, 0));
132 oidn::FilterRef albedoFilter = device.newFilter(
"RT");
133 albedoFilter.setImage(
134 "albedo", albedo, oidn::Format::Float3, width, height, 0, pixel_stride);
135 albedoFilter.setImage(
136 "output", albedo, oidn::Format::Float3, width, height, 0, pixel_stride);
138 albedoFilter.commit();
139 albedoFilter.execute();
142 filter.setImage(
"albedo", albedo, oidn::Format::Float3, width, height, 0, pixel_stride);
149 float *normal =
nullptr;
152 normal =
static_cast<float *
>(
GPU_texture_read(input_normal, data_format, 0));
155 oidn::FilterRef normalFilter = device.newFilter(
"RT");
156 normalFilter.setImage(
157 "normal", normal, oidn::Format::Float3, width, height, 0, pixel_stride);
158 normalFilter.setImage(
159 "output", normal, oidn::Format::Float3, width, height, 0, pixel_stride);
161 normalFilter.commit();
162 normalFilter.execute();
165 filter.setImage(
"normal", normal, oidn::Format::Float3, width, height, 0, pixel_stride);
204 return node_storage(
bnode()).hdr;
217#ifndef WITH_OPENIMAGEDENOISE
243 ntype.
declare = file_ns::cmp_node_denoise_declare;
244 ntype.
draw_buttons = file_ns::node_composit_buts_denoise;
245 ntype.
initfunc = file_ns::node_composit_init_denonise;
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_OP_FILTER
int BLI_cpu_support_sse42(void)
@ CMP_NODE_DENOISE_PREFILTER_FAST
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
void GPU_memory_barrier(eGPUBarrier barrier)
@ GPU_BARRIER_TEXTURE_UPDATE
void * GPU_texture_read(GPUTexture *texture, eGPUDataFormat data_format, int mip_level)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
Read Guarded memory(de)allocation.
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
ColorGeometry4f default_value
NodeOperation(Context &context, DNode node)
bool should_denoise_auxiliary_passes()
CMPNodeDenoisePrefilter get_prefilter_mode()
bool auxiliary_passes_are_clean()
NodeOperation(Context &context, DNode node)
const bNode & bnode() const
Result & get_input(StringRef identifier) const
Result & get_result(StringRef identifier)
Context & context() const
void pass_through(Result &target)
const Domain & domain() const
bool is_single_value() const
void allocate_texture(Domain domain, bool from_pool=true)
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
void MEM_freeN(void *vmemh)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
static void node_composit_buts_denoise(uiLayout *layout, bContext *, PointerRNA *ptr)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void cmp_node_denoise_declare(NodeDeclarationBuilder &b)
static bool oidn_progress_monitor_function(void *user_ptr, double)
static void node_composit_init_denonise(bNodeTree *, bNode *node)
void register_node_type_cmp_denoise()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare