1#ifndef _GL4CSHADERGROUPVOTETESTS_HPP
2#define _GL4CSHADERGROUPVOTETESTS_HPP
3/*-------------------------------------------------------------------------
4* OpenGL Conformance Test Suite
5* -----------------------------
6*
7* Copyright (c) 2017 The Khronos Group Inc.
8*
9* Licensed under the Apache License, Version 2.0 (the "License");
10* you may not use this file except in compliance with the License.
11* You may obtain a copy of the License at
12*
13*      http://www.apache.org/licenses/LICENSE-2.0
14*
15* Unless required by applicable law or agreed to in writing, software
16* distributed under the License is distributed on an "AS IS" BASIS,
17* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18* See the License for the specific language governing permissions and
19* limitations under the License.
20*
21*/ /*!
22* \file  gl4cShaderGroupVoteTests.hpp
23* \brief Conformance tests for the ARB_shader_group_vote functionality.
24*/ /*-------------------------------------------------------------------*/
25
26#include "esextcTestCaseBase.hpp"
27#include "glcTestCase.hpp"
28#include "gluShaderProgram.hpp"
29
30#include <string>
31
32namespace gl4cts
33{
34class ShaderGroupVoteTestCaseBase : public glcts::TestCaseBase
35{
36public:
37	class ComputeShader
38	{
39	private:
40		/* Private members */
41		std::string			m_name;
42		std::string			m_shader;
43		glu::ShaderProgram* m_program;
44		tcu::Vec4			m_desiredColor;
45		bool				m_compileOnly;
46
47		/* Private methods */
48		bool validateColor(tcu::Vec4 testedColor, tcu::Vec4 desiredColor);
49		bool validateScreenPixels(deqp::Context& context, tcu::Vec4 desiredColor);
50
51	public:
52		/* Public methods */
53		ComputeShader(const std::string& name, const std::string& shader);
54		ComputeShader(const std::string& name, const std::string& shader, const tcu::Vec4& desiredColor);
55		~ComputeShader();
56
57		void create(deqp::Context& context);
58		void execute(deqp::Context& context);
59		void validate(deqp::Context& context);
60	};
61
62	/* Public methods */
63	ShaderGroupVoteTestCaseBase(deqp::Context& context, const char* name, const char* description);
64
65	void init();
66	void deinit();
67
68	tcu::TestNode::IterateResult iterate();
69
70	typedef std::vector<ComputeShader*>::iterator ComputeShaderIter;
71
72protected:
73	/* Protected members */
74	bool						m_extensionSupported;
75	std::string					m_glslFunctionPostfix;
76	std::vector<ComputeShader*> m_shaders;
77};
78
79/** Test verifies availability of new built-in functions and constants
80**/
81class ShaderGroupVoteAvailabilityTestCase : public ShaderGroupVoteTestCaseBase
82{
83public:
84	/* Public methods */
85	ShaderGroupVoteAvailabilityTestCase(deqp::Context& context);
86};
87
88class ShaderGroupVoteFunctionTestCaseBase : public ShaderGroupVoteTestCaseBase
89{
90protected:
91	/* Protected members*/
92	const char* m_shaderBase;
93
94public:
95	/* Public methods */
96	ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context, const char* name, const char* description);
97};
98
99/** Test verifies allInvocationsARB function calls
100**/
101class ShaderGroupVoteAllInvocationsTestCase : public ShaderGroupVoteFunctionTestCaseBase
102{
103public:
104	/* Public methods */
105	ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context);
106};
107
108/** Test verifies anyInvocationARB function calls
109**/
110class ShaderGroupVoteAnyInvocationTestCase : public ShaderGroupVoteFunctionTestCaseBase
111{
112public:
113	/* Public methods */
114	ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context);
115};
116
117/** Test verifies allInvocationsEqualARB function calls
118**/
119class ShaderGroupVoteAllInvocationsEqualTestCase : public ShaderGroupVoteFunctionTestCaseBase
120{
121public:
122	/* Public methods */
123	ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context);
124};
125
126/** Test group which encapsulates all ARB_shader_group_vote conformance tests */
127class ShaderGroupVote : public deqp::TestCaseGroup
128{
129public:
130	/* Public methods */
131	ShaderGroupVote(deqp::Context& context);
132
133	void init();
134
135private:
136	ShaderGroupVote(const ShaderGroupVote& other);
137};
138
139} /* glcts namespace */
140
141#endif // _GL4CSHADERGROUPVOTETESTS_HPP
142