blob: 7c73390a6431bb5fe5c139746910357bf565d2d0 [file] [log] [blame]
Olli Etuaho19d1dc92016-03-08 17:18:46 +02001//
2// Copyright (c) 2016 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// ValidateMaxParameters checks if function definitions have more than a set number of parameters.
7
8#ifndef COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_
9#define COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_
10
11#include "compiler/translator/IntermNode.h"
12
Jamie Madill45bcc782016-11-07 13:58:48 -050013namespace sh
14{
15
Olli Etuaho19d1dc92016-03-08 17:18:46 +020016class ValidateMaxParameters : public TIntermTraverser
17{
18 public:
19 // Returns false if maxParameters is exceeded.
20 static bool validate(TIntermNode *root, unsigned int maxParameters);
21
22 protected:
Olli Etuaho8ad9e752017-01-16 19:55:20 +000023 bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
Olli Etuaho19d1dc92016-03-08 17:18:46 +020024
25 private:
26 ValidateMaxParameters(unsigned int maxParameters);
27
28 unsigned int mMaxParameters;
29 bool mValid;
30};
31
Jamie Madill45bcc782016-11-07 13:58:48 -050032} // namespace sh
33
Olli Etuaho19d1dc92016-03-08 17:18:46 +020034#endif // COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_