14static_assert(
sizeof(int32_t) == 4);
15static_assert(
sizeof(
float) == 4);
16static_assert(
sizeof(short) == 2);
17static_assert(
sizeof(
SkHalf) == 2);
20 : fUniformSize(uniformSize)
21 , fUniformsDirty(
false) {
37 switch (uniformType) {
45 const float* floatBits =
static_cast<const float*
>(
src);
47 while (numUniforms-- > 0) {
61 const int32_t* intBits =
static_cast<const int32_t*
>(
src);
62 short* shortBits =
static_cast<short*
>(
dest);
63 while (numUniforms-- > 0) {
64 *shortBits++ = (short)(*intBits++);
75 memcpy(
dest,
src, numUniforms * 4);
79template <
int N, SkSLType FullType, SkSLType HalfType>
88template <
int N, SkSLType FullType, SkSLType HalfType>
93 SkASSERT(arrayCount <= uni.fArrayCount ||
97 if constexpr (
N == 4) {
100 for (
int i = 0;
i < arrayCount; ++
i) {
103 v =
static_cast<const char*
>(v) +
N * 4;
109 this->set<1, SkSLType::kInt, SkSLType::kShort>(u, &i0);
114 const int32_t v[])
const {
115 this->setv<1, SkSLType::kInt, SkSLType::kShort>(u, arrayCount, v);
119 this->set<1, SkSLType::kFloat, SkSLType::kHalf>(u, &v0);
124 const float v[])
const {
125 this->setv<1, SkSLType::kFloat, SkSLType::kHalf>(u, arrayCount, v);
129 int32_t v[2] = { i0, i1 };
130 this->set<2, SkSLType::kInt2, SkSLType::kShort2>(u, v);
135 const int32_t v[])
const {
136 this->setv<2, SkSLType::kInt2, SkSLType::kShort2>(u, arrayCount, v);
140 float v[2] = { v0, v1 };
141 this->set<2, SkSLType::kFloat2, SkSLType::kHalf2>(u, v);
146 const float v[])
const {
147 this->setv<2, SkSLType::kFloat2, SkSLType::kHalf2>(u, arrayCount, v);
154 int32_t v[3] = { i0, i1, i2 };
155 this->set<3, SkSLType::kInt3, SkSLType::kShort3>(u, v);
160 const int32_t v[])
const {
161 this->setv<3, SkSLType::kInt3, SkSLType::kShort3>(u, arrayCount, v);
165 float v[3] = { v0, v1,
v2 };
166 this->set<3, SkSLType::kFloat3, SkSLType::kHalf3>(u, v);
171 const float v[])
const {
172 this->setv<3, SkSLType::kFloat3, SkSLType::kHalf3>(u, arrayCount, v);
180 int32_t v[4] = { i0, i1, i2, i3 };
181 this->set<4, SkSLType::kInt4, SkSLType::kShort4>(u, v);
186 const int32_t v[])
const {
187 this->setv<4, SkSLType::kInt4, SkSLType::kShort4>(u, arrayCount, v);
195 float v[4] = { v0, v1,
v2, v3 };
196 this->set<4, SkSLType::kFloat4, SkSLType::kHalf4>(u, v);
201 const float v[])
const {
202 this->setv<4, SkSLType::kFloat4, SkSLType::kHalf4>(u, arrayCount, v);
206 this->setMatrices<2, SkSLType::kFloat2x2, SkSLType::kHalf2x2>(u, 1,
matrix);
210 this->setMatrices<2, SkSLType::kFloat2x2, SkSLType::kHalf2x2>(u, arrayCount,
m);
214 this->setMatrices<3, SkSLType::kFloat3x3, SkSLType::kHalf3x3>(u, 1,
matrix);
218 this->setMatrices<3, SkSLType::kFloat3x3, SkSLType::kHalf3x3>(u, arrayCount,
m);
222 this->setMatrices<4, SkSLType::kFloat4x4, SkSLType::kHalf4x4>(u, 1,
matrix);
226 this->setMatrices<4, SkSLType::kFloat4x4, SkSLType::kHalf4x4>(u, arrayCount,
m);
229template <
int N, SkSLType FullType, SkSLType HalfType>
232 const float matrices[])
const {
236 SkASSERT(arrayCount <= uni.fArrayCount ||
240 if constexpr (
N == 4) {
243 for (
int i = 0;
i < arrayCount; ++
i) {
244 const float*
matrix = &matrices[
N *
N *
i];
245 for (
int j = 0; j <
N; ++j) {
SkHalf SkFloatToHalf(float f)
void * reset(size_t size=0, OnShrink shrink=kAlloc_OnShrink)
unsigned useCenter Optional< SkMatrix > matrix
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer