aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-27 14:36:24 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-27 14:36:44 +0000
commited50200682e0de72c3abecaa4d5324ebcd1ed9f9 (patch)
treef991fa9668072f9b87a9929c7834b55cd9175fff /src/sksl/ir
parentccf59917d3fe7aaf59de714acfbd0596503f324f (diff)
Revert "sksl fragment processor support"
This reverts commit ccf59917d3fe7aaf59de714acfbd0596503f324f. Reason for revert: breaking iOS bots Original change's description: > sksl fragment processor support > > Bug: skia: > Change-Id: Ia3b0305c2b0c78074303831f628fb01852b90d34 > Reviewed-on: https://skia-review.googlesource.com/17843 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,benjaminwagner@google.com,ethannicholas@google.com Change-Id: I0a33060c7c42c7b44c5c13d443ac42958291c2f1 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/20962 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ir')
-rw-r--r--src/sksl/ir/SkSLExpression.h1
-rw-r--r--src/sksl/ir/SkSLFunctionDeclaration.h4
-rw-r--r--src/sksl/ir/SkSLLayout.h39
-rw-r--r--src/sksl/ir/SkSLPrefixExpression.h5
-rw-r--r--src/sksl/ir/SkSLProgram.h46
-rw-r--r--src/sksl/ir/SkSLProgramElement.h3
-rw-r--r--src/sksl/ir/SkSLSection.h43
-rw-r--r--src/sksl/ir/SkSLSetting.cpp22
-rw-r--r--src/sksl/ir/SkSLSetting.h51
-rw-r--r--src/sksl/ir/SkSLSwizzle.h6
-rw-r--r--src/sksl/ir/SkSLVarDeclarations.h2
-rw-r--r--src/sksl/ir/SkSLVariableReference.h7
12 files changed, 17 insertions, 212 deletions
diff --git a/src/sksl/ir/SkSLExpression.h b/src/sksl/ir/SkSLExpression.h
index 89a1a1e84a..07dad1d7df 100644
--- a/src/sksl/ir/SkSLExpression.h
+++ b/src/sksl/ir/SkSLExpression.h
@@ -36,7 +36,6 @@ struct Expression : public IRNode {
kIndex_Kind,
kPrefix_Kind,
kPostfix_Kind,
- kSetting_Kind,
kSwizzle_Kind,
kVariableReference_Kind,
kTernary_Kind,
diff --git a/src/sksl/ir/SkSLFunctionDeclaration.h b/src/sksl/ir/SkSLFunctionDeclaration.h
index 64236d3980..8704c9a5b0 100644
--- a/src/sksl/ir/SkSLFunctionDeclaration.h
+++ b/src/sksl/ir/SkSLFunctionDeclaration.h
@@ -71,7 +71,7 @@ struct FunctionDeclaration : public Symbol {
bool determineFinalTypes(const std::vector<std::unique_ptr<Expression>>& arguments,
std::vector<const Type*>* outParameterTypes,
const Type** outReturnType) const {
- ASSERT(arguments.size() == fParameters.size());
+ assert(arguments.size() == fParameters.size());
int genericIndex = -1;
for (size_t i = 0; i < arguments.size(); i++) {
if (fParameters[i]->fType.kind() == Type::kGeneric_Kind) {
@@ -93,7 +93,7 @@ struct FunctionDeclaration : public Symbol {
}
}
if (fReturnType.kind() == Type::kGeneric_Kind) {
- ASSERT(genericIndex != -1);
+ assert(genericIndex != -1);
*outReturnType = fReturnType.coercibleTypes()[genericIndex];
} else {
*outReturnType = &fReturnType;
diff --git a/src/sksl/ir/SkSLLayout.h b/src/sksl/ir/SkSLLayout.h
index 8bf0472a95..3a8416ac4e 100644
--- a/src/sksl/ir/SkSLLayout.h
+++ b/src/sksl/ir/SkSLLayout.h
@@ -8,7 +8,6 @@
#ifndef SKSL_LAYOUT
#define SKSL_LAYOUT
-#include "SkSLString.h"
#include "SkSLUtil.h"
namespace SkSL {
@@ -43,16 +42,6 @@ struct Layout {
kR8I,
};
- // used by SkSL processors
- enum Key {
- // field is not a key
- kNo_Key,
- // field is a key
- kKey_Key,
- // key is 0 or 1 depending on whether the matrix is an identity matrix
- kIdentity_Key,
- };
-
static const char* FormatToStr(Format format) {
switch (format) {
case Format::kUnspecified: return "";
@@ -66,6 +55,7 @@ struct Layout {
case Format::kR8I: return "r8i";
}
ABORT("Unexpected format");
+ return "";
}
static bool ReadFormat(String str, Format* format) {
@@ -100,7 +90,7 @@ struct Layout {
Layout(int location, int offset, int binding, int index, int set, int builtin,
int inputAttachmentIndex, bool originUpperLeft, bool overrideCoverage,
bool blendSupportAllEquations, Format format, bool pushconstant, Primitive primitive,
- int maxVertices, int invocations, String when, Key key)
+ int maxVertices, int invocations)
: fLocation(location)
, fOffset(offset)
, fBinding(binding)
@@ -115,9 +105,7 @@ struct Layout {
, fPushConstant(pushconstant)
, fPrimitive(primitive)
, fMaxVertices(maxVertices)
- , fInvocations(invocations)
- , fWhen(when)
- , fKey(key) {}
+ , fInvocations(invocations) {}
Layout()
: fLocation(-1)
@@ -134,8 +122,7 @@ struct Layout {
, fPushConstant(false)
, fPrimitive(kUnspecified_Primitive)
, fMaxVertices(-1)
- , fInvocations(-1)
- , fKey(kNo_Key) {}
+ , fInvocations(-1) {}
String description() const {
String result;
@@ -228,22 +215,6 @@ struct Layout {
result += separator + "invocations = " + to_string(fInvocations);
separator = ", ";
}
- if (fWhen.size()) {
- result += separator + "when = " + fWhen;
- separator = ", ";
- }
- switch (fKey) {
- case kNo_Key:
- break;
- case kKey_Key:
- result += separator + "key";
- separator = ", ";
- break;
- case kIdentity_Key:
- result += separator + "key=identity";
- separator = ", ";
- break;
- }
if (result.size() > 0) {
result = "layout (" + result + ")";
}
@@ -290,8 +261,6 @@ struct Layout {
Primitive fPrimitive;
int fMaxVertices;
int fInvocations;
- String fWhen;
- Key fKey;
};
} // namespace
diff --git a/src/sksl/ir/SkSLPrefixExpression.h b/src/sksl/ir/SkSLPrefixExpression.h
index 5ac84c66b1..acab37ed88 100644
--- a/src/sksl/ir/SkSLPrefixExpression.h
+++ b/src/sksl/ir/SkSLPrefixExpression.h
@@ -33,8 +33,9 @@ struct PrefixExpression : public Expression {
fOperand->hasSideEffects();
}
- std::unique_ptr<Expression> constantPropagate(const IRGenerator& irGenerator,
- const DefinitionMap& definitions) override {
+ virtual std::unique_ptr<Expression> constantPropagate(
+ const IRGenerator& irGenerator,
+ const DefinitionMap& definitions) override {
if (fOperand->fKind == Expression::kFloatLiteral_Kind) {
return std::unique_ptr<Expression>(new FloatLiteral(
irGenerator.fContext,
diff --git a/src/sksl/ir/SkSLProgram.h b/src/sksl/ir/SkSLProgram.h
index a3eeaa3612..96bd5c4fbd 100644
--- a/src/sksl/ir/SkSLProgram.h
+++ b/src/sksl/ir/SkSLProgram.h
@@ -11,9 +11,7 @@
#include <vector>
#include <memory>
-#include "SkSLBoolLiteral.h"
-#include "SkSLExpression.h"
-#include "SkSLIntLiteral.h"
+#include "SkSLContext.h"
#include "SkSLModifiers.h"
#include "SkSLProgramElement.h"
#include "SkSLSymbolTable.h"
@@ -23,46 +21,11 @@
namespace SkSL {
-class Context;
-
/**
* Represents a fully-digested program, ready for code generation.
*/
struct Program {
struct Settings {
- struct Value {
- Value(bool b)
- : fKind(kBool_Kind)
- , fValue(b) {}
-
- Value(int i)
- : fKind(kInt_Kind)
- , fValue(i) {}
-
- std::unique_ptr<Expression> literal(const Context& context, Position position) const {
- switch (fKind) {
- case Program::Settings::Value::kBool_Kind:
- return std::unique_ptr<Expression>(new BoolLiteral(context,
- position,
- fValue));
- case Program::Settings::Value::kInt_Kind:
- return std::unique_ptr<Expression>(new IntLiteral(context,
- position,
- fValue));
- default:
- ASSERT(false);
- return nullptr;
- }
- }
-
- enum {
- kBool_Kind,
- kInt_Kind,
- } fKind;
-
- int fValue;
- };
-
#ifdef SKSL_STANDALONE
const StandaloneShaderCaps* fCaps = &standaloneCaps;
#else
@@ -71,10 +34,6 @@ struct Program {
// if false, sk_FragCoord is exactly the same as gl_FragCoord. If true, the y coordinate
// must be flipped.
bool fFlipY = false;
- // if true, Setting objects (e.g. sk_Caps.fbFetchSupport) should be replaced with their
- // constant equivalents during compilation
- bool fReplaceSettings = true;
- std::unordered_map<String, Value> fArgs;
};
struct Inputs {
@@ -98,8 +57,7 @@ struct Program {
enum Kind {
kFragment_Kind,
kVertex_Kind,
- kGeometry_Kind,
- kFragmentProcessor_Kind
+ kGeometry_Kind
};
Program(Kind kind,
diff --git a/src/sksl/ir/SkSLProgramElement.h b/src/sksl/ir/SkSLProgramElement.h
index 1e2bb48641..ebb4e9a84d 100644
--- a/src/sksl/ir/SkSLProgramElement.h
+++ b/src/sksl/ir/SkSLProgramElement.h
@@ -21,8 +21,7 @@ struct ProgramElement : public IRNode {
kFunction_Kind,
kInterfaceBlock_Kind,
kExtension_Kind,
- kModifiers_Kind,
- kSection_Kind
+ kModifiers_Kind
};
ProgramElement(Position position, Kind kind)
diff --git a/src/sksl/ir/SkSLSection.h b/src/sksl/ir/SkSLSection.h
deleted file mode 100644
index f9815b1caa..0000000000
--- a/src/sksl/ir/SkSLSection.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SKSL_SECTION
-#define SKSL_SECTION
-
-#include "SkSLProgramElement.h"
-
-namespace SkSL {
-
-/**
- * A section declaration (e.g. @body { body code here })..
- */
-struct Section : public ProgramElement {
- Section(Position position, String name, String arg, String text)
- : INHERITED(position, kSection_Kind)
- , fName(std::move(name))
- , fArgument(std::move(arg))
- , fText(std::move(text)) {}
-
- String description() const override {
- String result = "@" + fName;
- if (fArgument.size()) {
- result += "(" + fArgument + ")";
- }
- result += " { " + fText + " }";
- return result;
- }
-
- const String fName;
- const String fArgument;
- const String fText;
-
- typedef ProgramElement INHERITED;
-};
-
-} // namespace
-
-#endif
diff --git a/src/sksl/ir/SkSLSetting.cpp b/src/sksl/ir/SkSLSetting.cpp
deleted file mode 100644
index 2d4a8ba151..0000000000
--- a/src/sksl/ir/SkSLSetting.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkSLSetting.h"
-#include "SkSLIRGenerator.h"
-#include "SkSLVariableReference.h"
-
-namespace SkSL {
-
-std::unique_ptr<Expression> Setting::constantPropagate(const IRGenerator& irGenerator,
- const DefinitionMap& definitions) {
- if (irGenerator.fSettings->fReplaceSettings) {
- return VariableReference::copy_constant(irGenerator, fValue.get());
- }
- return nullptr;
- }
-} // namespace
-
diff --git a/src/sksl/ir/SkSLSetting.h b/src/sksl/ir/SkSLSetting.h
deleted file mode 100644
index 995fcf55bf..0000000000
--- a/src/sksl/ir/SkSLSetting.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SKSL_SETTING
-#define SKSL_SETTING
-
-#include "SkSLContext.h"
-#include "SkSLExpression.h"
-
-namespace SkSL {
-
-/**
- * Represents a compile-time constant setting, such as sk_Caps.fbFetchSupport. These are generally
- * collapsed down to their constant representations during the compilation process.
- */
-struct Setting : public Expression {
- Setting(Position position, String name, std::unique_ptr<Expression> value)
- : INHERITED(position, kSetting_Kind, value->fType)
- , fName(std::move(name))
- , fValue(std::move(value)) {
- ASSERT(fValue->isConstant());
- }
-
- std::unique_ptr<Expression> constantPropagate(const IRGenerator& irGenerator,
- const DefinitionMap& definitions) override;
-
- String description() const override {
- return fName;
- }
-
- bool hasSideEffects() const override {
- return false;
- }
-
- bool isConstant() const override {
- return true;
- }
-
- const String fName;
- std::unique_ptr<Expression> fValue;
-
- typedef Expression INHERITED;
-};
-
-} // namespace
-
-#endif
diff --git a/src/sksl/ir/SkSLSwizzle.h b/src/sksl/ir/SkSLSwizzle.h
index 442e92f348..1e36c41e41 100644
--- a/src/sksl/ir/SkSLSwizzle.h
+++ b/src/sksl/ir/SkSLSwizzle.h
@@ -71,8 +71,10 @@ struct Swizzle : public Expression {
ASSERT(fComponents.size() >= 1 && fComponents.size() <= 4);
}
- std::unique_ptr<Expression> constantPropagate(const IRGenerator& irGenerator,
- const DefinitionMap& definitions) override {
+ virtual std::unique_ptr<Expression> constantPropagate(
+ const IRGenerator& irGenerator,
+ const DefinitionMap& definitions) override {
+
if (fBase->fKind == Expression::kConstructor_Kind && fBase->isConstant()) {
// we're swizzling a constant vector, e.g. vec4(1).x. Simplify it.
ASSERT(fBase->fKind == Expression::kConstructor_Kind);
diff --git a/src/sksl/ir/SkSLVarDeclarations.h b/src/sksl/ir/SkSLVarDeclarations.h
index 1eda87e979..c07fee87db 100644
--- a/src/sksl/ir/SkSLVarDeclarations.h
+++ b/src/sksl/ir/SkSLVarDeclarations.h
@@ -55,7 +55,7 @@ struct VarDeclaration : public Statement {
* A variable declaration statement, which may consist of one or more individual variables.
*/
struct VarDeclarations : public ProgramElement {
- VarDeclarations(Position position, const Type* baseType,
+ VarDeclarations(Position position, const Type* baseType,
std::vector<std::unique_ptr<VarDeclaration>> vars)
: INHERITED(position, kVar_Kind)
, fBaseType(*baseType) {
diff --git a/src/sksl/ir/SkSLVariableReference.h b/src/sksl/ir/SkSLVariableReference.h
index ba17437e24..92aef94290 100644
--- a/src/sksl/ir/SkSLVariableReference.h
+++ b/src/sksl/ir/SkSLVariableReference.h
@@ -14,7 +14,6 @@
#include "SkSLFloatLiteral.h"
#include "SkSLIRGenerator.h"
#include "SkSLIntLiteral.h"
-#include "SkSLSetting.h"
namespace SkSL {
@@ -105,12 +104,6 @@ struct VariableReference : public Expression {
return std::unique_ptr<Expression>(new Constructor(Position(), c->fType,
std::move(args)));
}
- case Expression::kSetting_Kind: {
- const Setting* s = (const Setting*) expr;
- return std::unique_ptr<Expression>(new Setting(Position(), s->fName,
- copy_constant(irGenerator,
- s->fValue.get())));
- }
default:
ABORT("unsupported constant\n");
}