1#ifndef _ESEXTCGEOMETRYSHADERBLITTING_HPP
2#define _ESEXTCGEOMETRYSHADERBLITTING_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
29namespace glcts
30{
31
32/** Base class for implementation of "Group 9" tests from CTS_EXT_geometry_shader.*/
33class GeometryShaderBlitting : public TestCaseBase
34{
35public:
36	/* Public methods */
37	virtual void		  deinit(void);
38	virtual IterateResult iterate(void);
39
40protected:
41	GeometryShaderBlitting(Context& context, const ExtParameters& extParams, const char* name, const char* description);
42
43	virtual ~GeometryShaderBlitting(void)
44	{
45	}
46
47	/* Protected abstract methods */
48	virtual void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
49											   glw::GLint to_read) = 0;
50
51private:
52	/* Private variables */
53	glw::GLenum m_draw_fbo_completeness;
54	glw::GLenum m_read_fbo_completeness;
55	glw::GLuint m_fbo_draw_id;
56	glw::GLuint m_fbo_read_id;
57	glw::GLuint m_to_draw;
58	glw::GLuint m_to_read;
59	glw::GLuint m_vao_id;
60};
61
62/**
63 * 1. Only layer zero should be used when blitting from a layered read
64 *    framebuffer to a non-layered draw framebuffer.
65 *
66 *    Category: API;
67 *              Functional Test.
68 *
69 *    A 3D texture object A of resolution 4x4x4 and of internalformat GL_RGBA8
70 *    should be created:
71 *
72 *    - First slice should be filled with  (255, 0,   0,   0);
73 *    - Second slice should be filled with (0,   255, 0,   0);
74 *    - Third slice should be filled with  (0,   0,   255, 0);
75 *    - Fourth slice should be filled with (0,   0,   0,   255);
76 *
77 *    Source FBO should use:
78 *
79 *    - glFramebufferTextureEXT() to bind level 0 of 3D texture A for color
80 *      attachment zero;
81 *
82 *    For destination FBO, create texture object A' of exactly the same type
83 *    as A. The difference should be in content - all layers and slices should
84 *    be filled with (0, 0, 0, 0).
85 *
86 *    Destination FBO should use:
87 *
88 *    - glFramebufferTextureLayer() to bind level 0 of texture A'.
89 *
90 *    After blitting, the test should confirm that only zero layer/slice of
91 *    destination FBO's attachments have been changed. Remaining layers and
92 *    slices should remain black.
93 */
94class GeometryShaderBlittingLayeredToNonLayered : public GeometryShaderBlitting
95{
96public:
97	/* Public methods */
98	GeometryShaderBlittingLayeredToNonLayered(Context& context, const ExtParameters& extParams, const char* name,
99											  const char* description);
100
101	virtual ~GeometryShaderBlittingLayeredToNonLayered(void)
102	{
103	}
104
105protected:
106	/* Protected methods */
107	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
108									   glw::GLint to_read);
109};
110
111/**
112 * 2. Only layer zero should be used when blitting from a non-layered read
113 *    framebuffer to a layered draw framebuffer.
114 *
115 *    Category: API;
116 *              Functional Test.
117 *
118 *    Modify test case 9.1 so that:
119 *
120 *    - Original source FBO becomes a destination FBO;
121 *    - Original destination FBO becomes a source FBO;
122 *    - Texture objects A' and B' are filled with data as original textures
123 *      A and B;
124 *    - Texture objects A and B are filled with data as original textures
125 *      A' and B'.
126 */
127class GeometryShaderBlittingNonLayeredToLayered : public GeometryShaderBlitting
128{
129public:
130	/* Public methods */
131	GeometryShaderBlittingNonLayeredToLayered(Context& context, const ExtParameters& extParams, const char* name,
132											  const char* description);
133
134	virtual ~GeometryShaderBlittingNonLayeredToLayered(void)
135	{
136	}
137
138protected:
139	/* Protected methods */
140	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
141									   glw::GLint to_read);
142};
143
144/**
145 * 3. Only layer zero should be used when blitting from layered read framebuffer
146 *    to a layered draw framebuffer.
147 *
148 *    Category: API;
149 *              Functional Test.
150 *
151 *    Modify test case 9.1 so that:
152 *
153 *    - Texture objects A' and B' should be configured in exactly the same way
154 *      as A and B (they should be layered!), however they should still carry
155 *      the same data as described in test case 9.1.
156 */
157class GeometryShaderBlittingLayeredToLayered : public GeometryShaderBlitting
158{
159public:
160	/* Public methods */
161	GeometryShaderBlittingLayeredToLayered(Context& context, const ExtParameters& extParams, const char* name,
162										   const char* description);
163
164	virtual ~GeometryShaderBlittingLayeredToLayered(void)
165	{
166	}
167
168protected:
169	/* Protected methods */
170	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
171									   glw::GLint to_read);
172};
173
174} /* namespace glcts */
175
176#endif // _ESEXTCGEOMETRYSHADERBLITTING_HPP
177