27 b.add_input<
decl::Int>(
"Index"_ustr).default_value(0).min(0);
28 b.add_input<
decl::Bool>(
"Anti-Alias"_ustr).default_value(
false);
30 b.add_output<
decl::Float>(
"Alpha"_ustr).structure_type(StructureType::Dynamic);
52 if (this->
context().use_gpu()) {
61 non_anti_aliased_mask.
release();
96 float input_mask_value = input_mask.load_pixel<float>(texel);
97 float mask = int(math::round(input_mask_value)) == index ? 1.0f : 0.0f;
98 output_mask.store_pixel(texel, mask);
132 ntype.
ui_description =
"Create a matte from an object or material index pass";
#define NODE_CLASS_CONVERTER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
Result create_result(ResultType type, ResultPrecision precision)
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
NodeOperation(Context &context, const bNode &node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
virtual Domain compute_domain()
bool is_single_value() const
void allocate_texture(const Domain domain, const bool from_pool=true, const std::optional< ResultStorageType > storage_type=std::nullopt)
void unbind_as_texture() const
void set_single_value(const T &value)
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
T get_single_value_default() const
void unbind_as_image() const
void allocate_single_value()
void bind_as_image(gpu::Shader *shader, const char *image_name, bool read=false) const
const T & get_single_value() const
StructureType structure_type
NodeOperation(Context &context, const bNode &node)
void execute_single_value()
void execute_cpu(Result &output_mask)
void execute_gpu(Result &output_mask)
void node_register_type(bNodeType &ntype)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
void smaa(Context &context, const Result &input, Result &output, const float threshold=0.1f, const float local_contrast_adaptation_factor=2.0f, const int corner_rounding=25)
void parallel_for(const int2 range, const Function &function)
T max(const T &a, const T &b)
static void node_declare(NodeDeclarationBuilder &b)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_register()
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_1i(gpu::Shader *sh, const char *name, int value)
void cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
const char * enum_name_legacy
NodeDeclareFunction declare