1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2015-2016 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */ /*!
20  * \file
21  * \brief
22  */ /*-------------------------------------------------------------------*/
23 
24 /*!
25  * \file  esextcDrawBuffersIndexedDefaultState.hpp
26  * \brief Draw Buffers Indexed tests 2. Default State
27  */ /*-------------------------------------------------------------------*/
28 
29 #include "esextcDrawBuffersIndexedDefaultState.hpp"
30 #include "tcuTestLog.hpp"
31 
32 namespace glcts
33 {
34 
35 /** Constructor
36  *
37  *  @param context     Test context
38  *  @param name        Test case's name
39  *  @param description Test case's description
40  **/
DrawBuffersIndexedDefaultState(Context & context,const ExtParameters & extParams,const char * name,const char * description)41 DrawBuffersIndexedDefaultState::DrawBuffersIndexedDefaultState(Context &context, const ExtParameters &extParams,
42                                                                const char *name, const char *description)
43     : DrawBuffersIndexedBase(context, extParams, name, description)
44 {
45     /* Left blank on purpose */
46 }
47 
iterate()48 tcu::TestNode::IterateResult DrawBuffersIndexedDefaultState::iterate()
49 {
50     const glw::Functions &gl = m_context.getRenderContext().getFunctions();
51 
52     // Check number of available draw buffers
53     glw::GLint maxDrawBuffers = 0;
54     gl.getIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
55     if (maxDrawBuffers < 4)
56     {
57         m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Minimum number of draw buffers too low");
58         return STOP;
59     }
60 
61     BlendMaskStateMachine state(m_context, m_testCtx.getLog(), maxDrawBuffers);
62     if (!state.CheckAll())
63     {
64         m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Default state verification failed");
65         return STOP;
66     }
67 
68     // Check for error
69     glw::GLenum error_code = gl.getError();
70     if (error_code != GL_NO_ERROR)
71     {
72         m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Some functions generated error");
73         return STOP;
74     }
75 
76     m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
77     return STOP;
78 }
79 
80 } // namespace glcts
81