• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ESEXTCTEXTURECUBEMAPARRAYIMAGEOPERATIONS_HPP
2 #define _ESEXTCTEXTURECUBEMAPARRAYIMAGEOPERATIONS_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  esextcTextureCubeMapArrayImageOperations.hpp
28  * \brief texture_cube_map_array extension - Image Operations (Test 8)
29  */ /*-------------------------------------------------------------------*/
30 
31 #include "../esextcTestCaseBase.hpp"
32 #include <map>
33 #include <vector>
34 
35 namespace glcts
36 {
37 
38 /** Implementation of (Test 8) for CTS_EXT_texture_cube_map_array. Test description follows:
39  *
40  *   Make sure cube-map array textures work correctly when used as images.
41  *
42  *   Category: Functionality tests,
43  *             Optional dependency on EXT_geometry_shader;
44  *             Optional dependency on EXT_tessellation_shader.
45  *   Priority: Must-have.
46  *
47  *   Make sure that read and write operations performed on images bound to
48  *   image units, to which cube-map array textures have been bound, work
49  *   correctly from:
50  *
51  *   * a compute shader;                 (required)
52  *   * a fragment shader;                (if supported)
53  *   * a geometry shader;                (if supported)
54  *   * a tessellation control shader;    (if supported)
55  *   * a tessellation evaluation shader; (if supported)
56  *   * a vertex shader.                  (if supported)
57  *
58  *   Each shader stage should read data from first image and store read data to
59  *   the second image. Next test should verify if data in second image is the
60  *   same as stored in the first image.
61  *
62  *   The test should use the following image samplers (whichever applies for
63  *   image considered):
64  *
65  *   * iimageCubeArray;
66  *   * imageCubeArray;
67  *   * uimageCubeArray;
68  *
69  *   Following texture resolutions should be  used
70  *   { 32, 32, 12},
71  *   { 64, 64, 6},
72  *   { 16, 16, 18},
73  *   { 16, 16,  6}
74  *
75  *   Both immutable and mutable textures should be checked.
76  *
77  */
78 
79 /* Define allowed test variants for shaders */
80 enum SHADER_TO_CHECK
81 {
82 	STC_COMPUTE_SHADER,
83 	STC_FRAGMENT_SHADER,
84 	STC_GEOMETRY_SHADER,
85 	STC_TESSELLATION_CONTROL_SHADER,
86 	STC_TESSELLATION_EVALUATION_SHADER,
87 	STC_VERTEX_SHADER
88 };
89 
90 /* Location of dimensions in array StorageConfigIOC::m_dimensions */
91 enum DIMENSIONS_LOCATION
92 {
93 	DL_WIDTH  = 0,
94 	DL_HEIGHT = 1,
95 	DL_DEPTH  = 2
96 };
97 
98 /* Define tested images formats */
99 enum IMAGE_FORMATS
100 {
101 	IF_IMAGE  = 0,
102 	IF_IIMAGE = 1,
103 	IF_UIMAGE = 2
104 };
105 
106 class TextureCubeMapArrayImageOpCompute : public TestCaseBase
107 {
108 public:
109 	/* Public methods */
110 	TextureCubeMapArrayImageOpCompute(Context& context, const ExtParameters& extParams, const char* name,
111 									  const char* description, SHADER_TO_CHECK shaderToCheck);
112 
~TextureCubeMapArrayImageOpCompute(void)113 	virtual ~TextureCubeMapArrayImageOpCompute(void)
114 	{
115 	}
116 
117 	virtual void		  deinit(void);
118 	virtual IterateResult iterate(void);
119 
120 	/* Public static constants */
121 	static const glw::GLfloat m_f_base;
122 	static const glw::GLint   m_i_base;
123 	static const glw::GLuint  m_ui_base;
124 	static const glw::GLuint  m_n_components;
125 	static const glw::GLuint  m_n_dimensions;
126 	static const glw::GLuint  m_n_image_formats;
127 	static const glw::GLuint  m_n_resolutions;
128 	static const glw::GLuint  m_n_storage_type;
129 	static const char*		  m_mutable_storage;
130 	static const char*		  m_immutable_storage;
131 
132 private:
133 	/* Private methods */
134 	void initTest(void);
135 	void removeTextures(void);
136 	void configureProgram(void);
137 	void runShaders(glw::GLuint width, glw::GLuint height, glw::GLuint depth);
138 
139 	const char* getComputeShaderCode(void);
140 	const char* getFragmentShaderCode(void);
141 	const char* getFragmentShaderCodeBoilerPlate(void);
142 	const char* getGeometryShaderCode(void);
143 	const char* getTessControlShaderCode(void);
144 	const char* getTessControlShaderCodeBoilerPlate(void);
145 	const char* getTessEvaluationShaderCode(void);
146 	const char* getTessEvaluationShaderCodeBoilerPlate(void);
147 	const char* getVertexShaderCode(void);
148 	const char* getVertexShaderCodeBoilerPlate(void);
149 	const char* getFloatingPointCopyShaderSource(void);
150 
151 	/* Variables for general usage */
152 	SHADER_TO_CHECK m_shader_to_check;
153 
154 	glw::GLuint m_cs_id;
155 	glw::GLuint m_fbo_id;
156 	glw::GLuint m_fs_id;
157 	glw::GLuint m_gs_id;
158 	glw::GLuint m_po_id;
159 	glw::GLuint m_tc_id;
160 	glw::GLuint m_te_id;
161 	glw::GLuint m_vao_id;
162 	glw::GLuint m_vs_id;
163 	glw::GLuint m_copy_po_id;
164 	glw::GLuint m_copy_cs_id;
165 
166 	glw::GLuint m_iimage_read_to_id;
167 	glw::GLuint m_iimage_write_to_id;
168 	glw::GLuint m_image_read_to_id;
169 	glw::GLuint m_image_write_to_id;
170 	glw::GLuint m_uimage_read_to_id;
171 	glw::GLuint m_uimage_write_to_id;
172 };
173 
174 } /* glcts */
175 
176 #endif // _ESEXTCTEXTURECUBEMAPARRAYIMAGEOPERATIONS_HPP
177