Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
GrMtlVaryingHandler.mm File Reference
#include "src/gpu/ganesh/mtl/GrMtlVaryingHandler.h"
#include "src/gpu/ganesh/mtl/GrMtlTypesPriv.h"

Go to the source code of this file.

Functions

static GR_NORETAIN_BEGIN void finalize_helper (GrMtlVaryingHandler::VarArray &vars)
 

Function Documentation

◆ finalize_helper()

static GR_NORETAIN_BEGIN void finalize_helper ( GrMtlVaryingHandler::VarArray vars)
static

Definition at line 18 of file GrMtlVaryingHandler.mm.

18 {
19 int locationIndex = 0;
20
21 SkDEBUGCODE(int componentCount = 0);
22 for (GrShaderVar& var : vars.items()) {
23 // Metal only allows scalars (including bool and char) and vectors as varyings
24 SkASSERT(SkSLTypeVecLength(var.getType()) != -1);
25 SkDEBUGCODE(componentCount += SkSLTypeVecLength(var.getType()));
26
27 SkString location;
28 location.appendf("location = %d", locationIndex);
29 var.addLayoutQualifier(location.c_str());
30 ++locationIndex;
31 }
32 // The max number of inputs is 60 for iOS and 32 for macOS. The max number of components is 60
33 // for iOS and 128 for macOS. To be conservative, we are going to assert that we have less than
34 // 32 varyings and less than 60 components across all varyings. If we hit this assert, we can
35 // implement a function in GrMtlCaps to be less conservative.
36 SkASSERT(locationIndex <= 32);
37 SkASSERT(componentCount <= 60);
38}
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
static constexpr int SkSLTypeVecLength(SkSLType type)
const char * c_str() const
Definition SkString.h:133
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:550