• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GLCTRANSFORMFEEDBACKTESTS_HPP
2 #define _GLCTRANSFORMFEEDBACKTESTS_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2024 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  */ /*!
28  * \file  glcTransformFeedbackTests.hpp
29  * \brief Conformance tests for the transform_feedback2 functionality.
30  */ /*-------------------------------------------------------------------*/
31 
32 #include "glcTestCase.hpp"
33 #include "glwDefs.hpp"
34 #include "tcuDefs.hpp"
35 
36 #include <map>
37 
38 namespace glu
39 {
40 class ShaderProgram;
41 }
42 
43 namespace glcts
44 {
45 
46 /*
47 Specification:
48 
49       Using the Basic Outline above, enable each of the following features and
50       permutations and make sure they operate as expected.
51 
52     * Create and bind a user transform feedback object with
53       GenTransformFeedbacks and BindTransformFeedback and ensure the test
54       runs correctly. Delete the user transform buffer object.
55 
56     * Create multiple user transform feedback objects and configure different
57       state in each object. The state tested should be the following:
58 
59           TRANSFORM_FEEDBACK_BUFFER_BINDING
60           TRANSFORM_FEEDBACK_BUFFER_START
61           TRANSFORM_FEEDBACK_BUFFER_SIZE
62 
63     * Draw a subset of the primitives for the test, call
64       PauseTransformFeedback, draw other primitives not part of the test,
65       call ResumeTransformFeedback and continue with the remaining primitives.
66       The feedback buffer should only contain primitives drawn while the
67       transform feedback object is not paused.
68 
69       Query the transform feedback state for TRANSFORM_FEEDBACK_BUFFER_PAUSED
70       and TRANSFORM_FEEDBACK_BUFFER_ACTIVE to verify the state is reflected
71       correctly.
72 
73 Procedure:
74 
75     Draw and query state
76 
77 Notes:
78 */
79 class TransformFeedbackStatesTestCase : public deqp::TestCase
80 {
81 public:
82     /* Public methods */
83     TransformFeedbackStatesTestCase(deqp::Context &context);
84     ~TransformFeedbackStatesTestCase();
85 
86     void deinit();
87     void init();
88     tcu::TestNode::IterateResult iterate();
89 
90 private:
91     /* Private methods */
92     bool draw_simple2(glw::GLuint program, glw::GLenum primitivetype, glw::GLint vertexcount, bool pauseresume);
93     void buildTransformFeedbackProgram(const char *vsSource, const char *fsSource);
94 
95     /* Private members */
96     static const glw::GLchar *m_shader_vert;
97     static const glw::GLchar *m_shader_frag;
98 
99     glw::GLuint m_program;
100 
101     std::map<std::string, std::string> specializationMap;
102 
103     glw::GLuint m_vao;
104 
105     glw::GLuint m_buffers[2];
106     glw::GLuint m_tf_id;
107     glw::GLuint m_queries[2];
108 
109     bool m_isContextES;
110     bool m_testSupported;
111 };
112 
113 /** Test group which encapsulates all conformance tests */
114 class TransformFeedbackTests : public deqp::TestCaseGroup
115 {
116 public:
117     /* Public methods */
118     TransformFeedbackTests(deqp::Context &context);
119 
120     void init();
121 
122 private:
123     TransformFeedbackTests(const TransformFeedbackTests &other);
124     TransformFeedbackTests &operator=(const TransformFeedbackTests &other);
125 };
126 
127 } // namespace glcts
128 
129 #endif // _GLCTRANSFORMFEEDBACKTESTS_HPP
130