Home | History | Annotate | Download | only in texture_cube_map_array
      1 #ifndef _ESEXTCTEXTURECUBEMAPARRAYCOLORDEPTHATTACHMENTS_HPP
      2 #define _ESEXTCTEXTURECUBEMAPARRAYCOLORDEPTHATTACHMENTS_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 #include "../esextcTestCaseBase.hpp"
     27 
     28 namespace glcts
     29 {
     30 /** Implementation of Test 2. Test description follows:
     31  *
     32  *  Make sure cube-map texture layers can be used as color- or depth-
     33  *  attachments.
     34  *
     35  *  Category: Functionality tests,
     36  *            Optional dependency on EXT_geometry_shader;
     37  *  Priority: Must-have.
     38  *
     39  *  Verify that cube-map array texture layers using color- and depth-
     40  *  renderable internalformats can be used as color and depth attachments
     41  *  for a framebuffer object by rendering a static (but differentiable between
     42  *  faces and layers, along the lines of how test 1 behaves) color to the
     43  *  attachment and then checking the outcome.
     44  *
     45  *  Both layered (if supported) and non-layered framebuffers should be checked.
     46  *
     47  *  Test four different cube-map array texture resolutions, as described
     48  *  in test 1. Both immutable and mutable textures should be checked.
     49  **/
     50 class TextureCubeMapArrayColorDepthAttachmentsTest : public TestCaseBase
     51 {
     52 public:
     53 	/* Public methods */
     54 	TextureCubeMapArrayColorDepthAttachmentsTest(Context& context, const ExtParameters& extParams, const char* name,
     55 												 const char* description);
     56 
     57 	virtual ~TextureCubeMapArrayColorDepthAttachmentsTest()
     58 	{
     59 	}
     60 
     61 	virtual void		  deinit(void);
     62 	virtual IterateResult iterate(void);
     63 
     64 private:
     65 	/* Private type definitions */
     66 	struct _texture_size
     67 	{
     68 		_texture_size(glw::GLuint size, glw::GLuint m_n_cubemaps);
     69 
     70 		/* Face width & height */
     71 		glw::GLuint m_size;
     72 
     73 		/* Number of cubemaps in array */
     74 		glw::GLuint m_n_cubemaps;
     75 	};
     76 
     77 	typedef std::vector<_texture_size> _texture_size_vector;
     78 
     79 	/* Private methods */
     80 	void determineSupportedDepthFormat();
     81 	void draw(const _texture_size& texture_size);
     82 	void generateAndConfigureTextureObjects(glw::GLuint texture_size, glw::GLuint n_cubemaps,
     83 											bool should_generate_mutable_textures);
     84 	void initTest();
     85 	void prepareImmutableTextureObject(glw::GLuint texture_id, glw::GLuint texture_size, glw::GLuint n_cubemaps,
     86 									   bool should_take_color_texture_properties);
     87 	void prepareMutableTextureObject(glw::GLuint texture_id, glw::GLuint texture_size, glw::GLuint n_cubemaps,
     88 									 bool should_take_color_texture_properties);
     89 	void releaseAndDetachTextureObject(glw::GLuint texture_id, bool is_color);
     90 	void configureLayeredFramebufferAttachment(glw::GLuint texture_id, bool should_use_as_color_attachment);
     91 	void configureNonLayeredFramebufferAttachment(glw::GLuint texture_id, glw::GLuint n_layer,
     92 												  bool should_use_as_color_attachment,
     93 												  bool should_update_draw_framebuffer = true);
     94 	void testLayeredRendering(const _texture_size& texture_size, bool should_use_mutable_textures);
     95 	void testNonLayeredRendering(const _texture_size& texture_size, bool should_use_mutable_texture);
     96 	bool verifyColorData(const _texture_size& texture_size, glw::GLuint n_layer);
     97 	bool verifyDepth16Data(const _texture_size& texture_size, glw::GLuint n_layer);
     98 	bool verifyDepth24Data(const _texture_size& texture_size, glw::GLuint n_layer);
     99 	bool verifyDepth32FData(const _texture_size& texture_size, glw::GLuint n_layer);
    100 
    101 	/* Private fields */
    102 	glw::GLuint m_vao_id;
    103 	glw::GLuint m_color_texture_id;
    104 	glw::GLuint m_depth_texture_id;
    105 	glw::GLuint m_fragment_shader_id;
    106 	glw::GLuint m_framebuffer_object_id;
    107 	glw::GLuint m_layered_geometry_shader_id;
    108 	glw::GLuint m_layered_program_id;
    109 	glw::GLuint m_non_layered_geometry_shader_id;
    110 	glw::GLuint m_non_layered_program_id;
    111 	glw::GLint  m_non_layered_program_id_uni_layer_uniform_location;
    112 	glw::GLuint m_vertex_shader_id;
    113 
    114 	_texture_size_vector m_resolutions;
    115 
    116 	static const glw::GLenum m_color_internal_format;
    117 	static const glw::GLenum m_color_format;
    118 	static const glw::GLenum m_color_type;
    119 	glw::GLenum				 m_depth_internal_format;
    120 	static const glw::GLenum m_depth_format;
    121 	glw::GLenum				 m_depth_type;
    122 
    123 	glw::GLuint m_n_invalid_color_checks;
    124 	glw::GLuint m_n_invalid_depth_checks;
    125 
    126 	static const glw::GLchar* const m_fragment_shader_code;
    127 	static const glw::GLchar* const m_geometry_shader_code_preamble;
    128 	static const glw::GLchar* const m_geometry_shader_code_layered;
    129 	static const glw::GLchar* const m_geometry_shader_code_non_layered;
    130 	static const glw::GLchar* const m_geometry_shader_code_body;
    131 	static const glw::GLchar* const m_vertex_shader_code;
    132 };
    133 
    134 } /* glcts */
    135 
    136 #endif // _ESEXTCTEXTURECUBEMAPARRAYCOLORDEPTHATTACHMENTS_HPP
    137