1 #ifndef _ESEXTCDRAWBUFFERSINDEXEDBASE_HPP
2 #define _ESEXTCDRAWBUFFERSINDEXEDBASE_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2015-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  esextcDrawBuffersIndexedBase.hpp
28  * \brief Base class for Draw Buffers Indexed extension tests 1-6
29  */ /*-------------------------------------------------------------------*/
30 
31 #include "../esextcTestCaseBase.hpp"
32 #include "glwEnums.hpp"
33 #include <vector>
34 
35 namespace glcts
36 {
37 
38 /** Base class for Draw Buffers Indexed tests
39  **/
40 class DrawBuffersIndexedBase : public TestCaseBase
41 {
42 public:
43     /** Public methods
44      **/
45     DrawBuffersIndexedBase(Context &context, const ExtParameters &extParams, const char *name, const char *description);
46 
~DrawBuffersIndexedBase()47     virtual ~DrawBuffersIndexedBase()
48     {
49     }
50 
51 private:
52     virtual void init(void);
53 
54 protected:
55     class BlendMaskState
56     {
57     public:
58         glw::GLenum enable;
59         glw::GLenum mode_rgb;
60         glw::GLenum mode_a;
61         glw::GLenum func_src_rgb;
62         glw::GLenum func_src_a;
63         glw::GLenum func_dst_rgb;
64         glw::GLenum func_dst_a;
65         glw::GLboolean mask_r;
66         glw::GLboolean mask_g;
67         glw::GLboolean mask_b;
68         glw::GLboolean mask_a;
69 
BlendMaskState()70         BlendMaskState()
71             : enable(GL_FALSE)
72             , mode_rgb(GL_FUNC_ADD)
73             , mode_a(GL_FUNC_ADD)
74             , func_src_rgb(GL_ONE)
75             , func_src_a(GL_ONE)
76             , func_dst_rgb(GL_ZERO)
77             , func_dst_a(GL_ZERO)
78             , mask_r(GL_TRUE)
79             , mask_g(GL_TRUE)
80             , mask_b(GL_TRUE)
81             , mask_a(GL_TRUE)
82         {
83         }
84     };
85 
86     class BlendMaskStateMachine
87     {
88     public:
89         BlendMaskStateMachine(Context &context, tcu::TestLog &log);
90         BlendMaskStateMachine(Context &context, tcu::TestLog &log, int dbs);
91 
92         std::vector<BlendMaskState> state;
93 
94         bool CheckEnumGeneral(glw::GLenum e, glw::GLenum state);
95         bool CheckEnumForBuffer(int idx, glw::GLenum e, glw::GLenum state);
96         bool CheckBuffer(int idx);
97         bool CheckAll();
98 
99         void SetEnablei(int idx);
100         void SetDisablei(int idx);
101         void SetColorMaski(int idx, glw::GLboolean r, glw::GLboolean g, glw::GLboolean b, glw::GLboolean a);
102         void SetBlendEquationi(int idx, glw::GLenum mode);
103         void SetBlendEquationSeparatei(int idx, glw::GLenum rgb, glw::GLenum a);
104         void SetBlendFunci(int idx, glw::GLenum src, glw::GLenum dst);
105         void SetBlendFuncSeparatei(int idx, glw::GLenum src_rgb, glw::GLenum dst_rgb, glw::GLenum src_a,
106                                    glw::GLenum dst_a);
107         void SetEnable();
108         void SetDisable();
109         void SetColorMask(glw::GLboolean r, glw::GLboolean g, glw::GLboolean b, glw::GLboolean a);
110         void SetBlendEquation(glw::GLenum mode);
111         void SetBlendEquationSeparate(glw::GLenum rgb, glw::GLenum a);
112         void SetBlendFunc(glw::GLenum src, glw::GLenum dst);
113         void SetBlendFuncSeparate(glw::GLenum src_rgb, glw::GLenum dst_rgb, glw::GLenum src_a, glw::GLenum dst_a);
114         void SetDefaults();
115 
116     private:
117         const glw::Functions &gl;
118         tcu::TestLog &testLog;
119     };
120 };
121 } // namespace glcts
122 #endif // _ESEXTCDRAWBUFFERSINDEXEDBASE_HPP
123