blob: dc5eac674dbf4cdac6741b0e2a4809c102d83568 [file] [log] [blame]
Olli Etuaho72fc5542016-12-19 19:53:29 +00001//
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// ShaderCompileTreeTest.h:
7// Test that shader validation results in the correct compile status.
8//
9
10#ifndef TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_
11#define TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_
12
13#include "angle_gl.h"
14#include "compiler/translator/PoolAlloc.h"
15#include "gtest/gtest.h"
16#include "GLSLANG/ShaderLang.h"
17
18namespace sh
19{
20
21class TIntermBlock;
22class TranslatorESSL;
23
24class ShaderCompileTreeTest : public testing::Test
25{
26 public:
27 ShaderCompileTreeTest() : mExtraCompileOptions(0) {}
28
29 protected:
30 void SetUp() override;
31
32 void TearDown() override;
33
34 // Return true when compilation succeeds
35 bool compile(const std::string &shaderString);
36 void compileAssumeSuccess(const std::string &shaderString);
37
38 bool hasWarning() const;
39
40 const std::vector<sh::Uniform> getUniforms();
41
42 virtual void initResources(ShBuiltInResources *resources) {}
43 virtual ::GLenum getShaderType() const = 0;
44 virtual ShShaderSpec getShaderSpec() const = 0;
45
46 std::string mInfoLog;
47 ShCompileOptions mExtraCompileOptions;
48
49 TIntermBlock *mASTRoot;
50
51 private:
52 TranslatorESSL *mTranslator;
53
54 TPoolAllocator mAllocator;
55};
56
57} // namespace sh
58
59#endif // TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_