• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2022-2022 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 /*!
22  * \file  esextcFragmentShadingRateComplex.cpp
23  * \brief Base test group for fragment shading rate combination tests
24  */ /*-------------------------------------------------------------------*/
25 
26 #include "esextcFragmentShadingRateComplex.hpp"
27 #include "esextcFragmentShadingRateCombinedTests.hpp"
28 #include "glw.h"
29 
30 namespace glcts
31 {
32 
33 /// Constructor
34 ///
35 /// @param context       Test context
36 /// @param extParams   extra parameters
FragmentShadingRateComplex(glcts::Context & context,const ExtParameters & extParams)37 FragmentShadingRateComplex::FragmentShadingRateComplex(glcts::Context& context, const ExtParameters& extParams)
38 	: TestCaseGroupBase(context, extParams, "complex", "Fragment Shading Rate Complex Tests")
39 {
40 }
41 
42 /// Initializes test cases for fragment shading rate tests
init(void)43 void FragmentShadingRateComplex::init(void)
44 {
45 	TestNode::init();
46 
47 	// on/off combination list
48 	// 1. ShadingRate API
49 	// 2. Primitive Shading Rate
50 	// 3. Attachment Shading Rate
51 	// 4. op1 Enums, Keep, Replace, Min, Max, Mul
52 	// 5. op2 Enums, Keep, Replace, Min, Max, Mul
53 	// 6. MultiSample Enable
54 	// 7. Framebuffer sizes
55 
56 	struct BooleanTestParam
57 	{
58 		bool		state;
59 		std::string name;
60 	};
61 
62 	struct EnumTestParam
63 	{
64 		glw::GLenum state;
65 		std::string name;
66 	};
67 
68 	struct IntTestParam
69 	{
70 		int			state;
71 		std::string name;
72 	};
73 
74 	const std::vector<BooleanTestParam> shadingRateAPIs{ { false, "" }, { true, "api_" } };
75 
76 	const std::vector<BooleanTestParam> shadingRatePrimitives{ { false, "" }, { true, "primitive_" } };
77 
78 	const std::vector<BooleanTestParam> shadingRateAttachments{ { false, "" }, { true, "attachment_" } };
79 
80 	const std::vector<EnumTestParam> combineAttachments{ { GL_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_EXT, "keep_" },
81 														 { GL_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_EXT,
82 														   "replace_" },
83 														 { GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_EXT, "min_" },
84 														 { GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_EXT, "max_" },
85 														 { GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_EXT, "mul_" } };
86 
87 	const std::vector<BooleanTestParam> msaas{ { false, "" }, { true, "msaa_" } };
88 
89 	const std::vector<IntTestParam> sizes{
90 		{ 6, "6x6" },
91 		{ 37, "37x37" },
92 		{ 256, "256x256" },
93 	};
94 
95 	for (const BooleanTestParam& shadingRateAPI : shadingRateAPIs)
96 	{
97 		for (const BooleanTestParam& shadingRatePrimitive : shadingRatePrimitives)
98 		{
99 			for (const BooleanTestParam& shadingRateAttachment : shadingRateAttachments)
100 			{
101 				if (!shadingRateAPI.state && !shadingRatePrimitive.state && !shadingRateAttachment.state)
102 				{
103 					// fragment shading rate does not use
104 					continue;
105 				}
106 
107 				for (const EnumTestParam& op0 : combineAttachments)
108 				{
109 					for (const EnumTestParam& op1 : combineAttachments)
110 					{
111 						for (const BooleanTestParam& msaa : msaas)
112 						{
113 							for (const IntTestParam& sz : sizes)
114 							{
115 								std::string name = shadingRateAPI.name + shadingRatePrimitive.name +
116 												   shadingRateAttachment.name + op0.name + op1.name + msaa.name +
117 												   sz.name;
118 								FragmentShadingRateCombined::TestcaseParam testcaseParam = {
119 									shadingRateAPI.state,
120 									shadingRatePrimitive.state,
121 									shadingRateAttachment.state,
122 									op0.state,
123 									op1.state,
124 									msaa.state,
125 									sz.state,
126 								};
127 
128 								addChild(new FragmentShadingRateCombined(m_context, m_extParams, testcaseParam,
129 																		 name.c_str(), ""));
130 							}
131 						}
132 					}
133 				}
134 			}
135 		}
136 	}
137 }
138 } // namespace glcts