Line data Source code
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 :
7 : #ifndef COMPILER_TRANSLATOR_VARIABLEPACKER_H_
8 : #define COMPILER_TRANSLATOR_VARIABLEPACKER_H_
9 :
10 : #include <vector>
11 : #include "compiler/translator/VariableInfo.h"
12 :
13 0 : class VariablePacker {
14 : public:
15 : // Returns true if the passed in variables pack in maxVectors following
16 : // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
17 : bool CheckVariablesWithinPackingLimits(unsigned int maxVectors,
18 : const std::vector<sh::ShaderVariable> &in_variables);
19 :
20 : // Gets how many components in a row a data type takes.
21 : static int GetNumComponentsPerRow(sh::GLenum type);
22 :
23 : // Gets how many rows a data type takes.
24 : static int GetNumRows(sh::GLenum type);
25 :
26 : private:
27 : static const int kNumColumns = 4;
28 : static const unsigned kColumnMask = (1 << kNumColumns) - 1;
29 :
30 : unsigned makeColumnFlags(int column, int numComponentsPerRow);
31 : void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow);
32 : bool searchColumn(int column, int numRows, int *destRow, int *destSize);
33 :
34 : int topNonFullRow_;
35 : int bottomNonFullRow_;
36 : int maxRows_;
37 : std::vector<unsigned> rows_;
38 : };
39 :
40 : #endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_
|