24 : fProgramBuilder(program)
27 , fFeaturesAddedMask(0)
30 , fTmpVariableCounter(0) {
36 this->
main() =
"void main() {";
55 const char* mangledName,
58 for (
size_t i = 0;
i <
args.size(); ++
i) {
69 const char* mangledName,
81 "}\n\n", declaration, body);
85 const char* mangledName,
103 const char* coordName)
const {
105 out->appendf(
"sample(%s, %s)", sampler, coordName);
110 const char* coordName,
121 const char* coordName,
136 load.appendf(
"subpassLoad(%s)", input);
142 const char* srcColor,
144 if (!colorXformHelper || colorXformHelper->
isNoop()) {
155 auto emitTFFunc = [
this, &uniformHandler](
const char*
name,
156 GrGLSLProgramDataManager::UniformHandle uniform,
170 body.
append(
"float s = sign(x);");
171 body.
append(
"x = abs(x);");
174 body.
append(
"x = (x < D) ? (C * x) + F : pow(A * x + B, G) + E;");
177 body.
append(
"x = pow(max(A + B * pow(x, C), 0) / (D + E * pow(x, C)), F);");
180 body.
append(
"x = (x*A <= 1) ? pow(x*A, B) : exp((x-E)*C) + D; x *= (F+1);");
183 body.
append(
"x /= (F+1); x = (x <= 1) ? A * pow(x, B) : C * log(x - D) + E;");
189 body.
append(
"return s * x;");
198 srcTFFuncName = emitTFFunc(
"src_tf", colorXformHelper->
srcTFUniform(),
204 dstTFFuncName = emitTFFunc(
"dst_tf", colorXformHelper->
dstTFUniform(),
213 body.
appendf(
"color.rgb = (%s * color.rgb);", xform);
214 body.
append(
"return color;");
217 {gGamutXformArgs, std::size(gGamutXformArgs)}, body.
c_str());
225 body.
append(
"color = unpremul(color);");
228 body.
appendf(
"color.r = %s(color.r);", srcTFFuncName.
c_str());
229 body.
appendf(
"color.g = %s(color.g);", srcTFFuncName.
c_str());
230 body.
appendf(
"color.b = %s(color.b);", srcTFFuncName.
c_str());
233 body.
appendf(
"color = %s(color);", gamutXformFuncName.
c_str());
236 body.
appendf(
"color.r = %s(color.r);", dstTFFuncName.
c_str());
237 body.
appendf(
"color.g = %s(color.g);", dstTFFuncName.
c_str());
238 body.
appendf(
"color.b = %s(color.b);", dstTFFuncName.
c_str());
241 body.
append(
"color.rgb *= color.a;");
243 body.
append(
"return half4(color);");
246 {gColorXformArgs, std::size(gColorXformArgs)}, body.
c_str());
247 out->appendf(
"%s(%s)", colorXformFuncName.
c_str(), srcColor);
268 for (
const auto& v :
vars.items()) {
281 static const char* interfaceQualifierNames[] = {
292 for (
int i = 1;
i <
params.size(); ++
i) {
312 this->
code().append(
"}");
static void append_texture_swizzle(SkString *out, skgpu::Swizzle swizzle)
const char * SkSLTypeString(SkSLType t)
SkString nameVariable(char prefix, const char *name, bool mangle=true)
virtual GrGLSLUniformHandler * uniformHandler()=0
const char * samplerVariable(SamplerHandle handle) const
skgpu::Swizzle samplerSwizzle(SamplerHandle handle) const
const GrShaderCaps * shaderCaps() const
const char * inputSamplerVariable(SamplerHandle handle) const
skgpu::Swizzle inputSamplerSwizzle(SamplerHandle handle) const
void appendUniformDecls(GrShaderFlags visibility, SkString *) const
virtual void onFinalize()=0
void emitFunction(SkSLType returnType, const char *mangledName, SkSpan< const GrShaderVar > args, const char *body)
void appendDecls(const VarArray &vars, SkString *out) const
void compileAndAppendLayoutQualifiers()
void addLayoutQualifier(const char *param, InterfaceQualifier)
GrGLSLUniformHandler::SamplerHandle SamplerHandle
void declareGlobal(const GrShaderVar &)
GrGLSLShaderBuilder(GrGLSLProgramBuilder *program)
this code().appendVAList(format
void declAppend(const GrShaderVar &var)
SkString & layoutQualifiers()
bool addFeature(uint32_t featureBit, const char *extensionName)
std::string fCompilerString
void finalize(uint32_t visibility)
void codeAppend(const char *str)
void appendColorGamutXform(SkString *out, const char *srcColor, GrGLSLColorSpaceXformHelper *colorXformHelper)
uint32_t fFeaturesAddedMask
this definitions().appendVAList(fmt
skia_private::STArray< kPrealloc, SkString > fShaderStrings
@ kLastInterfaceQualifier
@ kOut_InterfaceQualifier
void appendTextureLookup(SkString *out, SamplerHandle, const char *coordName) const
SkString getMangledFunctionName(const char *baseName)
void codeAppendf(const char format[],...) SK_PRINTF_LIKE(2
void appendInputLoad(SamplerHandle)
GrGLSLProgramBuilder * fProgramBuilder
void appendFunctionDecl(SkSLType returnType, const char *mangledName, SkSpan< const GrShaderVar > args)
skia_private::STArray< 1, SkString > fLayoutParams[kLastInterfaceQualifier+1]
void appendTextureLookupAndBlend(const char *dst, SkBlendMode, SamplerHandle, const char *coordName, GrGLSLColorSpaceXformHelper *colorXformHelper=nullptr)
GrGLSLProgramBuilder * getProgramBuilder()
void emitFunctionPrototype(SkSLType returnType, const char *mangledName, SkSpan< const GrShaderVar > args)
void appendDecl(const GrShaderCaps *, SkString *out) const
void append(const char text[])
const char * c_str() const
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
SkString asString() const
static constexpr Swizzle RGBA()
const EmbeddedViewParams * params
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DEF_SWITCHES_START aot vmservice shared library name
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 mode
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
const char * BlendFuncName(SkBlendMode mode)
bool mustEnableAdvBlendEqs() const
SkSL::GLSLGeneration fGLSLGeneration