35 b.add_input<
decl::Int>(
"Index").default_value(0).min(0);
36 b.add_input<
decl::Bool>(
"Anti-Alias").default_value(
false);
38 b.add_output<
decl::Float>(
"Alpha").structure_type(StructureType::Dynamic);
60 if (this->
context().use_gpu()) {
69 non_anti_aliased_mask.
release();
104 float input_mask_value = input_mask.load_pixel<float>(texel);
105 float mask = int(math::round(input_mask_value)) == index ? 1.0f : 0.0f;
106 output_mask.store_pixel(texel, mask);
144 ntype.
ui_description =
"Create a matte from an object or material index pass";
147 ntype.
declare = file_ns::cmp_node_idmask_declare;
#define NODE_CLASS_CONVERTER
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_1i(blender::gpu::Shader *sh, const char *name, int value)
#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, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
virtual Domain compute_domain()
T get_single_value_default(const T &default_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
void unbind_as_image() const
void allocate_single_value()
void bind_as_image(gpu::Shader *shader, const char *image_name, bool read=false) const
bool is_single_value() const
const T & get_single_value() const
StructureType structure_type
void execute_single_value()
void execute_cpu(Result &output_mask)
void execute_gpu(Result &output_mask)
NodeOperation(Context &context, DNode node)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
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 NodeOperation * get_compositor_operation(Context &context, DNode node)
static void cmp_node_idmask_declare(NodeDeclarationBuilder &b)
VecBase< int32_t, 2 > int2
static void register_node_type_cmp_idmask()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
const char * enum_name_legacy
NodeDeclareFunction declare