daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Nicolas Capens | b1f45b7 | 2013-12-19 17:37:19 -0500 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_TRANSLATOR_OUTPUTHLSL_H_ |
| 8 | #define COMPILER_TRANSLATOR_OUTPUTHLSL_H_ |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 9 | |
alokp@chromium.org | 4e89d23 | 2010-05-14 19:37:21 +0000 | [diff] [blame] | 10 | #include <list> |
| 11 | #include <set> |
daniel@transgaming.com | 652468c | 2012-12-20 21:11:57 +0000 | [diff] [blame] | 12 | #include <map> |
Jamie Madill | 32aab01 | 2015-01-27 14:12:26 -0500 | [diff] [blame] | 13 | #include <stack> |
daniel@transgaming.com | 652468c | 2012-12-20 21:11:57 +0000 | [diff] [blame] | 14 | |
Jamie Madill | f51639a | 2014-06-25 16:04:57 -0400 | [diff] [blame] | 15 | #include "angle_gl.h" |
Corentin Wallez | f4eab3b | 2015-03-18 12:55:45 -0700 | [diff] [blame] | 16 | #include "compiler/translator/ASTMetadataHLSL.h" |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 17 | #include "compiler/translator/IntermNode.h" |
Jamie Madill | 6b9cb25 | 2013-10-17 10:45:47 -0400 | [diff] [blame] | 18 | #include "compiler/translator/ParseContext.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 19 | |
Olli Etuaho | 8efc5ad | 2015-03-03 17:21:10 +0200 | [diff] [blame] | 20 | class BuiltInFunctionEmulator; |
Olli Etuaho | e17e319 | 2015-01-02 12:47:59 +0200 | [diff] [blame] | 21 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 22 | namespace sh |
| 23 | { |
daniel@transgaming.com | f8f8f36 | 2012-04-28 00:35:00 +0000 | [diff] [blame] | 24 | class UnfoldShortCircuit; |
Jamie Madill | 8daaba1 | 2014-06-13 10:04:33 -0400 | [diff] [blame] | 25 | class StructureHLSL; |
Jamie Madill | f91ce81 | 2014-06-13 10:04:34 -0400 | [diff] [blame] | 26 | class UniformHLSL; |
| 27 | |
| 28 | typedef std::map<TString, TIntermSymbol*> ReferencedSymbols; |
daniel@transgaming.com | b587598 | 2010-04-15 20:44:53 +0000 | [diff] [blame] | 29 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 30 | class OutputHLSL : public TIntermTraverser |
| 31 | { |
| 32 | public: |
Olli Etuaho | a3a5cc6 | 2015-02-13 13:12:22 +0200 | [diff] [blame] | 33 | OutputHLSL(sh::GLenum shaderType, int shaderVersion, |
| 34 | const TExtensionBehavior &extensionBehavior, |
| 35 | const char *sourcePath, ShShaderOutput outputType, |
| 36 | int numRenderTargets, const std::vector<Uniform> &uniforms, |
| 37 | int compileOptions); |
| 38 | |
daniel@transgaming.com | b587598 | 2010-04-15 20:44:53 +0000 | [diff] [blame] | 39 | ~OutputHLSL(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 40 | |
Olli Etuaho | a3a5cc6 | 2015-02-13 13:12:22 +0200 | [diff] [blame] | 41 | void output(TIntermNode *treeRoot, TInfoSinkBase &objSink); |
daniel@transgaming.com | 950f993 | 2010-04-13 03:26:14 +0000 | [diff] [blame] | 42 | |
Jamie Madill | 4e1fd41 | 2014-07-10 17:50:10 -0400 | [diff] [blame] | 43 | const std::map<std::string, unsigned int> &getInterfaceBlockRegisterMap() const; |
Jamie Madill | 9fe25e9 | 2014-07-18 10:33:08 -0400 | [diff] [blame] | 44 | const std::map<std::string, unsigned int> &getUniformRegisterMap() const; |
Jamie Madill | 4e1fd41 | 2014-07-10 17:50:10 -0400 | [diff] [blame] | 45 | |
daniel@transgaming.com | b587598 | 2010-04-15 20:44:53 +0000 | [diff] [blame] | 46 | static TString initializer(const TType &type); |
daniel@transgaming.com | b587598 | 2010-04-15 20:44:53 +0000 | [diff] [blame] | 47 | |
Jamie Madill | 32aab01 | 2015-01-27 14:12:26 -0500 | [diff] [blame] | 48 | TInfoSinkBase &getInfoSink() { ASSERT(!mInfoSinkStack.empty()); return *mInfoSinkStack.top(); } |
| 49 | |
Olli Etuaho | 18b9deb | 2015-11-05 12:14:50 +0200 | [diff] [blame] | 50 | static bool canWriteAsHLSLLiteral(TIntermTyped *expression); |
| 51 | |
daniel@transgaming.com | 950f993 | 2010-04-13 03:26:14 +0000 | [diff] [blame] | 52 | protected: |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 53 | void header(TInfoSinkBase &out, const BuiltInFunctionEmulator *builtInFunctionEmulator); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 54 | |
daniel@transgaming.com | 950f993 | 2010-04-13 03:26:14 +0000 | [diff] [blame] | 55 | // Visit AST nodes and output their code to the body stream |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 56 | void visitSymbol(TIntermSymbol*); |
Jamie Madill | 4cfb1e8 | 2014-07-07 12:49:23 -0400 | [diff] [blame] | 57 | void visitRaw(TIntermRaw*); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 58 | void visitConstantUnion(TIntermConstantUnion*); |
| 59 | bool visitBinary(Visit visit, TIntermBinary*); |
| 60 | bool visitUnary(Visit visit, TIntermUnary*); |
| 61 | bool visitSelection(Visit visit, TIntermSelection*); |
Olli Etuaho | 3c1dfb5 | 2015-02-20 11:34:03 +0200 | [diff] [blame] | 62 | bool visitSwitch(Visit visit, TIntermSwitch *); |
| 63 | bool visitCase(Visit visit, TIntermCase *); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 64 | bool visitAggregate(Visit visit, TIntermAggregate*); |
| 65 | bool visitLoop(Visit visit, TIntermLoop*); |
| 66 | bool visitBranch(Visit visit, TIntermBranch*); |
| 67 | |
daniel@transgaming.com | b587598 | 2010-04-15 20:44:53 +0000 | [diff] [blame] | 68 | bool isSingleStatement(TIntermNode *node); |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 69 | bool handleExcessiveLoop(TInfoSinkBase &out, TIntermLoop *node); |
Daniel Bratell | 2919008 | 2015-02-20 16:42:54 +0100 | [diff] [blame] | 70 | |
| 71 | // Emit one of three strings depending on traverse phase. Called with literal strings so using const char* instead of TString. |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 72 | void outputTriplet(TInfoSinkBase &out, |
| 73 | Visit visit, |
| 74 | const char *preString, |
| 75 | const char *inString, |
| 76 | const char *postString); |
| 77 | void outputLineDirective(TInfoSinkBase &out, int line); |
daniel@transgaming.com | 005c739 | 2010-04-15 20:45:27 +0000 | [diff] [blame] | 78 | TString argumentString(const TIntermSymbol *symbol); |
daniel@transgaming.com | 0b6b834 | 2010-04-26 15:33:45 +0000 | [diff] [blame] | 79 | int vectorSize(const TType &type) const; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 80 | |
Daniel Bratell | 2919008 | 2015-02-20 16:42:54 +0100 | [diff] [blame] | 81 | // Emit constructor. Called with literal names so using const char* instead of TString. |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 82 | void outputConstructor(TInfoSinkBase &out, |
| 83 | Visit visit, |
| 84 | const TType &type, |
| 85 | const char *name, |
| 86 | const TIntermSequence *parameters); |
| 87 | const TConstantUnion *writeConstantUnion(TInfoSinkBase &out, |
| 88 | const TType &type, |
| 89 | const TConstantUnion *constUnion); |
daniel@transgaming.com | 6369186 | 2010-04-29 03:32:42 +0000 | [diff] [blame] | 90 | |
Olli Etuaho | 7fb4955 | 2015-03-18 17:27:44 +0200 | [diff] [blame] | 91 | void outputEqual(Visit visit, const TType &type, TOperator op, TInfoSinkBase &out); |
| 92 | |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 93 | void writeEmulatedFunctionTriplet(TInfoSinkBase &out, Visit visit, const char *preStr); |
Jamie Madill | 3799714 | 2015-01-28 10:06:34 -0500 | [diff] [blame] | 94 | void makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs); |
| 95 | |
| 96 | // Returns true if it found a 'same symbol' initializer (initializer that references the variable it's initting) |
| 97 | bool writeSameSymbolInitializer(TInfoSinkBase &out, TIntermSymbol *symbolNode, TIntermTyped *expression); |
Olli Etuaho | 18b9deb | 2015-11-05 12:14:50 +0200 | [diff] [blame] | 98 | // Returns true if variable initializer could be written using literal {} notation. |
| 99 | bool writeConstantInitialization(TInfoSinkBase &out, |
| 100 | TIntermSymbol *symbolNode, |
| 101 | TIntermTyped *expression); |
| 102 | |
Jamie Madill | 3799714 | 2015-01-28 10:06:34 -0500 | [diff] [blame] | 103 | void writeDeferredGlobalInitializers(TInfoSinkBase &out); |
Jamie Madill | 8c46ab1 | 2015-12-07 16:39:19 -0500 | [diff] [blame^] | 104 | void writeSelection(TInfoSinkBase &out, TIntermSelection *node); |
Olli Etuaho | 5c9cd3d | 2014-12-18 13:04:25 +0200 | [diff] [blame] | 105 | |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 106 | // Returns the function name |
| 107 | TString addStructEqualityFunction(const TStructure &structure); |
Olli Etuaho | 7fb4955 | 2015-03-18 17:27:44 +0200 | [diff] [blame] | 108 | TString addArrayEqualityFunction(const TType &type); |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 109 | TString addArrayAssignmentFunction(const TType &type); |
Olli Etuaho | 9638c35 | 2015-04-01 14:34:52 +0300 | [diff] [blame] | 110 | TString addArrayConstructIntoFunction(const TType &type); |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 111 | |
Jamie Madill | 2e295e2 | 2015-04-29 10:41:33 -0400 | [diff] [blame] | 112 | // Ensures if the type is a struct, the struct is defined |
| 113 | void ensureStructDefined(const TType &type); |
| 114 | |
Olli Etuaho | a3a5cc6 | 2015-02-13 13:12:22 +0200 | [diff] [blame] | 115 | sh::GLenum mShaderType; |
| 116 | int mShaderVersion; |
| 117 | const TExtensionBehavior &mExtensionBehavior; |
| 118 | const char *mSourcePath; |
shannon.woods@transgaming.com | b73964e | 2013-01-25 21:49:14 +0000 | [diff] [blame] | 119 | const ShShaderOutput mOutputType; |
Olli Etuaho | a3a5cc6 | 2015-02-13 13:12:22 +0200 | [diff] [blame] | 120 | int mCompileOptions; |
| 121 | |
daniel@transgaming.com | f9ef107 | 2010-04-22 13:35:16 +0000 | [diff] [blame] | 122 | bool mInsideFunction; |
daniel@transgaming.com | 950f993 | 2010-04-13 03:26:14 +0000 | [diff] [blame] | 123 | |
| 124 | // Output streams |
| 125 | TInfoSinkBase mHeader; |
| 126 | TInfoSinkBase mBody; |
| 127 | TInfoSinkBase mFooter; |
daniel@transgaming.com | d91cfe7 | 2010-04-13 03:26:17 +0000 | [diff] [blame] | 128 | |
Jamie Madill | 32aab01 | 2015-01-27 14:12:26 -0500 | [diff] [blame] | 129 | // A stack is useful when we want to traverse in the header, or in helper functions, but not always |
| 130 | // write to the body. Instead use an InfoSink stack to keep our current state intact. |
Olli Etuaho | 7fb4955 | 2015-03-18 17:27:44 +0200 | [diff] [blame] | 131 | // TODO (jmadill): Just passing an InfoSink in function parameters would be simpler. |
Jamie Madill | 32aab01 | 2015-01-27 14:12:26 -0500 | [diff] [blame] | 132 | std::stack<TInfoSinkBase *> mInfoSinkStack; |
| 133 | |
daniel@transgaming.com | 8803b85 | 2012-12-20 21:11:47 +0000 | [diff] [blame] | 134 | ReferencedSymbols mReferencedUniforms; |
shannonwoods@chromium.org | 4a643ae | 2013-05-30 00:12:27 +0000 | [diff] [blame] | 135 | ReferencedSymbols mReferencedInterfaceBlocks; |
daniel@transgaming.com | 8803b85 | 2012-12-20 21:11:47 +0000 | [diff] [blame] | 136 | ReferencedSymbols mReferencedAttributes; |
| 137 | ReferencedSymbols mReferencedVaryings; |
Jamie Madill | 46131a3 | 2013-06-20 11:55:50 -0400 | [diff] [blame] | 138 | ReferencedSymbols mReferencedOutputVariables; |
daniel@transgaming.com | 86f7c9d | 2010-04-20 18:52:06 +0000 | [diff] [blame] | 139 | |
Jamie Madill | 8daaba1 | 2014-06-13 10:04:33 -0400 | [diff] [blame] | 140 | StructureHLSL *mStructureHLSL; |
Jamie Madill | f91ce81 | 2014-06-13 10:04:34 -0400 | [diff] [blame] | 141 | UniformHLSL *mUniformHLSL; |
Jamie Madill | 8daaba1 | 2014-06-13 10:04:33 -0400 | [diff] [blame] | 142 | |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 143 | struct TextureFunction |
| 144 | { |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 145 | enum Method |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 146 | { |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 147 | IMPLICIT, // Mipmap LOD determined implicitly (standard lookup) |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 148 | BIAS, |
| 149 | LOD, |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 150 | LOD0, |
Nicolas Capens | 84cfa12 | 2014-04-14 13:48:45 -0400 | [diff] [blame] | 151 | LOD0BIAS, |
Nicolas Capens | fc01454 | 2014-02-18 14:47:13 -0500 | [diff] [blame] | 152 | SIZE, // textureSize() |
Nicolas Capens | d11d549 | 2014-02-19 17:06:10 -0500 | [diff] [blame] | 153 | FETCH, |
| 154 | GRAD |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | TBasicType sampler; |
| 158 | int coords; |
| 159 | bool proj; |
Nicolas Capens | b1f45b7 | 2013-12-19 17:37:19 -0500 | [diff] [blame] | 160 | bool offset; |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 161 | Method method; |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 162 | |
| 163 | TString name() const; |
| 164 | |
| 165 | bool operator<(const TextureFunction &rhs) const; |
| 166 | }; |
| 167 | |
| 168 | typedef std::set<TextureFunction> TextureFunctionSet; |
| 169 | |
daniel@transgaming.com | d91cfe7 | 2010-04-13 03:26:17 +0000 | [diff] [blame] | 170 | // Parameters determining what goes in the header output |
Nicolas Capens | e0ba27a | 2013-06-24 16:10:52 -0400 | [diff] [blame] | 171 | TextureFunctionSet mUsesTexture; |
shannon.woods%transgaming.com@gtempaccount.com | aa8b5cf | 2013-04-13 03:31:55 +0000 | [diff] [blame] | 172 | bool mUsesFragColor; |
| 173 | bool mUsesFragData; |
daniel@transgaming.com | d7c9810 | 2010-05-14 17:30:48 +0000 | [diff] [blame] | 174 | bool mUsesDepthRange; |
daniel@transgaming.com | 4af7acc | 2010-05-14 17:30:53 +0000 | [diff] [blame] | 175 | bool mUsesFragCoord; |
| 176 | bool mUsesPointCoord; |
| 177 | bool mUsesFrontFacing; |
| 178 | bool mUsesPointSize; |
Gregoire Payen de La Garanderie | b3dced2 | 2015-01-12 14:54:55 +0000 | [diff] [blame] | 179 | bool mUsesInstanceID; |
Jamie Madill | 2aeb26a | 2013-07-08 14:02:55 -0400 | [diff] [blame] | 180 | bool mUsesFragDepth; |
daniel@transgaming.com | d7c9810 | 2010-05-14 17:30:48 +0000 | [diff] [blame] | 181 | bool mUsesXor; |
Jamie Madill | 3c9eeb9 | 2013-11-04 11:09:26 -0500 | [diff] [blame] | 182 | bool mUsesDiscardRewriting; |
Nicolas Capens | 655fe36 | 2014-04-11 13:12:34 -0400 | [diff] [blame] | 183 | bool mUsesNestedBreak; |
Arun Patole | 44efa0b | 2015-03-04 17:11:05 +0530 | [diff] [blame] | 184 | bool mRequiresIEEEStrictCompiling; |
| 185 | |
daniel@transgaming.com | 005c739 | 2010-04-15 20:45:27 +0000 | [diff] [blame] | 186 | |
shannon.woods%transgaming.com@gtempaccount.com | aa8b5cf | 2013-04-13 03:31:55 +0000 | [diff] [blame] | 187 | int mNumRenderTargets; |
| 188 | |
daniel@transgaming.com | b6ef8f1 | 2010-11-15 16:41:14 +0000 | [diff] [blame] | 189 | int mUniqueIndex; // For creating unique names |
daniel@transgaming.com | 89431aa | 2012-05-31 01:20:29 +0000 | [diff] [blame] | 190 | |
Corentin Wallez | 1239ee9 | 2015-03-19 14:38:02 -0700 | [diff] [blame] | 191 | CallDAG mCallDag; |
| 192 | MetadataList mASTMetadataList; |
| 193 | ASTMetadataHLSL *mCurrentFunctionMetadata; |
daniel@transgaming.com | 89431aa | 2012-05-31 01:20:29 +0000 | [diff] [blame] | 194 | bool mOutputLod0Function; |
daniel@transgaming.com | e11100c | 2012-05-31 01:20:32 +0000 | [diff] [blame] | 195 | bool mInsideDiscontinuousLoop; |
Nicolas Capens | 655fe36 | 2014-04-11 13:12:34 -0400 | [diff] [blame] | 196 | int mNestedLoopDepth; |
daniel@transgaming.com | e9b3f60 | 2012-07-11 20:37:31 +0000 | [diff] [blame] | 197 | |
| 198 | TIntermSymbol *mExcessiveLoopIndex; |
daniel@transgaming.com | 652468c | 2012-12-20 21:11:57 +0000 | [diff] [blame] | 199 | |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 200 | TString structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName); |
daniel@transgaming.com | f4d9fef | 2012-12-20 21:12:13 +0000 | [diff] [blame] | 201 | |
Jamie Madill | 570e04d | 2013-06-21 09:15:33 -0400 | [diff] [blame] | 202 | std::map<TIntermTyped*, TString> mFlaggedStructMappedNames; |
| 203 | std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames; |
| 204 | |
Olli Etuaho | d81ed84 | 2015-05-12 12:46:35 +0300 | [diff] [blame] | 205 | // Some initializers may have been unfolded into if statements, thus we can't evaluate all initializers |
| 206 | // at global static scope in HLSL. Instead, we can initialize these static globals inside a helper function. |
| 207 | // This also enables initialization of globals with uniforms. |
| 208 | TIntermSequence mDeferredGlobalInitializers; |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 209 | |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 210 | struct HelperFunction |
Olli Etuaho | ae37a5c | 2015-03-20 16:50:15 +0200 | [diff] [blame] | 211 | { |
| 212 | TString functionName; |
| 213 | TString functionDefinition; |
| 214 | |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 215 | virtual ~HelperFunction() {} |
Olli Etuaho | ae37a5c | 2015-03-20 16:50:15 +0200 | [diff] [blame] | 216 | }; |
| 217 | |
| 218 | // A list of all equality comparison functions. It's important to preserve the order at |
| 219 | // which we add the functions, since nested structures call each other recursively, and |
| 220 | // structure equality functions may need to call array equality functions and vice versa. |
| 221 | // The ownership of the pointers is maintained by the type-specific arrays. |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 222 | std::vector<HelperFunction*> mEqualityFunctions; |
Olli Etuaho | ae37a5c | 2015-03-20 16:50:15 +0200 | [diff] [blame] | 223 | |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 224 | struct StructEqualityFunction : public HelperFunction |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 225 | { |
| 226 | const TStructure *structure; |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 227 | }; |
Olli Etuaho | ae37a5c | 2015-03-20 16:50:15 +0200 | [diff] [blame] | 228 | std::vector<StructEqualityFunction*> mStructEqualityFunctions; |
Jamie Madill | 55e79e0 | 2015-02-09 15:35:00 -0500 | [diff] [blame] | 229 | |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 230 | struct ArrayHelperFunction : public HelperFunction |
Olli Etuaho | 7fb4955 | 2015-03-18 17:27:44 +0200 | [diff] [blame] | 231 | { |
| 232 | TType type; |
Olli Etuaho | 7fb4955 | 2015-03-18 17:27:44 +0200 | [diff] [blame] | 233 | }; |
Olli Etuaho | 1269076 | 2015-03-31 12:55:28 +0300 | [diff] [blame] | 234 | std::vector<ArrayHelperFunction*> mArrayEqualityFunctions; |
| 235 | |
| 236 | std::vector<ArrayHelperFunction> mArrayAssignmentFunctions; |
Olli Etuaho | 9638c35 | 2015-04-01 14:34:52 +0300 | [diff] [blame] | 237 | |
| 238 | // The construct-into functions are functions that fill an N-element array passed as an out parameter |
| 239 | // with the other N parameters of the function. This is used to work around that arrays can't be |
| 240 | // return values in HLSL. |
| 241 | std::vector<ArrayHelperFunction> mArrayConstructIntoFunctions; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 242 | }; |
Jamie Madill | 8daaba1 | 2014-06-13 10:04:33 -0400 | [diff] [blame] | 243 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 244 | } |
| 245 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 246 | #endif // COMPILER_TRANSLATOR_OUTPUTHLSL_H_ |