1 #ifndef _ESEXTCTEXTURECUBEMAPARRAYGENERATEMIPMAP_HPP
2 #define _ESEXTCTEXTURECUBEMAPARRAYGENERATEMIPMAP_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2014-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  * \file  esextcTextureCubeMapArrayGenerateMipMap.hpp
28  * \brief texture_cube_map_array extenstion - glGenerateMipmap() (Test 7)
29  */ /*-------------------------------------------------------------------*/
30 
31 #include "../esextcTestCaseBase.hpp"
32 #include "gluStrUtil.hpp"
33 #include <vector>
34 
35 namespace glcts
36 {
37 /* Represents a specific texture storage configuration */
38 struct StorageConfig
39 {
40     glw::GLuint m_depth;
41     glw::GLuint m_height;
42     glw::GLuint m_levels;
43     glw::GLuint m_to_id;
44     glw::GLuint m_width;
45 };
46 
47 /**  Implementation of the first four paragraphs of Texture Cube Map Array Test 7.
48  *   Description follows:
49  *
50  *   Make sure glGenerateMipmap() works as specified for cube-map array
51  *   textures.
52  *
53  *   Category: Functionality tests, Coverage.
54  *   Priority: Must-have.
55  *
56  *   Make sure that mip-map generation works correctly for cube-map array
57  *   textures. Use texture resolutions:
58  *
59  *         [width x height x depth]
60  *      1)   64   x   64   x  18;
61  *      2)  117   x  117   x   6;
62  *      3)  256   x  256   x   6;
63  *      4)  173   x  173   x  12;
64  *
65  *   Both mutable and immutable textures should be checked (except as noted below).
66  *
67  *   1. For each layer-face, the test should initialize a base mip-map of iteration-
68  *      -specific resolution with a checkerboard pattern filled with two colors.
69  *
70  *      The color pair used for the pattern should be different for each
71  *      layer-face considered. The test should then call glGenerateMipmap().
72  *      This part of the test passes if base mip-map was left unchanged and the
73  *      lowest level mip-map is not set to either of the colors used.
74  **/
75 
76 class TextureCubeMapArrayGenerateMipMapFilterable : public TestCaseBase
77 {
78 public:
79     /* Public methods */
80     TextureCubeMapArrayGenerateMipMapFilterable(Context &context, const ExtParameters &extParams, const char *name,
81                                                 const char *description, STORAGE_TYPE storageType);
82 
~TextureCubeMapArrayGenerateMipMapFilterable(void)83     virtual ~TextureCubeMapArrayGenerateMipMapFilterable(void)
84     {
85     }
86 
87     void deinit(void);
88     void init(void);
89     IterateResult iterate(void);
90 
91 private:
92     /* Private method */
93     void generateTestData(int face, unsigned char *data, int width, int height);
94     void initTest();
95 
96     /* Private constants */
97     static const int m_n_colors_per_layer_face = 2;
98     static const int m_n_components            = 4;
99     static const int m_n_max_faces             = 18;
100     static const unsigned char m_layer_face_data[m_n_max_faces][m_n_colors_per_layer_face][m_n_components];
101 
102     /* Variables for general usage */
103     glw::GLuint m_fbo_id;
104     std::vector<StorageConfig> m_storage_configs;
105     STORAGE_TYPE m_storage_type;
106 
107     unsigned char *m_reference_data_ptr;
108     unsigned char *m_rendered_data_ptr;
109 };
110 
111 /** Implementats the last paragraph of Texture Cube Map Array Test 7.
112  *  Description follows:
113  *
114  *  3. Make sure that GL_INVALID_OPERATION error is generated if the texture
115  *     bound to target is not cube array complete. To check this, configure
116  *     a cube-map array texture object so that its faces use a non-filterable
117  *     internalformat, and the magnification filter parameter for the object
118  *     is set to LINEAR. This test should be executed for both mutable and
119  *     immutable textures.
120  */
121 class TextureCubeMapArrayGenerateMipMapNonFilterable : public TestCaseBase
122 {
123 public:
124     /* Public methods */
125     TextureCubeMapArrayGenerateMipMapNonFilterable(Context &context, const ExtParameters &extParams, const char *name,
126                                                    const char *description, STORAGE_TYPE storageType);
127 
~TextureCubeMapArrayGenerateMipMapNonFilterable(void)128     virtual ~TextureCubeMapArrayGenerateMipMapNonFilterable(void)
129     {
130     }
131 
132     void deinit(void);
133     void init(void);
134     void initTest(void);
135     IterateResult iterate(void);
136 
137 private:
138     /* Private methods */
139     void generateTestData(int face, unsigned char *data, int size);
140 
141     /* Variables for general usage */
142     std::vector<StorageConfig> m_non_filterable_texture_configs;
143     STORAGE_TYPE m_storage_type;
144 };
145 
146 } // namespace glcts
147 
148 #endif // _ESEXTCTEXTURECUBEMAPARRAYGENERATEMIPMAP_HPP
149