• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GLCSHADERGROUPVOTETESTS_HPP
2 #define _GLCSHADERGROUPVOTETESTS_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  glcShaderGroupVoteTests.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 
32 namespace glcts
33 {
34 class ShaderGroupVoteTestCaseBase : public glcts::TestCaseBase
35 {
36 public:
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::IVec4			m_desiredColor;
45 		bool				m_compileOnly;
46 
47 		/* Private methods */
48 		bool validateScreenPixels(deqp::Context& context, tcu::IVec4 desiredColor);
49 
50 	public:
51 		/* Public methods */
52 		ComputeShader(const std::string& name, const std::string& shader);
53 		ComputeShader(const std::string& name, const std::string& shader, const tcu::IVec4& desiredColor);
54 		~ComputeShader();
55 
56 		void create(deqp::Context& context);
57 		void execute(deqp::Context& context);
58 		void validate(deqp::Context& context);
59 	};
60 
61 	/* Public methods */
62 	ShaderGroupVoteTestCaseBase(deqp::Context& context, ExtParameters& extParam, const char* name,
63 								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 
72 protected:
73 	/* Protected members */
74 	bool						m_extensionSupported;
75 	std::vector<ComputeShader*> m_shaders;
76 };
77 
78 /** Test verifies availability of new built-in functions and constants
79 **/
80 class ShaderGroupVoteAvailabilityTestCase : public ShaderGroupVoteTestCaseBase
81 {
82 public:
83 	/* Public methods */
84 	ShaderGroupVoteAvailabilityTestCase(deqp::Context& context, ExtParameters& extParam);
85 };
86 
87 class ShaderGroupVoteFunctionTestCaseBase : public ShaderGroupVoteTestCaseBase
88 {
89 protected:
90 	/* Protected members*/
91 	std::string m_shaderBase;
92 
93 public:
94 	/* Public methods */
95 	ShaderGroupVoteFunctionTestCaseBase(deqp::Context& context, ExtParameters& extParam, const char* name,
96 										const char* description);
97 };
98 
99 /** Test verifies allInvocationsARB function calls
100 **/
101 class ShaderGroupVoteAllInvocationsTestCase : public ShaderGroupVoteFunctionTestCaseBase
102 {
103 public:
104 	/* Public methods */
105 	ShaderGroupVoteAllInvocationsTestCase(deqp::Context& context, ExtParameters& extParam);
106 };
107 
108 /** Test verifies anyInvocationARB function calls
109 **/
110 class ShaderGroupVoteAnyInvocationTestCase : public ShaderGroupVoteFunctionTestCaseBase
111 {
112 public:
113 	/* Public methods */
114 	ShaderGroupVoteAnyInvocationTestCase(deqp::Context& context, ExtParameters& extParam);
115 };
116 
117 /** Test verifies allInvocationsEqualARB function calls
118 **/
119 class ShaderGroupVoteAllInvocationsEqualTestCase : public ShaderGroupVoteFunctionTestCaseBase
120 {
121 public:
122 	/* Public methods */
123 	ShaderGroupVoteAllInvocationsEqualTestCase(deqp::Context& context, ExtParameters& extParam);
124 };
125 
126 /** Test verifies allInvocationsARB function calls
127 **/
128 class ShaderGroupVoteWithVariablesTestCase : public ShaderGroupVoteTestCaseBase
129 {
130 public:
131 	/* Public methods */
132 	ShaderGroupVoteWithVariablesTestCase(deqp::Context& context, ExtParameters& extParam);
133 };
134 
135 /** Test group which encapsulates all ARB_shader_group_vote conformance tests */
136 class ShaderGroupVote : public deqp::TestCaseGroup
137 {
138 public:
139 	/* Public methods */
140 	ShaderGroupVote(deqp::Context& context);
141 
142 	void init();
143 
144 private:
145 	ShaderGroupVote(const ShaderGroupVote& other);
146 };
147 
148 } /* glcts namespace */
149 
150 #endif // _GLCSHADERGROUPVOTETESTS_HPP
151