1 #ifndef _ESEXTCTEXTURECUBEMAPARRAYIMAGETEXTURESIZE_HPP 2 #define _ESEXTCTEXTURECUBEMAPARRAYIMAGETEXTURESIZE_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 esextcTextureCubeMapArrayImageTextureSize.hpp 28 * \brief texture_cube_map_array extension - Texture Size Test (Test 10) 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "../esextcTestCaseBase.hpp" 32 #include <vector> 33 34 namespace glcts 35 { 36 /** Implementation of (Test 10) for texture_cube_map_array extension. Test description follows: 37 * 38 * Make sure shaders can correctly query the size of cube-map array textures 39 * bound to active texture or image samplers. 40 * 41 * Category: Coverage, 42 * Optional dependency on EXT_geometry_shader; 43 * Optional dependency on EXT_tessellation_shader; 44 * Priority: Must-have. 45 * 46 * Make sure textureSize() (both shadow and normal cases) GLSL functions 47 * return correct values for cube-map array textures. 48 * Make sure imageSize() returns correct values for image units, to which 49 * cube-map array textures have been bound. 50 * 51 * All supported shader types should be considered for the purpose of the 52 * test. 53 * 54 * The results should be XFBed back to test implementation for verification 55 * in case of geometry & tessellation shaders & vertex shaders. 56 * For compute shaders, the size should be stored to an image of 57 * 1x1 resolution and of GL_RGBA32UI internalformat. 58 * Fragment shaders should store the texture size by writing it to 59 * an output variable defined in the fragment shader. A GL_RGBA32UI 60 * texture of 1x1 resolution should be used as a draw buffer. 61 * 62 * Test the following cube-map array texture resolutions: 63 * 64 * { 64, 64, 6}, 65 * {128, 128, 12}, 66 * {256, 256, 12}, 67 * { 32, 32, 18} 68 * 69 * Both immutable and mutable textures should be checked. 70 * 71 */ 72 73 /* Base class for tests */ 74 class TextureCubeMapArrayTextureSizeBase : public TestCaseBase 75 { 76 public: 77 /* Public methods */ 78 TextureCubeMapArrayTextureSizeBase(Context &context, const ExtParameters &extParams, const char *name, 79 const char *description); 80 ~TextureCubeMapArrayTextureSizeBase(void)81 virtual ~TextureCubeMapArrayTextureSizeBase(void) 82 { 83 } 84 85 virtual void deinit(void); 86 virtual IterateResult iterate(void); 87 88 /* Public static constants */ 89 static const glw::GLuint m_n_dimensions; 90 static const glw::GLuint m_n_resolutions; 91 92 protected: 93 /* Protected methods */ 94 void initTest(void); 95 void createCubeMapArrayTexture(glw::GLuint &texId, glw::GLuint width, glw::GLuint height, glw::GLuint depth, 96 STORAGE_TYPE storType, glw::GLboolean shadow); 97 98 virtual void configureProgram(void) = 0; 99 virtual void deleteProgram(void) = 0; 100 virtual void configureUniforms(void); 101 virtual void configureTestSpecificObjects(void) = 0; 102 virtual void deleteTestSpecificObjects(void) = 0; 103 virtual void configureTextures(glw::GLuint width, glw::GLuint height, glw::GLuint depth, STORAGE_TYPE storType); 104 virtual void deleteTextures(void); 105 virtual void runShaders(void) = 0; 106 virtual glw::GLboolean checkResults(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 107 STORAGE_TYPE storType) = 0; 108 virtual glw::GLboolean isMutableTextureTestable(void); 109 110 /* Protected variables */ 111 glw::GLuint m_po_id; 112 glw::GLuint m_to_std_id; 113 glw::GLuint m_to_shw_id; 114 glw::GLuint m_vao_id; 115 116 /* Protected static constants */ 117 static const glw::GLuint m_n_layers_per_cube; 118 static const glw::GLuint m_n_storage_types; 119 static const glw::GLuint m_n_texture_components; 120 }; 121 122 /* Base class for tests using transform feedback to fetch result */ 123 class TextureCubeMapArrayTextureSizeTFBase : public TextureCubeMapArrayTextureSizeBase 124 { 125 public: 126 /* Public methods */ 127 TextureCubeMapArrayTextureSizeTFBase(Context &context, const ExtParameters &extParams, const char *name, 128 const char *description); 129 ~TextureCubeMapArrayTextureSizeTFBase(void)130 virtual ~TextureCubeMapArrayTextureSizeTFBase(void) 131 { 132 } 133 134 protected: 135 /* Protected methods */ 136 virtual void configureProgram(void) = 0; 137 virtual void deleteProgram(void) = 0; 138 virtual void configureTestSpecificObjects(void); 139 virtual void deleteTestSpecificObjects(void); 140 virtual void configureTextures(glw::GLuint width, glw::GLuint height, glw::GLuint depth, STORAGE_TYPE storType); 141 virtual void runShaders(void) = 0; 142 virtual glw::GLboolean checkResults(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 143 STORAGE_TYPE storType); 144 145 /* Protected variables */ 146 glw::GLuint m_tf_bo_id; 147 148 /* Protected static constants */ 149 static const glw::GLsizei m_n_varyings; 150 static const glw::GLuint m_n_tf_components; 151 }; 152 153 class TextureCubeMapArrayTextureSizeTFVertexShader : public TextureCubeMapArrayTextureSizeTFBase 154 { 155 public: 156 /* Public methods */ 157 TextureCubeMapArrayTextureSizeTFVertexShader(Context &context, const ExtParameters &extParams, const char *name, 158 const char *description); 159 ~TextureCubeMapArrayTextureSizeTFVertexShader(void)160 virtual ~TextureCubeMapArrayTextureSizeTFVertexShader(void) 161 { 162 } 163 164 protected: 165 /* Protected methods */ 166 virtual void configureProgram(void); 167 virtual void deleteProgram(void); 168 virtual void runShaders(void); 169 170 const char *getVertexShaderCode(void); 171 const char *getFragmentShaderCode(void); 172 173 /* Protected variables */ 174 glw::GLuint m_vs_id; 175 glw::GLuint m_fs_id; 176 }; 177 178 class TextureCubeMapArrayTextureSizeTFGeometryShader : public TextureCubeMapArrayTextureSizeTFBase 179 { 180 public: 181 /* Public methods */ 182 TextureCubeMapArrayTextureSizeTFGeometryShader(Context &context, const ExtParameters &extParams, const char *name, 183 const char *description); 184 ~TextureCubeMapArrayTextureSizeTFGeometryShader(void)185 virtual ~TextureCubeMapArrayTextureSizeTFGeometryShader(void) 186 { 187 } 188 189 protected: 190 /* Protected methods */ 191 virtual void configureProgram(void); 192 virtual void deleteProgram(void); 193 virtual void runShaders(void); 194 195 const char *getVertexShaderCode(void); 196 const char *getGeometryShaderCode(void); 197 const char *getFragmentShaderCode(void); 198 199 /* Protected variables */ 200 glw::GLuint m_vs_id; 201 glw::GLuint m_gs_id; 202 glw::GLuint m_fs_id; 203 }; 204 205 class TextureCubeMapArrayTextureSizeTFTessControlShader : public TextureCubeMapArrayTextureSizeTFBase 206 { 207 public: 208 /* Public methods */ 209 TextureCubeMapArrayTextureSizeTFTessControlShader(Context &context, const ExtParameters &extParams, 210 const char *name, const char *description); 211 ~TextureCubeMapArrayTextureSizeTFTessControlShader(void)212 virtual ~TextureCubeMapArrayTextureSizeTFTessControlShader(void) 213 { 214 } 215 216 protected: 217 /* Protected methods */ 218 virtual void configureProgram(void); 219 virtual void deleteProgram(void); 220 virtual void runShaders(void); 221 222 const char *getVertexShaderCode(void); 223 virtual const char *getTessellationControlShaderCode(void); 224 virtual const char *getTessellationEvaluationShaderCode(void); 225 const char *getFragmentShaderCode(void); 226 227 /* Protected variables */ 228 glw::GLuint m_vs_id; 229 glw::GLuint m_tcs_id; 230 glw::GLuint m_tes_id; 231 glw::GLuint m_fs_id; 232 }; 233 234 class TextureCubeMapArrayTextureSizeTFTessEvaluationShader : public TextureCubeMapArrayTextureSizeTFTessControlShader 235 { 236 public: 237 /* Public methods */ 238 TextureCubeMapArrayTextureSizeTFTessEvaluationShader(Context &context, const ExtParameters &extParams, 239 const char *name, const char *description); 240 ~TextureCubeMapArrayTextureSizeTFTessEvaluationShader(void)241 virtual ~TextureCubeMapArrayTextureSizeTFTessEvaluationShader(void) 242 { 243 } 244 245 protected: 246 /* Protected methods */ 247 virtual const char *getTessellationControlShaderCode(void); 248 virtual const char *getTessellationEvaluationShaderCode(void); 249 }; 250 251 /* Base class for tests using rendering to texture to fetch result */ 252 class TextureCubeMapArrayTextureSizeRTBase : public TextureCubeMapArrayTextureSizeBase 253 { 254 public: 255 /* Public methods */ 256 TextureCubeMapArrayTextureSizeRTBase(Context &context, const ExtParameters &extParams, const char *name, 257 const char *description); 258 ~TextureCubeMapArrayTextureSizeRTBase(void)259 virtual ~TextureCubeMapArrayTextureSizeRTBase(void) 260 { 261 } 262 263 protected: 264 /* Protected methods */ 265 virtual void configureProgram(void) = 0; 266 virtual void deleteProgram(void) = 0; 267 virtual void configureTestSpecificObjects(void); 268 virtual void deleteTestSpecificObjects(void); 269 virtual void runShaders(void) = 0; 270 virtual glw::GLboolean checkResults(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 271 STORAGE_TYPE storType); 272 void checkFramebufferStatus(glw::GLenum framebuffer); 273 274 /* Protected variables */ 275 glw::GLuint m_read_fbo_id; 276 glw::GLuint m_rt_std_id; 277 glw::GLuint m_rt_shw_id; 278 279 /* Protected static constants */ 280 static const glw::GLuint m_n_rt_components; 281 }; 282 283 class TextureCubeMapArrayTextureSizeRTFragmentShader : public TextureCubeMapArrayTextureSizeRTBase 284 { 285 public: 286 /* Public methods */ 287 TextureCubeMapArrayTextureSizeRTFragmentShader(Context &context, const ExtParameters &extParams, const char *name, 288 const char *description); 289 ~TextureCubeMapArrayTextureSizeRTFragmentShader(void)290 virtual ~TextureCubeMapArrayTextureSizeRTFragmentShader(void) 291 { 292 } 293 294 protected: 295 /* Protected methods */ 296 virtual void configureProgram(void); 297 virtual void deleteProgram(void); 298 virtual void configureTestSpecificObjects(void); 299 virtual void deleteTestSpecificObjects(void); 300 virtual void runShaders(void); 301 302 const char *getVertexShaderCode(void); 303 const char *getFragmentShaderCode(void); 304 305 /* Protected variables */ 306 glw::GLuint m_draw_fbo_id; 307 glw::GLuint m_vs_id; 308 glw::GLuint m_fs_id; 309 }; 310 311 class TextureCubeMapArrayTextureSizeRTComputeShader : public TextureCubeMapArrayTextureSizeRTBase 312 { 313 public: 314 /* Public methods */ 315 TextureCubeMapArrayTextureSizeRTComputeShader(Context &context, const ExtParameters &extParams, const char *name, 316 const char *description); 317 ~TextureCubeMapArrayTextureSizeRTComputeShader(void)318 virtual ~TextureCubeMapArrayTextureSizeRTComputeShader(void) 319 { 320 } 321 322 private: 323 /* Private methods */ 324 virtual void configureProgram(void); 325 virtual void deleteProgram(void); 326 virtual void configureTestSpecificObjects(void); 327 virtual void deleteTestSpecificObjects(void); 328 virtual void configureTextures(glw::GLuint width, glw::GLuint height, glw::GLuint depth, STORAGE_TYPE storType); 329 virtual void deleteTextures(void); 330 virtual void runShaders(void); 331 virtual glw::GLboolean checkResults(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 332 STORAGE_TYPE storType); 333 virtual glw::GLboolean isMutableTextureTestable(void); 334 335 const char *getComputeShaderCode(void); 336 337 /* Private variables */ 338 glw::GLuint m_cs_id; 339 glw::GLuint m_to_img_id; 340 glw::GLuint m_rt_img_id; 341 }; 342 343 } // namespace glcts 344 345 #endif // _ESEXTCTEXTURECUBEMAPARRAYIMAGETEXTURESIZE_HPP 346