xref: /aosp_15_r20/external/deqp/modules/glshared/glsMemoryStressCase.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _GLSMEMORYSTRESSCASE_HPP
2 #define _GLSMEMORYSTRESSCASE_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL ES Module
5  * ---------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
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 Memory object stress test
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "gluRenderContext.hpp"
29 
30 #include <vector>
31 
32 namespace deqp
33 {
34 namespace gls
35 {
36 
37 enum MemObjectType
38 {
39     MEMOBJECTTYPE_TEXTURE = (1 << 0),
40     MEMOBJECTTYPE_BUFFER  = (1 << 1),
41 
42     MEMOBJECTTYPE_LAST
43 };
44 
45 struct MemObjectConfig
46 {
47     int minBufferSize;
48     int maxBufferSize;
49 
50     int minTextureSize;
51     int maxTextureSize;
52 
53     bool useUnusedData;
54     bool write;
55     bool use;
56 };
57 
58 class MemoryStressCase : public tcu::TestCase
59 {
60 public:
61     MemoryStressCase(tcu::TestContext &testCtx, glu::RenderContext &renderContext, uint32_t objectTypes,
62                      int minTextureSize, int maxTextureSize, int minBufferSize, int maxBufferSize, bool write, bool use,
63                      bool useUnusedData, bool clearAfterOOM, const char *name, const char *desc);
64     ~MemoryStressCase(void);
65 
66     void init(void);
67     void deinit(void);
68     IterateResult iterate(void);
69 
70 private:
71     int m_iteration;
72     int m_iterationCount;
73     std::vector<int> m_allocated;
74     MemObjectType m_objectTypes;
75     MemObjectConfig m_config;
76     bool m_zeroAlloc;
77     bool m_clearAfterOOM;
78     glu::RenderContext &m_renderCtx;
79 
80     MemoryStressCase(const MemoryStressCase &);
81     MemoryStressCase &operator=(const MemoryStressCase &);
82 };
83 
84 } // namespace gls
85 } // namespace deqp
86 
87 #endif // _GLSMEMORYSTRESSCASE_HPP
88