111 bool is_single_value_ =
false;
126 int reference_count_ = 1;
133 int *data_reference_count_ =
nullptr;
138 std::variant<float, float2, float3, float4, int32_t, int2, bool, std::string, nodes::MenuValue>
139 single_value_ = 0.0f;
146 bool is_external_ =
false;
150 bool is_from_pool_ =
false;
226 const bool from_pool =
true,
227 const std::optional<ResultStorageType> storage_type = std::nullopt);
399 template<
typename T,
bool CouldBeSingleValue = false>
T load_pixel(
const int2 &texel)
const;
402 template<
typename T,
bool CouldBeSingleValue = false>
406 template<
typename T,
bool CouldBeSingleValue = false>
461 const float2 &y_gradient)
const;
466 const float2 &y_gradient)
const;
481 const bool from_pool =
true,
482 const std::optional<ResultStorageType> storage_type = std::nullopt);
547 return std::get<T>(single_value_);
556 return default_value;
564 single_value_ = value;
568template<
typename T,
bool CouldBeSingleValue>
571 if constexpr (CouldBeSingleValue) {
572 if (is_single_value_) {
583template<
typename T,
bool CouldBeSingleValue>
586 if constexpr (CouldBeSingleValue) {
587 if (is_single_value_) {
596 return this->
cpu_data().
typed<
T>()[this->get_pixel_index(clamped_texel)];
599template<
typename T,
bool CouldBeSingleValue>
602 if constexpr (CouldBeSingleValue) {
603 if (is_single_value_) {
611 if (texel.x < 0 || texel.y < 0 || texel.x >= domain_.size.x || texel.y >= domain_.size.y) {
618template<
typename T,
bool CouldBeSingleValue>
627 if (is_single_value_) {
639 this->
cpu_data().
typed<
T>()[this->get_pixel_index(texel)] = pixel_value;
643 const float4 &pixel_value)
654 if (is_single_value_) {
664 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
668 switch (interpolation) {
674 this->channels_count(),
685 this->channels_count(),
697 this->channels_count(),
711 if (is_single_value_) {
719 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
724 this->channels_count(),
726 texel_coordinates.y);
735 if (is_single_value_) {
743 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
749 this->channels_count(),
762 if (is_single_value_) {
770 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
776 this->channels_count(),
789 if (is_single_value_) {
797 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
803 this->channels_count(),
814 if (is_single_value_) {
822 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
827 this->channels_count(),
829 texel_coordinates.y);
836 if (is_single_value_) {
844 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
849 this->channels_count(),
851 texel_coordinates.y);
858 if (is_single_value_) {
866 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
871 this->channels_count(),
873 texel_coordinates.y);
880 if (is_single_value_) {
888 const float *buffer =
static_cast<const float *
>(this->
cpu_data().
data());
893 this->channels_count(),
895 texel_coordinates.y);
912 const float2 &y_gradient)
const
917 if (is_single_value_) {
931 const_cast<Result *
>(
this),
949 const float2 &y_gradient)
const
954 if (is_single_value_) {
968 const_cast<Result *
>(
this),
977 BLI_assert(texel.x >= 0 && texel.y >= 0 && texel.x < domain_.
size.x && texel.y < domain_.
size.y);
978 return int64_t(texel.y) * domain_.
size.x + texel.x;
#define BLI_assert_unreachable()
#define BLI_INLINE_METHOD
void BLI_ewa_filter(int width, int height, bool intpol, bool use_alpha, const float uv[2], const float du[2], const float dv[2], ewa_filter_read_pixel_cb read_pixel_cb, void *userdata, float result[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void copy_assign(const void *src, void *dst) const
const void * data() const
float4 sample_nearest_extended(const float2 &coordinates) const
void decrement_reference_count(int count=1)
float4 sample_cubic_wrap(const float2 &coordinates, bool wrap_x, bool wrap_y) const
void share_data(const Result &source)
RealizationOptions & get_realization_options()
Result upload_to_gpu(const bool from_pool) const
float4 sample_nearest_wrap(const float2 &coordinates, bool wrap_x, bool wrap_y) const
const CPPType & get_cpp_type() const
T get_single_value_default(const T &default_value) const
void store_pixel(const int2 &texel, const T &pixel_value)
int reference_count() const
void allocate_texture(const Domain domain, const bool from_pool=true, const std::optional< ResultStorageType > storage_type=std::nullopt)
static eGPUDataFormat gpu_data_format(const ResultType type)
int64_t size_in_bytes() const
float4 sample_nearest_zero(const float2 &coordinates) const
void wrap_external(blender::gpu::Texture *texture)
void unbind_as_texture() const
Result download_to_cpu() const
static blender::gpu::TextureFormat gpu_texture_format(ResultType type, ResultPrecision precision)
static const char * type_name(const ResultType type)
float4 sample_ewa_extended(const float2 &coordinates, const float2 &x_gradient, const float2 &y_gradient) const
bool is_allocated() const
float4 sample_cubic_extended(const float2 &coordinates) const
void set_transformation(const float3x3 &transformation)
T load_pixel_zero(const int2 &texel) const
static bool is_single_value_only_type(ResultType type)
float4 sample_bilinear_zero(const float2 &coordinates) const
float4 sample(const float2 &coordinates, const Interpolation &interpolation, const ExtensionMode &extend_mode_x, const ExtensionMode &extend_mode_y) const
GPointer single_value() const
blender::gpu::Texture * gpu_texture_
blender::gpu::TextureFormat get_gpu_texture_format() const
eGPUDataFormat get_gpu_data_format() const
void set_single_value(const T &value)
static ResultType type(blender::gpu::TextureFormat format)
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
ResultPrecision precision() const
float4 sample_bilinear_wrap(const float2 &coordinates, bool wrap_x, bool wrap_y) const
void update_single_value_data()
blender::gpu::Texture * gpu_texture() const
void store_pixel_generic_type(const int2 &texel, const float4 &pixel_value)
T load_pixel_extended(const int2 &texel) const
static ResultType float_type(const int channels_count)
void set_precision(ResultPrecision precision)
void transform(const float3x3 &transformation)
void increment_reference_count(int count=1)
const Domain & domain() const
static const CPPType & cpp_type(const ResultType type)
T load_pixel(const int2 &texel) const
int64_t channels_count() const
void unbind_as_image() const
T load_pixel_fallback(const int2 &texel, const T &fallback) const
void allocate_single_value()
static ResultPrecision precision(blender::gpu::TextureFormat format)
float4 sample_ewa_zero(const float2 &coordinates, const float2 &x_gradient, const float2 &y_gradient) const
DerivedResources & derived_resources()
float4 sample_bilinear_extended(const float2 &coordinates) const
float4 load_pixel_generic_type(const int2 &texel) const
void bind_as_image(gpu::Shader *shader, const char *image_name, bool read=false) const
void set_reference_count(int count)
bool is_single_value() const
void steal_data(Result &source)
const T & get_single_value() const
void set_type(ResultType type)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
static void sample_ewa_extended_read_callback(void *userdata, int x, int y, float result[4])
static void sample_ewa_zero_read_callback(void *userdata, int x, int y, float result[4])
math::InterpWrapMode map_extension_mode_to_wrap_mode(const ExtensionMode &mode)
T clamp(const T &a, const T &min, const T &max)
void interpolate_nearest_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
void interpolate_nearest_border_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
float4 interpolate_bilinear_border_fl(const float *buffer, int width, int height, float u, float v)
float4 interpolate_cubic_bspline_fl(const float *buffer, int width, int height, float u, float v)
void interpolate_nearest_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_u, InterpWrapMode wrap_v)
float4 interpolate_bilinear_fl(const float *buffer, int width, int height, float u, float v)
void interpolate_bilinear_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_u, InterpWrapMode wrap_v)
void interpolate_cubic_bspline_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_u, InterpWrapMode wrap_v)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3