34 b.add_input<
decl::Color>(
"Image").default_value({0.0f, 0.0f, 0.0f, 1.0f});
35 b.add_input<
decl::Float>(
"Alpha").default_value(1.0f).min(0.0f).max(1.0f);
40 ImageUser *iuser = MEM_cnew<ImageUser>(__func__);
61 if (!
context().use_composite_output() && !
context().is_valid_compositing_region()) {
73 else if (!
node().input_by_identifier(
"Alpha")->is_logically_linked()) {
92 else if (
node().input_by_identifier(
"Alpha")->is_logically_linked()) {
98 domain,
image.meta_data.is_non_color_data,
image.precision());
99 if (this->
context().use_gpu()) {
123 domain,
image.meta_data.is_non_color_data,
image.precision());
132 image.bind_as_texture(shader,
"input_tx");
134 output.bind_as_image(shader,
"output_img");
138 image.unbind_as_texture();
148 domain,
image.meta_data.is_non_color_data,
image.precision());
152 const int2 output_texel = texel + bounds.min;
153 if (output_texel.x > bounds.max.x || output_texel.y > bounds.max.y) {
177 domain,
image.meta_data.is_non_color_data,
image.precision());
186 image.bind_as_texture(shader,
"input_tx");
188 output.bind_as_image(shader,
"output_img");
192 image.unbind_as_texture();
202 domain,
image.meta_data.is_non_color_data,
image.precision());
206 const int2 output_texel = texel + bounds.min;
207 if (output_texel.x > bounds.max.x || output_texel.y > bounds.max.y) {
230 domain,
image.meta_data.is_non_color_data,
image.precision());
239 image.bind_as_texture(shader,
"input_tx");
244 output.bind_as_image(shader,
"output_img");
248 image.unbind_as_texture();
260 domain,
image.meta_data.is_non_color_data,
image.precision());
264 const int2 output_texel = texel + bounds.min;
265 if (output_texel.x > bounds.max.x || output_texel.y > bounds.max.y) {
279 if (
context().use_composite_output()) {
283 const rcti compositing_region =
context().get_compositing_region();
285 int2(compositing_region.
xmax, compositing_region.
ymax));
301 if (
context().use_composite_output()) {
326 ntype.
declare = file_ns::cmp_node_viewer_declare;
327 ntype.
draw_buttons = file_ns::node_composit_buts_viewer;
328 ntype.
initfunc = file_ns::node_composit_init_viewer;
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
#define NODE_CLASS_OUTPUT
@ CMP_NODE_OUTPUT_IGNORE_ALPHA
void GPU_shader_uniform_2iv(GPUShader *sh, const char *name, const int data[2])
void GPU_shader_bind(GPUShader *shader)
void GPU_texture_clear(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
struct GPUShader GPUShader
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
NodeOperation(Context &context, DNode node)
void execute_ignore_alpha_gpu()
void execute_ignore_alpha_cpu()
void execute_set_alpha_gpu()
void execute_set_alpha_cpu()
Domain compute_domain() override
Bounds< int2 > get_output_bounds()
void execute_ignore_alpha()
virtual Result get_viewer_output_result(Domain domain, bool is_data, ResultPrecision precision)=0
GPUShader * get_shader(const char *info_name, ResultPrecision precision)
NodeOperation(Context &context, DNode node)
const bNode & bnode() const
const DNode & node() const
Result & get_input(StringRef identifier) const
Context & context() const
virtual Domain compute_domain()
float get_float_value() const
float4 load_pixel(const int2 &texel) const
void unbind_as_texture() const
bool is_single_value() const
void bind_as_texture(GPUShader *shader, const char *texture_name) const
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
local_group_size(16, 16) .push_constant(Type b
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 NodeOperation * get_compositor_operation(Context &context, DNode node)
static void node_composit_buts_viewer(uiLayout *layout, bContext *, PointerRNA *ptr)
static void cmp_node_viewer_declare(NodeDeclarationBuilder &b)
static void node_composit_init_viewer(bNodeTree *, bNode *node)
void parallel_for(const int2 range, FunctionRef< void(int2)> function)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void register_node_type_cmp_viewer()
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
static pxr::UsdShadeInput get_input(const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &input_name)