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

Unified Diff: src/sksl/SkSLSPIRVCodeGenerator.cpp

Issue 2288033003: Turned on SkSL->GLSL compiler (Closed)
Patch Set: changed <iostream> to <ostream> 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/SkSLSPIRVCodeGenerator.h ('k') | src/sksl/SkSLToken.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLSPIRVCodeGenerator.cpp
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index d17e3c42a2d438a38a7f80ce35a9899141bd20cc..5403ba362814057ad46e2047d96a3f730b4a54c8 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -15,6 +15,7 @@
#include "ir/SkSLExtension.h"
#include "ir/SkSLIndexExpression.h"
#include "ir/SkSLVariableReference.h"
+#include "SkSLCompiler.h"
namespace SkSL {
@@ -2162,13 +2163,19 @@ SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, std::
lv->store(result, out);
return result;
}
- case Token::NOT: {
+ case Token::LOGICALNOT: {
ASSERT(p.fOperand->fType == *fContext.fBool_Type);
SpvId result = this->nextId();
this->writeInstruction(SpvOpLogicalNot, this->getType(p.fOperand->fType), result,
this->writeExpression(*p.fOperand, out), out);
return result;
}
+ case Token::BITWISENOT: {
+ SpvId result = this->nextId();
+ this->writeInstruction(SpvOpNot, this->getType(p.fOperand->fType), result,
+ this->writeExpression(*p.fOperand, out), out);
+ return result;
+ }
default:
ABORT("unsupported prefix expression: %s", p.description().c_str());
}
@@ -2321,7 +2328,7 @@ void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationDescriptorSet, layout.fSet,
fDecorationBuffer);
}
- if (layout.fBuiltin >= 0) {
+ if (layout.fBuiltin >= 0 && layout.fBuiltin != SK_FRAGCOLOR_BUILTIN) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationBuiltIn, layout.fBuiltin,
fDecorationBuffer);
}
@@ -2363,10 +2370,19 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
return result;
}
-void SPIRVCodeGenerator::writeGlobalVars(const VarDeclarations& decl, std::ostream& out) {
+#define BUILTIN_IGNORE 9999
+void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclarations& decl,
+ std::ostream& out) {
for (size_t i = 0; i < decl.fVars.size(); i++) {
const VarDeclaration& varDecl = decl.fVars[i];
const Variable* var = varDecl.fVar;
+ if (var->fModifiers.fLayout.fBuiltin == BUILTIN_IGNORE) {
+ continue;
+ }
+ if (var->fModifiers.fLayout.fBuiltin == SK_FRAGCOLOR_BUILTIN &&
+ kind != Program::kFragment_Kind) {
+ continue;
+ }
if (!var->fIsReadFrom && !var->fIsWrittenTo &&
!(var->fModifiers.fFlags & (Modifiers::kIn_Flag |
Modifiers::kOut_Flag |
@@ -2562,7 +2578,8 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, std::ostream&
}
for (size_t i = 0; i < program.fElements.size(); i++) {
if (program.fElements[i]->fKind == ProgramElement::kVar_Kind) {
- this->writeGlobalVars(((VarDeclarations&) *program.fElements[i]), body);
+ this->writeGlobalVars(program.fKind, ((VarDeclarations&) *program.fElements[i]),
+ body);
}
}
for (size_t i = 0; i < program.fElements.size(); i++) {
« no previous file with comments | « src/sksl/SkSLSPIRVCodeGenerator.h ('k') | src/sksl/SkSLToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698