1 #ifndef _ESEXTCGEOMETRYSHADERLAYEREDRENDERINGFBONOATTACHMENT_HPP 2 #define _ESEXTCGEOMETRYSHADERLAYEREDRENDERINGFBONOATTACHMENT_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 #include "glwEnums.hpp" 28 #include "glwFunctions.hpp" 29 30 namespace glcts 31 { 32 /** Implementation of "Group 14" from CTS_EXT_geometry_shader. Description follows: 33 * 34 * 1. Make sure that layered rendering works correctly when using a framebuffer 35 * with no attachments, but for which default height & width & non - zero 36 * number of layers have been defined. 37 * 38 * Category: API; 39 * Functional Test. 40 * 41 * Create a program object, as well as a fragment, geometry and vertex 42 * shader objects. 43 * 44 * Vertex shader can be boilerplate. 45 * 46 * Geometry shader should : 47 * 48 * - accept points on input; 49 * - output triangle strips (a maximum of(4 vertices * 4 layers) vertices 50 * will be stored); 51 * - generate "full-screen" quads (as per definition in test case 7.1) for 52 * layers 0, 1, 2, and 3. 53 * - define output uv variable and set it to valid UV coordinates for each 54 * of quad's vertices. 55 * - define output layer_id variable and set it to gl_Layer for each 56 * of quad's vertices. 57 * 58 * Fragment shader should : 59 * 60 * - declare an image2DArray called array_image. 61 * - using array_image store color (0, 255, 0, 0) at texel coordinates 62 * ivec3( int(128.0 * uv.x), int(128.0 * uv.y), layer_id ) 63 * 64 * Shader objects should be compiled and attached to the program object. 65 * The program object should then be linked. 66 * 67 * 2d array texture object having GL_RGBA32I internal format and 68 * resolution 128x128x4 should be created and initialized. All texels of base 69 * mip - maps of the texture should be filled with (255, 0, 0, 0). 70 * 71 * The texture object should be bound to image unit 0 and array_image uniform 72 * should have binding set to 0 as well. 73 * 74 * Generate a framebuffer object. Bind the FBO to GL_FRAMEBUFFER target and 75 * set its : 76 * 77 * - default width & height to 128x128; 78 * - default number of layers to 4; 79 * 80 * Generate and bind a vertex array object. Test should now draw 81 * a single point. 82 * 83 * After rendering finishes, the test should check if all texels of base 84 * mip - maps of all layers of 2d array texture object have been set to 85 * (0, 255, 0, 0). If so, the test has passed. 86 * 87 * 88 * 2. Make sure that, for a newly generated framebuffer object, default layer 89 * count of a framebuffer object without attachments should be equal to 0. 90 * Once modified, an updated value should be reported for the property by 91 * GLES implementation. 92 * 93 * Category: API; 94 * Coverage; 95 * 96 * Test should generate a FBO, bind it to GL_DRAW_FRAMEBUFFER target, and do 97 * a glGetFramebufferParameteriv() call to determine value of 98 * GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT property. No error should be generated, 99 * the value reported should be equal to 0. 100 * 101 * Test should now modify the property's value by doing 102 * a glFramebufferParameteri() call. It should then use the 103 * glGetFramebufferParameteriv() call again to make sure the value has been 104 * updated. 105 **/ 106 class GeometryShaderLayeredRenderingFBONoAttachment : public TestCaseBase 107 { 108 public: 109 /* Public methods */ 110 GeometryShaderLayeredRenderingFBONoAttachment(Context& context, const ExtParameters& extParams, const char* name, 111 const char* description); 112 ~GeometryShaderLayeredRenderingFBONoAttachment(void)113 virtual ~GeometryShaderLayeredRenderingFBONoAttachment(void) 114 { 115 } 116 117 virtual void deinit(void); 118 virtual IterateResult iterate(void); 119 120 private: 121 /* Private variables */ 122 static const char* m_fs_code; 123 static const char* m_vs_code; 124 static const char* m_gs_code; 125 126 static const glw::GLint m_height; 127 static const glw::GLint m_width; 128 static const int m_n_layers; 129 static const glw::GLint m_n_texture_components; 130 131 glw::GLuint m_fbo_id; 132 glw::GLuint m_fs_id; 133 glw::GLuint m_gs_id; 134 glw::GLuint m_po_id; 135 glw::GLuint m_to_id; 136 glw::GLuint m_vao_id; 137 glw::GLuint m_vs_id; 138 139 glw::GLint* m_all_layers_data; 140 glw::GLint* m_layer_data; 141 }; 142 143 } // namespace glcts 144 145 #endif // _ESEXTCGEOMETRYSHADERLAYEREDRENDERINGFBONOATTACHMENT_HPP 146