diff options
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/VariablePacker.h')
-rw-r--r-- | src/3rdparty/angle/src/compiler/translator/VariablePacker.h | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/VariablePacker.h b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h index 9c80eea618..36b2104cd0 100644 --- a/src/3rdparty/angle/src/compiler/translator/VariablePacker.h +++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h @@ -3,39 +3,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // +// Check whether variables fit within packing limits according to the packing rules from the GLSL ES +// 1.00.17 spec, Appendix A, section 7. #ifndef COMPILER_TRANSLATOR_VARIABLEPACKER_H_ #define COMPILER_TRANSLATOR_VARIABLEPACKER_H_ #include <vector> -#include "compiler/translator/VariableInfo.h" -class VariablePacker { - public: - // Returns true if the passed in variables pack in maxVectors following - // the packing rules from the GLSL 1.017 spec, Appendix A, section 7. - template <typename VarT> - bool CheckVariablesWithinPackingLimits(unsigned int maxVectors, - const std::vector<VarT> &in_variables); +#include <GLSLANG/ShaderLang.h> - // Gets how many components in a row a data type takes. - static int GetNumComponentsPerRow(sh::GLenum type); +namespace sh +{ - // Gets how many rows a data type takes. - static int GetNumRows(sh::GLenum type); +// Gets how many components in a row a data type takes. +int GetTypePackingComponentsPerRow(sh::GLenum type); - private: - static const int kNumColumns = 4; - static const unsigned kColumnMask = (1 << kNumColumns) - 1; +// Gets how many rows a data type takes. +int GetTypePackingRows(sh::GLenum type); - unsigned makeColumnFlags(int column, int numComponentsPerRow); - void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow); - bool searchColumn(int column, int numRows, int* destRow, int* destSize); +// Returns true if the passed in variables pack in maxVectors. +// T should be ShaderVariable or one of the subclasses of ShaderVariable. +template <typename T> +bool CheckVariablesInPackingLimits(unsigned int maxVectors, const std::vector<T> &variables); - int topNonFullRow_; - int bottomNonFullRow_; - int maxRows_; - std::vector<unsigned> rows_; -}; +} // namespace sh -#endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_ +#endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_ |