1 #ifndef _ESEXTCGPUSHADER5ATOMICCOUNTERSARRAYINDEXING_HPP 2 #define _ESEXTCGPUSHADER5ATOMICCOUNTERSARRAYINDEXING_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 /*! 27 * \file esextcGPUShader5AtomicCountersArrayIndexing.hpp 28 * \brief GPUShader5 Atomic Counters Array Indexing (Test 3) 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "../esextcTestCaseBase.hpp" 32 33 namespace glcts 34 { 35 /** "Test 3" from CTS_EXT_gpu_shader5. Description follows 36 * 37 * Test whether indexing into an array of atomic counters using dynamically 38 * uniform integer expressions works as expected. 39 * 40 * Category: API, 41 * Functional Test. 42 * 43 * Write a compute shader with an array of four atomic_uint counters. 44 * The work group size should be 2x2. 45 * 46 * Set up a buffer object of enough size to fit all four shader atomic 47 * counters. Fill it with zeroes. 48 * 49 * In the compute shader perform operations: 50 * 51 * for(uint index = 0; index <= 3; ++index) 52 * { 53 * for(uint iteration = 0; iteration <= gl_LocalInvocationID.x * 54 * local_size_y + gl_LocalInvocationID.y; ++iteration) 55 * { 56 * atomicCounterIncrement ( counters[index] ); 57 * } 58 * } 59 * 60 * Create a program from the above compute shader, use it and call 61 * glDispatchCompute(10, 10, 1); 62 * 63 * The test is successful if the values of all counters are equal to 1000. 64 */ 65 class GPUShader5AtomicCountersArrayIndexing : public TestCaseBase 66 { 67 public: 68 /* Public methods */ 69 GPUShader5AtomicCountersArrayIndexing(Context &context, const ExtParameters &extParams, const char *name, 70 const char *description); 71 ~GPUShader5AtomicCountersArrayIndexing()72 virtual ~GPUShader5AtomicCountersArrayIndexing() 73 { 74 } 75 76 virtual IterateResult iterate(void); 77 virtual void deinit(void); 78 79 private: 80 /* Private methods */ 81 void initTest(void); 82 83 /* Private variables */ 84 static const char *m_compute_shader_code; 85 static const glw::GLuint m_atomic_counters_array_size; 86 87 glw::GLuint m_buffer_id; 88 glw::GLuint m_compute_shader_id; 89 glw::GLuint m_program_id; 90 }; 91 } // namespace glcts 92 93 #endif // _ESEXTCGPUSHADER5ATOMICCOUNTERSARRAYINDEXING_HPP 94