Blender V5.3
blender::draw::detail Namespace Reference

Classes

class  DataBuffer
class  Pass
class  PassBase
struct  RadiancePack
class  StorageCommon
class  SubPassVector
class  UniformCommon

Functions

static void index_mask_to_ibo (const IndexMask &mask, gpu::IndexBuf &ibo)
BLI_INLINE float3 pack_quaternion_4_to_3 (const float4 &q)
BLI_INLINE uint4 pack_gaussian (const float3 &bounded_mean, const float3 &bounded_log_scale, bool log_scale_is_zero, const math::Quaternion &rotation, float opacity)
BLI_INLINE RadiancePack pack_radiance (const Array< float3, radiance_coeffs_max > &radiance_sh)
static Vector< VArraySpan< float3 > > read_radiance_sh_attributes (const bke::AttributeAccessor &attributes)
static void batched_dispatch (const int invocs_count, PassSimple::Sub &pass)
template<typename PassT>
void compute_pass_setup (PassT &ps, const ObjectRef &ob_ref, const ResourceHandleRange &res_handle)
template<typename PassT>
gpu::Batch * draw_subpass_setup (PassT &sub_ps, const ObjectRef &ob_ref, const ResourceHandleRange &res_handle, GPUMaterial *gpu_material)

Function Documentation

◆ batched_dispatch()

void blender::draw::detail::batched_dispatch ( const int invocs_count,
PassSimple::Sub & pass )
static

◆ compute_pass_setup()

◆ draw_subpass_setup()

◆ index_mask_to_ibo()

void blender::draw::detail::index_mask_to_ibo ( const IndexMask & mask,
gpu::IndexBuf & ibo )
static

◆ pack_gaussian()

BLI_INLINE uint4 blender::draw::detail::pack_gaussian ( const float3 & bounded_mean,
const float3 & bounded_log_scale,
bool log_scale_is_zero,
const math::Quaternion & rotation,
float opacity )

Tightly pack Gaussian shape data to a uint4.

This is an adapted version of the quantization in [gspt2026], which relies on separately stored boundaries in a UBO. Our variant reduces Gaussian mean to 3x22b, scale to 3x9b, and rotation to 3x9b. We additionally pack Gaussian opacity in 8b. Across 4 uints, data is then distributed as follows:

  • word 0: [ meanx, 22 ] [ meany, 10 ]
  • word 1: [ meany, 12 ] [ meanz, 20 ]
  • word 2: [ meanz, 2 ] [ quatx, 9 ] [ quaty, 9 ] [ quatz, 9 ] [ scalx, 3 ]
  • word 3: [ scalx, 6 ] [ scaly, 9 ] [ scalz, 9 ] [ opaci, 8 ]
Note
Keep in sync with unpack_gaussian_* in draw_gsplat_lib.bsl.hh.

Definition at line 114 of file draw_cache_impl_gsplat.cc.

References BLI_INLINE, blender::math::clamp(), clamp(), blender::math::normalize(), pack_gaussian(), pack_quaternion_4_to_3(), blender::math::round(), and w().

Referenced by pack_gaussian().

◆ pack_quaternion_4_to_3()

BLI_INLINE float3 blender::draw::detail::pack_quaternion_4_to_3 ( const float4 & q)

Expmap packing [quat2017] of quaternion data.

Note
Keep in sync with unpack_quaternion_3_to_4 in draw_gsplat_lib.bsl.hh.

Definition at line 89 of file draw_cache_impl_gsplat.cc.

References atan, b, BLI_INLINE, M_PI, pack_quaternion_4_to_3(), blender::sqrt(), and w().

Referenced by pack_gaussian(), and pack_quaternion_4_to_3().

◆ pack_radiance()

BLI_INLINE RadiancePack blender::draw::detail::pack_radiance ( const Array< float3, radiance_coeffs_max > & radiance_sh)

Tightly pack radiance and opacity data to 4x uint4.

This quantizes 3 channels of spherical harmonics degrees 0-3 using 8b per coefficient, so 3x16 coefficients. Note that the draw module restricts spherical harmonics to 3 degrees; packing a 4th would greatly increase memory and packing complexity for little gain.

The coefficients are distributed over 12 words as follows:

[0, 1, 2, 3] : [xyzx][yzxy][zxyz][xyzx] [4, 5, 6, 7] : [yzxy][zxyz][xyzx][yzxy] [8, 9, 10, 11] : [zxyz][xyzx][yzxy][zxyz]

Note
Keep in sync with eval_radiance in draw_gsplat.bsl.hh.

Definition at line 175 of file draw_cache_impl_gsplat.cc.

References BLI_INLINE, blender::math::clamp(), pack_radiance(), blender::draw::radiance_coeffs_max, and blender::math::round().

Referenced by pack_radiance().

◆ read_radiance_sh_attributes()

Vector< VArraySpan< float3 > > blender::draw::detail::read_radiance_sh_attributes ( const bke::AttributeAccessor & attributes)
static

Collect virtual arrays for existing pointcloud attributes that store the various spherical harmonics coefficients, up to the maximum supported number.

Definition at line 194 of file draw_cache_impl_gsplat.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::blender::Span< T >::is_empty(), blender::bke::AttributeAccessor::lookup(), blender::draw::radiance_coeffs_max, and read_radiance_sh_attributes().

Referenced by blender::draw::GSplatEvalCache::ensure_builtin_buffers(), and read_radiance_sh_attributes().