13static_assert(
sizeof(int32_t) == 4);
14static_assert(
sizeof(
float) == 4);
15static_assert(
sizeof(
SkHalf) == 2);
29 SkASSERT(1 <= dimension && dimension <= 4);
41 const int align =
SkNextPow2(dimension) * primitiveSize;
42 const int alignedOffset =
SkAlignTo(fOffset, align);
43 fOffset = alignedOffset + dimension * primitiveSize *
std::max(
count, 1);
44 fReqAlignment =
std::max(fReqAlignment, align);
53 size_t paddingSize =
size - fStorage.
size();
54 if (paddingSize > 0) {
55 char* padding = fStorage.
append(paddingSize);
56 memset(padding, 0, paddingSize);
65 fWrotePaintColor =
false;
69 fExpectedUniforms = {};
70 fExpectedUniformIndex = 0;
138 if (fExpectedUniformIndex >= (
int) fExpectedUniforms.size()) {
144 const Uniform& expected = fExpectedUniforms[fExpectedUniformIndex++];
151 if (expectedType !=
type || expectedCount !=
count) {
158 int offset =
static_cast<int>(
reinterpret_cast<intptr_t
>(
dst) -
159 reinterpret_cast<intptr_t
>(fStorage.
data()));
161 if (
offset != fOffsetCalculator.advanceOffset(expected.
type(), expected.
count())) {
164 if (fReqAlignment != fOffsetCalculator.requiredAlignment()) {
168 return !(fWrotePaintColor && expected.isPaintColor());
173 return expected.isPaintColor();
177bool UniformManager::isReset()
const {
178 return fStorage.
empty();
182 fExpectedUniforms = expected;
183 fExpectedUniformIndex = 0;
186void UniformManager::doneWithExpectedUniforms() {
187 SkASSERT(fExpectedUniformIndex ==
static_cast<int>(fExpectedUniforms.size()));
188 fExpectedUniforms = {};
static constexpr size_t SkAlignTo(size_t x, size_t alignment)
static int SkNextPow2(int value)
int SkSLTypeMatrixSize(SkSLType type)
bool SkSLTypeIsFullPrecisionNumericType(SkSLType type)
static constexpr bool SkSLTypeCanBeUniformValue(SkSLType type)
static constexpr int SkSLTypeVecLength(SkSLType type)
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
static float max(float r, float g, float b)
static constexpr bool UseFullPrecision(Layout layout)
static constexpr bool AlignArraysAsVec4(Layout layout)
static constexpr bool PadVec3Size(Layout layout)
static std::pair< SkSLType, int > adjust_for_matrix_type(SkSLType type, int count)
std::shared_ptr< const fml::Mapping > data