diff options
Diffstat (limited to 'src/sksl/SkSLGLSLCodeGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLGLSLCodeGenerator.cpp | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index f3400c7f5a..9e2336e22e 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -597,12 +597,6 @@ void GLSLCodeGenerator::writeConstructor(const Constructor& c, Precedence parent } void GLSLCodeGenerator::writeFragCoord() { - if (!fProgram.fSettings.fCaps->canUseFragCoord()) { - this->write("vec4(sk_FragCoord_Workaround.xyz / sk_FragCoord_Workaround.w, " - "1.0 / sk_FragCoord_Workaround.w)"); - return; - } - // We only declare "gl_FragCoord" when we're in the case where we want to use layout qualifiers // to reverse y. Otherwise it isn't necessary and whether the "in" qualifier appears in the // declaration varies in earlier GLSL specs. So it is simpler to omit it. @@ -625,7 +619,7 @@ void GLSLCodeGenerator::writeFragCoord() { // The Adreno compiler seems to be very touchy about access to "gl_FragCoord". // Accessing glFragCoord.zw can cause a program to fail to link. Additionally, // depending on the surrounding code, accessing .xy with a uniform involved can - // do the same thing. Copying gl_FragCoord.xy into a temp float2 beforehand + // do the same thing. Copying gl_FragCoord.xy into a temp float2beforehand // (and only accessing .xy) seems to "fix" things. const char* precision = usesPrecisionModifiers() ? "highp " : ""; fHeader.writeText("uniform "); @@ -646,6 +640,7 @@ void GLSLCodeGenerator::writeFragCoord() { } } + void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) { switch (ref.fVariable.fModifiers.fLayout.fBuiltin) { case SK_FRAGCOLOR_BUILTIN: @@ -685,10 +680,6 @@ void GLSLCodeGenerator::writeIndexExpression(const IndexExpression& expr) { this->write("]"); } -bool is_sk_position(const FieldAccess& f) { - return "sk_Position" == f.fBase->fType.fields()[f.fFieldIndex].fName; -} - void GLSLCodeGenerator::writeFieldAccess(const FieldAccess& f) { if (f.fOwnerKind == FieldAccess::kDefault_OwnerKind) { this->writeExpression(*f.fBase, kPostfix_Precedence); @@ -764,22 +755,11 @@ void GLSLCodeGenerator::writeBinaryExpression(const BinaryExpression& b, if (precedence >= parentPrecedence) { this->write("("); } - bool positionWorkaround = Compiler::IsAssignment(b.fOperator) && - Expression::kFieldAccess_Kind == b.fLeft->fKind && - is_sk_position((FieldAccess&) *b.fLeft) && - !strstr(b.fRight->description().c_str(), "sk_RTAdjust") && - !fProgram.fSettings.fCaps->canUseFragCoord(); - if (positionWorkaround) { - this->write("sk_FragCoord_Workaround = ("); - } this->writeExpression(*b.fLeft, precedence); this->write(" "); this->write(Compiler::OperatorName(b.fOperator)); this->write(" "); this->writeExpression(*b.fRight, precedence); - if (positionWorkaround) { - this->write(")"); - } if (precedence >= parentPrecedence) { this->write(")"); } @@ -1208,25 +1188,6 @@ void GLSLCodeGenerator::writeHeader() { this->writeExtension((Extension&) *e); } } - if (!fProgram.fSettings.fCaps->canUseFragCoord()) { - Layout layout; - switch (fProgram.fKind) { - case Program::kVertex_Kind: { - Modifiers modifiers(layout, Modifiers::kOut_Flag | Modifiers::kHighp_Flag); - this->writeModifiers(modifiers, true); - this->write("vec4 sk_FragCoord_Workaround;\n"); - break; - } - case Program::kFragment_Kind: { - Modifiers modifiers(layout, Modifiers::kIn_Flag | Modifiers::kHighp_Flag); - this->writeModifiers(modifiers, true); - this->write("vec4 sk_FragCoord_Workaround;\n"); - break; - } - default: - break; - } - } } void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) { |