michael@0: // michael@0: // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #ifndef _VARIABLEPACKER_INCLUDED_ michael@0: #define _VARIABLEPACKER_INCLUDED_ michael@0: michael@0: #include michael@0: #include "compiler/ShHandle.h" michael@0: michael@0: class VariablePacker { michael@0: public: michael@0: // Returns true if the passed in variables pack in maxVectors following michael@0: // the packing rules from the GLSL 1.017 spec, Appendix A, section 7. michael@0: bool CheckVariablesWithinPackingLimits( michael@0: int maxVectors, michael@0: const TVariableInfoList& in_variables); michael@0: michael@0: // Gets how many components in a row a data type takes. michael@0: static int GetNumComponentsPerRow(ShDataType type); michael@0: michael@0: // Gets how many rows a data type takes. michael@0: static int GetNumRows(ShDataType type); michael@0: michael@0: private: michael@0: static const int kNumColumns = 4; michael@0: static const unsigned kColumnMask = (1 << kNumColumns) - 1; michael@0: michael@0: unsigned makeColumnFlags(int column, int numComponentsPerRow); michael@0: void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow); michael@0: bool searchColumn(int column, int numRows, int* destRow, int* destSize); michael@0: michael@0: int topNonFullRow_; michael@0: int bottomNonFullRow_; michael@0: int maxRows_; michael@0: std::vector rows_; michael@0: }; michael@0: michael@0: #endif // _VARIABLEPACKER_INCLUDED_