Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
skgpu::graphite::LayoutTraits< N, Half > Struct Template Reference

#include <UniformManager.h>

Static Public Member Functions

static void Copy (const void *src, void *dst)
 

Static Public Attributes

static constexpr int kElemSize = Half ? sizeof(SkHalf) : sizeof(float)
 
static constexpr int kSize = N * kElemSize
 
static constexpr int kAlign = SkNextPow2_portable(N) * kElemSize
 

Detailed Description

template<int N, bool Half>
struct skgpu::graphite::LayoutTraits< N, Half >

Definition at line 366 of file UniformManager.h.

Member Function Documentation

◆ Copy()

template<int N, bool Half>
static void skgpu::graphite::LayoutTraits< N, Half >::Copy ( const void *  src,
void *  dst 
)
inlinestatic

Definition at line 375 of file UniformManager.h.

375 {
376 if constexpr (Half) {
377 using VecF = skvx::Vec<SkNextPow2_portable(N), float>;
378 VecF srcData;
379 if constexpr (N == 3) {
380 // Load the 3 values into a float4 to take advantage of vectorized conversion.
381 // The 4th value will not be copied to dst.
382 const float* srcF = static_cast<const float*>(src);
383 srcData = VecF{srcF[0], srcF[1], srcF[2], 0.f};
384 } else {
385 srcData = VecF::Load(src);
386 }
387
388 auto dstData = to_half(srcData);
389 // NOTE: this is identical to Vec::store() for N=1,2,4 and correctly drops the 4th
390 // lane when N=3.
391 memcpy(dst, &dstData, kSize);
392 } else {
393 memcpy(dst, src, kSize);
394 }
395 }
constexpr int SkNextPow2_portable(int value)
Definition SkMathPriv.h:277
#define N
Definition beziers.cpp:19
SIN Vec< N, uint16_t > to_half(const Vec< N, float > &x)
Definition SkVx.h:750

Member Data Documentation

◆ kAlign

template<int N, bool Half>
constexpr int skgpu::graphite::LayoutTraits< N, Half >::kAlign = SkNextPow2_portable(N) * kElemSize
staticconstexpr

Definition at line 371 of file UniformManager.h.

◆ kElemSize

template<int N, bool Half>
constexpr int skgpu::graphite::LayoutTraits< N, Half >::kElemSize = Half ? sizeof(SkHalf) : sizeof(float)
staticconstexpr

Definition at line 369 of file UniformManager.h.

◆ kSize

template<int N, bool Half>
constexpr int skgpu::graphite::LayoutTraits< N, Half >::kSize = N * kElemSize
staticconstexpr

Definition at line 370 of file UniformManager.h.


The documentation for this struct was generated from the following file: