Merge "Fix color change verification in dithering tests" into nougat-cts-dev am:...
[platform/upstream/VK-GL-CTS.git] / modules / glshared / glsRandomUniformBlockCase.hpp
1 #ifndef _GLSRANDOMUNIFORMBLOCKCASE_HPP
2 #define _GLSRANDOMUNIFORMBLOCKCASE_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL (ES) Module
5  * -----------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
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 Random uniform block layout case.
24  *//*--------------------------------------------------------------------*/
25
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "glsUniformBlockCase.hpp"
29
30 namespace de
31 {
32 class Random;
33 } // de
34
35 namespace deqp
36 {
37 namespace gls
38 {
39
40 namespace ub
41 {
42
43 enum FeatureBits
44 {
45         FEATURE_VECTORS                         = (1<<0),
46         FEATURE_MATRICES                        = (1<<1),
47         FEATURE_ARRAYS                          = (1<<2),
48         FEATURE_STRUCTS                         = (1<<3),
49         FEATURE_NESTED_STRUCTS          = (1<<4),
50         FEATURE_INSTANCE_ARRAYS         = (1<<5),
51         FEATURE_VERTEX_BLOCKS           = (1<<6),
52         FEATURE_FRAGMENT_BLOCKS         = (1<<7),
53         FEATURE_SHARED_BLOCKS           = (1<<8),
54         FEATURE_UNUSED_UNIFORMS         = (1<<9),
55         FEATURE_UNUSED_MEMBERS          = (1<<10),
56         FEATURE_PACKED_LAYOUT           = (1<<11),
57         FEATURE_SHARED_LAYOUT           = (1<<12),
58         FEATURE_STD140_LAYOUT           = (1<<13),
59         FEATURE_MATRIX_LAYOUT           = (1<<14),      //!< Matrix layout flags.
60         FEATURE_ARRAYS_OF_ARRAYS        = (1<<15)
61 };
62
63 } // ub
64
65 class RandomUniformBlockCase : public UniformBlockCase
66 {
67 public:
68                                                         RandomUniformBlockCase          (tcu::TestContext&              testCtx,
69                                                                                                                  glu::RenderContext&    renderCtx,
70                                                                                                                  glu::GLSLVersion               glslVersion,
71                                                                                                                  const char*                    name,
72                                                                                                                  const char*                    description,
73                                                                                                                  BufferMode                             bufferMode,
74                                                                                                                  deUint32                               features,
75                                                                                                                  deUint32                               seed);
76
77         void                                    init                                            (void);
78
79 private:
80         void                                    generateBlock                           (de::Random& rnd, deUint32 layoutFlags);
81         void                                    generateUniform                         (de::Random& rnd, ub::UniformBlock& block);
82         ub::VarType                             generateType                            (de::Random& rnd, int typeDepth, bool arrayOk);
83
84         const deUint32                  m_features;
85         const int                               m_maxVertexBlocks;
86         const int                               m_maxFragmentBlocks;
87         const int                               m_maxSharedBlocks;
88         const int                               m_maxInstances;
89         const int                               m_maxArrayLength;
90         const int                               m_maxStructDepth;
91         const int                               m_maxBlockMembers;
92         const int                               m_maxStructMembers;
93         const deUint32                  m_seed;
94
95         int                                             m_blockNdx;
96         int                                             m_uniformNdx;
97         int                                             m_structNdx;
98 };
99
100 } // gls
101 } // deqp
102
103 #endif // _GLSRANDOMUNIFORMBLOCKCASE_HPP