Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2239)

Unified Diff: src/sksl/SkSLSPIRVCodeGenerator.h

Issue 2131223002: SkSL performance improvements (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/SkSLParser.cpp ('k') | src/sksl/SkSLSPIRVCodeGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLSPIRVCodeGenerator.h
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h
index 885c6b8b706bc1ea6043b2d41af122d2113f9bcf..a20ad9f40b976fd693229936f34628a83e146142 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.h
+++ b/src/sksl/SkSLSPIRVCodeGenerator.h
@@ -61,8 +61,9 @@ public:
virtual void store(SpvId value, std::ostream& out) = 0;
};
- SPIRVCodeGenerator()
- : fCapabilities(1 << SpvCapabilityShader)
+ SPIRVCodeGenerator(const Context* context)
+ : fContext(*context)
+ , fCapabilities(1 << SpvCapabilityShader)
, fIdCount(1)
, fBoolTrue(0)
, fBoolFalse(0)
@@ -92,9 +93,9 @@ private:
SpvId getType(const Type& type);
- SpvId getFunctionType(std::shared_ptr<FunctionDeclaration> function);
+ SpvId getFunctionType(const FunctionDeclaration& function);
- SpvId getPointerType(std::shared_ptr<Type> type, SpvStorageClass_ storageClass);
+ SpvId getPointerType(const Type& type, SpvStorageClass_ storageClass);
std::vector<SpvId> getAccessChain(Expression& expr, std::ostream& out);
@@ -108,11 +109,11 @@ private:
SpvId writeInterfaceBlock(InterfaceBlock& intf);
- SpvId writeFunctionStart(std::shared_ptr<FunctionDeclaration> f, std::ostream& out);
+ SpvId writeFunctionStart(const FunctionDeclaration& f, std::ostream& out);
- SpvId writeFunctionDeclaration(std::shared_ptr<FunctionDeclaration> f, std::ostream& out);
+ SpvId writeFunctionDeclaration(const FunctionDeclaration& f, std::ostream& out);
- SpvId writeFunction(FunctionDefinition& f, std::ostream& out);
+ SpvId writeFunction(const FunctionDefinition& f, std::ostream& out);
void writeGlobalVars(VarDeclaration& v, std::ostream& out);
@@ -227,14 +228,16 @@ private:
int32_t word5, int32_t word6, int32_t word7, int32_t word8,
std::ostream& out);
+ const Context& fContext;
+
uint64_t fCapabilities;
SpvId fIdCount;
SpvId fGLSLExtendedInstructions;
typedef std::tuple<IntrinsicKind, int32_t, int32_t, int32_t, int32_t> Intrinsic;
std::unordered_map<std::string, Intrinsic> fIntrinsicMap;
- std::unordered_map<std::shared_ptr<FunctionDeclaration>, SpvId> fFunctionMap;
- std::unordered_map<std::shared_ptr<Variable>, SpvId> fVariableMap;
- std::unordered_map<std::shared_ptr<Variable>, int32_t> fInterfaceBlockMap;
+ std::unordered_map<const FunctionDeclaration*, SpvId> fFunctionMap;
+ std::unordered_map<const Variable*, SpvId> fVariableMap;
+ std::unordered_map<const Variable*, int32_t> fInterfaceBlockMap;
std::unordered_map<std::string, SpvId> fTypeMap;
std::stringstream fCapabilitiesBuffer;
std::stringstream fGlobalInitializersBuffer;
« no previous file with comments | « src/sksl/SkSLParser.cpp ('k') | src/sksl/SkSLSPIRVCodeGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698