Hash :
d7487b13
Author :
Date :
2017-08-09T15:45:13
Clean up checking variable packing limits This encapsulates expanding struct variables inside the VariablePacker class that packs variables according to the GLSL ES spec. The variable expansion step is no longer run twice when checking uniforms against the max uniforms limit. BUG=angleproject:2068 TEST=angle_unittests Change-Id: I012ddaa249f71c0a78d937c98007c61352e64888 Reviewed-on: https://chromium-review.googlesource.com/608367 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// 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 <GLSLANG/ShaderLang.h>
namespace sh
{
// Gets how many components in a row a data type takes.
int GetVariablePackingComponentsPerRow(sh::GLenum type);
// Gets how many rows a data type takes.
int GetVariablePackingRows(sh::GLenum type);
// 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);
} // namespace sh
#endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_