1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
5 * Copyright (c) 2014-2016 The Khronos Group Inc.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 */ /*-------------------------------------------------------------------*/
25 * \file gl3cTransformFeedbackOverflowQueryTests.cpp
26 * \brief Implements conformance tests for "Transform Feedback Overflow
27 * Query" functionality.
28 */ /*-------------------------------------------------------------------*/
30 #include "gl3cTransformFeedbackOverflowQueryTests.hpp"
33 #include "deSharedPtr.hpp"
35 #include "gluContextInfo.hpp"
36 #include "gluDefs.hpp"
37 #include "gluPixelTransfer.hpp"
38 #include "gluShaderProgram.hpp"
40 #include "tcuFuzzyImageCompare.hpp"
41 #include "tcuImageCompare.hpp"
42 #include "tcuRenderTarget.hpp"
43 #include "tcuSurface.hpp"
44 #include "tcuTestLog.hpp"
47 #include "glwFunctions.hpp"
53 Base class of all test cases of the feature. Enforces the requirements below:
55 * Check that the extension string is available.
57 class TransformFeedbackOverflowQueryBaseTest : public deqp::TestCase
60 TransformFeedbackOverflowQueryBaseTest(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
61 const char* name, const char* description)
62 : TestCase(context, name, description), m_api(api), m_max_vertex_streams(0)
66 /* Checks whether the feature is supported. */
67 bool featureSupported()
69 return (m_api == TransformFeedbackOverflowQueryTests::API_GL_ARB_transform_feedback_overflow_query &&
70 m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback_overflow_query"));
73 /* Checks whether transform_feedback2 is supported. */
74 bool supportsTransformFeedback2()
76 return (m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback2") ||
77 glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType(4, 0, glu::PROFILE_CORE)));
80 /* Checks whether transform_feedback3 is supported. */
81 bool supportsTransformFeedback3()
83 return (m_context.getContextInfo().isExtensionSupported("GL_ARB_transform_feedback3") ||
84 glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType(4, 0, glu::PROFILE_CORE)));
87 /* Checks whether gpu_shader5 is supported. */
88 bool supportsGpuShader5()
90 return (m_context.getContextInfo().isExtensionSupported("GL_ARB_gpu_shader5") ||
91 glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType(4, 0, glu::PROFILE_CORE)));
94 /* Checks whether conditional_render_inverted is supported. */
95 bool supportsConditionalRenderInverted()
97 return (m_context.getContextInfo().isExtensionSupported("GL_ARB_conditional_render_inverted") ||
98 glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType(4, 5, glu::PROFILE_CORE)));
101 /* Checks whether query_buffer_object are supported. */
102 bool supportsQueryBufferObject()
104 return (m_context.getContextInfo().isExtensionSupported("GL_ARB_query_buffer_object") ||
105 glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType(4, 4, glu::PROFILE_CORE)));
108 /* Returns the maximum number of vertex streams. */
109 GLuint getMaxVertexStreams() const
111 return m_max_vertex_streams;
114 /* Basic test init, child classes must call it. */
117 if (!featureSupported())
119 throw tcu::NotSupportedError("Required transform_feedback_overflow_query extension is not supported");
122 if (supportsTransformFeedback3())
124 m_max_vertex_streams = (GLuint)m_context.getContextInfo().getInt(GL_MAX_VERTEX_STREAMS);
129 const TransformFeedbackOverflowQueryTests::API m_api;
132 GLuint m_max_vertex_streams;
136 API Implementation Dependent State Test
138 * Check that calling GetQueryiv with target TRANSFORM_FEEDBACK_OVERFLOW_ARB
139 and pname QUERY_COUNTER_BITS returns a non-negative value without error.
141 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
142 GetQueryiv with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and pname
143 QUERY_COUNTER_BITS returns a non-negative value without error.
145 class TransformFeedbackOverflowQueryImplDepState : public TransformFeedbackOverflowQueryBaseTest
148 TransformFeedbackOverflowQueryImplDepState(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
150 : TransformFeedbackOverflowQueryBaseTest(
152 "Tests whether the implementation dependent state defined by the feature matches the requirements.")
156 /* Test case iterate function. Contains the actual test case logic. */
157 IterateResult iterate()
159 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
162 gl.getQueryiv(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, GL_QUERY_COUNTER_BITS, &counterBits);
165 TCU_FAIL("Value of QUERY_COUNTER_BITS for query target TRANSFORM_FEEDBACK_OVERFLOW_ARB is invalid");
168 if (supportsTransformFeedback3())
170 gl.getQueryiv(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, GL_QUERY_COUNTER_BITS, &counterBits);
174 "Value of QUERY_COUNTER_BITS for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB is invalid");
178 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
185 Base class for all test cases of the feature that verify newly introduced context state.
187 class TransformFeedbackOverflowQueryContextStateBase : public TransformFeedbackOverflowQueryBaseTest
190 TransformFeedbackOverflowQueryContextStateBase(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
191 const char* name, const char* description)
192 : TransformFeedbackOverflowQueryBaseTest(context, api, name, description)
196 /* Returns whether CURRENT_QUERY state for the specified target and index matches the given value. */
197 bool verifyCurrentQueryState(GLenum target, GLuint index, GLuint value)
199 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
200 GLint expected = (GLint)value;
203 // Use GetQueryIndexediv by default
204 gl.getQueryIndexediv(target, index, GL_CURRENT_QUERY, &actual);
205 if (actual != expected)
212 // If index is zero then GetQueryiv should also return the expected value
213 gl.getQueryiv(target, GL_CURRENT_QUERY, &actual);
214 if (actual != expected)
225 API Default Context State Test
227 * Check that calling GetQueryiv with target TRANSFORM_FEEDBACK_OVERFLOW_ARB
228 and pname CURRENT_QUERY returns zero by default.
230 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
231 GetQueryIndexediv with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and
232 pname CURRENT_QUERY returns zero for any index between zero and MAX_-
235 class TransformFeedbackOverflowQueryDefaultState : public TransformFeedbackOverflowQueryContextStateBase
238 TransformFeedbackOverflowQueryDefaultState(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
240 : TransformFeedbackOverflowQueryContextStateBase(
242 "Tests whether the new context state defined by the feature has the expected default values.")
246 /* Test case iterate function. Contains the actual test case logic. */
247 IterateResult iterate()
249 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, 0))
251 TCU_FAIL("Default value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_OVERFLOW_ARB is non-zero");
254 if (supportsTransformFeedback3())
256 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
258 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, 0, 0))
260 TCU_FAIL("Default value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
266 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
273 API Context State Update Test
275 * Check that after a successful call to BeginQuery with target TRANSFORM_-
276 FEEDBACK_OVERFLOW_ARB calling GetQueryiv with the same target and with
277 pname CURRENT_QUERY returns the name of the query previously passed to
278 BeginQuery. Also check that after calling EndQuery with the same target
279 GetQueryiv returns zero for the same parameters.
281 * If GL 4.0 or ARB_transform_feedback3 is supported, check that after a
282 successful call to BeginQueryIndexed with target TRANSFORM_FEEDBACK_-
283 STREAM_OVERFLOW_ARB calling GetQueryIndexediv with the same target and
284 with pname CURRENT_QUERY returns the name of the query previously passed
285 to BeginQueryIndexed if the index parameters match and otherwise it
286 returns zero. Also check that after calling EndQueryIndexed with the
287 same target and index GetQueryIndexediv returns zero for the same
288 parameters for all indices. Indices used should be between zero and
291 class TransformFeedbackOverflowQueryStateUpdate : public TransformFeedbackOverflowQueryContextStateBase
294 TransformFeedbackOverflowQueryStateUpdate(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
296 : TransformFeedbackOverflowQueryContextStateBase(
298 "Tests whether the new context state defined by the feature is correctly updated after a successful "
299 "call to {Begin|End}Query[Indexed] if the target of the query is one of the newly introduced ones.")
300 , m_overflow_query(0)
301 , m_stream_overflow_query(0)
305 /* Test case init. */
308 TransformFeedbackOverflowQueryContextStateBase::init();
310 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
312 gl.genQueries(1, &m_overflow_query);
313 gl.genQueries(1, &m_stream_overflow_query);
316 /* Test case deinit */
317 virtual void deinit()
319 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
321 gl.deleteQueries(1, &m_overflow_query);
322 gl.deleteQueries(1, &m_stream_overflow_query);
324 TransformFeedbackOverflowQueryContextStateBase::deinit();
327 /* Test case iterate function. Contains the actual test case logic. */
328 IterateResult iterate()
330 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
333 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_overflow_query);
335 // Verify that CURRENT_QUERY is set to the name of the query
336 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, m_overflow_query))
338 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_OVERFLOW_ARB is not updated properly "
339 "after a call to BeginQuery");
343 gl.endQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB);
345 // Verify that CURRENT_QUERY is reset to zero
346 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, 0))
348 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_OVERFLOW_ARB is not reset properly "
349 "after a call to EndQuery");
352 if (supportsTransformFeedback3())
354 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
356 // Call BeginQueryIndexed with specified index
357 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i, m_stream_overflow_query);
359 // Verify that CURRENT_QUERY is set to the name of the query for the specified index, but remains zero for other indices
360 for (GLuint j = 0; j < getMaxVertexStreams(); ++j)
364 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, j,
365 m_stream_overflow_query))
367 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
368 "is not updated properly after a call to BeginQueryIndexed");
373 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, j, 0))
375 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
376 "is incorrectly updated for an unrelated vertex stream"
377 "index after a call to BeginQueryIndexed");
382 // Call EndQueryIndexed with specified index
383 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i);
385 // Verify that CURRENT_QUERY is reset to zero for the specified index and still remains zero for other indices
386 for (GLuint j = 0; j < getMaxVertexStreams(); ++j)
390 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, j, 0))
392 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
393 "is not reset properly after a call to EndQueryIndexed");
398 if (!verifyCurrentQueryState(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, j, 0))
400 TCU_FAIL("Value of CURRENT_QUERY for query target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
401 "is incorrectly updated for an unrelated vertex stream"
402 "index after a call to EndQueryIndexed");
409 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
415 GLuint m_overflow_query;
416 GLuint m_stream_overflow_query;
420 Base class for all test cases of the feature that verify various error scenarios.
422 class TransformFeedbackOverflowQueryErrorBase : public TransformFeedbackOverflowQueryBaseTest
425 TransformFeedbackOverflowQueryErrorBase(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
426 const char* name, const char* description)
427 : TransformFeedbackOverflowQueryBaseTest(context, api, name, description), m_case_name(0)
431 /* Starts a new error scenario sub-test with the given name. The name is used in error messages if the sub-test fails. */
432 void startTest(const char* caseName)
434 m_case_name = caseName;
437 /* Verifies whether the actually generated error matches that of the expected one. If not then it triggers the failure
438 of the test case with the sub-case name used as the failure message. */
439 void verifyError(GLenum expectedError)
441 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
443 GLenum actualError = gl.getError();
445 if (actualError != expectedError)
447 TCU_FAIL(m_case_name);
452 const char* m_case_name;
456 API Invalid Index Error Test
458 * Check that calling GetQueryIndexediv with target TRANSFORM_FEEDBACK_-
459 OVERFLOW_ARB and a non-zero index generates an INVALID_VALUE error.
461 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
462 GetQueryIndexediv with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
463 and an index greater than or equal to MAX_VERTEX_STREAMS generates an
466 * Check that calling BeginQueryIndexed with target TRANSFORM_FEEDBACK_-
467 OVERFLOW_ARB and a non-zero index generates an INVALID_VALUE error.
469 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
470 BeginQueryIndexed with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
471 and an index greater than or equal to MAX_VERTEX_STREAMS generates an
474 class TransformFeedbackOverflowQueryErrorInvalidIndex : public TransformFeedbackOverflowQueryErrorBase
477 TransformFeedbackOverflowQueryErrorInvalidIndex(deqp::Context& context,
478 TransformFeedbackOverflowQueryTests::API api, const char* name)
479 : TransformFeedbackOverflowQueryErrorBase(
480 context, api, name, "Verifies whether an INVALID_VALUE error is properly generated if GetQueryIndexediv "
481 "or BeginQueryIndexed is called "
482 "with an invalid index when using the new targets introduced by the feature.")
487 /* Test case init. */
490 TransformFeedbackOverflowQueryErrorBase::init();
492 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
494 gl.genQueries(1, &m_query);
497 /* Test case deinit */
498 virtual void deinit()
500 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
502 gl.deleteQueries(1, &m_query);
504 TransformFeedbackOverflowQueryErrorBase::deinit();
507 /* Test case iterate function. Contains the actual test case logic. */
508 IterateResult iterate()
510 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
513 startTest("GetQueryIndexediv must generate INVALID_VALUE if <target> is "
514 "TRANSFORM_FEEDBACK_OVERFLOW_ARB and <index> is non-zero.");
516 for (GLuint i = 1; i < getMaxVertexStreams(); ++i)
518 gl.getQueryIndexediv(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, i, GL_CURRENT_QUERY, &value);
519 verifyError(GL_INVALID_VALUE);
522 if (supportsTransformFeedback3())
524 startTest("GetQueryIndexediv must generate INVALID_VALUE if <target> is "
525 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and <index> is greater "
526 "than or equal to MAX_VERTEX_STREAMS.");
528 for (GLuint i = getMaxVertexStreams(); i < getMaxVertexStreams() + 4; ++i)
530 gl.getQueryIndexediv(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i, GL_CURRENT_QUERY, &value);
531 verifyError(GL_INVALID_VALUE);
535 startTest("BeginQueryIndexed must generate INVALID_VALUE if <target> is "
536 "TRANSFORM_FEEDBACK_OVERFLOW_ARB and <index> is non-zero.");
538 for (GLuint i = 1; i < getMaxVertexStreams(); ++i)
540 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, i, m_query);
541 verifyError(GL_INVALID_VALUE);
544 if (supportsTransformFeedback3())
546 startTest("BeginQueryIndexed must generate INVALID_VALUE if <target> is "
547 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and <index> is greater "
548 "than or equal to MAX_VERTEX_STREAMS.");
550 for (GLuint i = getMaxVertexStreams(); i < getMaxVertexStreams() + 4; ++i)
552 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i, m_query);
553 verifyError(GL_INVALID_VALUE);
557 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
567 API Already Active Error Test
569 * Check that calling BeginQuery with target TRANSFORM_FEEDBACK_OVERFLOW_ARB
570 generates an INVALID_OPERATION error if there is already an active
571 query for TRANSFORM_FEEDBACK_OVERFLOW_ARB.
573 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
574 BeginQueryIndexed with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
575 generates an INVALID_OPERATION error if there is already an active
576 query for TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB for the specified
579 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
580 BeginQueryIndexed with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
581 generates an INVALID_OPERATION error if the specified query is already
582 active on another TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB target with
585 class TransformFeedbackOverflowQueryErrorAlreadyActive : public TransformFeedbackOverflowQueryErrorBase
588 TransformFeedbackOverflowQueryErrorAlreadyActive(deqp::Context& context,
589 TransformFeedbackOverflowQueryTests::API api, const char* name)
590 : TransformFeedbackOverflowQueryErrorBase(context, api, name,
591 "Verifies whether an INVALID_OPERATION error is properly generated "
592 "if BeginQuery[Indexed] is used to try to start "
593 "a query on an index that has already a query active, or the query "
594 "object itself is active on another index.")
596 , m_active_overflow_query(0)
597 , m_active_stream_overflow_query(0)
598 , m_active_query_stream_index(0)
602 /* Test case init. */
605 TransformFeedbackOverflowQueryErrorBase::init();
607 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
609 gl.genQueries(1, &m_query);
611 gl.genQueries(1, &m_active_overflow_query);
612 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_active_overflow_query);
614 if (supportsTransformFeedback3())
616 gl.genQueries(1, &m_active_stream_overflow_query);
617 m_active_query_stream_index = 2;
618 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_query_stream_index,
619 m_active_stream_overflow_query);
623 /* Test case deinit */
624 virtual void deinit()
626 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
628 if (supportsTransformFeedback3())
630 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_query_stream_index);
631 gl.deleteQueries(1, &m_active_stream_overflow_query);
634 gl.endQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB);
635 gl.deleteQueries(1, &m_active_overflow_query);
637 gl.deleteQueries(1, &m_query);
639 TransformFeedbackOverflowQueryErrorBase::deinit();
642 /* Test case iterate function. Contains the actual test case logic. */
643 IterateResult iterate()
645 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
647 startTest("BeginQuery[Indexed] must generate INVALID_OPERATION if <target> is "
648 "TRANSFORM_FEEDBACK_OVERFLOW_ARB and there is already an active "
649 "query for TRANSFORM_FEEDBACK_ARB.");
651 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_query);
652 verifyError(GL_INVALID_OPERATION);
653 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, m_query);
654 verifyError(GL_INVALID_OPERATION);
656 if (supportsTransformFeedback3())
658 startTest("BeginQueryIndexed must generate INVALID_OPERATION if <target> is "
659 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and there is already an active "
660 "query for TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB for the specified index.");
662 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_query_stream_index, m_query);
663 verifyError(GL_INVALID_OPERATION);
665 startTest("BeginQuery[Indexed] must generate INVALID_OPERATION if <target> is "
666 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and the specified query is "
667 "already active on another TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB "
668 "target with a different index.");
670 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
672 if (i != m_active_query_stream_index)
674 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i, m_active_stream_overflow_query);
675 verifyError(GL_INVALID_OPERATION);
679 gl.beginQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_stream_overflow_query);
680 verifyError(GL_INVALID_OPERATION);
686 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
693 GLuint m_active_overflow_query;
694 GLuint m_active_stream_overflow_query;
695 GLuint m_active_query_stream_index;
699 API Incompatible Target Error Test
701 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
702 BeginQueryIndexed with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
703 generates an INVALID_OPERATION error if the specified query was
704 previously used as a TRANSFORM_FEEDBACK_OVERFLOW_ARB query. Also check
705 the other way around.
707 class TransformFeedbackOverflowQueryErrorIncompatibleTarget : public TransformFeedbackOverflowQueryErrorBase
710 TransformFeedbackOverflowQueryErrorIncompatibleTarget(deqp::Context& context,
711 TransformFeedbackOverflowQueryTests::API api,
713 : TransformFeedbackOverflowQueryErrorBase(context, api, name,
714 "Verifies whether an INVALID_OPERATION error is properly generated "
715 "if BeginQuery[Indexed] is called with one of "
716 "the newly introduced query targets but one that is different than "
717 "that used earlier on the same query object.")
718 , m_overflow_query(0)
719 , m_stream_overflow_query(0)
720 , m_incompatible_query(0)
724 /* Test case init. */
727 TransformFeedbackOverflowQueryErrorBase::init();
729 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
731 gl.genQueries(1, &m_incompatible_query);
732 gl.beginQuery(GL_SAMPLES_PASSED, m_incompatible_query);
733 gl.endQuery(GL_SAMPLES_PASSED);
735 gl.genQueries(1, &m_overflow_query);
736 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_overflow_query);
737 gl.endQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB);
739 if (supportsTransformFeedback3())
741 gl.genQueries(1, &m_stream_overflow_query);
742 gl.beginQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_stream_overflow_query);
743 gl.endQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB);
747 /* Test case deinit */
748 virtual void deinit()
750 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
752 gl.deleteQueries(1, &m_incompatible_query);
754 gl.deleteQueries(1, &m_overflow_query);
756 if (supportsTransformFeedback3())
758 gl.deleteQueries(1, &m_stream_overflow_query);
761 TransformFeedbackOverflowQueryErrorBase::deinit();
764 /* Test case iterate function. Contains the actual test case logic. */
765 IterateResult iterate()
767 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
769 startTest("BeginQuery[Indexed] must generate INVALID_OPERATION if <target> is "
770 "TRANSFORM_FEEDBACK_OVERFLOW_ARB and the specified query was "
771 "previously used with another target.");
773 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_incompatible_query);
774 verifyError(GL_INVALID_OPERATION);
775 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, m_incompatible_query);
776 verifyError(GL_INVALID_OPERATION);
778 if (supportsTransformFeedback3())
780 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_stream_overflow_query);
781 verifyError(GL_INVALID_OPERATION);
782 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0, m_stream_overflow_query);
783 verifyError(GL_INVALID_OPERATION);
785 startTest("BeginQuery[Indexed] must generate INVALID_OPERATION if <target> is "
786 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and the specified query "
787 "was previously used with another target.");
789 gl.beginQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_incompatible_query);
790 verifyError(GL_INVALID_OPERATION);
791 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, 2, m_incompatible_query);
792 verifyError(GL_INVALID_OPERATION);
794 gl.beginQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_overflow_query);
795 verifyError(GL_INVALID_OPERATION);
796 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, 2, m_overflow_query);
797 verifyError(GL_INVALID_OPERATION);
800 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
806 GLuint m_overflow_query;
807 GLuint m_stream_overflow_query;
808 GLuint m_incompatible_query;
812 API No Query Active Error Test
814 * Check that calling EndQuery with target TRANSFORM_FEEDBACK_OVERFLOW_ARB
815 generates an INVALID_OPERATION error if no query is active for
816 TRANSFORM_FEEDBACK_OVERFLOW_ARB.
818 * If GL 4.0 or ARB_transform_feedback3 is supported, check that calling
819 EndQueryIndexed with target TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
820 generates an INVALID_OPERATION error if no query is active for
821 TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB for the specified index, even
822 if there is an active query for another index.
824 class TransformFeedbackOverflowQueryErrorNoActiveQuery : public TransformFeedbackOverflowQueryErrorBase
827 TransformFeedbackOverflowQueryErrorNoActiveQuery(deqp::Context& context,
828 TransformFeedbackOverflowQueryTests::API api, const char* name)
829 : TransformFeedbackOverflowQueryErrorBase(context, api, name,
830 "Verifies whether an INVALID_OPERATION error is properly generated "
831 "if EndQuery[Indexed] is called with a target "
832 "(and index) for which there isn't a currently active query.")
833 , m_active_stream_overflow_query(0)
834 , m_active_query_stream_index(0)
838 /* Test case init. */
841 TransformFeedbackOverflowQueryErrorBase::init();
843 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
845 if (supportsTransformFeedback3())
847 gl.genQueries(1, &m_active_stream_overflow_query);
848 m_active_query_stream_index = 2;
849 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_query_stream_index,
850 m_active_stream_overflow_query);
854 /* Test case deinit */
855 virtual void deinit()
857 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
859 if (supportsTransformFeedback3())
861 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, m_active_query_stream_index);
862 gl.deleteQueries(1, &m_active_stream_overflow_query);
865 TransformFeedbackOverflowQueryErrorBase::deinit();
868 /* Test case iterate function. Contains the actual test case logic. */
869 IterateResult iterate()
871 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
873 startTest("EndQuery[Indexed] must generate INVALID_OPERATION if <target> is "
874 "TRANSFORM_FEEDBACK_OVERFLOW_ARB and there is no query active "
875 "for TRANSFORM_FEEDBACK_OVERFLOW_ARB.");
877 gl.endQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB);
878 verifyError(GL_INVALID_OPERATION);
879 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 0);
880 verifyError(GL_INVALID_OPERATION);
882 if (supportsTransformFeedback3())
884 startTest("EndQuery[Indexed] must generate INVALID_OPERATION if <target> is "
885 "TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB and there is no query active "
886 "for TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB for the given index.");
888 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
890 if (i != m_active_query_stream_index)
892 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i);
893 verifyError(GL_INVALID_OPERATION);
897 gl.endQuery(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB);
898 verifyError(GL_INVALID_OPERATION);
904 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
910 GLuint m_active_stream_overflow_query;
911 GLuint m_active_query_stream_index;
915 Base class of all functionality tests. Helps enforce the following requirements:
917 * Ensuring that QUERY_COUNTER_BITS is at least one for the TRANSFORM_FEEDBACK_OVERFLOW_ARB query
918 target before running any test that uses such a query's result.
920 * Ensuring that GL 4.0 or ARB_transform_feedback3 is supported and QUERY_COUNTER_BITS is at least
921 one for the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB query target before running any test that
922 uses such a query's result.
924 class TransformFeedbackOverflowQueryFunctionalBase : public TransformFeedbackOverflowQueryBaseTest
927 TransformFeedbackOverflowQueryFunctionalBase(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
928 const char* name, const char* description)
929 : TransformFeedbackOverflowQueryBaseTest(context, api, name, description)
930 , m_overflow_query(0)
931 , m_stream_overflow_query(NULL)
933 , m_tf_buffer_count(0)
937 , m_checker_program(NULL)
941 /* Tells whether functional tests using TRANSFORM_FEEDBACK_OVERFLOW_ARB are runnable */
942 bool canTestOverflow()
944 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
947 gl.getQueryiv(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, GL_QUERY_COUNTER_BITS, &counterBits);
949 return counterBits > 0;
952 /* Tells whether functional tests using TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB are runnable */
953 bool canTestStreamOverflow()
955 if (supportsTransformFeedback3())
957 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
960 gl.getQueryiv(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, GL_QUERY_COUNTER_BITS, &counterBits);
962 return counterBits > 0;
970 /* Dummy vertex shader. */
971 const char* dummyVsh()
973 return "#version 150 core\n"
975 " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
979 /* Dummy fragment shader */
980 const char* dummyFsh()
982 return "#version 150 core\n"
986 /* Functional test init. Creates necessary query objects. */
989 TransformFeedbackOverflowQueryBaseTest::init();
991 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
993 if (canTestOverflow())
995 // Setup vertex array
996 gl.genVertexArrays(1, &m_vao);
997 gl.bindVertexArray(m_vao);
1000 gl.genQueries(1, &m_overflow_query);
1002 if (canTestStreamOverflow())
1004 m_stream_overflow_query = new GLuint[getMaxVertexStreams()];
1006 gl.genQueries(getMaxVertexStreams(), m_stream_overflow_query);
1009 // Setup checker program
1011 new glu::ShaderProgram(m_context.getRenderContext(), glu::makeVtxFragSources(dummyVsh(), dummyFsh()));
1012 if (!m_checker_program->isOk())
1014 TCU_FAIL("Checker program compilation failed");
1017 // Setup transform feedback shader and buffers
1018 buildTransformFeedbackProgram();
1019 setupTransformFeedbackBuffers();
1023 throw tcu::NotSupportedError(
1024 "QUERY_COUNTER_BITS for TRANSFORM_FEEDBACK_OVERFLOW_ARB queries is zero, skipping test");
1028 /* Functional test deinit. Deletes created query objects */
1029 virtual void deinit()
1031 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1033 gl.deleteVertexArrays(1, &m_vao);
1035 gl.deleteQueries(1, &m_overflow_query);
1037 if (canTestStreamOverflow())
1039 if (m_stream_overflow_query != NULL)
1041 gl.deleteQueries(getMaxVertexStreams(), m_stream_overflow_query);
1043 delete[] m_stream_overflow_query;
1047 if (m_checker_program != NULL)
1049 delete m_checker_program;
1053 gl.deleteProgram(m_program);
1055 if (m_tf_buffer != NULL)
1057 gl.deleteBuffers(m_tf_buffer_count, m_tf_buffer);
1059 delete[] m_tf_buffer;
1062 TransformFeedbackOverflowQueryBaseTest::deinit();
1066 Basic Checking Mechanism
1068 * Call BeginConditionalRender with mode QUERY_WAIT and with the given
1069 query object as parameters. Draw something, then call EndConditional-
1070 Render. If the expected result for the query is FALSE, expect
1071 conditional render to discard the previous draw command.
1073 * If GL 4.5 or ARB_conditional_render_inverted is supported, call Begin-
1074 ConditionalRender with mode QUERY_WAIT_INVERTED and with the given query
1075 object as parameters. Draw something, then call EndConditionalRender. If
1076 the expected result for the query is TRUE, expect conditional render to
1077 discard the previous draw command.
1079 * Finally, check using GetQueryObjectiv with QUERY_RESULT that the result
1080 of the query matches the expected result.
1082 * If GL 4.4 or ARB_query_buffer_object is supported then check the result
1083 of the query against the expected result also by having a query buffer
1084 bound at the time of calling GetQueryObjectiv.
1086 bool verifyQueryResult(GLuint query, GLboolean expected)
1088 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1092 GLuint current_program = m_context.getContextInfo().getInt(GL_CURRENT_PROGRAM);
1093 GLuint checker_query, check_result;
1095 // We'll use a PRIMITIVES_GENERATED query to test whether conditional
1096 // rendering actually executed the draw command or not. If the draw command
1097 // was discarded then the PRIMITIVES_GENERATED query should have a result
1099 gl.genQueries(1, &checker_query);
1101 gl.useProgram(m_checker_program->getProgram());
1103 // Verify that conditional render discards the rendering if the expected
1104 // result is FALSE and renders otherwise.
1105 gl.beginConditionalRender(query, GL_QUERY_WAIT);
1106 gl.beginQuery(GL_PRIMITIVES_GENERATED, checker_query);
1107 gl.drawArrays(GL_POINTS, 0, 1);
1108 gl.endQuery(GL_PRIMITIVES_GENERATED);
1109 gl.endConditionalRender();
1110 gl.getQueryObjectuiv(checker_query, GL_QUERY_RESULT, &check_result);
1111 if (check_result != (GLuint)expected)
1116 // Verify that an inverted conditional render discards the rendering if
1117 // the expected result is TRUE and renders otherwise.
1118 if (supportsConditionalRenderInverted())
1120 gl.beginConditionalRender(query, GL_QUERY_WAIT_INVERTED);
1121 gl.beginQuery(GL_PRIMITIVES_GENERATED, checker_query);
1122 gl.drawArrays(GL_POINTS, 0, 1);
1123 gl.endQuery(GL_PRIMITIVES_GENERATED);
1124 gl.endConditionalRender();
1125 gl.getQueryObjectuiv(checker_query, GL_QUERY_RESULT, &check_result);
1126 if (check_result == (GLuint)expected)
1132 gl.useProgram(current_program);
1134 // Verify that the result of the query matches the expected result.
1135 gl.getQueryObjectuiv(query, GL_QUERY_RESULT, &actual);
1136 if ((GLboolean)actual != expected)
1141 // Verify that the result of the query matches the expected result even
1142 // when using a query buffer.
1143 if (supportsQueryBufferObject())
1145 const GLuint initValue = 0xDEADBEEF;
1147 gl.genBuffers(1, &m_query_buffer);
1148 gl.bindBuffer(GL_QUERY_BUFFER, m_query_buffer);
1149 gl.bufferData(GL_QUERY_BUFFER, sizeof(initValue), &initValue, GL_STREAM_READ);
1150 gl.getQueryObjectuiv(query, GL_QUERY_RESULT, NULL);
1151 gl.getBufferSubData(GL_QUERY_BUFFER, 0, sizeof(actual), &actual);
1152 gl.deleteBuffers(1, &m_query_buffer);
1154 if ((GLboolean)actual != expected)
1160 gl.deleteQueries(1, &checker_query);
1165 /* Verifies the result of all queries. There can only be up to 5 non-FALSE result queries as none of
1166 the tests use more than 4 vertex streams so the rest is assumed to always have a FALSE result. */
1167 void verifyQueryResults(GLboolean any, GLboolean stream0, GLboolean stream1, GLboolean stream2 = GL_FALSE,
1168 GLboolean stream3 = GL_FALSE)
1172 // Verify the result of the TRANSFORM_FEEDBACK_OVERFLOW_ARB query.
1173 result &= verifyQueryResult(m_overflow_query, any);
1175 if (supportsTransformFeedback3())
1177 // Verify the result of the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB queries
1178 // corresponding to the first 4 vertex streams.
1179 result &= verifyQueryResult(m_stream_overflow_query[0], stream0);
1180 result &= verifyQueryResult(m_stream_overflow_query[1], stream1);
1181 result &= verifyQueryResult(m_stream_overflow_query[2], stream2);
1182 result &= verifyQueryResult(m_stream_overflow_query[3], stream3);
1184 // Expect the rest of the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB queries
1185 // to have a FALSE result.
1186 for (GLuint i = 4; i < getMaxVertexStreams(); ++i)
1188 result &= verifyQueryResult(m_stream_overflow_query[i], GL_FALSE);
1194 TCU_FAIL("Failed to validate the results of the queries");
1198 /* Single stream version of verifyQueryResults */
1199 void verifyQueryResults(GLboolean result)
1201 verifyQueryResults(result, result, GL_FALSE, GL_FALSE, GL_FALSE);
1204 /* Compiles and links transform feedback program. */
1205 void buildTransformFeedbackProgram()
1207 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1211 m_program = gl.createProgram();
1213 const char* vsSource = transformFeedbackVertexShader();
1215 GLuint vShader = gl.createShader(GL_VERTEX_SHADER);
1216 gl.shaderSource(vShader, 1, (const char**)&vsSource, NULL);
1217 gl.compileShader(vShader);
1218 gl.getShaderiv(vShader, GL_COMPILE_STATUS, &status);
1219 if (status == GL_FALSE)
1221 GLint infoLogLength = 0;
1222 gl.getShaderiv(vShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1224 std::vector<char> infoLogBuf(infoLogLength + 1);
1225 gl.getShaderInfoLog(vShader, (GLsizei)infoLogBuf.size(), NULL, &infoLogBuf[0]);
1227 std::string infoLog = &infoLogBuf[0];
1228 m_testCtx.getLog().writeShader(QP_SHADER_TYPE_VERTEX, vsSource, false, infoLog.c_str());
1230 gl.deleteShader(vShader);
1232 TCU_FAIL("Failed to compile transform feedback vertex shader");
1234 gl.attachShader(m_program, vShader);
1235 gl.deleteShader(vShader);
1237 const char* gsSource = transformFeedbackGeometryShader();
1241 GLuint gShader = gl.createShader(GL_GEOMETRY_SHADER);
1242 gl.shaderSource(gShader, 1, (const char**)&gsSource, NULL);
1243 gl.compileShader(gShader);
1244 gl.getShaderiv(gShader, GL_COMPILE_STATUS, &status);
1245 if (status == GL_FALSE)
1247 GLint infoLogLength = 0;
1248 gl.getShaderiv(gShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1250 std::vector<char> infoLogBuf(infoLogLength + 1);
1251 gl.getShaderInfoLog(gShader, (GLsizei)infoLogBuf.size(), NULL, &infoLogBuf[0]);
1253 std::string infoLog = &infoLogBuf[0];
1254 m_testCtx.getLog().writeShader(QP_SHADER_TYPE_GEOMETRY, gsSource, false, infoLog.c_str());
1256 gl.deleteShader(gShader);
1258 TCU_FAIL("Failed to compile transform feedback geometry shader");
1260 gl.attachShader(m_program, gShader);
1261 gl.deleteShader(gShader);
1264 gl.transformFeedbackVaryings(m_program, varyingsCount(), varyings(), bufferMode());
1265 gl.linkProgram(m_program);
1266 gl.getProgramiv(m_program, GL_LINK_STATUS, &status);
1267 if (status == GL_FALSE)
1269 GLint infoLogLength = 0;
1270 gl.getProgramiv(m_program, GL_INFO_LOG_LENGTH, &infoLogLength);
1272 std::vector<char> infoLogBuf(infoLogLength + 1);
1273 gl.getProgramInfoLog(m_program, (GLsizei)infoLogBuf.size(), NULL, &infoLogBuf[0]);
1275 std::string infoLog = &infoLogBuf[0];
1276 m_testCtx.getLog().writeShader(QP_SHADER_TYPE_VERTEX, vsSource, true, infoLog.c_str());
1278 TCU_FAIL("Failed to link transform feedback program");
1281 gl.useProgram(m_program);
1284 /* Generates a number of transform feedback buffers and binds them. */
1285 void setupTransformFeedbackBuffers()
1287 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1289 m_tf_buffer_count = bufferCount();
1291 m_tf_buffer = new GLuint[m_tf_buffer_count];
1293 gl.genBuffers(m_tf_buffer_count, m_tf_buffer);
1295 for (GLint i = 0; i < m_tf_buffer_count; ++i)
1297 gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, i, m_tf_buffer[i]);
1298 gl.bufferData(GL_TRANSFORM_FEEDBACK_BUFFER, bufferSize(i), NULL, GL_DYNAMIC_COPY);
1302 /* Starts all overflow queries. */
1305 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1307 gl.beginQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, m_overflow_query);
1309 if (supportsTransformFeedback3())
1311 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
1313 gl.beginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i, m_stream_overflow_query[i]);
1318 /* Stops all overflow queries. */
1321 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1323 gl.endQuery(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB);
1325 if (supportsTransformFeedback3())
1327 for (GLuint i = 0; i < getMaxVertexStreams(); ++i)
1329 gl.endQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, i);
1334 /* Draws a set of points to vertex stream #0 while having the overflow queries active. */
1335 void drawPoints(GLsizei count)
1337 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1340 gl.drawArrays(GL_POINTS, 0, count);
1344 /* Draws a set of triangles to vertex stream #0 while having the overflow queries active. */
1345 void drawTriangles(GLsizei count)
1347 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1350 gl.drawArrays(GL_TRIANGLES, 0, count * 3);
1354 /* Vertex shader to use for transform feedback. */
1355 virtual const char* transformFeedbackVertexShader() = 0;
1357 /* Geometry shader to use for transform feedback. */
1358 virtual const char* transformFeedbackGeometryShader() = 0;
1360 /* Returns the number of transform feedback varyings. */
1361 virtual GLsizei varyingsCount() = 0;
1363 /* Returns the array of transform feedback varying names. */
1364 virtual const char** varyings() = 0;
1366 /* Returns the transform feedback buffer mode. */
1367 virtual GLenum bufferMode() = 0;
1369 /* Returns the number of transform feedback buffers. */
1370 virtual GLsizei bufferCount() = 0;
1372 /* Returns the size of the specified transform feedback buffer. */
1373 virtual GLsizei bufferSize(GLint index) = 0;
1376 GLuint m_overflow_query;
1377 GLuint* m_stream_overflow_query;
1378 GLuint m_query_buffer;
1379 GLsizei m_tf_buffer_count;
1380 GLuint* m_tf_buffer;
1383 glu::ShaderProgram* m_checker_program;
1387 Base class for all single stream test cases.
1389 class TransformFeedbackOverflowQuerySingleStreamBase : public TransformFeedbackOverflowQueryFunctionalBase
1392 TransformFeedbackOverflowQuerySingleStreamBase(deqp::Context& context, TransformFeedbackOverflowQueryTests::API api,
1393 const char* name, const char* description)
1394 : TransformFeedbackOverflowQueryFunctionalBase(context, api, name, description)
1398 /* Vertex shader to use for transform feedback. */
1399 virtual const char* transformFeedbackVertexShader()
1401 return "#version 150 core\n"
1402 "out float output1;\n"
1403 "out float output2;\n"
1404 "out float output3;\n"
1405 "out float output4;\n"
1414 /* No geometry shader for single stream test cases. */
1415 virtual const char* transformFeedbackGeometryShader()
1420 /* There are a total of 4 varyings. */
1421 virtual GLsizei varyingsCount()
1426 /* The varying name list contains all outputs in order. */
1427 virtual const char** varyings()
1429 static const char* vars[] = { "output1", "output2", "output3", "output4" };
1435 Test case #1 - Basic single stream, interleaved attributes.
1437 class TransformFeedbackOverflowQueryBasicSingleStreamInterleavedAttribs
1438 : public TransformFeedbackOverflowQuerySingleStreamBase
1441 TransformFeedbackOverflowQueryBasicSingleStreamInterleavedAttribs(deqp::Context& context,
1442 TransformFeedbackOverflowQueryTests::API api,
1444 : TransformFeedbackOverflowQuerySingleStreamBase(context, api, name,
1445 "Basic single stream, interleaved attributes.")
1449 /* Use interleaved attributes. */
1450 virtual GLenum bufferMode()
1452 return GL_INTERLEAVED_ATTRIBS;
1455 /* A single transform feedback buffer is enough. */
1456 virtual GLsizei bufferCount()
1461 /* The transform feedback buffer should be able to capture exactly 10 vertices. */
1462 virtual GLsizei bufferSize(GLint index)
1465 return static_cast<GLsizei>(10 * sizeof(GLfloat) * varyingsCount());
1468 /* Test case iterate function. Contains the actual test case logic. */
1469 IterateResult iterate()
1471 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1473 // Call BeginTransformFeedback with mode POINTS.
1474 gl.beginTransformFeedback(GL_POINTS);
1476 // Start the query, submit draw that results in feeding back exactly 10
1477 // points, then stop the query.
1480 // Call EndTransformFeedback.
1481 gl.endTransformFeedback();
1483 // Use the basic checking mechanism to validate that the result of the
1485 verifyQueryResults(GL_FALSE);
1487 // Repeat the above steps, but this time feed back more than 10 vertices
1488 // and expect the result of the query to be TRUE.
1489 gl.beginTransformFeedback(GL_POINTS);
1491 gl.endTransformFeedback();
1492 verifyQueryResults(GL_TRUE);
1494 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1501 Test case #2 - Basic single stream, separate attributes.
1503 class TransformFeedbackOverflowQueryBasicSingleStreamSeparateAttribs
1504 : public TransformFeedbackOverflowQuerySingleStreamBase
1507 TransformFeedbackOverflowQueryBasicSingleStreamSeparateAttribs(deqp::Context& context,
1508 TransformFeedbackOverflowQueryTests::API api,
1510 : TransformFeedbackOverflowQuerySingleStreamBase(context, api, name,
1511 "Basic single stream, separate attributes.")
1515 /* Use separate attributes. */
1516 virtual GLenum bufferMode()
1518 return GL_SEPARATE_ATTRIBS;
1521 /* We need a separate buffer for each varying. */
1522 virtual GLsizei bufferCount()
1524 return varyingsCount();
1527 /* One of the transform feedback buffers should be able to capture exactly 12 vertices,
1528 the others should be able to capture at least 15 vertices. */
1529 virtual GLsizei bufferSize(GLint index)
1533 return 12 * sizeof(GLfloat);
1537 return 15 * sizeof(GLfloat);
1541 /* Test case iterate function. Contains the actual test case logic. */
1542 IterateResult iterate()
1544 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1546 // Call BeginTransformFeedback with mode TRIANGLES.
1547 gl.beginTransformFeedback(GL_TRIANGLES);
1549 // Start the query, submit draw that results in feeding back exactly 4
1550 // triangles, then stop the query.
1553 // Call EndTransformFeedback.
1554 gl.endTransformFeedback();
1556 // Use the basic checking mechanism to validate that the result of the
1558 verifyQueryResults(GL_FALSE);
1560 // Repeat the above steps, but this time feed back exactly 5 triangles
1561 // and expect the result of the query to be TRUE.
1562 gl.beginTransformFeedback(GL_TRIANGLES);
1564 gl.endTransformFeedback();
1565 verifyQueryResults(GL_TRUE);
1567 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1574 Test case #3 - Advanced single stream, interleaved attributes.
1576 class TransformFeedbackOverflowQueryAdvancedSingleStreamInterleavedAttribs
1577 : public TransformFeedbackOverflowQuerySingleStreamBase
1580 TransformFeedbackOverflowQueryAdvancedSingleStreamInterleavedAttribs(deqp::Context& context,
1581 TransformFeedbackOverflowQueryTests::API api,
1583 : TransformFeedbackOverflowQuerySingleStreamBase(context, api, name,
1584 "Advanced single stream, interleaved attributes.")
1588 /* Use interleaved attributes. */
1589 virtual GLenum bufferMode()
1591 return GL_INTERLEAVED_ATTRIBS;
1594 /* A single transform feedback buffer is enough. */
1595 virtual GLsizei bufferCount()
1600 /* The transform feedback buffer should be able to capture exactly 10 vertices. */
1601 virtual GLsizei bufferSize(GLint index)
1604 return static_cast<GLsizei>(10 * sizeof(GLfloat) * varyingsCount());
1607 /* Test case iterate function. Contains the actual test case logic. */
1608 IterateResult iterate()
1610 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1612 // If GL 4.0 and ARB_transform_feedback2 are not supported then skip this
1614 if (!supportsTransformFeedback2())
1616 throw tcu::NotSupportedError("Required transform_feedback2 extension is not supported");
1619 // Call BeginTransformFeedback with mode POINTS.
1620 gl.beginTransformFeedback(GL_POINTS);
1622 // Start the query, submit draw that results in feeding back exactly 8
1623 // triangles, then stop the query.
1626 // Call PauseTransformFeedback.
1627 gl.pauseTransformFeedback();
1629 // Use the basic checking mechanism to validate that the result of the
1631 verifyQueryResults(GL_FALSE);
1633 // Start the query, submit draw that would result in feeding back more than
1634 // 10 points if transform feedback wasn't paused, then stop the query.
1637 // Use the basic checking mechanism to validate that the result of the
1639 verifyQueryResults(GL_FALSE);
1641 // Call ResumeTransformFeedback.
1642 gl.resumeTransformFeedback();
1644 // Start the query, submit draw that results in feeding back exactly 1
1645 // point, then stop the query.
1648 // Call PauseTransformFeedback.
1649 gl.pauseTransformFeedback();
1651 // Use the basic checking mechanism to validate that the result of the
1653 verifyQueryResults(GL_FALSE);
1655 // Call ResumeTransformFeedback.
1656 gl.resumeTransformFeedback();
1658 // Start the query, submit draw that results in feeding back exactly 2
1659 // point, then stop the query.
1662 // Call EndTransformFeedback.
1663 gl.endTransformFeedback();
1665 // Use the basic checking mechanism to validate that the result of the
1667 verifyQueryResults(GL_TRUE);
1669 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1676 Test case #4 - Advanced single stream, separate attributes.
1678 class TransformFeedbackOverflowQueryAdvancedSingleStreamSeparateAttribs
1679 : public TransformFeedbackOverflowQuerySingleStreamBase
1682 TransformFeedbackOverflowQueryAdvancedSingleStreamSeparateAttribs(deqp::Context& context,
1683 TransformFeedbackOverflowQueryTests::API api,
1685 : TransformFeedbackOverflowQuerySingleStreamBase(context, api, name,
1686 "Advanced single stream, separate attributes.")
1690 /* Use separate attributes. */
1691 virtual GLenum bufferMode()
1693 return GL_SEPARATE_ATTRIBS;
1696 /* We need a separate buffer for each varying. */
1697 virtual GLsizei bufferCount()
1699 return varyingsCount();
1702 /* One of the transform feedback buffers should be able to capture exactly 12 vertices,
1703 the others should be able to capture at least 15 vertices. */
1704 virtual GLsizei bufferSize(GLint index)
1708 return 12 * sizeof(GLfloat);
1712 return 15 * sizeof(GLfloat);
1716 /* Test case iterate function. Contains the actual test case logic. */
1717 IterateResult iterate()
1719 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1721 // If GL 4.0 and ARB_transform_feedback2 are not supported then skip this
1723 if (!supportsTransformFeedback2())
1725 throw tcu::NotSupportedError("Required transform_feedback2 extension is not supported");
1728 // Call BeginTransformFeedback with mode TRIANGLES.
1729 gl.beginTransformFeedback(GL_TRIANGLES);
1731 // Start the query, submit draw that results in feeding back exactly 2
1732 // triangles, then stop the query.
1735 // Call PauseTransformFeedback.
1736 gl.pauseTransformFeedback();
1738 // Use the basic checking mechanism to validate that the result of the
1740 verifyQueryResults(GL_FALSE);
1742 // Start the query, submit draw that would result in feeding back more than
1743 // 4 triangles if transform feedback wasn't paused, then stop the query.
1746 // Use the basic checking mechanism to validate that the result of the
1748 verifyQueryResults(GL_FALSE);
1750 // Call ResumeTransformFeedback.
1751 gl.resumeTransformFeedback();
1753 // Start the query, submit draw that results in feeding back exactly 2
1754 // triangles, then stop the query.
1757 // Call PauseTransformFeedback.
1758 gl.pauseTransformFeedback();
1760 // Use the basic checking mechanism to validate that the result of the
1762 verifyQueryResults(GL_FALSE);
1764 // Call ResumeTransformFeedback.
1765 gl.resumeTransformFeedback();
1767 // Start the query, submit draw that results in feeding back exactly 1
1768 // triangles, then stop the query.
1771 // Call EndTransformFeedback.
1772 gl.endTransformFeedback();
1774 // Use the basic checking mechanism to validate that the result of the
1776 verifyQueryResults(GL_TRUE);
1778 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1785 Base class for all multiple stream test cases.
1787 class TransformFeedbackOverflowQueryMultipleStreamsBase : public TransformFeedbackOverflowQueryFunctionalBase
1790 TransformFeedbackOverflowQueryMultipleStreamsBase(deqp::Context& context,
1791 TransformFeedbackOverflowQueryTests::API api, const char* name,
1792 const char* description)
1793 : TransformFeedbackOverflowQueryFunctionalBase(context, api, name, description)
1797 /* Vertex shader to use for transform feedback. */
1798 virtual const char* transformFeedbackVertexShader()
1800 return "#version 150 core\n"
1805 /* Use interleaved attributes. */
1806 virtual GLenum bufferMode()
1808 return GL_INTERLEAVED_ATTRIBS;
1811 /* Always use 4 transform feedback buffers. */
1812 virtual GLsizei bufferCount()
1817 /* Draws a set of points to each vertex stream while having the overflow queries active. */
1818 void drawStreams(GLsizei count0, GLsizei count1 = 0, GLsizei count2 = 0, GLsizei count3 = 0)
1820 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1822 GLint streamLoc = gl.getUniformLocation(m_program, "stream");
1826 gl.uniform1ui(streamLoc, 0);
1827 gl.drawArrays(GL_POINTS, 0, count0);
1829 gl.uniform1ui(streamLoc, 1);
1830 gl.drawArrays(GL_POINTS, 0, count1);
1832 gl.uniform1ui(streamLoc, 2);
1833 gl.drawArrays(GL_POINTS, 0, count2);
1835 gl.uniform1ui(streamLoc, 3);
1836 gl.drawArrays(GL_POINTS, 0, count3);
1843 Test case #5 - Advanced multiple streams, one buffer per stream.
1845 class TransformFeedbackOverflowQueryMultipleStreamsOneBufferPerStream
1846 : public TransformFeedbackOverflowQueryMultipleStreamsBase
1849 TransformFeedbackOverflowQueryMultipleStreamsOneBufferPerStream(deqp::Context& context,
1850 TransformFeedbackOverflowQueryTests::API api,
1852 : TransformFeedbackOverflowQueryMultipleStreamsBase(context, api, name,
1853 "Advanced multiple streams, one buffer per stream.")
1857 /* Geometry shader to use for transform feedback. */
1858 virtual const char* transformFeedbackGeometryShader()
1860 return "#version 150 core\n"
1861 "#extension GL_ARB_gpu_shader5 : require\n"
1862 "layout(points) in;\n"
1863 "layout(points, max_vertices = 1) out;\n"
1864 "layout(stream=0) out float output1;\n"
1865 "layout(stream=1) out float output2;\n"
1866 "layout(stream=2) out float output3;\n"
1867 "layout(stream=3) out float output4;\n"
1868 "uniform uint stream;\n"
1870 " if (stream == 0) {\n"
1872 " EmitStreamVertex(0);\n"
1873 " EndStreamPrimitive(0);\n"
1875 " if (stream == 1) {\n"
1877 " EmitStreamVertex(1);\n"
1878 " EndStreamPrimitive(1);\n"
1880 " if (stream == 2) {\n"
1882 " EmitStreamVertex(2);\n"
1883 " EndStreamPrimitive(2);\n"
1885 " if (stream == 3) {\n"
1887 " EmitStreamVertex(3);\n"
1888 " EndStreamPrimitive(3);\n"
1893 /* Together with the separators there are a total of 7 varyings. */
1894 virtual GLsizei varyingsCount()
1899 /* Each output goes to different buffer. The mapping between vertex stream outputs and transform feedback buffers is non-identity. */
1900 virtual const char** varyings()
1902 static const char* vars[] = { "output4", "gl_NextBuffer", "output3", "gl_NextBuffer",
1903 "output2", "gl_NextBuffer", "output1" };
1907 /* The size of the transform feedback buffers should be enough to be able to capture exactly 10 vertices for each vertex stream. */
1908 virtual GLsizei bufferSize(GLint index)
1911 return 10 * sizeof(GLfloat);
1914 /* Test case iterate function. Contains the actual test case logic. */
1915 IterateResult iterate()
1917 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1919 // If GL 4.0 and ARB_transform_feedback3 are not supported then skip this
1921 if (!supportsTransformFeedback3())
1923 throw tcu::NotSupportedError("Required transform_feedback3 extension is not supported");
1926 // If GL 4.0 and ARB_gpu_shader5 are not supported then skip this
1928 if (!supportsGpuShader5())
1930 throw tcu::NotSupportedError("Required gpu_shader5 extension is not supported");
1933 // Call BeginTransformFeedback with mode POINTS.
1934 gl.beginTransformFeedback(GL_POINTS);
1936 // Start all queries, submit draw that results in feeding back exactly 8
1937 // points for all four vertex streams, then stop the queries.
1938 drawStreams(8, 8, 8, 8);
1940 // Call PauseTransformFeedback.
1941 gl.pauseTransformFeedback();
1943 // Use the basic checking mechanism to validate that the result of the
1944 // queries are all FALSE.
1945 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1947 // Start the queries, submit draw that would result in feeding back more
1948 // than 10 points for all four vertex streams if transform feedback wasn't
1949 // paused, then stop the queries.
1950 drawStreams(11, 11, 11, 11);
1952 // Use the basic checking mechanism to validate that the result of the
1953 // queries are all FALSE.
1954 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1956 // Call ResumeTransformFeedback.
1957 gl.resumeTransformFeedback();
1959 // Start the queries, submit draw that results in feeding back exactly 3
1960 // points only for vertex streams #1 and #3, then stop the queries.
1961 drawStreams(0, 3, 0, 3);
1963 // Call PauseTransformFeedback.
1964 gl.pauseTransformFeedback();
1966 // Use the basic checking mechanism to validate that the result of the
1967 // queries are all FALSE, except for the TRANSFORM_FEEDBACK_OVERFLOW_ARB
1968 // query, and the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB queries for
1969 // vertex streams #1 and #3, which should have a TRUE result.
1970 verifyQueryResults(GL_TRUE, GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE);
1972 // Call ResumeTransformFeedback.
1973 gl.resumeTransformFeedback();
1975 // Start the queries, submit draw that results in feeding back exactly 2
1976 // points only for vertex streams #0 and #2, then stop the queries.
1977 drawStreams(2, 0, 2, 0);
1979 // Call PauseTransformFeedback.
1980 gl.pauseTransformFeedback();
1982 // Use the basic checking mechanism to validate that the result of the
1983 // queries are all FALSE.
1984 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1986 // Call ResumeTransformFeedback.
1987 gl.resumeTransformFeedback();
1989 // Start the queries, submit draw that results in feeding back exactly 1
1990 // point for vertex streams #2 and #3, then stop the queries.
1991 drawStreams(0, 0, 1, 1);
1993 // Call EndTransformFeedback.
1994 gl.endTransformFeedback();
1996 // Use the basic checking mechanism to validate that the result of the
1997 // queries are all FALSE, except for the TRANSFORM_FEEDBACK_OVERFLOW_ARB
1998 // query, and the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB queries for
1999 // vertex streams #2 and #3, which should have a TRUE result.
2000 verifyQueryResults(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE);
2002 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2009 Test case #6 - Advanced multiple streams, multiple buffers per stream.
2011 class TransformFeedbackOverflowQueryMultipleStreamsMultipleBufferPerStream
2012 : public TransformFeedbackOverflowQueryMultipleStreamsBase
2015 TransformFeedbackOverflowQueryMultipleStreamsMultipleBufferPerStream(deqp::Context& context,
2016 TransformFeedbackOverflowQueryTests::API api,
2018 : TransformFeedbackOverflowQueryMultipleStreamsBase(context, api, name,
2019 "Advanced multiple streams, multiple buffers per stream.")
2023 /* Geometry shader to use for transform feedback. */
2024 virtual const char* transformFeedbackGeometryShader()
2026 return "#version 150 core\n"
2027 "#extension GL_ARB_gpu_shader5 : require\n"
2028 "layout(points) in;\n"
2029 "layout(points, max_vertices = 1) out;\n"
2030 "layout(stream=0) out float output1;\n"
2031 "layout(stream=0) out float output2;\n"
2032 "layout(stream=1) out float output3;\n"
2033 "layout(stream=1) out float output4;\n"
2034 "uniform uint stream;\n"
2036 " if (stream == 0) {\n"
2039 " EmitStreamVertex(0);\n"
2040 " EndStreamPrimitive(0);\n"
2042 " if (stream == 1) {\n"
2045 " EmitStreamVertex(1);\n"
2046 " EndStreamPrimitive(1);\n"
2051 /* Together with the separators there are a total of 7 varyings. */
2052 virtual GLsizei varyingsCount()
2057 /* Vertex stream #0 is captured by transform feedback buffers #1 and #2, while
2058 vertex stream #1 is captured by transform feedback buffers #3 and #0. */
2059 virtual const char** varyings()
2061 static const char* vars[] = { "output4", "gl_NextBuffer", "output1", "gl_NextBuffer",
2062 "output2", "gl_NextBuffer", "output3" };
2066 /* Transform feedback buffers #0 and #1 should be able to capture exactly 10 vertices, while
2067 transform feedback buffers #2 and #3 should be able to capture exactly 20 vertices. */
2068 virtual GLsizei bufferSize(GLint index)
2072 return 10 * sizeof(GLfloat);
2076 return 20 * sizeof(GLfloat);
2080 /* Test case iterate function. Contains the actual test case logic. */
2081 IterateResult iterate()
2083 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
2085 // If GL 4.0 and ARB_transform_feedback3 are not supported then skip this
2087 if (!supportsTransformFeedback3())
2089 throw tcu::NotSupportedError("Required transform_feedback3 extension is not supported");
2092 // If GL 4.0 and ARB_gpu_shader5 are not supported then skip this
2094 if (!supportsGpuShader5())
2096 throw tcu::NotSupportedError("Required gpu_shader5 extension is not supported");
2099 // Call BeginTransformFeedback with mode POINTS.
2100 gl.beginTransformFeedback(GL_POINTS);
2102 // Start all queries, submit draw that results in feeding back exactly 8
2103 // points to both vertex streams, then stop the queries.
2106 // Call PauseTransformFeedback.
2107 gl.pauseTransformFeedback();
2109 // Use the basic checking mechanism to validate that the result of the
2110 // queries are all FALSE.
2111 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE);
2113 // Start the queries, submit draw that would result in feeding back more
2114 // than 10 points for both vertex streams if transform feedback wasn't
2115 // paused, then stop the queries.
2116 drawStreams(11, 11);
2118 // Use the basic checking mechanism to validate that the result of the
2119 // queries are all FALSE.
2120 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE);
2122 // Call ResumeTransformFeedback.
2123 gl.resumeTransformFeedback();
2125 // Start the queries, submit draw that results in feeding back exactly 1
2126 // point for vertex stream #0 and exactly 3 points for vertex stream #1,
2127 // then stop the queries.
2130 // Call PauseTransformFeedback.
2131 gl.pauseTransformFeedback();
2133 // Use the basic checking mechanism to validate that the result of the
2134 // queries are all FALSE, except for the TRANSFORM_FEEDBACK_OVERFLOW_ARB
2135 // query, and the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB query for vertex
2136 // stream #1, which should have a TRUE result.
2137 verifyQueryResults(GL_TRUE, GL_FALSE, GL_TRUE);
2139 // Call ResumeTransformFeedback.
2140 gl.resumeTransformFeedback();
2142 // Start the queries, submit draw that results in feeding back exactly 1
2143 // point only for vertex stream #0, then stop the queries.
2146 // Call PauseTransformFeedback.
2147 gl.pauseTransformFeedback();
2149 // Use the basic checking mechanism to validate that the result of the
2150 // queries are all FALSE.
2151 verifyQueryResults(GL_FALSE, GL_FALSE, GL_FALSE);
2153 // Call ResumeTransformFeedback.
2154 gl.resumeTransformFeedback();
2156 // Start the queries, submit draw that results in feeding back exactly 1
2157 // point for vertex streams #0 and #1, then stop the queries.
2160 // Call EndTransformFeedback.
2161 gl.endTransformFeedback();
2163 // Use the basic checking mechanism to validate that the result of the
2164 // queries are all FALSE, except for the TRANSFORM_FEEDBACK_OVERFLOW_ARB
2165 // query, and the TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB queries for
2166 // vertex streams #0 and #1, which should have a TRUE result.
2167 verifyQueryResults(GL_TRUE, GL_TRUE, GL_TRUE);
2169 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2175 const char* apiToTestName(TransformFeedbackOverflowQueryTests::API api)
2179 case TransformFeedbackOverflowQueryTests::API_GL_ARB_transform_feedback_overflow_query:
2180 return "transform_feedback_overflow_query_ARB";
2188 * @param context Rendering context.
2189 * @param api API to test (core vs ARB extension)
2191 TransformFeedbackOverflowQueryTests::TransformFeedbackOverflowQueryTests(deqp::Context& context, API api)
2192 : TestCaseGroup(context, apiToTestName(api), "Verifies \"transform_feedback_overflow_query\" functionality")
2195 /* Left blank on purpose */
2201 TransformFeedbackOverflowQueryTests::~TransformFeedbackOverflowQueryTests()
2205 /** Initializes the texture_barrier test group.
2208 void TransformFeedbackOverflowQueryTests::init(void)
2210 addChild(new TransformFeedbackOverflowQueryImplDepState(m_context, m_api, "implementation-dependent-state"));
2211 addChild(new TransformFeedbackOverflowQueryDefaultState(m_context, m_api, "default-context-state"));
2212 addChild(new TransformFeedbackOverflowQueryStateUpdate(m_context, m_api, "context-state-update"));
2213 addChild(new TransformFeedbackOverflowQueryErrorInvalidIndex(m_context, m_api, "error-invalid-index"));
2214 addChild(new TransformFeedbackOverflowQueryErrorAlreadyActive(m_context, m_api, "error-already-active"));
2215 addChild(new TransformFeedbackOverflowQueryErrorIncompatibleTarget(m_context, m_api, "error-incompatible-target"));
2216 addChild(new TransformFeedbackOverflowQueryErrorNoActiveQuery(m_context, m_api, "error-no-active-query"));
2217 addChild(new TransformFeedbackOverflowQueryBasicSingleStreamInterleavedAttribs(
2218 m_context, m_api, "basic-single-stream-interleaved-attribs"));
2219 addChild(new TransformFeedbackOverflowQueryBasicSingleStreamSeparateAttribs(
2220 m_context, m_api, "basic-single-stream-separate-attribs"));
2221 addChild(new TransformFeedbackOverflowQueryAdvancedSingleStreamInterleavedAttribs(
2222 m_context, m_api, "advanced-single-stream-interleaved-attribs"));
2223 addChild(new TransformFeedbackOverflowQueryAdvancedSingleStreamSeparateAttribs(
2224 m_context, m_api, "advanced-single-stream-separate-attribs"));
2225 addChild(new TransformFeedbackOverflowQueryMultipleStreamsOneBufferPerStream(
2226 m_context, m_api, "multiple-streams-one-buffer-per-stream"));
2227 addChild(new TransformFeedbackOverflowQueryMultipleStreamsMultipleBufferPerStream(
2228 m_context, m_api, "multiple-streams-multiple-buffers-per-stream"));
2230 } /* glcts namespace */