Commit bbd9d4c6 by Olli Etuaho Committed by Commit Bot

Use TVariable instead of TIntermSymbol for variables

This removes unnecessary indirection. It's easier to just create TVariables in createSamplerSymbols, and to track referenced variables using TVariable pointers instead of TIntermSymbol pointers. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: Id1e75e04da084eb9026f581f22070b27a45615ba Reviewed-on: https://chromium-review.googlesource.com/839442Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 47c8ea3f
...@@ -408,8 +408,8 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -408,8 +408,8 @@ void OutputHLSL::header(TInfoSinkBase &out,
for (const auto &varying : mReferencedVaryings) for (const auto &varying : mReferencedVaryings)
{ {
const TType &type = varying.second->variable().getType(); const TType &type = varying.second->getType();
const TString &name = varying.second->getName(); const TString &name = varying.second->name();
// Program linking depends on this exact format // Program linking depends on this exact format
varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) + varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) +
...@@ -419,7 +419,7 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -419,7 +419,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
for (const auto &attribute : mReferencedAttributes) for (const auto &attribute : mReferencedAttributes)
{ {
const TType &type = attribute.second->getType(); const TType &type = attribute.second->getType();
const TString &name = attribute.second->getName(); const TString &name = attribute.second->name();
attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) + attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) +
" = " + initializer(type) + ";\n"; " = " + initializer(type) + ";\n";
...@@ -491,7 +491,7 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -491,7 +491,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
{ {
for (const auto &outputVariable : mReferencedOutputVariables) for (const auto &outputVariable : mReferencedOutputVariables)
{ {
const TString &variableName = outputVariable.second->getName(); const TString &variableName = outputVariable.second->name();
const TType &variableType = outputVariable.second->getType(); const TType &variableType = outputVariable.second->getType();
out << "static " + TypeString(variableType) + " out_" + variableName + out << "static " + TypeString(variableType) + " out_" + variableName +
...@@ -900,19 +900,19 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node) ...@@ -900,19 +900,19 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
} }
else else
{ {
mReferencedUniforms[uniqueId.get()] = node; mReferencedUniforms[uniqueId.get()] = &variable;
} }
out << DecorateVariableIfNeeded(variable); out << DecorateVariableIfNeeded(variable);
} }
else if (qualifier == EvqAttribute || qualifier == EvqVertexIn) else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
{ {
mReferencedAttributes[uniqueId.get()] = node; mReferencedAttributes[uniqueId.get()] = &variable;
out << Decorate(name); out << Decorate(name);
} }
else if (IsVarying(qualifier)) else if (IsVarying(qualifier))
{ {
mReferencedVaryings[uniqueId.get()] = node; mReferencedVaryings[uniqueId.get()] = &variable;
out << Decorate(name); out << Decorate(name);
if (name == "ViewID_OVR") if (name == "ViewID_OVR")
{ {
...@@ -921,7 +921,7 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node) ...@@ -921,7 +921,7 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
} }
else if (qualifier == EvqFragmentOut) else if (qualifier == EvqFragmentOut)
{ {
mReferencedOutputVariables[uniqueId.get()] = node; mReferencedOutputVariables[uniqueId.get()] = &variable;
out << "out_" << name; out << "out_" << name;
} }
else if (qualifier == EvqFragColor) else if (qualifier == EvqFragColor)
...@@ -1833,11 +1833,13 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node) ...@@ -1833,11 +1833,13 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
TIntermSymbol *symbol = declarator->getAsSymbolNode(); TIntermSymbol *symbol = declarator->getAsSymbolNode();
ASSERT(symbol); // Varying declarations can't have initializers. ASSERT(symbol); // Varying declarations can't have initializers.
if (symbol->variable().symbolType() != SymbolType::Empty) const TVariable &variable = symbol->variable();
if (variable.symbolType() != SymbolType::Empty)
{ {
// Vertex outputs which are declared but not written to should still be declared to // Vertex outputs which are declared but not written to should still be declared to
// allow successful linking. // allow successful linking.
mReferencedVaryings[symbol->uniqueId().get()] = symbol; mReferencedVaryings[symbol->uniqueId().get()] = &variable;
} }
} }
} }
...@@ -1966,22 +1968,22 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1966,22 +1968,22 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
if (typedArg->getType().isStructureContainingSamplers()) if (typedArg->getType().isStructureContainingSamplers())
{ {
const TType &argType = typedArg->getType(); const TType &argType = typedArg->getType();
TVector<TIntermSymbol *> samplerSymbols; TVector<const TVariable *> samplerSymbols;
TString structName = samplerNamePrefixFromStruct(typedArg); TString structName = samplerNamePrefixFromStruct(typedArg);
argType.createSamplerSymbols("angle_" + structName, "", &samplerSymbols, argType.createSamplerSymbols("angle_" + structName, "", &samplerSymbols,
nullptr, mSymbolTable); nullptr, mSymbolTable);
for (const TIntermSymbol *sampler : samplerSymbols) for (const TVariable *sampler : samplerSymbols)
{ {
if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT) if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
{ {
out << ", texture_" << sampler->getName(); out << ", texture_" << sampler->name();
out << ", sampler_" << sampler->getName(); out << ", sampler_" << sampler->name();
} }
else else
{ {
// In case of HLSL 4.1+, this symbol is the sampler index, and in case // In case of HLSL 4.1+, this symbol is the sampler index, and in case
// of D3D9, it's the sampler variable. // of D3D9, it's the sampler variable.
out << ", " + sampler->getName(); out << ", " + sampler->name();
} }
} }
} }
...@@ -2661,30 +2663,30 @@ TString OutputHLSL::argumentString(const TIntermSymbol *symbol) ...@@ -2661,30 +2663,30 @@ TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
if (type.isStructureContainingSamplers()) if (type.isStructureContainingSamplers())
{ {
ASSERT(qualifier != EvqOut && qualifier != EvqInOut); ASSERT(qualifier != EvqOut && qualifier != EvqInOut);
TVector<TIntermSymbol *> samplerSymbols; TVector<const TVariable *> samplerSymbols;
type.createSamplerSymbols("angle" + nameStr, "", &samplerSymbols, nullptr, mSymbolTable); type.createSamplerSymbols("angle" + nameStr, "", &samplerSymbols, nullptr, mSymbolTable);
for (const TIntermSymbol *sampler : samplerSymbols) for (const TVariable *sampler : samplerSymbols)
{ {
const TType &samplerType = sampler->getType(); const TType &samplerType = sampler->getType();
if (mOutputType == SH_HLSL_4_1_OUTPUT) if (mOutputType == SH_HLSL_4_1_OUTPUT)
{ {
argString << ", const uint " << sampler->getName() << ArrayString(samplerType); argString << ", const uint " << sampler->name() << ArrayString(samplerType);
} }
else if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT) else if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
{ {
ASSERT(IsSampler(samplerType.getBasicType())); ASSERT(IsSampler(samplerType.getBasicType()));
argString << ", " << QualifierString(qualifier) << " " argString << ", " << QualifierString(qualifier) << " "
<< TextureString(samplerType.getBasicType()) << " texture_" << TextureString(samplerType.getBasicType()) << " texture_"
<< sampler->getName() << ArrayString(samplerType) << ", " << sampler->name() << ArrayString(samplerType) << ", "
<< QualifierString(qualifier) << " " << QualifierString(qualifier) << " "
<< SamplerString(samplerType.getBasicType()) << " sampler_" << SamplerString(samplerType.getBasicType()) << " sampler_"
<< sampler->getName() << ArrayString(samplerType); << sampler->name() << ArrayString(samplerType);
} }
else else
{ {
ASSERT(IsSampler(samplerType.getBasicType())); ASSERT(IsSampler(samplerType.getBasicType()));
argString << ", " << QualifierString(qualifier) << " " << TypeString(samplerType) argString << ", " << QualifierString(qualifier) << " " << TypeString(samplerType)
<< " " << sampler->getName() << ArrayString(samplerType); << " " << sampler->name() << ArrayString(samplerType);
} }
} }
} }
......
...@@ -28,8 +28,9 @@ class ImageFunctionHLSL; ...@@ -28,8 +28,9 @@ class ImageFunctionHLSL;
class UnfoldShortCircuit; class UnfoldShortCircuit;
class UniformHLSL; class UniformHLSL;
// Map from uniqueId to a symbol node. // Maps from uniqueId to a symbol node or a variable.
typedef std::map<int, TIntermSymbol *> ReferencedSymbols; typedef std::map<int, TIntermSymbol *> ReferencedSymbols;
typedef std::map<int, const TVariable *> ReferencedVariables;
class OutputHLSL : public TIntermTraverser class OutputHLSL : public TIntermTraverser
{ {
...@@ -155,7 +156,7 @@ class OutputHLSL : public TIntermTraverser ...@@ -155,7 +156,7 @@ class OutputHLSL : public TIntermTraverser
// TODO (jmadill): Just passing an InfoSink in function parameters would be simpler. // TODO (jmadill): Just passing an InfoSink in function parameters would be simpler.
std::stack<TInfoSinkBase *> mInfoSinkStack; std::stack<TInfoSinkBase *> mInfoSinkStack;
ReferencedSymbols mReferencedUniforms; ReferencedVariables mReferencedUniforms;
// Indexed by block id, not instance id. Stored nodes point to either the block instance in // Indexed by block id, not instance id. Stored nodes point to either the block instance in
// the case of an instanced block, or a member uniform in the case of a non-instanced block. // the case of an instanced block, or a member uniform in the case of a non-instanced block.
...@@ -163,9 +164,9 @@ class OutputHLSL : public TIntermTraverser ...@@ -163,9 +164,9 @@ class OutputHLSL : public TIntermTraverser
// blocks. It needs to know the instance name if any and link to the TInterfaceBlock object. // blocks. It needs to know the instance name if any and link to the TInterfaceBlock object.
ReferencedSymbols mReferencedUniformBlocks; ReferencedSymbols mReferencedUniformBlocks;
ReferencedSymbols mReferencedAttributes; ReferencedVariables mReferencedAttributes;
ReferencedSymbols mReferencedVaryings; ReferencedVariables mReferencedVaryings;
ReferencedSymbols mReferencedOutputVariables; ReferencedVariables mReferencedOutputVariables;
StructureHLSL *mStructureHLSL; StructureHLSL *mStructureHLSL;
UniformHLSL *mUniformHLSL; UniformHLSL *mUniformHLSL;
......
...@@ -76,8 +76,8 @@ TStructure::TStructure(TSymbolTable *symbolTable, ...@@ -76,8 +76,8 @@ TStructure::TStructure(TSymbolTable *symbolTable,
void TStructure::createSamplerSymbols(const TString &namePrefix, void TStructure::createSamplerSymbols(const TString &namePrefix,
const TString &apiNamePrefix, const TString &apiNamePrefix,
TVector<TIntermSymbol *> *outputSymbols, TVector<const TVariable *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames, TMap<const TVariable *, TString> *outputSymbolsToAPINames,
TSymbolTable *symbolTable) const TSymbolTable *symbolTable) const
{ {
ASSERT(containsSamplers()); ASSERT(containsSamplers());
......
...@@ -103,8 +103,8 @@ class TStructure : public TSymbol, public TFieldListCollection ...@@ -103,8 +103,8 @@ class TStructure : public TSymbol, public TFieldListCollection
void createSamplerSymbols(const TString &namePrefix, void createSamplerSymbols(const TString &namePrefix,
const TString &apiNamePrefix, const TString &apiNamePrefix,
TVector<TIntermSymbol *> *outputSymbols, TVector<const TVariable *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames, TMap<const TVariable *, TString> *outputSymbolsToAPINames,
TSymbolTable *symbolTable) const; TSymbolTable *symbolTable) const;
void setAtGlobalScope(bool atGlobalScope) { mAtGlobalScope = atGlobalScope; } void setAtGlobalScope(bool atGlobalScope) { mAtGlobalScope = atGlobalScope; }
......
...@@ -776,8 +776,8 @@ void TType::invalidateMangledName() ...@@ -776,8 +776,8 @@ void TType::invalidateMangledName()
void TType::createSamplerSymbols(const TString &namePrefix, void TType::createSamplerSymbols(const TString &namePrefix,
const TString &apiNamePrefix, const TString &apiNamePrefix,
TVector<TIntermSymbol *> *outputSymbols, TVector<const TVariable *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames, TMap<const TVariable *, TString> *outputSymbolsToAPINames,
TSymbolTable *symbolTable) const TSymbolTable *symbolTable) const
{ {
if (isStructureContainingSamplers()) if (isStructureContainingSamplers())
...@@ -808,11 +808,10 @@ void TType::createSamplerSymbols(const TString &namePrefix, ...@@ -808,11 +808,10 @@ void TType::createSamplerSymbols(const TString &namePrefix,
ASSERT(IsSampler(type)); ASSERT(IsSampler(type));
TVariable *variable = new TVariable(symbolTable, NewPoolTString(namePrefix.c_str()), *this, TVariable *variable = new TVariable(symbolTable, NewPoolTString(namePrefix.c_str()), *this,
SymbolType::AngleInternal); SymbolType::AngleInternal);
TIntermSymbol *symbol = new TIntermSymbol(variable); outputSymbols->push_back(variable);
outputSymbols->push_back(symbol);
if (outputSymbolsToAPINames) if (outputSymbolsToAPINames)
{ {
(*outputSymbolsToAPINames)[symbol] = apiNamePrefix; (*outputSymbolsToAPINames)[variable] = apiNamePrefix;
} }
} }
......
...@@ -22,6 +22,7 @@ class TType; ...@@ -22,6 +22,7 @@ class TType;
class TInterfaceBlock; class TInterfaceBlock;
class TStructure; class TStructure;
class TSymbol; class TSymbol;
class TVariable;
class TIntermSymbol; class TIntermSymbol;
class TSymbolTable; class TSymbolTable;
...@@ -306,8 +307,8 @@ class TType ...@@ -306,8 +307,8 @@ class TType
void createSamplerSymbols(const TString &namePrefix, void createSamplerSymbols(const TString &namePrefix,
const TString &apiNamePrefix, const TString &apiNamePrefix,
TVector<TIntermSymbol *> *outputSymbols, TVector<const TVariable *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames, TMap<const TVariable *, TString> *outputSymbolsToAPINames,
TSymbolTable *symbolTable) const; TSymbolTable *symbolTable) const;
// Initializes all lazily-initialized members. // Initializes all lazily-initialized members.
......
...@@ -198,8 +198,8 @@ unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type ...@@ -198,8 +198,8 @@ unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type
void UniformHLSL::outputHLSLSamplerUniformGroup( void UniformHLSL::outputHLSLSamplerUniformGroup(
TInfoSinkBase &out, TInfoSinkBase &out,
const HLSLTextureGroup textureGroup, const HLSLTextureGroup textureGroup,
const TVector<const TIntermSymbol *> &group, const TVector<const TVariable *> &group,
const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames, const TMap<const TVariable *, TString> &samplerInStructSymbolsToAPINames,
unsigned int *groupTextureRegisterIndex) unsigned int *groupTextureRegisterIndex)
{ {
if (group.empty()) if (group.empty())
...@@ -207,10 +207,10 @@ void UniformHLSL::outputHLSLSamplerUniformGroup( ...@@ -207,10 +207,10 @@ void UniformHLSL::outputHLSLSamplerUniformGroup(
return; return;
} }
unsigned int groupRegisterCount = 0; unsigned int groupRegisterCount = 0;
for (const TIntermSymbol *uniform : group) for (const TVariable *uniform : group)
{ {
const TType &type = uniform->getType(); const TType &type = uniform->getType();
const TString &name = uniform->getName(); const TString &name = uniform->name();
unsigned int registerCount; unsigned int registerCount;
// The uniform might be just a regular sampler or one extracted from a struct. // The uniform might be just a regular sampler or one extracted from a struct.
...@@ -231,14 +231,14 @@ void UniformHLSL::outputHLSLSamplerUniformGroup( ...@@ -231,14 +231,14 @@ void UniformHLSL::outputHLSLSamplerUniformGroup(
if (type.isArray()) if (type.isArray())
{ {
out << "static const uint " << DecorateVariableIfNeeded(uniform->variable()) out << "static const uint " << DecorateVariableIfNeeded(*uniform) << ArrayString(type)
<< ArrayString(type) << " = "; << " = ";
OutputSamplerIndexArrayInitializer(out, type, samplerArrayIndex); OutputSamplerIndexArrayInitializer(out, type, samplerArrayIndex);
out << ";\n"; out << ";\n";
} }
else else
{ {
out << "static const uint " << DecorateVariableIfNeeded(uniform->variable()) << " = " out << "static const uint " << DecorateVariableIfNeeded(*uniform) << " = "
<< samplerArrayIndex << ";\n"; << samplerArrayIndex << ";\n";
} }
} }
...@@ -340,7 +340,7 @@ void UniformHLSL::outputUniform(TInfoSinkBase &out, ...@@ -340,7 +340,7 @@ void UniformHLSL::outputUniform(TInfoSinkBase &out,
void UniformHLSL::uniformsHeader(TInfoSinkBase &out, void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
ShShaderOutput outputType, ShShaderOutput outputType,
const ReferencedSymbols &referencedUniforms, const ReferencedVariables &referencedUniforms,
TSymbolTable *symbolTable) TSymbolTable *symbolTable)
{ {
if (!referencedUniforms.empty()) if (!referencedUniforms.empty())
...@@ -350,20 +350,19 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -350,20 +350,19 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
// In the case of HLSL 4, sampler uniforms need to be grouped by type before the code is // In the case of HLSL 4, sampler uniforms need to be grouped by type before the code is
// written. They are grouped based on the combination of the HLSL texture type and // written. They are grouped based on the combination of the HLSL texture type and
// HLSL sampler type, enumerated in HLSLTextureSamplerGroup. // HLSL sampler type, enumerated in HLSLTextureSamplerGroup.
TVector<TVector<const TIntermSymbol *>> groupedSamplerUniforms(HLSL_TEXTURE_MAX + 1); TVector<TVector<const TVariable *>> groupedSamplerUniforms(HLSL_TEXTURE_MAX + 1);
TMap<const TIntermSymbol *, TString> samplerInStructSymbolsToAPINames; TMap<const TVariable *, TString> samplerInStructSymbolsToAPINames;
TVector<const TIntermSymbol *> imageUniformsHLSL41Output; TVector<const TVariable *> imageUniformsHLSL41Output;
for (auto &uniformIt : referencedUniforms) for (auto &uniformIt : referencedUniforms)
{ {
// Output regular uniforms. Group sampler uniforms by type. // Output regular uniforms. Group sampler uniforms by type.
const TIntermSymbol &uniform = *uniformIt.second; const TVariable &variable = *uniformIt.second;
const TType &type = uniform.getType(); const TType &type = variable.getType();
const TVariable &variable = uniform.variable();
if (outputType == SH_HLSL_4_1_OUTPUT && IsSampler(type.getBasicType())) if (outputType == SH_HLSL_4_1_OUTPUT && IsSampler(type.getBasicType()))
{ {
HLSLTextureGroup group = TextureGroup(type.getBasicType()); HLSLTextureGroup group = TextureGroup(type.getBasicType());
groupedSamplerUniforms[group].push_back(&uniform); groupedSamplerUniforms[group].push_back(&variable);
} }
else if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT && IsSampler(type.getBasicType())) else if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT && IsSampler(type.getBasicType()))
{ {
...@@ -372,20 +371,19 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -372,20 +371,19 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
} }
else if (outputType == SH_HLSL_4_1_OUTPUT && IsImage(type.getBasicType())) else if (outputType == SH_HLSL_4_1_OUTPUT && IsImage(type.getBasicType()))
{ {
imageUniformsHLSL41Output.push_back(&uniform); imageUniformsHLSL41Output.push_back(&variable);
} }
else else
{ {
if (type.isStructureContainingSamplers()) if (type.isStructureContainingSamplers())
{ {
TVector<TIntermSymbol *> samplerSymbols; TVector<const TVariable *> samplerSymbols;
TMap<TIntermSymbol *, TString> symbolsToAPINames; TMap<const TVariable *, TString> symbolsToAPINames;
type.createSamplerSymbols("angle_" + uniform.getName(), uniform.getName(), type.createSamplerSymbols("angle_" + variable.name(), variable.name(),
&samplerSymbols, &symbolsToAPINames, symbolTable); &samplerSymbols, &symbolsToAPINames, symbolTable);
for (TIntermSymbol *sampler : samplerSymbols) for (const TVariable *sampler : samplerSymbols)
{ {
const TType &samplerType = sampler->getType(); const TType &samplerType = sampler->getType();
const TVariable &samplerVariable = sampler->variable();
if (outputType == SH_HLSL_4_1_OUTPUT) if (outputType == SH_HLSL_4_1_OUTPUT)
{ {
...@@ -397,19 +395,18 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -397,19 +395,18 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
{ {
unsigned int registerIndex = assignSamplerInStructUniformRegister( unsigned int registerIndex = assignSamplerInStructUniformRegister(
samplerType, symbolsToAPINames[sampler], nullptr); samplerType, symbolsToAPINames[sampler], nullptr);
outputHLSL4_0_FL9_3Sampler(out, samplerType, samplerVariable, outputHLSL4_0_FL9_3Sampler(out, samplerType, *sampler, registerIndex);
registerIndex);
} }
else else
{ {
ASSERT(outputType == SH_HLSL_3_0_OUTPUT); ASSERT(outputType == SH_HLSL_3_0_OUTPUT);
unsigned int registerIndex = assignSamplerInStructUniformRegister( unsigned int registerIndex = assignSamplerInStructUniformRegister(
samplerType, symbolsToAPINames[sampler], nullptr); samplerType, symbolsToAPINames[sampler], nullptr);
outputUniform(out, samplerType, samplerVariable, registerIndex); outputUniform(out, samplerType, *sampler, registerIndex);
} }
} }
} }
unsigned int registerIndex = assignUniformRegister(type, uniform.getName(), nullptr); unsigned int registerIndex = assignUniformRegister(type, variable.name(), nullptr);
outputUniform(out, type, variable, registerIndex); outputUniform(out, type, variable, registerIndex);
} }
} }
...@@ -427,18 +424,17 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out, ...@@ -427,18 +424,17 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
} }
mSamplerCount = groupTextureRegisterIndex; mSamplerCount = groupTextureRegisterIndex;
for (const TIntermSymbol *image : imageUniformsHLSL41Output) for (const TVariable *image : imageUniformsHLSL41Output)
{ {
const TType &type = image->getType(); const TType &type = image->getType();
const TVariable &variable = image->variable(); unsigned int registerIndex = assignUniformRegister(type, image->name(), nullptr);
unsigned int registerIndex = assignUniformRegister(type, image->getName(), nullptr);
if (type.getMemoryQualifier().readonly) if (type.getMemoryQualifier().readonly)
{ {
outputHLSL4_1_FL11Texture(out, type, variable, registerIndex); outputHLSL4_1_FL11Texture(out, type, *image, registerIndex);
} }
else else
{ {
outputHLSL4_1_FL11RWTexture(out, type, variable, registerIndex); outputHLSL4_1_FL11RWTexture(out, type, *image, registerIndex);
} }
} }
} }
......
...@@ -31,7 +31,7 @@ class UniformHLSL : angle::NonCopyable ...@@ -31,7 +31,7 @@ class UniformHLSL : angle::NonCopyable
void reserveUniformBlockRegisters(unsigned int registerCount); void reserveUniformBlockRegisters(unsigned int registerCount);
void uniformsHeader(TInfoSinkBase &out, void uniformsHeader(TInfoSinkBase &out,
ShShaderOutput outputType, ShShaderOutput outputType,
const ReferencedSymbols &referencedUniforms, const ReferencedVariables &referencedUniforms,
TSymbolTable *symbolTable); TSymbolTable *symbolTable);
// Must be called after uniformsHeader // Must be called after uniformsHeader
...@@ -89,8 +89,8 @@ class UniformHLSL : angle::NonCopyable ...@@ -89,8 +89,8 @@ class UniformHLSL : angle::NonCopyable
void outputHLSLSamplerUniformGroup( void outputHLSLSamplerUniformGroup(
TInfoSinkBase &out, TInfoSinkBase &out,
const HLSLTextureGroup textureGroup, const HLSLTextureGroup textureGroup,
const TVector<const TIntermSymbol *> &group, const TVector<const TVariable *> &group,
const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames, const TMap<const TVariable *, TString> &samplerInStructSymbolsToAPINames,
unsigned int *groupTextureRegisterIndex); unsigned int *groupTextureRegisterIndex);
unsigned int mUniformRegister; unsigned int mUniformRegister;
......
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