Edit

kc3-lang/angle/src/compiler/translator/TranslatorMetalDirect/TransposeRowMajorMatrices.cpp

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2021-09-01 00:42:58
    Hash : 9d0e2851
    Message : Fix SeparateDeclarations vs struct specifiers Bug: chromium:1237696 Change-Id: I3b00f3797800e814ca83226a8e4f25b2a43cc641 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3133824 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>

  • src/compiler/translator/TranslatorMetalDirect/TransposeRowMajorMatrices.cpp
  • //
    // Copyright 2020 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    #include <algorithm>
    #include <unordered_map>
    
    #include "compiler/translator/TranslatorMetalDirect/AstHelpers.h"
    #include "compiler/translator/TranslatorMetalDirect/IntermRebuild.h"
    #include "compiler/translator/TranslatorMetalDirect/TransposeRowMajorMatrices.h"
    
    using namespace sh;
    
    ////////////////////////////////////////////////////////////////////////////////
    
    namespace
    {
    
    class Rewriter : public TIntermRebuild
    {
      public:
        Rewriter(TCompiler &compiler) : TIntermRebuild(compiler, true, false) {}
        // PreResult visitConstantUnionPre(TIntermSymbol &symbolNode) override
        // {
        //     const TVariable &var = symbolNode.variable();
        //     const TType &type = var.getType();
        //     //const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
        //     if(type.isMatrix())
        //     {
        //         return CreateBuiltInUnaryFunctionCallNode("transpose", symbolNode.deepCopy(),
        //                                                   mSymbolTable, 300));
        //     }
        //     return symbolNode;
        // }
    };
    
    }  // anonymous namespace
    
    ////////////////////////////////////////////////////////////////////////////////
    
    bool sh::TransposeRowMajorMatricies(TCompiler &compiler, TIntermBlock &root)
    {
        Rewriter rewriter(compiler);
        if (!rewriter.rebuildRoot(root))
        {
            return false;
        }
        return true;
    }