1 #ifndef _ESEXTCTEXTURECUBEMAPARRAYSUBIMAGE3D_HPP 2 #define _ESEXTCTEXTURECUBEMAPARRAYSUBIMAGE3D_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 esextcTextureCubeMapArraySubImage3D.hpp 28 * \brief Texture Cube Map Array SubImage3D (Test 5) 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "../esextcTestCaseBase.hpp" 32 33 namespace glcts 34 { 35 /** Implementation of Test 5 from CTS_EXT_texture_cube_map_array. Test description follows: 36 * 37 * Make sure glTexSubImage3D() and glCopyTexSubImage3D() calls work correctly 38 * for cube-map array textures. 39 * 40 * Category: Functionality tests. 41 * Priority: Must-have. 42 * 43 * Make sure glTexSubImage3D() and glCopyTexSubImage3D() correctly replace 44 * a region of a cube-map array texture defined with GL_RGBA32UI internalformat. 45 * Source data should be defined with the same GL_RGBA32UI internalformat. 46 * 47 * Original cube-map array texture data should be defined as in test case 1. 48 * The data to be written over layer-face(s) should be distinctively different 49 * (for instance: the same values could be used with a different component 50 * ordering). 51 * 52 * The test should use both client-side pointers and data defined in a BO 53 * bound to GL_PIXEL_UNPACK_BUFFER target. 54 * 55 * Iterate through texture resolutions as described in test 1. 56 * 57 * The following scenarios should be tested: 58 * 59 * a) A single whole layer-face at index 0 should be replaced 60 * (both functions); 61 * b) A region of a layer-face at index 0 should be replaced 62 * (both functions); 63 * c) 6 layer-faces, making up a single layer, should be replaced 64 * (glTexSubImage3D() only). 65 * d) 6 layer-faces, making up two different layers (for instance: three 66 * last layer-faces of layer 1 and three first layer-faces of layer 2) 67 * should be replaced (glTexSubImage3D() only). 68 * e) c) and d), but limited to a quad defined by the following points: 69 * 70 * (width/2, height/2) x (width, height) 71 * 72 * (glTexSubImage3D() only) 73 * 74 * Test four different cube-map array texture resolutions, as described 75 * in test 1. Both immutable and mutable textures should be checked. 76 */ 77 78 /* Structure holding information which region of the cube map to replace */ 79 struct SubImage3DCopyParams 80 { SubImage3DCopyParamsglcts::SubImage3DCopyParams81 SubImage3DCopyParams(void) : m_xoffset(0), m_yoffset(0), m_zoffset(0), m_width(0), m_height(0), m_depth(0) 82 { 83 /* Nothing to be done here */ 84 } 85 initglcts::SubImage3DCopyParams86 void init(const glw::GLuint xoffset, const glw::GLuint yoffset, const glw::GLuint zoffset, const glw::GLuint width, 87 const glw::GLuint height, const glw::GLuint depth) 88 { 89 m_xoffset = xoffset; 90 m_yoffset = yoffset; 91 m_zoffset = zoffset; 92 m_width = width; 93 m_height = height; 94 m_depth = depth; 95 } 96 97 glw::GLuint m_xoffset; 98 glw::GLuint m_yoffset; 99 glw::GLuint m_zoffset; 100 glw::GLuint m_width; 101 glw::GLuint m_height; 102 glw::GLuint m_depth; 103 }; 104 105 class TextureCubeMapArraySubImage3D : public TestCaseBase 106 { 107 public: 108 /* Public methods */ 109 TextureCubeMapArraySubImage3D(Context& context, const ExtParameters& extParams, const char* name, 110 const char* description); 111 ~TextureCubeMapArraySubImage3D()112 virtual ~TextureCubeMapArraySubImage3D() 113 { 114 } 115 116 virtual IterateResult iterate(void); 117 virtual void deinit(void); 118 119 /* Public static constants */ 120 static const glw::GLuint m_n_components; 121 static const glw::GLuint m_n_dimensions; 122 static const glw::GLuint m_n_resolutions; 123 static const glw::GLuint m_n_storage_type; 124 125 protected: 126 /* Protected methods */ 127 void initTest(void); 128 129 void configureDataBuffer(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 130 const SubImage3DCopyParams& copy_params, glw::GLuint clear_value); 131 void configurePixelUnpackBuffer(const SubImage3DCopyParams& copy_params); 132 void configureCubeMapArrayTexture(glw::GLuint width, glw::GLuint height, glw::GLuint depth, STORAGE_TYPE storType, 133 glw::GLuint clear_value); 134 void clearCubeMapArrayTexture(glw::GLuint width, glw::GLuint height, glw::GLuint depth, glw::GLuint clear_value); 135 void configure2DTexture(const SubImage3DCopyParams& copy_params); 136 137 void testTexSubImage3D(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 138 const SubImage3DCopyParams& copy_params, glw::GLboolean& test_passed); 139 void testCopyTexSubImage3D(glw::GLuint width, glw::GLuint height, glw::GLuint depth, 140 const SubImage3DCopyParams& copy_params, glw::GLboolean& test_passed); 141 142 void texSubImage3D(const SubImage3DCopyParams& copy_params, const glw::GLuint* data_pointer); 143 void copyTexSubImage3D(const SubImage3DCopyParams& copy_params); 144 bool checkResults(glw::GLuint width, glw::GLuint height, glw::GLuint depth); 145 146 void deletePixelUnpackBuffer(); 147 void deleteCubeMapArrayTexture(); 148 void delete2DTexture(); 149 150 typedef std::vector<glw::GLuint> DataBufferVec; 151 152 /* Protected variables */ 153 DataBufferVec m_copy_data_buffer; 154 DataBufferVec m_expected_data_buffer; 155 glw::GLuint m_read_fbo_id; 156 glw::GLuint m_pixel_buffer_id; 157 glw::GLuint m_tex_cube_map_array_id; 158 glw::GLuint m_tex_2d_id; 159 }; 160 161 } // namespace glcts 162 163 #endif // _ESEXTCTEXTURECUBEMAPARRAYSUBIMAGE3D_HPP 164