Hash :
a3a5cc6a
Author :
Date :
2015-02-13T13:12:22
Expose the IntermNode tree generated in the compiler for testing This refactoring makes it possible for tests to access the IntermNode tree produced by compilation by calling compileTree(). Removing ParseContext usage from OutputHLSL has the additional benefit of better separation between parsing and output. BUG=angle:916 Change-Id: Ib40954832316328772a5c1dcbbe6b46b238e4e65 Reviewed-on: https://chromium-review.googlesource.com/249723 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.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
//
// Copyright (c) 2002-2013 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 "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/OutputHLSL.h"
TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
: TCompiler(type, spec, output)
{
}
void TranslatorHLSL::translate(TIntermNode *root, int compileOptions)
{
const ShBuiltInResources &resources = getResources();
int numRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
sh::OutputHLSL outputHLSL(getShaderType(), getShaderVersion(), getExtensionBehavior(),
getSourcePath(), getOutputType(), numRenderTargets, getUniforms(), compileOptions);
outputHLSL.output(root, getInfoSink().obj);
mInterfaceBlockRegisterMap = outputHLSL.getInterfaceBlockRegisterMap();
mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
}
bool TranslatorHLSL::hasInterfaceBlock(const std::string &interfaceBlockName) const
{
return (mInterfaceBlockRegisterMap.count(interfaceBlockName) > 0);
}
unsigned int TranslatorHLSL::getInterfaceBlockRegister(const std::string &interfaceBlockName) const
{
ASSERT(hasInterfaceBlock(interfaceBlockName));
return mInterfaceBlockRegisterMap.find(interfaceBlockName)->second;
}
bool TranslatorHLSL::hasUniform(const std::string &uniformName) const
{
return (mUniformRegisterMap.count(uniformName) > 0);
}
unsigned int TranslatorHLSL::getUniformRegister(const std::string &uniformName) const
{
ASSERT(hasUniform(uniformName));
return mUniformRegisterMap.find(uniformName)->second;
}