8#ifndef skgpu_UniformManager_DEFINED
9#define skgpu_UniformManager_DEFINED
34class UniformDataBlock;
166namespace LayoutRules {
181 int size()
const {
return fOffset; }
195 int fReqAlignment = 0;
209 void write(
float f) { this->write<SkSLType::kFloat>(&
f); }
210 void write(int32_t
i) { this->write<SkSLType::kInt >(&
i); }
225 this->writeArray<SkSLType::kFloat4>(v.
data(), v.
size());
228 this->writeArray<SkSLType::kFloat4>(c.
data(), c.
size());
231 this->writeArray<SkSLType::kHalf4>(c.
data(), c.
size());
270 float colMajor[9] = {
m[0],
m[3],
m[6],
273 this->writeArray<SkSLType::kFloat3>(colMajor, 3);
276 float colMajor[9] = {
m[0],
m[3],
m[6],
279 this->writeArray<SkSLType::kHalf3>(colMajor, 3);
288 if (fWrotePaintColor) {
293 this->write<SkSLType::kFloat4>(&
color);
294 fWrotePaintColor =
true;
303 bool isReset()
const;
305 void doneWithExpectedUniforms();
322 template <SkSLType Type>
void write(
const void*
src) {
341 inline char* append(
int alignment,
int size);
346 int fReqAlignment = 0;
348 bool fWrotePaintColor =
false;
353 UniformOffsetCalculator fOffsetCalculator;
355 int fExpectedUniformIndex = 0;
365template <
int N,
bool Half>
367 static_assert(1 <=
N &&
N <= 4);
376 if constexpr (Half) {
379 if constexpr (
N == 3) {
382 const float* srcF =
static_cast<const float*
>(
src);
383 srcData = VecF{srcF[0], srcF[1], srcF[2], 0.f};
385 srcData = VecF::Load(
src);
388 auto dstData =
to_half(srcData);
407 if constexpr (Half) {
419template<
int N,
bool Half>
421 using L = LayoutTraits<N, Half>;
426 ? this->append(L::kAlign,
L::kSize + L::kElemSize)
427 : this->append(
L::kAlign,
L::
kSize);
436template<
int N,
bool Half>
438 using L = LayoutTraits<N, Half>;
439 static constexpr int kSrcStride =
N * 4;
447 static constexpr int kStride = Half ? L::kAlign : 4*L::kElemSize;
450 const char* srcBytes =
reinterpret_cast<const char*
>(
src);
451 char*
dst = this->append(kStride, kStride*
count);
455 L::Copy(srcBytes,
dst);
456 if constexpr (kStride -
L::kSize > 0) {
461 srcBytes += kSrcStride;
473char* UniformManager::append(
int alignment,
int size) {
486 memset(
dst, 0, padding);
490 fReqAlignment =
std::max(fReqAlignment, alignment);
static constexpr size_t SkAlignTo(size_t x, size_t alignment)
static constexpr bool SkIsAlign4(T x)
constexpr int SkNextPow2_portable(int value)
bool SkSLTypeIsFullPrecisionNumericType(SkSLType type)
static constexpr bool SkSLTypeCanBeUniformValue(SkSLType type)
static constexpr bool SkSLTypeIsFloatType(SkSLType type)
static constexpr int SkSLTypeVecLength(SkSLType type)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static const SkScalar * M44ColMajor(const SkM44 &m)
constexpr T * data() const
constexpr size_t size() const
static float max(float r, float g, float b)
void Validate(const Table &table)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr bool UseFullPrecision(Layout layout)
static constexpr bool AlignArraysAsVec4(Layout layout)
static constexpr bool PadVec3Size(Layout layout)
SIN Vec< N, uint16_t > to_half(const Vec< N, float > &x)
const float * vec() const
const float * asScalars() const
const float * ptr() const
const float * ptr() const
const float * ptr() const
static constexpr int kSize
static constexpr int kElemSize
static void Copy(const void *src, void *dst)
static constexpr int kAlign