1e5c31af7Sopenharmony_ci#ifndef _ESEXTCGEOMETRYSHADERBLITTING_HPP
2e5c31af7Sopenharmony_ci#define _ESEXTCGEOMETRYSHADERBLITTING_HPP
3e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite
5e5c31af7Sopenharmony_ci * -----------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright (c) 2014-2016 The Khronos Group Inc.
8e5c31af7Sopenharmony_ci *
9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
14e5c31af7Sopenharmony_ci *
15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
19e5c31af7Sopenharmony_ci * limitations under the License.
20e5c31af7Sopenharmony_ci *
21e5c31af7Sopenharmony_ci */ /*!
22e5c31af7Sopenharmony_ci * \file
23e5c31af7Sopenharmony_ci * \brief
24e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "../esextcTestCaseBase.hpp"
27e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_cinamespace glcts
30e5c31af7Sopenharmony_ci{
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_ci/** Base class for implementation of "Group 9" tests from CTS_EXT_geometry_shader.*/
33e5c31af7Sopenharmony_ciclass GeometryShaderBlitting : public TestCaseBase
34e5c31af7Sopenharmony_ci{
35e5c31af7Sopenharmony_cipublic:
36e5c31af7Sopenharmony_ci	/* Public methods */
37e5c31af7Sopenharmony_ci	virtual void		  deinit(void);
38e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ciprotected:
41e5c31af7Sopenharmony_ci	GeometryShaderBlitting(Context& context, const ExtParameters& extParams, const char* name, const char* description);
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ci	virtual ~GeometryShaderBlitting(void)
44e5c31af7Sopenharmony_ci	{
45e5c31af7Sopenharmony_ci	}
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci	/* Protected abstract methods */
48e5c31af7Sopenharmony_ci	virtual void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
49e5c31af7Sopenharmony_ci											   glw::GLint to_read) = 0;
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciprivate:
52e5c31af7Sopenharmony_ci	/* Private variables */
53e5c31af7Sopenharmony_ci	glw::GLenum m_draw_fbo_completeness;
54e5c31af7Sopenharmony_ci	glw::GLenum m_read_fbo_completeness;
55e5c31af7Sopenharmony_ci	glw::GLuint m_fbo_draw_id;
56e5c31af7Sopenharmony_ci	glw::GLuint m_fbo_read_id;
57e5c31af7Sopenharmony_ci	glw::GLuint m_to_draw;
58e5c31af7Sopenharmony_ci	glw::GLuint m_to_read;
59e5c31af7Sopenharmony_ci	glw::GLuint m_vao_id;
60e5c31af7Sopenharmony_ci};
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_ci/**
63e5c31af7Sopenharmony_ci * 1. Only layer zero should be used when blitting from a layered read
64e5c31af7Sopenharmony_ci *    framebuffer to a non-layered draw framebuffer.
65e5c31af7Sopenharmony_ci *
66e5c31af7Sopenharmony_ci *    Category: API;
67e5c31af7Sopenharmony_ci *              Functional Test.
68e5c31af7Sopenharmony_ci *
69e5c31af7Sopenharmony_ci *    A 3D texture object A of resolution 4x4x4 and of internalformat GL_RGBA8
70e5c31af7Sopenharmony_ci *    should be created:
71e5c31af7Sopenharmony_ci *
72e5c31af7Sopenharmony_ci *    - First slice should be filled with  (255, 0,   0,   0);
73e5c31af7Sopenharmony_ci *    - Second slice should be filled with (0,   255, 0,   0);
74e5c31af7Sopenharmony_ci *    - Third slice should be filled with  (0,   0,   255, 0);
75e5c31af7Sopenharmony_ci *    - Fourth slice should be filled with (0,   0,   0,   255);
76e5c31af7Sopenharmony_ci *
77e5c31af7Sopenharmony_ci *    Source FBO should use:
78e5c31af7Sopenharmony_ci *
79e5c31af7Sopenharmony_ci *    - glFramebufferTextureEXT() to bind level 0 of 3D texture A for color
80e5c31af7Sopenharmony_ci *      attachment zero;
81e5c31af7Sopenharmony_ci *
82e5c31af7Sopenharmony_ci *    For destination FBO, create texture object A' of exactly the same type
83e5c31af7Sopenharmony_ci *    as A. The difference should be in content - all layers and slices should
84e5c31af7Sopenharmony_ci *    be filled with (0, 0, 0, 0).
85e5c31af7Sopenharmony_ci *
86e5c31af7Sopenharmony_ci *    Destination FBO should use:
87e5c31af7Sopenharmony_ci *
88e5c31af7Sopenharmony_ci *    - glFramebufferTextureLayer() to bind level 0 of texture A'.
89e5c31af7Sopenharmony_ci *
90e5c31af7Sopenharmony_ci *    After blitting, the test should confirm that only zero layer/slice of
91e5c31af7Sopenharmony_ci *    destination FBO's attachments have been changed. Remaining layers and
92e5c31af7Sopenharmony_ci *    slices should remain black.
93e5c31af7Sopenharmony_ci */
94e5c31af7Sopenharmony_ciclass GeometryShaderBlittingLayeredToNonLayered : public GeometryShaderBlitting
95e5c31af7Sopenharmony_ci{
96e5c31af7Sopenharmony_cipublic:
97e5c31af7Sopenharmony_ci	/* Public methods */
98e5c31af7Sopenharmony_ci	GeometryShaderBlittingLayeredToNonLayered(Context& context, const ExtParameters& extParams, const char* name,
99e5c31af7Sopenharmony_ci											  const char* description);
100e5c31af7Sopenharmony_ci
101e5c31af7Sopenharmony_ci	virtual ~GeometryShaderBlittingLayeredToNonLayered(void)
102e5c31af7Sopenharmony_ci	{
103e5c31af7Sopenharmony_ci	}
104e5c31af7Sopenharmony_ci
105e5c31af7Sopenharmony_ciprotected:
106e5c31af7Sopenharmony_ci	/* Protected methods */
107e5c31af7Sopenharmony_ci	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
108e5c31af7Sopenharmony_ci									   glw::GLint to_read);
109e5c31af7Sopenharmony_ci};
110e5c31af7Sopenharmony_ci
111e5c31af7Sopenharmony_ci/**
112e5c31af7Sopenharmony_ci * 2. Only layer zero should be used when blitting from a non-layered read
113e5c31af7Sopenharmony_ci *    framebuffer to a layered draw framebuffer.
114e5c31af7Sopenharmony_ci *
115e5c31af7Sopenharmony_ci *    Category: API;
116e5c31af7Sopenharmony_ci *              Functional Test.
117e5c31af7Sopenharmony_ci *
118e5c31af7Sopenharmony_ci *    Modify test case 9.1 so that:
119e5c31af7Sopenharmony_ci *
120e5c31af7Sopenharmony_ci *    - Original source FBO becomes a destination FBO;
121e5c31af7Sopenharmony_ci *    - Original destination FBO becomes a source FBO;
122e5c31af7Sopenharmony_ci *    - Texture objects A' and B' are filled with data as original textures
123e5c31af7Sopenharmony_ci *      A and B;
124e5c31af7Sopenharmony_ci *    - Texture objects A and B are filled with data as original textures
125e5c31af7Sopenharmony_ci *      A' and B'.
126e5c31af7Sopenharmony_ci */
127e5c31af7Sopenharmony_ciclass GeometryShaderBlittingNonLayeredToLayered : public GeometryShaderBlitting
128e5c31af7Sopenharmony_ci{
129e5c31af7Sopenharmony_cipublic:
130e5c31af7Sopenharmony_ci	/* Public methods */
131e5c31af7Sopenharmony_ci	GeometryShaderBlittingNonLayeredToLayered(Context& context, const ExtParameters& extParams, const char* name,
132e5c31af7Sopenharmony_ci											  const char* description);
133e5c31af7Sopenharmony_ci
134e5c31af7Sopenharmony_ci	virtual ~GeometryShaderBlittingNonLayeredToLayered(void)
135e5c31af7Sopenharmony_ci	{
136e5c31af7Sopenharmony_ci	}
137e5c31af7Sopenharmony_ci
138e5c31af7Sopenharmony_ciprotected:
139e5c31af7Sopenharmony_ci	/* Protected methods */
140e5c31af7Sopenharmony_ci	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
141e5c31af7Sopenharmony_ci									   glw::GLint to_read);
142e5c31af7Sopenharmony_ci};
143e5c31af7Sopenharmony_ci
144e5c31af7Sopenharmony_ci/**
145e5c31af7Sopenharmony_ci * 3. Only layer zero should be used when blitting from layered read framebuffer
146e5c31af7Sopenharmony_ci *    to a layered draw framebuffer.
147e5c31af7Sopenharmony_ci *
148e5c31af7Sopenharmony_ci *    Category: API;
149e5c31af7Sopenharmony_ci *              Functional Test.
150e5c31af7Sopenharmony_ci *
151e5c31af7Sopenharmony_ci *    Modify test case 9.1 so that:
152e5c31af7Sopenharmony_ci *
153e5c31af7Sopenharmony_ci *    - Texture objects A' and B' should be configured in exactly the same way
154e5c31af7Sopenharmony_ci *      as A and B (they should be layered!), however they should still carry
155e5c31af7Sopenharmony_ci *      the same data as described in test case 9.1.
156e5c31af7Sopenharmony_ci */
157e5c31af7Sopenharmony_ciclass GeometryShaderBlittingLayeredToLayered : public GeometryShaderBlitting
158e5c31af7Sopenharmony_ci{
159e5c31af7Sopenharmony_cipublic:
160e5c31af7Sopenharmony_ci	/* Public methods */
161e5c31af7Sopenharmony_ci	GeometryShaderBlittingLayeredToLayered(Context& context, const ExtParameters& extParams, const char* name,
162e5c31af7Sopenharmony_ci										   const char* description);
163e5c31af7Sopenharmony_ci
164e5c31af7Sopenharmony_ci	virtual ~GeometryShaderBlittingLayeredToLayered(void)
165e5c31af7Sopenharmony_ci	{
166e5c31af7Sopenharmony_ci	}
167e5c31af7Sopenharmony_ci
168e5c31af7Sopenharmony_ciprotected:
169e5c31af7Sopenharmony_ci	/* Protected methods */
170e5c31af7Sopenharmony_ci	void setUpFramebuffersForRendering(glw::GLuint fbo_draw_id, glw::GLuint fbo_read_id, glw::GLint to_draw,
171e5c31af7Sopenharmony_ci									   glw::GLint to_read);
172e5c31af7Sopenharmony_ci};
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci} /* namespace glcts */
175e5c31af7Sopenharmony_ci
176e5c31af7Sopenharmony_ci#endif // _ESEXTCGEOMETRYSHADERBLITTING_HPP
177