15#if !__has_feature(objc_arc)
16#error This file must be compiled with Arc. Use -fobjc-arc flag
159 uint32_t* maxAlignment,
163 if (alignmentMask > *maxAlignment) {
164 *maxAlignment = alignmentMask;
166 uint32_t offsetDiff = *currentOffset & alignmentMask;
167 if (offsetDiff != 0) {
168 offsetDiff = alignmentMask - offsetDiff + 1;
170 uint32_t uniformOffset = *currentOffset + offsetDiff;
177 return uniformOffset;
187 const char** outName) {
210 MtlUniformInfo tempInfo;
211 tempInfo.fVariable =
GrShaderVar{std::move(resolvedName),
215 std::move(layoutQualifier),
219 tempInfo.fOwner = owner;
221 tempInfo.fUBOffset =
offset;
232GrGLSLUniformHandler::SamplerHandle GrMtlUniformHandler::addSampler(
235 int binding = fSamplers.
count();
239 constexpr char prefix =
'u';
245 layoutQualifier.
appendf(
"metal, binding=%d", binding);
247 MtlUniformInfo tempInfo;
248 tempInfo.fVariable =
GrShaderVar{std::move(mangleName),
252 std::move(layoutQualifier),
256 tempInfo.fOwner =
nullptr;
258 tempInfo.fUBOffset = 0;
264 return GrGLSLUniformHandler::SamplerHandle(fSamplers.
count() - 1);
268 for (
const UniformInfo& sampler : fSamplers.
items()) {
270 if (visibility == sampler.fVisibility) {
277 bool firstOffsetCheck =
false;
278 for (
const MtlUniformInfo& localUniform : fUniforms.
items()) {
279 if (!firstOffsetCheck) {
282 SkASSERT(0 == localUniform.fUBOffset);
283 firstOffsetCheck =
true;
289 for (
const UniformInfo& localUniform : fUniforms.
items()) {
290 if (visibility & localUniform.fVisibility) {
293 uniformsString.
append(
";\n");
298 if (!uniformsString.
isEmpty()) {
299 out->appendf(
"layout (metal, binding=%d) uniform uniformBuffer\n{\n",
kUniformBinding);
300 out->appendf(
"%s\n};\n", uniformsString.
c_str());
static SkSLType SkSLCombinedSamplerTypeForTextureType(GrTextureType type)
#define SK_ABORT(message,...)
static constexpr bool SkSLTypeCanBeUniformValue(SkSLType type)
@ kTextureExternalSampler
SkString nameVariable(char prefix, const char *name, bool mangle=true)
const GrShaderCaps * shaderCaps() const
const char * c_str() const
void append(const char text[])
const char * c_str() const
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
DEF_SWITCHES_START aot vmservice shared library name