• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GLCUNIFORMBLOCKNEGATIVETESTS_HPP
2 #define _GLCUNIFORMBLOCKNEGATIVETESTS_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2024 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
23  * \brief
24  */ /*-------------------------------------------------------------------*/
25 
26 /**
27  */ /*!
28  * \file  glcUniformBlockNegativeTests.hpp
29  * \brief Conformance tests uniform block negative functionality.
30  */ /*-------------------------------------------------------------------*/
31 
32 #include "glcTestCase.hpp"
33 #include "gluShaderUtil.hpp"
34 #include "glwDefs.hpp"
35 #include "tcuDefs.hpp"
36 
37 #include <map>
38 #include <memory>
39 
40 namespace glu
41 {
42 class ShaderProgram;
43 }
44 
45 namespace deqp
46 {
47 
48 /** base class to handle negative uniform block tests functionality */
49 class UniformBlockNegativeTestBase : public deqp::TestCase
50 {
51 public:
52     /* Public methods */
53     UniformBlockNegativeTestBase(deqp::Context &context, glu::GLSLVersion glslVersion, const char *name,
54                                  const char *desc);
55 
56     void deinit() override;
57     void init() override;
58 
59     virtual tcu::TestNode::IterateResult iterate() override;
60 
61     virtual tcu::TestNode::IterateResult run_test() = 0;
62 
63 protected:
64     /* Private members */
65     static const glw::GLchar *m_shader_vert;
66     static const glw::GLchar *m_shader_frag;
67 
68     std::map<std::string, std::string> specializationMap;
69 
70     bool m_isContextES;
71     bool m_isTestSupported;
72 
73     glu::GLSLVersion m_glslVersion;
74 };
75 
76 /*
77  * 4.2      Structure declaration
78  * Purpose: Verify that structure can't be declared inside an uniform block.
79  * Method:  Modify default negative test method replacing UB0 declaration with:
80  *              uniform UB0 { struct S { vec4 elem0 }; S ub_elem0; };
81  * NOTE: fixed as:
82  *              uniform UB0 { struct S { vec4 elem0; }; S ub_elem0; };
83  */
84 class UniformBlockStructDeclarationNegativeTestBase : public UniformBlockNegativeTestBase
85 {
86 public:
87     UniformBlockStructDeclarationNegativeTestBase(deqp::Context &context, glu::GLSLVersion glslVersion);
88 
89     virtual void deinit() override;
90     virtual void init() override;
91 
92     tcu::TestNode::IterateResult run_test() override;
93 };
94 
95 /** Test group which encapsulates all conformance tests */
96 class UniformBlockNegativeTests : public deqp::TestCaseGroup
97 {
98 public:
99     /* Public methods */
100     UniformBlockNegativeTests(deqp::Context &context, glu::GLSLVersion glslVersion);
101 
102     void init();
103 
104 private:
105     UniformBlockNegativeTests(const UniformBlockNegativeTests &other);
106     UniformBlockNegativeTests &operator=(const UniformBlockNegativeTests &other);
107 
108     glu::GLSLVersion m_glslVersion;
109 };
110 
111 } // namespace deqp
112 
113 #endif // _GLCUNIFORMBLOCKNEGATIVETESTS_HPP
114