#include "src/sksl/codegen/SkSLGLSLCodeGenerator.h"
#include "include/core/SkSpan.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTArray.h"
#include "src/base/SkEnumBitMask.h"
#include "src/base/SkNoDestructor.h"
#include "src/base/SkStringView.h"
#include "src/core/SkTHash.h"
#include "src/core/SkTraceEvent.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLContext.h"
#include "src/sksl/SkSLDefines.h"
#include "src/sksl/SkSLErrorReporter.h"
#include "src/sksl/SkSLGLSL.h"
#include "src/sksl/SkSLIntrinsicList.h"
#include "src/sksl/SkSLOperator.h"
#include "src/sksl/SkSLOutputStream.h"
#include "src/sksl/SkSLPosition.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLString.h"
#include "src/sksl/SkSLStringStream.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLCodeGenTypes.h"
#include "src/sksl/codegen/SkSLCodeGenerator.h"
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLBlock.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArrayCast.h"
#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLDoStatement.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLExpressionStatement.h"
#include "src/sksl/ir/SkSLExtension.h"
#include "src/sksl/ir/SkSLFieldAccess.h"
#include "src/sksl/ir/SkSLForStatement.h"
#include "src/sksl/ir/SkSLFunctionCall.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLFunctionPrototype.h"
#include "src/sksl/ir/SkSLIRNode.h"
#include "src/sksl/ir/SkSLIfStatement.h"
#include "src/sksl/ir/SkSLIndexExpression.h"
#include "src/sksl/ir/SkSLInterfaceBlock.h"
#include "src/sksl/ir/SkSLLayout.h"
#include "src/sksl/ir/SkSLLiteral.h"
#include "src/sksl/ir/SkSLModifierFlags.h"
#include "src/sksl/ir/SkSLModifiersDeclaration.h"
#include "src/sksl/ir/SkSLPostfixExpression.h"
#include "src/sksl/ir/SkSLPrefixExpression.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLProgramElement.h"
#include "src/sksl/ir/SkSLReturnStatement.h"
#include "src/sksl/ir/SkSLSetting.h"
#include "src/sksl/ir/SkSLStatement.h"
#include "src/sksl/ir/SkSLStructDefinition.h"
#include "src/sksl/ir/SkSLSwitchCase.h"
#include "src/sksl/ir/SkSLSwitchStatement.h"
#include "src/sksl/ir/SkSLSwizzle.h"
#include "src/sksl/ir/SkSLTernaryExpression.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
#include "src/sksl/spirv.h"
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <memory>
#include <string_view>
#include <vector>
usingnamespaceskia_private;
namespace SkSL {
class GLSLCodeGenerator final : public CodeGenerator { … };
void GLSLCodeGenerator::write(std::string_view s) { … }
void GLSLCodeGenerator::writeLine(std::string_view s) { … }
void GLSLCodeGenerator::finishLine() { … }
void GLSLCodeGenerator::writeExtension(std::string_view name, bool require) { … }
bool GLSLCodeGenerator::usesPrecisionModifiers() const { … }
static bool is_reserved_identifier(std::string_view identifier) { … }
void GLSLCodeGenerator::writeIdentifier(std::string_view identifier) { … }
std::string GLSLCodeGenerator::getTypeName(const Type& raw) { … }
void GLSLCodeGenerator::writeStructDefinition(const StructDefinition& s) { … }
void GLSLCodeGenerator::writeType(const Type& type) { … }
void GLSLCodeGenerator::writeExpression(const Expression& expr, Precedence parentPrecedence) { … }
static bool is_abs(Expression& expr) { … }
void GLSLCodeGenerator::writeMinAbsHack(Expression& absExpr, Expression& otherExpr) { … }
void GLSLCodeGenerator::writeInverseSqrtHack(const Expression& x) { … }
static constexpr char kDeterminant2[] = …;
static constexpr char kDeterminant3[] = …;
static constexpr char kDeterminant4[] = …;
void GLSLCodeGenerator::writeDeterminantHack(const Expression& mat) { … }
static constexpr char kInverse2[] = …;
static constexpr char kInverse3[] = …;
static constexpr char kInverse4[] = …;
void GLSLCodeGenerator::writeInverseHack(const Expression& mat) { … }
void GLSLCodeGenerator::writeTransposeHack(const Expression& mat) { … }
void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) { … }
void GLSLCodeGenerator::writeConstructorDiagonalMatrix(const ConstructorDiagonalMatrix& c,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeConstructorCompound(const ConstructorCompound& c,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeCastConstructor(const AnyConstructor& c, Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeAnyConstructor(const AnyConstructor& c, Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeFragCoord() { … }
void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) { … }
void GLSLCodeGenerator::writeIndexExpression(const IndexExpression& expr) { … }
bool is_sk_position(const Expression& expr) { … }
bool is_sk_samplemask(const Expression& expr) { … }
void GLSLCodeGenerator::writeFieldAccess(const FieldAccess& f) { … }
void GLSLCodeGenerator::writeSwizzle(const Swizzle& swizzle) { … }
void GLSLCodeGenerator::writeMatrixComparisonWorkaround(const BinaryExpression& b) { … }
void GLSLCodeGenerator::writeBinaryExpression(const BinaryExpression& b,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeShortCircuitWorkaroundExpression(const BinaryExpression& b,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeTernaryExpression(const TernaryExpression& t,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writePrefixExpression(const PrefixExpression& p,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writePostfixExpression(const PostfixExpression& p,
Precedence parentPrecedence) { … }
void GLSLCodeGenerator::writeLiteral(const Literal& l) { … }
bool GLSLCodeGenerator::shouldRewriteVoidTypedFunctions(const FunctionDeclaration* func) const { … }
void GLSLCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f) { … }
void GLSLCodeGenerator::writeFunction(const FunctionDefinition& f) { … }
void GLSLCodeGenerator::writeFunctionPrototype(const FunctionPrototype& f) { … }
void GLSLCodeGenerator::writeModifiers(const Layout& layout,
ModifierFlags flags,
bool globalContext) { … }
void GLSLCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) { … }
void GLSLCodeGenerator::writeVarInitializer(const Variable& var, const Expression& value) { … }
const char* GLSLCodeGenerator::getTypePrecision(const Type& type) { … }
void GLSLCodeGenerator::writeTypePrecision(const Type& type) { … }
void GLSLCodeGenerator::writeGlobalVarDeclaration(const GlobalVarDeclaration& e) { … }
void GLSLCodeGenerator::writeVarDeclaration(const VarDeclaration& decl, bool global) { … }
void GLSLCodeGenerator::writeStatement(const Statement& s) { … }
void GLSLCodeGenerator::writeBlock(const Block& b) { … }
void GLSLCodeGenerator::writeIfStatement(const IfStatement& stmt) { … }
void GLSLCodeGenerator::writeForStatement(const ForStatement& f) { … }
void GLSLCodeGenerator::writeDoStatement(const DoStatement& d) { … }
void GLSLCodeGenerator::writeExpressionStatement(const ExpressionStatement& s) { … }
void GLSLCodeGenerator::writeSwitchStatement(const SwitchStatement& s) { … }
void GLSLCodeGenerator::writeReturnStatement(const ReturnStatement& r) { … }
void GLSLCodeGenerator::writeHeader() { … }
void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) { … }
void GLSLCodeGenerator::writeInputVars() { … }
bool GLSLCodeGenerator::generateCode() { … }
bool ToGLSL(Program& program, const ShaderCaps* caps, OutputStream& out, PrettyPrint pp) { … }
bool ToGLSL(Program& program, const ShaderCaps* caps, OutputStream& out) { … }
bool ToGLSL(Program& program, const ShaderCaps* caps, std::string* out) { … }
}