xref: /aosp_15_r20/external/deqp/modules/gles3/functional/es3fFboTestCase.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _ES3FFBOTESTCASE_HPP
2 #define _ES3FFBOTESTCASE_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL ES 3.0 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 Base class for FBO tests.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tes3TestCase.hpp"
28 #include "sglrContextWrapper.hpp"
29 
30 namespace tcu
31 {
32 class Surface;
33 class TextureFormat;
34 } // namespace tcu
35 
36 namespace deqp
37 {
38 namespace gles3
39 {
40 namespace Functional
41 {
42 
43 class FboTestCase : public TestCase, public sglr::ContextWrapper
44 {
45 public:
46     FboTestCase(Context &context, const char *name, const char *description, bool useScreenSizedViewport = false);
47     ~FboTestCase(void);
48 
49     IterateResult iterate(void);
50 
51 protected:
preCheck(void)52     virtual void preCheck(void)
53     {
54     }
55     virtual void render(tcu::Surface &dst) = DE_NULL;
56     virtual bool compare(const tcu::Surface &reference, const tcu::Surface &result);
57 
58     // Utilities.
59     void checkFormatSupport(uint32_t sizedFormat);
60     void checkSampleCount(uint32_t sizedFormat, int numSamples);
61     void readPixels(tcu::Surface &dst, int x, int y, int width, int height, const tcu::TextureFormat &format,
62                     const tcu::Vec4 &scale, const tcu::Vec4 &bias);
63     void readPixels(tcu::Surface &dst, int x, int y, int width, int height);
64     void checkFramebufferStatus(uint32_t target);
65     void checkError(void);
66     void clearColorBuffer(const tcu::TextureFormat &format, const tcu::Vec4 &value = tcu::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
67 
68     int m_viewportWidth;
69     int m_viewportHeight;
70 
71 private:
72     FboTestCase(const FboTestCase &other);
73     FboTestCase &operator=(const FboTestCase &other);
74 };
75 
76 } // namespace Functional
77 } // namespace gles3
78 } // namespace deqp
79 
80 #endif // _ES3FFBOTESTCASE_HPP
81