1 #ifndef _GL4CSHADERTEXTUREIMAGESAMPLESTESTS_HPP
2 #define _GL4CSHADERTEXTUREIMAGESAMPLESTESTS_HPP
3 /*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
7 * Copyright (c) 2014-2016 The Khronos Group Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 */ /*-------------------------------------------------------------------*/
28 * \file gl4cShaderTextureImageSamples.hpp
29 * \brief Declares test classes that verify conformance of the
30 * GL implementation with GL_ARB_shader_texture_image_samples
31 * extension specification.
32 */ /*-------------------------------------------------------------------*/
34 #include "glcTestCase.hpp"
35 #include "glwDefs.hpp"
39 /** Base test class for GL_ARB_shader_texture_image_samples conformance tests. */
40 class ShaderTextureImageSamplesTestBase : public deqp::TestCase
44 ShaderTextureImageSamplesTestBase(deqp::Context& context, const char* name, const char* description);
50 /* Protected type definitions */
52 SAMPLER_TYPE_ISAMPLER2DMS,
53 SAMPLER_TYPE_ISAMPLER2DMSARRAY,
54 SAMPLER_TYPE_SAMPLER2DMS,
55 SAMPLER_TYPE_SAMPLER2DMSARRAY,
56 SAMPLER_TYPE_USAMPLER2DMS,
57 SAMPLER_TYPE_USAMPLER2DMSARRAY,
69 /* Protected methods */
70 bool buildComputeProgram(const char* cs_body, bool should_link_po, bool should_succeed);
72 void executeFunctionalTest(const _sampler_type& sampler_type, const _test_type& test_type);
76 void deinitProgramAndShaderObjects();
79 glw::GLint m_internalformat_n_samples_count;
80 glw::GLint* m_internalformat_n_samples_data;
87 const unsigned int m_to_depth;
88 const unsigned int m_to_height;
89 const unsigned int m_to_width;
92 /** Implements the following functional tests from CTS_ARB_shader_texture_image_samples:
94 * Basic Texture Functionality
96 * * Create a multisample texture and use a compute shader with an SSBO
97 * to verify the result of calling textureSamples() on that texture. The
98 * compute shader would look like this:
103 * uniform gsampler% tex;
105 * samples = textureSamples(tex);
108 * For gsampler% the test should iterate through all the texture targets;
109 * sampler*, isampler* and usamples* for 2DMS and 2DMSArray. For the
110 * 2SMSArray case a multisample array texture should be bound to the
113 * Readback the SSBO "samples" result and verify that it matches the
114 * <samples> parameter used to create the texture. Repeat the test for
115 * all <samples> values supported by the implementation.
117 * Basic Image Functionality
119 * * Similar to the test above, but bind an image from the multisample
122 * Create a multisample texture, bind an image from the texture and use
123 * a compute shader with an SSBO to verify the result of calling
124 * imageSamples() on that image. The compute shader would look like this:
129 * layout(format) uniform gimage% tex;
131 * samples = imageSamples(tex);
134 * For gimage% the test should iterate through all the image targets;
135 * image*, iimage* and uimage* for 2DMS and 2DMSArray. For the
136 * 2SMSArray case a multisample array image should be bound to the
139 * Readback the SSBO "samples" result and verify that it matches the
140 * <samples> parameter used to create the texture. Repeat the test for
141 * all <samples> values supported by the implementation.
144 class ShaderTextureImageSampleFunctionalTest : public ShaderTextureImageSamplesTestBase
148 ShaderTextureImageSampleFunctionalTest(deqp::Context& context, const char* name);
151 virtual tcu::TestNode::IterateResult iterate();
154 _test_type type_to_test;
155 /* Private methods */
158 /** Implements the following GLSL #extension test from CTS_ARB_shader_texture_image_samples:
160 * * Verify a shader with #extension GL_ARB_shader_texture_image_samples : enable
161 * defines the pre-processor macro "GL_ARB_shader_texture_image_samples"
165 class ShaderTextureImageSamplesGLSLExtensionEnableTest : public ShaderTextureImageSamplesTestBase
169 ShaderTextureImageSamplesGLSLExtensionEnableTest(deqp::Context& context);
171 virtual tcu::TestNode::IterateResult iterate();
174 /* Private methods */
177 /** Implements the following GLSL #extension test from CTS_ARB_shader_texture_image_samples:
179 * * Verify a shader with
180 * #extension GL_ARB_shader_texture_image_samples : require
181 * compiles without error.
184 class ShaderTextureImageSamplesGLSLExtensionRequireTest : public ShaderTextureImageSamplesTestBase
188 ShaderTextureImageSamplesGLSLExtensionRequireTest(deqp::Context& context);
190 virtual tcu::TestNode::IterateResult iterate();
193 /* Private methods */
196 /** Test group which encapsulates all conformance tests for GL_ARB_shader_texture_image_samples
199 class ShaderTextureImageSamplesTests : public deqp::TestCaseGroup
203 ShaderTextureImageSamplesTests(deqp::Context& context);
208 ShaderTextureImageSamplesTests(const ShaderTextureImageSamplesTests& other);
209 ShaderTextureImageSamplesTests& operator=(const ShaderTextureImageSamplesTests& other);
212 } /* glcts namespace */
214 #endif // _GL4CSHADERTEXTUREIMAGESAMPLESTESTS_HPP