| 1 | // |
| 2 | // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | // Check whether variables fit within packing limits according to the packing rules from the GLSL ES |
| 7 | // 1.00.17 spec, Appendix A, section 7. |
| 8 | |
| 9 | #ifndef COMPILER_TRANSLATOR_VARIABLEPACKER_H_ |
| 10 | #define COMPILER_TRANSLATOR_VARIABLEPACKER_H_ |
| 11 | |
| 12 | #include <vector> |
| 13 | |
| 14 | #include <GLSLANG/ShaderLang.h> |
| 15 | |
| 16 | namespace sh |
| 17 | { |
| 18 | |
| 19 | // Gets how many components in a row a data type takes. |
| 20 | int GetTypePackingComponentsPerRow(sh::GLenum type); |
| 21 | |
| 22 | // Gets how many rows a data type takes. |
| 23 | int GetTypePackingRows(sh::GLenum type); |
| 24 | |
| 25 | // Returns true if the passed in variables pack in maxVectors. |
| 26 | // T should be ShaderVariable or one of the subclasses of ShaderVariable. |
| 27 | template <typename T> |
| 28 | bool CheckVariablesInPackingLimits(unsigned int maxVectors, const std::vector<T> &variables); |
| 29 | |
| 30 | } // namespace sh |
| 31 | |
| 32 | #endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_ |
| 33 | |