Merge branch 'blender-v4.4-release'
This commit is contained in:
@@ -37,6 +37,12 @@ template<typename T> static inline T decltype_helper(T x)
|
||||
# define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define BLI_INLINE_METHOD __forceinline
|
||||
#else
|
||||
# define BLI_INLINE_METHOD inline __attribute__((always_inline)) __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define BLI_NOINLINE __attribute__((noinline))
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
@@ -464,12 +464,12 @@ class Result {
|
||||
/* Inline Methods.
|
||||
*/
|
||||
|
||||
inline const Domain &Result::domain() const
|
||||
BLI_INLINE_METHOD const Domain &Result::domain() const
|
||||
{
|
||||
return domain_;
|
||||
}
|
||||
|
||||
inline int64_t Result::channels_count() const
|
||||
BLI_INLINE_METHOD int64_t Result::channels_count() const
|
||||
{
|
||||
switch (type_) {
|
||||
case ResultType::Float:
|
||||
@@ -487,31 +487,32 @@ inline int64_t Result::channels_count() const
|
||||
return 4;
|
||||
}
|
||||
|
||||
inline GPUTexture *Result::gpu_texture() const
|
||||
BLI_INLINE_METHOD GPUTexture *Result::gpu_texture() const
|
||||
{
|
||||
BLI_assert(storage_type_ == ResultStorageType::GPU);
|
||||
return gpu_texture_;
|
||||
}
|
||||
|
||||
inline GMutableSpan Result::cpu_data() const
|
||||
BLI_INLINE_METHOD GMutableSpan Result::cpu_data() const
|
||||
{
|
||||
BLI_assert(storage_type_ == ResultStorageType::CPU);
|
||||
return cpu_data_;
|
||||
}
|
||||
|
||||
template<typename T> inline const T &Result::get_single_value() const
|
||||
template<typename T> BLI_INLINE_METHOD const T &Result::get_single_value() const
|
||||
{
|
||||
BLI_assert(this->is_single_value());
|
||||
|
||||
return std::get<T>(single_value_);
|
||||
}
|
||||
|
||||
template<typename T> inline T &Result::get_single_value()
|
||||
template<typename T> BLI_INLINE_METHOD T &Result::get_single_value()
|
||||
{
|
||||
return const_cast<T &>(std::as_const(*this).get_single_value<T>());
|
||||
}
|
||||
|
||||
template<typename T> inline T Result::get_single_value_default(const T &default_value) const
|
||||
template<typename T>
|
||||
BLI_INLINE_METHOD T Result::get_single_value_default(const T &default_value) const
|
||||
{
|
||||
if (this->is_single_value()) {
|
||||
return this->get_single_value<T>();
|
||||
@@ -519,7 +520,7 @@ template<typename T> inline T Result::get_single_value_default(const T &default_
|
||||
return default_value;
|
||||
}
|
||||
|
||||
template<typename T> inline void Result::set_single_value(const T &value)
|
||||
template<typename T> BLI_INLINE_METHOD void Result::set_single_value(const T &value)
|
||||
{
|
||||
BLI_assert(this->is_allocated());
|
||||
BLI_assert(this->is_single_value());
|
||||
@@ -551,7 +552,8 @@ template<typename T> inline void Result::set_single_value(const T &value)
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, bool CouldBeSingleValue> inline T Result::load_pixel(const int2 &texel) const
|
||||
template<typename T, bool CouldBeSingleValue>
|
||||
BLI_INLINE_METHOD T Result::load_pixel(const int2 &texel) const
|
||||
{
|
||||
if constexpr (CouldBeSingleValue) {
|
||||
if (is_single_value_) {
|
||||
@@ -566,7 +568,7 @@ template<typename T, bool CouldBeSingleValue> inline T Result::load_pixel(const
|
||||
}
|
||||
|
||||
template<typename T, bool CouldBeSingleValue>
|
||||
inline T Result::load_pixel_extended(const int2 &texel) const
|
||||
BLI_INLINE_METHOD T Result::load_pixel_extended(const int2 &texel) const
|
||||
{
|
||||
if constexpr (CouldBeSingleValue) {
|
||||
if (is_single_value_) {
|
||||
@@ -582,7 +584,7 @@ inline T Result::load_pixel_extended(const int2 &texel) const
|
||||
}
|
||||
|
||||
template<typename T, bool CouldBeSingleValue>
|
||||
inline T Result::load_pixel_fallback(const int2 &texel, const T &fallback) const
|
||||
BLI_INLINE_METHOD T Result::load_pixel_fallback(const int2 &texel, const T &fallback) const
|
||||
{
|
||||
if constexpr (CouldBeSingleValue) {
|
||||
if (is_single_value_) {
|
||||
@@ -601,12 +603,12 @@ inline T Result::load_pixel_fallback(const int2 &texel, const T &fallback) const
|
||||
}
|
||||
|
||||
template<typename T, bool CouldBeSingleValue>
|
||||
inline T Result::load_pixel_zero(const int2 &texel) const
|
||||
BLI_INLINE_METHOD T Result::load_pixel_zero(const int2 &texel) const
|
||||
{
|
||||
return this->load_pixel_fallback<T, CouldBeSingleValue>(texel, T(0));
|
||||
}
|
||||
|
||||
inline float4 Result::load_pixel_generic_type(const int2 &texel) const
|
||||
BLI_INLINE_METHOD float4 Result::load_pixel_generic_type(const int2 &texel) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -618,17 +620,19 @@ inline float4 Result::load_pixel_generic_type(const int2 &texel) const
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
template<typename T> inline void Result::store_pixel(const int2 &texel, const T &pixel_value)
|
||||
template<typename T>
|
||||
BLI_INLINE_METHOD void Result::store_pixel(const int2 &texel, const T &pixel_value)
|
||||
{
|
||||
this->cpu_data().typed<T>()[this->get_pixel_index(texel)] = pixel_value;
|
||||
}
|
||||
|
||||
inline void Result::store_pixel_generic_type(const int2 &texel, const float4 &pixel_value)
|
||||
BLI_INLINE_METHOD void Result::store_pixel_generic_type(const int2 &texel,
|
||||
const float4 &pixel_value)
|
||||
{
|
||||
this->get_cpp_type().copy_assign(pixel_value, this->cpu_data()[this->get_pixel_index(texel)]);
|
||||
}
|
||||
|
||||
inline float4 Result::sample_nearest_zero(const float2 &coordinates) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_nearest_zero(const float2 &coordinates) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -650,9 +654,9 @@ inline float4 Result::sample_nearest_zero(const float2 &coordinates) const
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_nearest_wrap(const float2 &coordinates,
|
||||
bool wrap_x,
|
||||
bool wrap_y) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_nearest_wrap(const float2 &coordinates,
|
||||
bool wrap_x,
|
||||
bool wrap_y) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -677,9 +681,9 @@ inline float4 Result::sample_nearest_wrap(const float2 &coordinates,
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_bilinear_wrap(const float2 &coordinates,
|
||||
bool wrap_x,
|
||||
bool wrap_y) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_bilinear_wrap(const float2 &coordinates,
|
||||
bool wrap_x,
|
||||
bool wrap_y) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -704,7 +708,9 @@ inline float4 Result::sample_bilinear_wrap(const float2 &coordinates,
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_cubic_wrap(const float2 &coordinates, bool wrap_x, bool wrap_y) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_cubic_wrap(const float2 &coordinates,
|
||||
bool wrap_x,
|
||||
bool wrap_y) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -729,7 +735,7 @@ inline float4 Result::sample_cubic_wrap(const float2 &coordinates, bool wrap_x,
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_bilinear_zero(const float2 &coordinates) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_bilinear_zero(const float2 &coordinates) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -751,7 +757,7 @@ inline float4 Result::sample_bilinear_zero(const float2 &coordinates) const
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_nearest_extended(const float2 &coordinates) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_nearest_extended(const float2 &coordinates) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -773,7 +779,7 @@ inline float4 Result::sample_nearest_extended(const float2 &coordinates) const
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline float4 Result::sample_bilinear_extended(const float2 &coordinates) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_bilinear_extended(const float2 &coordinates) const
|
||||
{
|
||||
float4 pixel_value = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
if (is_single_value_) {
|
||||
@@ -806,9 +812,9 @@ static void sample_ewa_extended_read_callback(void *userdata, int x, int y, floa
|
||||
copy_v4_v4(result, sampled_result);
|
||||
}
|
||||
|
||||
inline float4 Result::sample_ewa_extended(const float2 &coordinates,
|
||||
const float2 &x_gradient,
|
||||
const float2 &y_gradient) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_ewa_extended(const float2 &coordinates,
|
||||
const float2 &x_gradient,
|
||||
const float2 &y_gradient) const
|
||||
{
|
||||
BLI_assert(type_ == ResultType::Color);
|
||||
|
||||
@@ -843,9 +849,9 @@ static void sample_ewa_zero_read_callback(void *userdata, int x, int y, float re
|
||||
copy_v4_v4(result, sampled_result);
|
||||
}
|
||||
|
||||
inline float4 Result::sample_ewa_zero(const float2 &coordinates,
|
||||
const float2 &x_gradient,
|
||||
const float2 &y_gradient) const
|
||||
BLI_INLINE_METHOD float4 Result::sample_ewa_zero(const float2 &coordinates,
|
||||
const float2 &x_gradient,
|
||||
const float2 &y_gradient) const
|
||||
{
|
||||
BLI_assert(type_ == ResultType::Color);
|
||||
|
||||
@@ -869,7 +875,7 @@ inline float4 Result::sample_ewa_zero(const float2 &coordinates,
|
||||
return pixel_value;
|
||||
}
|
||||
|
||||
inline int64_t Result::get_pixel_index(const int2 &texel) const
|
||||
BLI_INLINE_METHOD int64_t Result::get_pixel_index(const int2 &texel) const
|
||||
{
|
||||
BLI_assert(!is_single_value_);
|
||||
BLI_assert(this->is_allocated());
|
||||
|
||||
Reference in New Issue
Block a user