1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/VariablePacker.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +#ifndef _VARIABLEPACKER_INCLUDED_ 1.11 +#define _VARIABLEPACKER_INCLUDED_ 1.12 + 1.13 +#include <vector> 1.14 +#include "compiler/ShHandle.h" 1.15 + 1.16 +class VariablePacker { 1.17 + public: 1.18 + // Returns true if the passed in variables pack in maxVectors following 1.19 + // the packing rules from the GLSL 1.017 spec, Appendix A, section 7. 1.20 + bool CheckVariablesWithinPackingLimits( 1.21 + int maxVectors, 1.22 + const TVariableInfoList& in_variables); 1.23 + 1.24 + // Gets how many components in a row a data type takes. 1.25 + static int GetNumComponentsPerRow(ShDataType type); 1.26 + 1.27 + // Gets how many rows a data type takes. 1.28 + static int GetNumRows(ShDataType type); 1.29 + 1.30 + private: 1.31 + static const int kNumColumns = 4; 1.32 + static const unsigned kColumnMask = (1 << kNumColumns) - 1; 1.33 + 1.34 + unsigned makeColumnFlags(int column, int numComponentsPerRow); 1.35 + void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow); 1.36 + bool searchColumn(int column, int numRows, int* destRow, int* destSize); 1.37 + 1.38 + int topNonFullRow_; 1.39 + int bottomNonFullRow_; 1.40 + int maxRows_; 1.41 + std::vector<unsigned> rows_; 1.42 +}; 1.43 + 1.44 +#endif // _VARIABLEPACKER_INCLUDED_