aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLSPIRVCodeGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-02 13:52:38 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-02 13:57:39 +0000
commitaffa6a3da87e9ea85f1d4fe3137b5bccbbc56f92 (patch)
treeccaa2cbc3e395a140b25f23bf250e948525a1541 /src/sksl/SkSLSPIRVCodeGenerator.cpp
parent370c2b304a35297d36fcee91e3b6ac516091434d (diff)
Revert "Fixed an issue with sksl variable declarations"
This reverts commit 88bd8edcff23dc9cf31b664cba7ba73b235318b0. Reason for revert: unhappy bots Original change's description: > Fixed an issue with sksl variable declarations > > There was an issue where multiple variables defined in the same > declaration were not being sequenced appropriately during analysis, so > 'int x = 0, y = x + 1' would report that x was undefined. > > Bug: skia: > Change-Id: I882f7e216467306f6a6013a0a34aac30a4c60744 > Reviewed-on: https://skia-review.googlesource.com/18313 > Reviewed-by: Chris Dalton <csmartdalton@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > TBR=csmartdalton@google.com,ethannicholas@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Change-Id: Ibc68674289dce70b6173a347a0e78bb0f1e6db1b Reviewed-on: https://skia-review.googlesource.com/18457 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLSPIRVCodeGenerator.cpp')
-rw-r--r--src/sksl/SkSLSPIRVCodeGenerator.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 20d292fd67..9cc25b90fe 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -2603,7 +2603,7 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclarations& decl,
OutputStream& out) {
for (size_t i = 0; i < decl.fVars.size(); i++) {
- const VarDeclaration& varDecl = (VarDeclaration&) *decl.fVars[i];
+ const VarDeclaration& varDecl = *decl.fVars[i];
const Variable* var = varDecl.fVar;
// These haven't been implemented in our SPIR-V generator yet and we only currently use them
// in the OpenGL backend.
@@ -2665,9 +2665,8 @@ void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclaratio
}
void SPIRVCodeGenerator::writeVarDeclarations(const VarDeclarations& decl, OutputStream& out) {
- for (const auto& stmt : decl.fVars) {
- VarDeclaration& varDecl = (VarDeclaration&) *stmt;
- const Variable* var = varDecl.fVar;
+ for (const auto& varDecl : decl.fVars) {
+ const Variable* var = varDecl->fVar;
// These haven't been implemented in our SPIR-V generator yet and we only currently use them
// in the OpenGL backend.
ASSERT(!(var->fModifiers.fFlags & (Modifiers::kReadOnly_Flag |
@@ -2680,8 +2679,8 @@ void SPIRVCodeGenerator::writeVarDeclarations(const VarDeclarations& decl, Outpu
SpvId type = this->getPointerType(var->fType, SpvStorageClassFunction);
this->writeInstruction(SpvOpVariable, type, id, SpvStorageClassFunction, fVariableBuffer);
this->writeInstruction(SpvOpName, id, var->fName.c_str(), fNameBuffer);
- if (varDecl.fValue) {
- SpvId value = this->writeExpression(*varDecl.fValue, out);
+ if (varDecl->fValue) {
+ SpvId value = this->writeExpression(*varDecl->fValue, out);
this->writeInstruction(SpvOpStore, id, value, out);
}
}