Commit 3e217f65 by Qin Jiajia Committed by Commit Bot

Rename UniformHLSL to ResourcesHLSL

In future, atomic counter and shader storage block will be added into UniformHLSL since they all need the UAV register. So this change renames UniformHLSL to ResourcesHLSL. Bug: angleproject:1951 Change-Id: Ie9eda090763fbb516468c138e65e111eb12fe514 Reviewed-on: https://chromium-review.googlesource.com/1193322 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent d310a434
...@@ -235,6 +235,8 @@ ...@@ -235,6 +235,8 @@
'compiler/translator/BuiltInFunctionEmulatorHLSL.h', 'compiler/translator/BuiltInFunctionEmulatorHLSL.h',
'compiler/translator/OutputHLSL.cpp', 'compiler/translator/OutputHLSL.cpp',
'compiler/translator/OutputHLSL.h', 'compiler/translator/OutputHLSL.h',
'compiler/translator/ResourcesHLSL.cpp',
'compiler/translator/ResourcesHLSL.h',
'compiler/translator/StructureHLSL.cpp', 'compiler/translator/StructureHLSL.cpp',
'compiler/translator/StructureHLSL.h', 'compiler/translator/StructureHLSL.h',
'compiler/translator/TextureFunctionHLSL.cpp', 'compiler/translator/TextureFunctionHLSL.cpp',
...@@ -243,8 +245,6 @@ ...@@ -243,8 +245,6 @@
'compiler/translator/ImageFunctionHLSL.h', 'compiler/translator/ImageFunctionHLSL.h',
'compiler/translator/TranslatorHLSL.cpp', 'compiler/translator/TranslatorHLSL.cpp',
'compiler/translator/TranslatorHLSL.h', 'compiler/translator/TranslatorHLSL.h',
'compiler/translator/UniformHLSL.cpp',
'compiler/translator/UniformHLSL.h',
'compiler/translator/UtilsHLSL.cpp', 'compiler/translator/UtilsHLSL.cpp',
'compiler/translator/UtilsHLSL.h', 'compiler/translator/UtilsHLSL.h',
'compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp', 'compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp',
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h" #include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
#include "compiler/translator/ImageFunctionHLSL.h" #include "compiler/translator/ImageFunctionHLSL.h"
#include "compiler/translator/InfoSink.h" #include "compiler/translator/InfoSink.h"
#include "compiler/translator/ResourcesHLSL.h"
#include "compiler/translator/StructureHLSL.h" #include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/TextureFunctionHLSL.h" #include "compiler/translator/TextureFunctionHLSL.h"
#include "compiler/translator/TranslatorHLSL.h" #include "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/UniformHLSL.h"
#include "compiler/translator/UtilsHLSL.h" #include "compiler/translator/UtilsHLSL.h"
#include "compiler/translator/blocklayout.h" #include "compiler/translator/blocklayout.h"
#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h" #include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h"
...@@ -236,7 +236,7 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType, ...@@ -236,7 +236,7 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType,
unsigned int firstUniformRegister = unsigned int firstUniformRegister =
((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u; ((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u;
mUniformHLSL = new UniformHLSL(mStructureHLSL, outputType, uniforms, firstUniformRegister); mResourcesHLSL = new ResourcesHLSL(mStructureHLSL, outputType, uniforms, firstUniformRegister);
if (mOutputType == SH_HLSL_3_0_OUTPUT) if (mOutputType == SH_HLSL_3_0_OUTPUT)
{ {
...@@ -244,17 +244,17 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType, ...@@ -244,17 +244,17 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType,
// Vertex shaders need a slightly different set: dx_DepthRange, dx_ViewCoords and // Vertex shaders need a slightly different set: dx_DepthRange, dx_ViewCoords and
// dx_ViewAdjust. // dx_ViewAdjust.
// In both cases total 3 uniform registers need to be reserved. // In both cases total 3 uniform registers need to be reserved.
mUniformHLSL->reserveUniformRegisters(3); mResourcesHLSL->reserveUniformRegisters(3);
} }
// Reserve registers for the default uniform block and driver constants // Reserve registers for the default uniform block and driver constants
mUniformHLSL->reserveUniformBlockRegisters(2); mResourcesHLSL->reserveUniformBlockRegisters(2);
} }
OutputHLSL::~OutputHLSL() OutputHLSL::~OutputHLSL()
{ {
SafeDelete(mStructureHLSL); SafeDelete(mStructureHLSL);
SafeDelete(mUniformHLSL); SafeDelete(mResourcesHLSL);
SafeDelete(mTextureFunctionHLSL); SafeDelete(mTextureFunctionHLSL);
SafeDelete(mImageFunctionHLSL); SafeDelete(mImageFunctionHLSL);
for (auto &eqFunction : mStructEqualityFunctions) for (auto &eqFunction : mStructEqualityFunctions)
...@@ -310,12 +310,12 @@ void OutputHLSL::output(TIntermNode *treeRoot, TInfoSinkBase &objSink) ...@@ -310,12 +310,12 @@ void OutputHLSL::output(TIntermNode *treeRoot, TInfoSinkBase &objSink)
const std::map<std::string, unsigned int> &OutputHLSL::getUniformBlockRegisterMap() const const std::map<std::string, unsigned int> &OutputHLSL::getUniformBlockRegisterMap() const
{ {
return mUniformHLSL->getUniformBlockRegisterMap(); return mResourcesHLSL->getUniformBlockRegisterMap();
} }
const std::map<std::string, unsigned int> &OutputHLSL::getUniformRegisterMap() const const std::map<std::string, unsigned int> &OutputHLSL::getUniformRegisterMap() const
{ {
return mUniformHLSL->getUniformRegisterMap(); return mResourcesHLSL->getUniformRegisterMap();
} }
TString OutputHLSL::structInitializerString(int indent, TString OutputHLSL::structInitializerString(int indent,
...@@ -409,7 +409,7 @@ TString OutputHLSL::generateStructMapping(const std::vector<MappedStruct> &std14 ...@@ -409,7 +409,7 @@ TString OutputHLSL::generateStructMapping(const std::vector<MappedStruct> &std14
unsigned int instanceStringArrayIndex = GL_INVALID_INDEX; unsigned int instanceStringArrayIndex = GL_INVALID_INDEX;
if (isInstanceArray) if (isInstanceArray)
instanceStringArrayIndex = instanceArrayIndex; instanceStringArrayIndex = instanceArrayIndex;
TString instanceString = mUniformHLSL->UniformBlockInstanceString( TString instanceString = mResourcesHLSL->UniformBlockInstanceString(
instanceName, instanceStringArrayIndex); instanceName, instanceStringArrayIndex);
originalName += instanceString; originalName += instanceString;
mappedName += instanceString; mappedName += instanceString;
...@@ -471,8 +471,8 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -471,8 +471,8 @@ void OutputHLSL::header(TInfoSinkBase &out,
out << mStructureHLSL->structsHeader(); out << mStructureHLSL->structsHeader();
mUniformHLSL->uniformsHeader(out, mOutputType, mReferencedUniforms, mSymbolTable); mResourcesHLSL->uniformsHeader(out, mOutputType, mReferencedUniforms, mSymbolTable);
out << mUniformHLSL->uniformBlocksHeader(mReferencedUniformBlocks); out << mResourcesHLSL->uniformBlocksHeader(mReferencedUniformBlocks);
if (!mEqualityFunctions.empty()) if (!mEqualityFunctions.empty())
{ {
...@@ -631,7 +631,7 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -631,7 +631,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
if (mOutputType == SH_HLSL_4_1_OUTPUT) if (mOutputType == SH_HLSL_4_1_OUTPUT)
{ {
mUniformHLSL->samplerMetadataUniforms(out, "c4"); mResourcesHLSL->samplerMetadataUniforms(out, "c4");
} }
out << "};\n"; out << "};\n";
...@@ -743,7 +743,7 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -743,7 +743,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
if (mOutputType == SH_HLSL_4_1_OUTPUT) if (mOutputType == SH_HLSL_4_1_OUTPUT)
{ {
mUniformHLSL->samplerMetadataUniforms(out, "c4"); mResourcesHLSL->samplerMetadataUniforms(out, "c4");
} }
out << "};\n" out << "};\n"
...@@ -779,7 +779,7 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -779,7 +779,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
out << " uint3 gl_NumWorkGroups : packoffset(c0);\n"; out << " uint3 gl_NumWorkGroups : packoffset(c0);\n";
} }
ASSERT(mOutputType == SH_HLSL_4_1_OUTPUT); ASSERT(mOutputType == SH_HLSL_4_1_OUTPUT);
mUniformHLSL->samplerMetadataUniforms(out, "c1"); mResourcesHLSL->samplerMetadataUniforms(out, "c1");
out << "};\n"; out << "};\n";
std::ostringstream systemValueDeclaration; std::ostringstream systemValueDeclaration;
...@@ -1309,8 +1309,8 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node) ...@@ -1309,8 +1309,8 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
new TReferencedBlock(interfaceBlock, &instanceArraySymbol->variable()); new TReferencedBlock(interfaceBlock, &instanceArraySymbol->variable());
} }
const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0); const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
out << mUniformHLSL->UniformBlockInstanceString(instanceArraySymbol->getName(), out << mResourcesHLSL->UniformBlockInstanceString(
arrayIndex); instanceArraySymbol->getName(), arrayIndex);
return false; return false;
} }
} }
......
...@@ -22,13 +22,13 @@ class BuiltInFunctionEmulator; ...@@ -22,13 +22,13 @@ class BuiltInFunctionEmulator;
namespace sh namespace sh
{ {
class ImageFunctionHLSL;
class ResourcesHLSL;
class StructureHLSL; class StructureHLSL;
class TextureFunctionHLSL; class TextureFunctionHLSL;
class TSymbolTable; class TSymbolTable;
class TVariable; class TVariable;
class ImageFunctionHLSL;
class UnfoldShortCircuit; class UnfoldShortCircuit;
class UniformHLSL;
struct TReferencedBlock : angle::NonCopyable struct TReferencedBlock : angle::NonCopyable
{ {
...@@ -180,7 +180,7 @@ class OutputHLSL : public TIntermTraverser ...@@ -180,7 +180,7 @@ class OutputHLSL : public TIntermTraverser
ReferencedVariables mReferencedOutputVariables; ReferencedVariables mReferencedOutputVariables;
StructureHLSL *mStructureHLSL; StructureHLSL *mStructureHLSL;
UniformHLSL *mUniformHLSL; ResourcesHLSL *mResourcesHLSL;
TextureFunctionHLSL *mTextureFunctionHLSL; TextureFunctionHLSL *mTextureFunctionHLSL;
ImageFunctionHLSL *mImageFunctionHLSL; ImageFunctionHLSL *mImageFunctionHLSL;
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// UniformHLSL.cpp: // ResourcesHLSL.cpp:
// Methods for GLSL to HLSL translation for uniforms and uniform blocks. // Methods for GLSL to HLSL translation for uniforms and interface blocks.
// //
#include "compiler/translator/UniformHLSL.h" #include "compiler/translator/ResourcesHLSL.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "compiler/translator/ImmutableStringBuilder.h" #include "compiler/translator/ImmutableStringBuilder.h"
...@@ -95,10 +95,10 @@ void OutputUniformIndexArrayInitializer(TInfoSinkBase &out, ...@@ -95,10 +95,10 @@ void OutputUniformIndexArrayInitializer(TInfoSinkBase &out,
} // anonymous namespace } // anonymous namespace
UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL, ResourcesHLSL::ResourcesHLSL(StructureHLSL *structureHLSL,
ShShaderOutput outputType, ShShaderOutput outputType,
const std::vector<Uniform> &uniforms, const std::vector<Uniform> &uniforms,
unsigned int firstUniformRegister) unsigned int firstUniformRegister)
: mUniformRegister(firstUniformRegister), : mUniformRegister(firstUniformRegister),
mUniformBlockRegister(0), mUniformBlockRegister(0),
mTextureRegister(0), mTextureRegister(0),
...@@ -110,17 +110,17 @@ UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL, ...@@ -110,17 +110,17 @@ UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL,
{ {
} }
void UniformHLSL::reserveUniformRegisters(unsigned int registerCount) void ResourcesHLSL::reserveUniformRegisters(unsigned int registerCount)
{ {
mUniformRegister = registerCount; mUniformRegister = registerCount;
} }
void UniformHLSL::reserveUniformBlockRegisters(unsigned int registerCount) void ResourcesHLSL::reserveUniformBlockRegisters(unsigned int registerCount)
{ {
mUniformBlockRegister = registerCount; mUniformBlockRegister = registerCount;
} }
const Uniform *UniformHLSL::findUniformByName(const ImmutableString &name) const const Uniform *ResourcesHLSL::findUniformByName(const ImmutableString &name) const
{ {
for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex) for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
{ {
...@@ -133,9 +133,9 @@ const Uniform *UniformHLSL::findUniformByName(const ImmutableString &name) const ...@@ -133,9 +133,9 @@ const Uniform *UniformHLSL::findUniformByName(const ImmutableString &name) const
return nullptr; return nullptr;
} }
unsigned int UniformHLSL::assignUniformRegister(const TType &type, unsigned int ResourcesHLSL::assignUniformRegister(const TType &type,
const ImmutableString &name, const ImmutableString &name,
unsigned int *outRegisterCount) unsigned int *outRegisterCount)
{ {
unsigned int registerIndex; unsigned int registerIndex;
const Uniform *uniform = findUniformByName(name); const Uniform *uniform = findUniformByName(name);
...@@ -179,9 +179,9 @@ unsigned int UniformHLSL::assignUniformRegister(const TType &type, ...@@ -179,9 +179,9 @@ unsigned int UniformHLSL::assignUniformRegister(const TType &type,
return registerIndex; return registerIndex;
} }
unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type, unsigned int ResourcesHLSL::assignSamplerInStructUniformRegister(const TType &type,
const TString &name, const TString &name,
unsigned int *outRegisterCount) unsigned int *outRegisterCount)
{ {
// Sampler that is a field of a uniform structure. // Sampler that is a field of a uniform structure.
ASSERT(IsSampler(type.getBasicType())); ASSERT(IsSampler(type.getBasicType()));
...@@ -196,7 +196,7 @@ unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type ...@@ -196,7 +196,7 @@ unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type
return registerIndex; return registerIndex;
} }
void UniformHLSL::outputHLSLSamplerUniformGroup( void ResourcesHLSL::outputHLSLSamplerUniformGroup(
TInfoSinkBase &out, TInfoSinkBase &out,
const HLSLTextureGroup textureGroup, const HLSLTextureGroup textureGroup,
const TVector<const TVariable *> &group, const TVector<const TVariable *> &group,
...@@ -210,7 +210,7 @@ void UniformHLSL::outputHLSLSamplerUniformGroup( ...@@ -210,7 +210,7 @@ void UniformHLSL::outputHLSLSamplerUniformGroup(
unsigned int groupRegisterCount = 0; unsigned int groupRegisterCount = 0;
for (const TVariable *uniform : group) for (const TVariable *uniform : group)
{ {
const TType &type = uniform->getType(); const TType &type = uniform->getType();
const ImmutableString &name = uniform->name(); const ImmutableString &name = uniform->name();
unsigned int registerCount; unsigned int registerCount;
...@@ -261,10 +261,10 @@ void UniformHLSL::outputHLSLSamplerUniformGroup( ...@@ -261,10 +261,10 @@ void UniformHLSL::outputHLSLSamplerUniformGroup(
*groupTextureRegisterIndex += groupRegisterCount; *groupTextureRegisterIndex += groupRegisterCount;
} }
void UniformHLSL::outputHLSLImageUniformIndices(TInfoSinkBase &out, void ResourcesHLSL::outputHLSLImageUniformIndices(TInfoSinkBase &out,
const TVector<const TVariable *> &group, const TVector<const TVariable *> &group,
unsigned int imageArrayIndex, unsigned int imageArrayIndex,
unsigned int *groupRegisterCount) unsigned int *groupRegisterCount)
{ {
for (const TVariable *uniform : group) for (const TVariable *uniform : group)
{ {
...@@ -292,11 +292,11 @@ void UniformHLSL::outputHLSLImageUniformIndices(TInfoSinkBase &out, ...@@ -292,11 +292,11 @@ void UniformHLSL::outputHLSLImageUniformIndices(TInfoSinkBase &out,
} }
} }
void UniformHLSL::outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out, void ResourcesHLSL::outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out,
const HLSLTextureGroup textureGroup, const HLSLTextureGroup textureGroup,
const TVector<const TVariable *> &group, const TVector<const TVariable *> &group,
unsigned int *groupTextureRegisterIndex, unsigned int *groupTextureRegisterIndex,
unsigned int *imageUniformGroupIndex) unsigned int *imageUniformGroupIndex)
{ {
if (group.empty()) if (group.empty())
{ {
...@@ -316,11 +316,11 @@ void UniformHLSL::outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out, ...@@ -316,11 +316,11 @@ void UniformHLSL::outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out,
*imageUniformGroupIndex += groupRegisterCount; *imageUniformGroupIndex += groupRegisterCount;
} }
void UniformHLSL::outputHLSLImageUniformGroup(TInfoSinkBase &out, void ResourcesHLSL::outputHLSLImageUniformGroup(TInfoSinkBase &out,
const HLSLRWTextureGroup textureGroup, const HLSLRWTextureGroup textureGroup,
const TVector<const TVariable *> &group, const TVector<const TVariable *> &group,
unsigned int *groupTextureRegisterIndex, unsigned int *groupTextureRegisterIndex,
unsigned int *imageUniformGroupIndex) unsigned int *imageUniformGroupIndex)
{ {
if (group.empty()) if (group.empty())
{ {
...@@ -340,10 +340,10 @@ void UniformHLSL::outputHLSLImageUniformGroup(TInfoSinkBase &out, ...@@ -340,10 +340,10 @@ void UniformHLSL::outputHLSLImageUniformGroup(TInfoSinkBase &out,
*imageUniformGroupIndex += groupRegisterCount; *imageUniformGroupIndex += groupRegisterCount;
} }
void UniformHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out, void ResourcesHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
const TType &type, const TType &type,
const TVariable &variable, const TVariable &variable,
const unsigned int registerIndex) const unsigned int registerIndex)
{ {
out << "uniform " << SamplerString(type.getBasicType()) << " sampler_" out << "uniform " << SamplerString(type.getBasicType()) << " sampler_"
<< DecorateVariableIfNeeded(variable) << ArrayString(type) << " : register(s" << DecorateVariableIfNeeded(variable) << ArrayString(type) << " : register(s"
...@@ -353,10 +353,10 @@ void UniformHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out, ...@@ -353,10 +353,10 @@ void UniformHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
<< str(registerIndex) << ");\n"; << str(registerIndex) << ");\n";
} }
void UniformHLSL::outputUniform(TInfoSinkBase &out, void ResourcesHLSL::outputUniform(TInfoSinkBase &out,
const TType &type, const TType &type,
const TVariable &variable, const TVariable &variable,
const unsigned int registerIndex) const unsigned int registerIndex)
{ {
const TStructure *structure = type.getStruct(); const TStructure *structure = type.getStruct();
// If this is a nameless struct, we need to use its full definition, rather than its (empty) // If this is a nameless struct, we need to use its full definition, rather than its (empty)
...@@ -378,10 +378,10 @@ void UniformHLSL::outputUniform(TInfoSinkBase &out, ...@@ -378,10 +378,10 @@ void UniformHLSL::outputUniform(TInfoSinkBase &out,
out << ArrayString(type) << " : " << registerString << ";\n"; out << ArrayString(type) << " : " << registerString << ";\n";
} }
void UniformHLSL::uniformsHeader(TInfoSinkBase &out, void ResourcesHLSL::uniformsHeader(TInfoSinkBase &out,
ShShaderOutput outputType, ShShaderOutput outputType,
const ReferencedVariables &referencedUniforms, const ReferencedVariables &referencedUniforms,
TSymbolTable *symbolTable) TSymbolTable *symbolTable)
{ {
if (!referencedUniforms.empty()) if (!referencedUniforms.empty())
{ {
...@@ -469,7 +469,7 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -469,7 +469,7 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
if (outputType == SH_HLSL_4_1_OUTPUT) if (outputType == SH_HLSL_4_1_OUTPUT)
{ {
unsigned int groupTextureRegisterIndex = 0; unsigned int groupTextureRegisterIndex = 0;
unsigned int groupRWTextureRegisterIndex = 0; unsigned int groupRWTextureRegisterIndex = 0;
unsigned int imageUniformGroupIndex = 0; unsigned int imageUniformGroupIndex = 0;
// TEXTURE_2D is special, index offset is assumed to be 0 and omitted in that case. // TEXTURE_2D is special, index offset is assumed to be 0 and omitted in that case.
...@@ -498,7 +498,7 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -498,7 +498,7 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
} }
} }
void UniformHLSL::samplerMetadataUniforms(TInfoSinkBase &out, const char *reg) void ResourcesHLSL::samplerMetadataUniforms(TInfoSinkBase &out, const char *reg)
{ {
// If mSamplerCount is 0 the shader doesn't use any textures for samplers. // If mSamplerCount is 0 the shader doesn't use any textures for samplers.
if (mSamplerCount > 0) if (mSamplerCount > 0)
...@@ -515,7 +515,8 @@ void UniformHLSL::samplerMetadataUniforms(TInfoSinkBase &out, const char *reg) ...@@ -515,7 +515,8 @@ void UniformHLSL::samplerMetadataUniforms(TInfoSinkBase &out, const char *reg)
} }
} }
TString UniformHLSL::uniformBlocksHeader(const ReferencedInterfaceBlocks &referencedInterfaceBlocks) TString ResourcesHLSL::uniformBlocksHeader(
const ReferencedInterfaceBlocks &referencedInterfaceBlocks)
{ {
TString interfaceBlocks; TString interfaceBlocks;
...@@ -528,8 +529,8 @@ TString UniformHLSL::uniformBlocksHeader(const ReferencedInterfaceBlocks &refere ...@@ -528,8 +529,8 @@ TString UniformHLSL::uniformBlocksHeader(const ReferencedInterfaceBlocks &refere
interfaceBlocks += uniformBlockStructString(interfaceBlock); interfaceBlocks += uniformBlockStructString(interfaceBlock);
} }
unsigned int activeRegister = mUniformBlockRegister; unsigned int activeRegister = mUniformBlockRegister;
mUniformBlockRegisterMap[interfaceBlock.name().data()] = activeRegister; mUniformBlockRegisterMap[interfaceBlock.name().data()] = activeRegister;
if (instanceVariable != nullptr && instanceVariable->getType().isArray()) if (instanceVariable != nullptr && instanceVariable->getType().isArray())
{ {
...@@ -552,10 +553,10 @@ TString UniformHLSL::uniformBlocksHeader(const ReferencedInterfaceBlocks &refere ...@@ -552,10 +553,10 @@ TString UniformHLSL::uniformBlocksHeader(const ReferencedInterfaceBlocks &refere
return (interfaceBlocks.empty() ? "" : ("// Uniform Blocks\n\n" + interfaceBlocks)); return (interfaceBlocks.empty() ? "" : ("// Uniform Blocks\n\n" + interfaceBlocks));
} }
TString UniformHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock, TString ResourcesHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock,
const TVariable *instanceVariable, const TVariable *instanceVariable,
unsigned int registerIndex, unsigned int registerIndex,
unsigned int arrayIndex) unsigned int arrayIndex)
{ {
const TString &arrayIndexString = (arrayIndex != GL_INVALID_INDEX ? str(arrayIndex) : ""); const TString &arrayIndexString = (arrayIndex != GL_INVALID_INDEX ? str(arrayIndex) : "");
const TString &blockName = TString(interfaceBlock.name().data()) + arrayIndexString; const TString &blockName = TString(interfaceBlock.name().data()) + arrayIndexString;
...@@ -581,8 +582,8 @@ TString UniformHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock, ...@@ -581,8 +582,8 @@ TString UniformHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock,
return hlsl; return hlsl;
} }
TString UniformHLSL::UniformBlockInstanceString(const ImmutableString &instanceName, TString ResourcesHLSL::UniformBlockInstanceString(const ImmutableString &instanceName,
unsigned int arrayIndex) unsigned int arrayIndex)
{ {
if (arrayIndex != GL_INVALID_INDEX) if (arrayIndex != GL_INVALID_INDEX)
{ {
...@@ -594,8 +595,8 @@ TString UniformHLSL::UniformBlockInstanceString(const ImmutableString &instanceN ...@@ -594,8 +595,8 @@ TString UniformHLSL::UniformBlockInstanceString(const ImmutableString &instanceN
} }
} }
TString UniformHLSL::uniformBlockMembersString(const TInterfaceBlock &interfaceBlock, TString ResourcesHLSL::uniformBlockMembersString(const TInterfaceBlock &interfaceBlock,
TLayoutBlockStorage blockStorage) TLayoutBlockStorage blockStorage)
{ {
TString hlsl; TString hlsl;
...@@ -628,7 +629,7 @@ TString UniformHLSL::uniformBlockMembersString(const TInterfaceBlock &interfaceB ...@@ -628,7 +629,7 @@ TString UniformHLSL::uniformBlockMembersString(const TInterfaceBlock &interfaceB
return hlsl; return hlsl;
} }
TString UniformHLSL::uniformBlockStructString(const TInterfaceBlock &interfaceBlock) TString ResourcesHLSL::uniformBlockStructString(const TInterfaceBlock &interfaceBlock)
{ {
const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage(); const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// UniformHLSL.h: // ResourcesHLSL.h:
// Methods for GLSL to HLSL translation for uniforms and uniform blocks. // Methods for GLSL to HLSL translation for uniforms and interface blocks.
// //
#ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_ #ifndef COMPILER_TRANSLATOR_RESOURCESHLSL_H_
#define COMPILER_TRANSLATOR_UNIFORMHLSL_H_ #define COMPILER_TRANSLATOR_RESOURCESHLSL_H_
#include "compiler/translator/OutputHLSL.h" #include "compiler/translator/OutputHLSL.h"
#include "compiler/translator/UtilsHLSL.h" #include "compiler/translator/UtilsHLSL.h"
...@@ -19,13 +19,13 @@ class ImmutableString; ...@@ -19,13 +19,13 @@ class ImmutableString;
class StructureHLSL; class StructureHLSL;
class TSymbolTable; class TSymbolTable;
class UniformHLSL : angle::NonCopyable class ResourcesHLSL : angle::NonCopyable
{ {
public: public:
UniformHLSL(StructureHLSL *structureHLSL, ResourcesHLSL(StructureHLSL *structureHLSL,
ShShaderOutput outputType, ShShaderOutput outputType,
const std::vector<Uniform> &uniforms, const std::vector<Uniform> &uniforms,
unsigned int firstUniformRegister); unsigned int firstUniformRegister);
void reserveUniformRegisters(unsigned int registerCount); void reserveUniformRegisters(unsigned int registerCount);
void reserveUniformBlockRegisters(unsigned int registerCount); void reserveUniformBlockRegisters(unsigned int registerCount);
...@@ -115,4 +115,4 @@ class UniformHLSL : angle::NonCopyable ...@@ -115,4 +115,4 @@ class UniformHLSL : angle::NonCopyable
}; };
} }
#endif // COMPILER_TRANSLATOR_UNIFORMHLSL_H_ #endif // COMPILER_TRANSLATOR_RESOURCESHLSL_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment