summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/UniformHLSL.h')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UniformHLSL.h85
1 files changed, 61 insertions, 24 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
index 0f51f349bb..8784e50533 100644
--- a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
// UniformHLSL.h:
-// Methods for GLSL to HLSL translation for uniforms and interface blocks.
+// Methods for GLSL to HLSL translation for uniforms and uniform blocks.
//
#ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_
@@ -16,29 +16,35 @@
namespace sh
{
class StructureHLSL;
+class TSymbolTable;
class UniformHLSL : angle::NonCopyable
{
public:
- UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType, const std::vector<Uniform> &uniforms);
+ UniformHLSL(sh::GLenum shaderType,
+ StructureHLSL *structureHLSL,
+ ShShaderOutput outputType,
+ const std::vector<Uniform> &uniforms);
void reserveUniformRegisters(unsigned int registerCount);
- void reserveInterfaceBlockRegisters(unsigned int registerCount);
- void outputHLSLSamplerUniformGroup(TInfoSinkBase &out,
- const HLSLTextureSamplerGroup textureGroup,
- const TVector<const TIntermSymbol *> &group,
- unsigned int *groupTextureRegisterIndex);
+ void reserveUniformBlockRegisters(unsigned int registerCount);
void uniformsHeader(TInfoSinkBase &out,
ShShaderOutput outputType,
- const ReferencedSymbols &referencedUniforms);
- TString interfaceBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks);
+ const ReferencedSymbols &referencedUniforms,
+ TSymbolTable *symbolTable);
+
+ // Must be called after uniformsHeader
+ void samplerMetadataUniforms(TInfoSinkBase &out, const char *reg);
+
+ TString uniformBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks);
// Used for direct index references
- static TString interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex);
+ static TString uniformBlockInstanceString(const TInterfaceBlock &interfaceBlock,
+ unsigned int arrayIndex);
- const std::map<std::string, unsigned int> &getInterfaceBlockRegisterMap() const
+ const std::map<std::string, unsigned int> &getUniformBlockRegisterMap() const
{
- return mInterfaceBlockRegisterMap;
+ return mUniformBlockRegisterMap;
}
const std::map<std::string, unsigned int> &getUniformRegisterMap() const
{
@@ -46,28 +52,59 @@ class UniformHLSL : angle::NonCopyable
}
private:
- TString interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
- TString interfaceBlockMembersString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage);
- TString interfaceBlockStructString(const TInterfaceBlock &interfaceBlock);
+ TString uniformBlockString(const TInterfaceBlock &interfaceBlock,
+ unsigned int registerIndex,
+ unsigned int arrayIndex);
+ TString uniformBlockMembersString(const TInterfaceBlock &interfaceBlock,
+ TLayoutBlockStorage blockStorage);
+ TString uniformBlockStructString(const TInterfaceBlock &interfaceBlock);
const Uniform *findUniformByName(const TString &name) const;
+ void outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
+ const TType &type,
+ const TName &name,
+ const unsigned int registerIndex);
+ void outputHLSL4_1_FL11Texture(TInfoSinkBase &out,
+ const TType &type,
+ const TName &name,
+ const unsigned int registerIndex);
+ void outputHLSL4_1_FL11RWTexture(TInfoSinkBase &out,
+ const TType &type,
+ const TName &name,
+ const unsigned int registerIndex);
+ void outputUniform(TInfoSinkBase &out,
+ const TType &type,
+ const TName &name,
+ const unsigned int registerIndex);
+
// Returns the uniform's register index
- unsigned int declareUniformAndAssignRegister(const TType &type,
- const TString &name,
- unsigned int *registerCount);
- unsigned int declareUniformAndAssignRegister(const TType &type, const TString &name);
+ unsigned int assignUniformRegister(const TType &type,
+ const TString &name,
+ unsigned int *outRegisterCount);
+ unsigned int assignSamplerInStructUniformRegister(const TType &type,
+ const TString &name,
+ unsigned int *outRegisterCount);
+
+ void outputHLSLSamplerUniformGroup(
+ TInfoSinkBase &out,
+ const HLSLTextureGroup textureGroup,
+ const TVector<const TIntermSymbol *> &group,
+ const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames,
+ unsigned int *groupTextureRegisterIndex);
unsigned int mUniformRegister;
- unsigned int mInterfaceBlockRegister;
- unsigned int mSamplerRegister;
+ unsigned int mUniformBlockRegister;
+ unsigned int mTextureRegister;
+ unsigned int mRWTextureRegister;
+ unsigned int mSamplerCount;
+ sh::GLenum mShaderType;
StructureHLSL *mStructureHLSL;
ShShaderOutput mOutputType;
const std::vector<Uniform> &mUniforms;
- std::map<std::string, unsigned int> mInterfaceBlockRegisterMap;
+ std::map<std::string, unsigned int> mUniformBlockRegisterMap;
std::map<std::string, unsigned int> mUniformRegisterMap;
};
-
}
-#endif // COMPILER_TRANSLATOR_UNIFORMHLSL_H_
+#endif // COMPILER_TRANSLATOR_UNIFORMHLSL_H_