diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-04-12 14:39:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-12 20:26:51 +0000 |
commit | b809efbbfae3efc1f5940a34f36cb07bf46166c5 (patch) | |
tree | 5239f61a1d1506c1a85217d8602cd7b524892034 /src/sksl/SkSLIRGenerator.cpp | |
parent | c828109ebd1519134b1c3fa168519ac07a31fe05 (diff) |
workaround for buggy macOS GLSL shader compiler
Bug: skia:
Change-Id: Ib77e11d80f93f76e65eac6119dbf2bd03523aaf9
Reviewed-on: https://skia-review.googlesource.com/117626
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLIRGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLIRGenerator.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp index 56d8e5e952..a0de551bb3 100644 --- a/src/sksl/SkSLIRGenerator.cpp +++ b/src/sksl/SkSLIRGenerator.cpp @@ -613,8 +613,7 @@ std::unique_ptr<Block> IRGenerator::applyInvocationIDWorkaround(std::unique_ptr< } std::unique_ptr<Statement> IRGenerator::getNormalizeSkPositionCode() { - // sk_Position = float4(sk_Position.x * rtAdjust.x + sk_Position.w * rtAdjust.y, - // sk_Position.y * rtAdjust.z + sk_Position.w * rtAdjust.w, + // sk_Position = float4(sk_Position.xy * rtAdjust.xz + sk_Position.ww * rtAdjust.yw, // 0, // sk_Position.w); ASSERT(fSkPerVertex && fRTAdjust); @@ -627,16 +626,15 @@ std::unique_ptr<Statement> IRGenerator::getNormalizeSkPositionCode() { #define ADJUST (fRTAdjustInterfaceBlock ? \ FIELD(fRTAdjustInterfaceBlock, fRTAdjustFieldIndex) : \ REF(fRTAdjust)) - #define SWIZZLE(expr, field) std::unique_ptr<Expression>(new Swizzle(fContext, expr, { field })) - #define OP(left, op, right) std::unique_ptr<Expression>(\ - new BinaryExpression(-1, left, op, right, *fContext.fFloat_Type)) + #define SWIZZLE(expr, ...) std::unique_ptr<Expression>(new Swizzle(fContext, expr, \ + { __VA_ARGS__ })) + #define OP(left, op, right) std::unique_ptr<Expression>( \ + new BinaryExpression(-1, left, op, right, \ + *fContext.fFloat2_Type)) std::vector<std::unique_ptr<Expression>> children; - children.push_back(OP(OP(SWIZZLE(POS, 0), Token::STAR, SWIZZLE(ADJUST, 0)), + children.push_back(OP(OP(SWIZZLE(POS, 0, 1), Token::STAR, SWIZZLE(ADJUST, 0, 2)), Token::PLUS, - OP(SWIZZLE(POS, 3), Token::STAR, SWIZZLE(ADJUST, 1)))); - children.push_back(OP(OP(SWIZZLE(POS, 1), Token::STAR, SWIZZLE(ADJUST, 2)), - Token::PLUS, - OP(SWIZZLE(POS, 3), Token::STAR, SWIZZLE(ADJUST, 3)))); + OP(SWIZZLE(POS, 3, 3), Token::STAR, SWIZZLE(ADJUST, 1, 3)))); children.push_back(std::unique_ptr<Expression>(new FloatLiteral(fContext, -1, 0.0))); children.push_back(SWIZZLE(POS, 3)); std::unique_ptr<Expression> result = OP(POS, Token::EQ, @@ -646,6 +644,7 @@ std::unique_ptr<Statement> IRGenerator::getNormalizeSkPositionCode() { return std::unique_ptr<Statement>(new ExpressionStatement(std::move(result))); } + void IRGenerator::convertFunction(const ASTFunction& f) { const Type* returnType = this->convertType(*f.fReturnType); if (!returnType) { |