xref: /aosp_15_r20/external/deqp/external/openglcts/modules/gl/gl4cSparseTextureClampTests.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _GL4CSPARSETEXTURECLAMPTESTS_HPP
2 #define _GL4CSPARSETEXTURECLAMPTESTS_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2016 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  gl4cSparseTextureClampTests.hpp
29  * \brief Conformance tests for the GL_ARB_sparse_texture_clamp functionality.
30  */ /*-------------------------------------------------------------------*/
31 #include "glcTestCase.hpp"
32 #include "glwDefs.hpp"
33 #include "tcuDefs.hpp"
34 
35 #include "gl4cSparseTexture2Tests.hpp"
36 #include "gl4cSparseTextureTests.hpp"
37 
38 using namespace glw;
39 using namespace glu;
40 
41 namespace gl4cts
42 {
43 
44 /** Test verifies if sparse texture clamp lookup functions generates access residency information
45  **/
46 class SparseTextureClampLookupResidencyTestCase : public SparseTexture2LookupTestCase
47 {
48 public:
49     /* Public methods */
50     SparseTextureClampLookupResidencyTestCase(deqp::Context &context);
51 
52     SparseTextureClampLookupResidencyTestCase(deqp::Context &context, const char *name, const char *description);
53 
54     virtual void init();
55     virtual tcu::TestNode::IterateResult iterate();
56 
57 protected:
58     /* Protected methods */
59     virtual bool funcAllowed(GLint target, GLint format, FunctionToken &funcToken);
60 
61     virtual bool verifyLookupTextureData(const Functions &gl, GLint target, GLint format, GLuint &texture, GLint level,
62                                          FunctionToken &funcToken);
63 
64     virtual void draw(GLint target, GLint layer, const ShaderProgram &program);
65 };
66 
67 /** Test verifies if sparse and non-sparse texture clamp lookup functions works as expected
68  **/
69 class SparseTextureClampLookupColorTestCase : public SparseTextureClampLookupResidencyTestCase
70 {
71 public:
72     /* Public methods */
73     SparseTextureClampLookupColorTestCase(deqp::Context &context);
74 
75     virtual void init();
76     virtual tcu::TestNode::IterateResult iterate();
77 
78 private:
79     /* Private methods */
80     virtual bool writeDataToTexture(const Functions &gl, GLint target, GLint format, GLuint &texture, GLint level);
81     virtual bool verifyLookupTextureData(const Functions &gl, GLint target, GLint format, GLuint &texture, GLint level,
82                                          FunctionToken &funcToken);
83 
84     virtual bool prepareTexture(const Functions &gl, GLint target, GLint format, GLuint &texture);
85     virtual bool commitTexturePage(const Functions &gl, GLint target, GLint format, GLuint &texture, GLint level);
86 
87     virtual bool isInPageSizesRange(GLint target, GLint level);
88     virtual bool isPageSizesMultiplication(GLint target, GLint level);
89 
90 private:
91     /* Private methods */
92     std::string generateFunctionDef(std::string funcName);
93     std::string generateExpectedResult(std::string returnType, GLint level, GLint format);
94 };
95 
96 /** Test group which encapsulates all sparse texture conformance tests */
97 class SparseTextureClampTests : public deqp::TestCaseGroup
98 {
99 public:
100     /* Public methods */
101     SparseTextureClampTests(deqp::Context &context);
102 
103     void init();
104 
105 private:
106     SparseTextureClampTests(const SparseTextureClampTests &other);
107     SparseTextureClampTests &operator=(const SparseTextureClampTests &other);
108 };
109 
110 } // namespace gl4cts
111 
112 #endif // _GL4CSPARSETEXTURECLAMPTESTS_HPP
113