Hash :
8b869a95
Author :
Date :
2021-06-13T01:09:27
Translator: Generate Ops for all built-in functions EOpCallBuiltInFunction is removed in this change, as well as the "op": "auto" property in builtin_function_declarations.txt. Instead, gen_builtin_symbols.py automatically generates Ops for every built-in function and generates the TOperator enum accordingly. This simplifies SPIR-V code generation by allowing switches to be used on operators instead of string comparisons. Bug: angleproject:4589 Bug: angleproject:4889 Change-Id: Ia351524400b0e12a10a5572e27e9b88c6ec2e61c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2958869 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//
// 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"
#include "compiler/translator/tree_ops/SeparateDeclarations.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;
}