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
32namespace deqp
33{
34namespace gls
35{
36
37enum MemObjectType
38{
39	MEMOBJECTTYPE_TEXTURE = (1 << 0),
40	MEMOBJECTTYPE_BUFFER = (1 << 1),
41
42	MEMOBJECTTYPE_LAST
43};
44
45struct MemObjectConfig
46{
47	int minBufferSize;
48	int maxBufferSize;
49
50	int minTextureSize;
51	int maxTextureSize;
52
53	bool useDummyData;
54	bool write;
55	bool use;
56};
57
58class MemoryStressCase : public tcu::TestCase
59{
60public:
61							MemoryStressCase		(tcu::TestContext& testCtx, glu::RenderContext& renderContext, deUint32 objectTypes, int minTextureSize, int maxTextureSize, int minBufferSize, int maxBufferSize, bool write, bool use, bool useDummyData, bool clearAfterOOM, const char* name, const char* desc);
62							~MemoryStressCase		(void);
63
64	void					init					(void);
65	void					deinit					(void);
66	IterateResult			iterate					(void);
67
68private:
69	int						m_iteration;
70	int						m_iterationCount;
71	std::vector<int>		m_allocated;
72	MemObjectType			m_objectTypes;
73	MemObjectConfig			m_config;
74	bool					m_zeroAlloc;
75	bool					m_clearAfterOOM;
76	glu::RenderContext&		m_renderCtx;
77
78							MemoryStressCase	(const MemoryStressCase&);
79	MemoryStressCase&		operator=			(const MemoryStressCase&);
80};
81
82
83} // gls
84} // deqp
85
86#endif // _GLSMEMORYSTRESSCASE_HPP
87