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 esextcFragmentShadingRateRenderTarget.cpp
23 * \brief Base test group for fragment shading rate render target tests
24 */ /*-------------------------------------------------------------------*/
25
26 #include "esextcFragmentShadingRateRenderTarget.hpp"
27 #include "esextcFragmentShadingRateAttachmentTests.hpp"
28 #include "glw.h"
29
30 namespace glcts
31 {
32
33 /// Constructor
34 ///
35 /// @param context Test context
36 /// @param extParams extra parameters
FragmentShadingRateRenderTarget(glcts::Context & context,const ExtParameters & extParams)37 FragmentShadingRateRenderTarget::FragmentShadingRateRenderTarget(glcts::Context& context,
38 const ExtParameters& extParams)
39 : TestCaseGroupBase(context, extParams, "render_target", "Fragment Shading Rate Attachment Tests")
40 {
41 }
42
43 /// Initializes test cases for fragment shading rate tests
init(void)44 void FragmentShadingRateRenderTarget::init(void)
45 {
46 TestNode::init();
47
48 // Combination or selection list
49 // scissor
50 // multiLayer
51 // multiView
52 // attachmentShadingRate
53 // multiShadingRate
54 // framebufferSize
55
56 // Only one of following option can be enabled. scissor multiLayer, multiView.
57 // multiShadingRate can be enabled either cases multiLayer or multiView.
58 // scissor test enable only for the single layer case.
59 // layerCount is 2 for multLayer or multiView is enabled.
60
61 struct TestKindParam
62 {
63 FragmentShadingRateAttachment::TestKind state;
64 std::string name;
65 };
66
67 struct BooleanTestParam
68 {
69 bool state;
70 std::string name;
71 };
72
73 struct UintTestParam
74 {
75 deUint32 state;
76 std::string name;
77 };
78
79 const std::vector<TestKindParam> testKindParams{
80 { FragmentShadingRateAttachment::TestKind::Scissor, "scissor_" },
81 { FragmentShadingRateAttachment::TestKind::MultiView, "multiview_" },
82 };
83
84 const std::vector<BooleanTestParam> attachmentShadingRateParams{ { false, "api_" }, { true, "attachment_" } };
85
86 const std::vector<BooleanTestParam> multiShadingRateParams{ { false, "" }, { true, "multishadingratelayer_" } };
87
88 const std::vector<UintTestParam> sizes{
89 { 6, "6x6" },
90 { 37, "37x37" },
91 { 256, "256x256" },
92 };
93
94 for (const TestKindParam& testKind : testKindParams)
95 {
96 for (const BooleanTestParam& attachmentShadingRate : attachmentShadingRateParams)
97 {
98 for (const BooleanTestParam& multiShadingRate : multiShadingRateParams)
99 {
100 for (const UintTestParam& sz : sizes)
101 {
102 const deUint32 layerCount =
103 (testKind.state == FragmentShadingRateAttachment::TestKind::MultiView) ? 2 : 1;
104
105 if (multiShadingRate.state && ((layerCount <= 1) || !attachmentShadingRate.state))
106 {
107 continue;
108 }
109
110 std::string name = testKind.name + attachmentShadingRate.name + multiShadingRate.name + sz.name;
111
112 FragmentShadingRateAttachment::TestcaseParam testcaseParam = {
113 testKind.state, attachmentShadingRate.state, multiShadingRate.state, sz.state, layerCount
114 };
115
116 addChild(
117 new FragmentShadingRateAttachment(m_context, m_extParams, testcaseParam, name.c_str(), ""));
118 }
119 }
120 }
121 }
122 }
123 } // namespace glcts