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

Unified Diff: src/sksl/SkSLGLSLCodeGenerator.h

Issue 2437063002: re-re-land of skslc now automatically turns on derivatives support (Closed)
Patch Set: Created 4 years, 2 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/SkSLCompiler.cpp ('k') | src/sksl/SkSLGLSLCodeGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLGLSLCodeGenerator.h
diff --git a/src/sksl/SkSLGLSLCodeGenerator.h b/src/sksl/SkSLGLSLCodeGenerator.h
index 17ac90ea233cae2f3dc1ffea9c38068e511f2378..97e60381463e6c8f9a2c572cfec7d072a0bb65e0 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.h
+++ b/src/sksl/SkSLGLSLCodeGenerator.h
@@ -45,20 +45,25 @@ namespace SkSL {
#define kLast_Capability SpvCapabilityMultiViewport
struct GLCaps {
- int fVersion;
+ GLCaps() {}
+
+ int fVersion = 400;
enum {
kGL_Standard,
kGLES_Standard
- } fStandard;
- bool fIsCoreProfile;
- bool fUsesPrecisionModifiers;
- bool fMustDeclareFragmentShaderOutput;
+ } fStandard = kGL_Standard;
+ bool fIsCoreProfile = false;
+ bool fUsesPrecisionModifiers = false;
+ bool fMustDeclareFragmentShaderOutput = false;
+ bool fShaderDerivativeSupport = true;
+ // extension string to enable derivative support, or null if unnecessary
+ std::string fShaderDerivativeExtensionString;
// The Tegra3 compiler will sometimes never return if we have min(abs(x), y)
- bool fCanUseMinAndAbsTogether;
+ bool fCanUseMinAndAbsTogether = true;
// On Intel GPU there is an issue where it misinterprets an atan argument (second argument only,
// apparently) of the form "-<expr>" as an int, so we rewrite it as "-1.0 * <expr>" to avoid
// this problem
- bool fMustForceNegatedAtanParamToFloat;
+ bool fMustForceNegatedAtanParamToFloat = false;
};
/**
@@ -89,11 +94,7 @@ public:
GLSLCodeGenerator(const Context* context, GLCaps caps)
: fContext(*context)
- , fCaps(caps)
- , fOut(nullptr)
- , fVarCount(0)
- , fIndentation(0)
- , fAtLineStart(true) {}
+ , fCaps(caps) {}
void generateCode(const Program& program, std::ostream& out) override;
@@ -176,16 +177,19 @@ private:
const Context& fContext;
const GLCaps fCaps;
- std::ostream* fOut;
+ std::ostream* fOut = nullptr;
+ std::stringstream fHeader;
std::string fFunctionHeader;
Program::Kind fProgramKind;
- int fVarCount;
- int fIndentation;
- bool fAtLineStart;
+ int fVarCount = 0;
+ int fIndentation = 0;
+ bool fAtLineStart = false;
// Keeps track of which struct types we have written. Given that we are unlikely to ever write
// more than one or two structs per shader, a simple linear search will be faster than anything
// fancier.
std::vector<const Type*> fWrittenStructs;
+ // true if we have run into usages of dFdx / dFdy
+ bool fFoundDerivatives = false;
};
}
« no previous file with comments | « src/sksl/SkSLCompiler.cpp ('k') | src/sksl/SkSLGLSLCodeGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698