OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SKSL_ASTPRECISION |
| 9 #define SKSL_ASTPRECISION |
| 10 |
| 11 #include "SkSLASTDeclaration.h" |
| 12 #include "../ir/SkSLModifiers.h" |
| 13 |
| 14 namespace SkSL { |
| 15 |
| 16 /** |
| 17 * Represents a precision declaration (e.g. 'precision mediump float;'). |
| 18 */ |
| 19 struct ASTPrecision : public ASTDeclaration { |
| 20 // FIXME handle the type |
| 21 ASTPrecision(Position position, Modifiers::Flag precision) |
| 22 : INHERITED(position, kPrecision_Kind) |
| 23 , fPrecision(precision) {} |
| 24 |
| 25 std::string description() const { |
| 26 switch (fPrecision) { |
| 27 case Modifiers::kLowp_Flag: return "precision lowp float;"; |
| 28 case Modifiers::kMediump_Flag: return "precision mediump float;"; |
| 29 case Modifiers::kHighp_Flag: return "precision highp float;"; |
| 30 default: |
| 31 ASSERT(false); |
| 32 return "<error>"; |
| 33 } |
| 34 ASSERT(false); |
| 35 return "<error>"; |
| 36 } |
| 37 |
| 38 const Modifiers::Flag fPrecision; |
| 39 |
| 40 typedef ASTDeclaration INHERITED; |
| 41 }; |
| 42 |
| 43 } // namespace |
| 44 |
| 45 #endif |
OLD | NEW |