LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/sksl/ir - SkSLInterfaceBlock.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 23 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_INTERFACEBLOCK
       9             : #define SKSL_INTERFACEBLOCK
      10             : 
      11             : #include "SkSLProgramElement.h"
      12             : #include "SkSLSymbolTable.h"
      13             : #include "SkSLVarDeclarations.h"
      14             : 
      15             : namespace SkSL {
      16             : 
      17             : /**
      18             :  * An interface block, as in:
      19             :  *
      20             :  * out gl_PerVertex {
      21             :  *   layout(builtin=0) vec4 gl_Position;
      22             :  *   layout(builtin=1) float gl_PointSize;
      23             :  * };
      24             :  *
      25             :  * At the IR level, this is represented by a single variable of struct type.
      26             :  */
      27           0 : struct InterfaceBlock : public ProgramElement {
      28           0 :     InterfaceBlock(Position position, const Variable* var, String typeName, String instanceName,
      29             :                    std::vector<std::unique_ptr<Expression>> sizes,
      30             :                    std::shared_ptr<SymbolTable> typeOwner)
      31           0 :     : INHERITED(position, kInterfaceBlock_Kind)
      32             :     , fVariable(*var)
      33           0 :     , fTypeName(std::move(typeName))
      34           0 :     , fInstanceName(std::move(instanceName))
      35           0 :     , fSizes(std::move(sizes))
      36           0 :     , fTypeOwner(typeOwner) {}
      37             : 
      38           0 :     String description() const override {
      39           0 :         String result = fVariable.fModifiers.description() + fTypeName + " {\n";
      40           0 :         const Type* structType = &fVariable.fType;
      41           0 :         while (structType->kind() == Type::kArray_Kind) {
      42           0 :             structType = &structType->componentType();
      43             :         }
      44           0 :         for (const auto& f : structType->fields()) {
      45           0 :             result += f.description() + "\n";
      46             :         }
      47           0 :         result += "}";
      48           0 :         if (fInstanceName.size()) {
      49           0 :             result += " " + fInstanceName;
      50           0 :             for (const auto& size : fSizes) {
      51           0 :                 result += "[";
      52           0 :                 if (size) {
      53           0 :                     result += size->description();
      54             :                 }
      55           0 :                 result += "]";
      56             :             }
      57             :         }
      58           0 :         return result + ";";
      59             :     }
      60             : 
      61             :     const Variable& fVariable;
      62             :     const String fTypeName;
      63             :     const String fInstanceName;
      64             :     const std::vector<std::unique_ptr<Expression>> fSizes;
      65             :     const std::shared_ptr<SymbolTable> fTypeOwner;
      66             : 
      67             :     typedef ProgramElement INHERITED;
      68             : };
      69             : 
      70             : } // namespace
      71             : 
      72             : #endif

Generated by: LCOV version 1.13