xref: /aosp_15_r20/external/deqp/modules/gles31/functional/es31fDefaultVertexArrayObjectTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2015 The Android Open Source Project
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 Default vertex array tests
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es31fDefaultVertexArrayObjectTests.hpp"
25 
26 #include "gluCallLogWrapper.hpp"
27 #include "gluRenderContext.hpp"
28 
29 #include "glwEnums.hpp"
30 
31 namespace deqp
32 {
33 namespace gles31
34 {
35 namespace Functional
36 {
37 namespace
38 {
39 
40 class VertexAttributeDivisorCase : public TestCase
41 {
42 public:
43     VertexAttributeDivisorCase(Context &context, const char *name, const char *description);
44     void init(void);
45     IterateResult iterate(void);
46 };
47 
VertexAttributeDivisorCase(Context & context,const char * name,const char * description)48 VertexAttributeDivisorCase::VertexAttributeDivisorCase(Context &context, const char *name, const char *description)
49     : TestCase(context, name, description)
50 {
51 }
52 
init(void)53 void VertexAttributeDivisorCase::init(void)
54 {
55     if (!glu::isContextTypeES(m_context.getRenderContext().getType()))
56     {
57         throw tcu::NotSupportedError(
58             "The Use VertexAttribDivisor with default VAO test is not supported in the GL context");
59     }
60 }
61 
iterate(void)62 VertexAttributeDivisorCase::IterateResult VertexAttributeDivisorCase::iterate(void)
63 {
64     glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
65 
66     m_testCtx.getLog() << tcu::TestLog::Message << "Using VertexAttribDivisor with default VAO.\n"
67                        << "Expecting no error." << tcu::TestLog::EndMessage;
68 
69     gl.enableLogging(true);
70     gl.glBindVertexArray(0);
71 
72     // Using vertexAttribDivisor with default vao is not an error in ES 3.1.
73     gl.glVertexAttribDivisor(0, 3);
74     GLU_EXPECT_NO_ERROR(gl.glGetError(), "VertexAttribDivisor");
75 
76     m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
77     return STOP;
78 }
79 
80 } // namespace
81 
DefaultVertexArrayObjectTests(Context & context)82 DefaultVertexArrayObjectTests::DefaultVertexArrayObjectTests(Context &context)
83     : TestCaseGroup(context, "default_vertex_array_object", "Default vertex array object")
84 {
85 }
86 
init(void)87 void DefaultVertexArrayObjectTests::init(void)
88 {
89     addChild(
90         new VertexAttributeDivisorCase(m_context, "vertex_attrib_divisor", "Use VertexAttribDivisor with default VAO"));
91 }
92 
93 } // namespace Functional
94 } // namespace gles31
95 } // namespace deqp
96