Add timer query handle reuse test for opengl es
authorJari Komppa <jari.komppa@siru.fi>
Tue, 11 May 2021 06:52:45 +0000 (09:52 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 3 Jun 2021 08:58:04 +0000 (08:58 +0000)
This change adds base class for disjoint_timer_query tests
as well as test for handle reuse which was ported from the
GL4+ version.

New test: KHR-GLESEXT.disjoint_timer_query.handle_reuse

Components: OpenGL
VK-GL-CTS issue: 2911

Change-Id: I44421813a5de510e52fb6e1109fb2863856351c6

external/openglcts/modules/glesext/CMakeLists.txt
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.cpp [new file with mode: 0644]
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.hpp [new file with mode: 0644]
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.cpp [new file with mode: 0644]
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.hpp [new file with mode: 0644]
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.cpp [new file with mode: 0644]
external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.hpp [new file with mode: 0644]
external/openglcts/modules/glesext/esextcTestCaseBase.hpp
external/openglcts/modules/glesext/esextcTestPackage.cpp

index 536b4bc..d73a8db 100644 (file)
@@ -9,6 +9,12 @@ set(GLCTS_ESEXT_SRCS
     esextcTestCaseBase.hpp
     esextcTestPackage.cpp
     esextcTestPackage.hpp
+    disjoint_timer_query/esextcDisjointTimerQueryBase.cpp
+    disjoint_timer_query/esextcDisjointTimerQueryBase.hpp
+    disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.cpp
+    disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.hpp
+    disjoint_timer_query/esextcDisjointTimerQueryTests.cpp
+    disjoint_timer_query/esextcDisjointTimerQueryTests.cpp
     draw_buffers_indexed/esextcDrawBuffersIndexedBase.cpp
     draw_buffers_indexed/esextcDrawBuffersIndexedBase.hpp
     draw_buffers_indexed/esextcDrawBuffersIndexedCoverage.cpp
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.cpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.cpp
new file mode 100644 (file)
index 0000000..e28500d
--- /dev/null
@@ -0,0 +1,65 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextDisjointTimerQueryBase.cpp
+ * \brief Base class for Timer query tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "esextcDisjointTimerQueryBase.hpp"
+#include "gluContextInfo.hpp"
+#include "gluDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+#include "tcuTestLog.hpp"
+#include <vector>
+
+namespace glcts
+{
+
+/** Constructor
+ *
+ *  @param context     Test context
+ *  @param name        Test case's name
+ *  @param description Test case's description
+ **/
+DisjointTimerQueryBase::DisjointTimerQueryBase (Context& context, const ExtParameters& extParams,
+                                                                                           const char* name, const char* description)
+       : TestCaseBase(context, extParams, name, description)
+{
+       glGenQueriesEXT                         = (glGenQueriesEXTFunc)context.getRenderContext().getProcAddress("glGenQueriesEXT");
+       glDeleteQueriesEXT                      = (glDeleteQueriesEXTFunc)context.getRenderContext().getProcAddress("glDeleteQueriesEXT");
+       glIsQueryEXT                            = (glIsQueryEXTFunc)context.getRenderContext().getProcAddress("glIsQueryEXT");
+       glBeginQueryEXT                         = (glBeginQueryEXTFunc)context.getRenderContext().getProcAddress("glBeginQueryEXT");
+       glEndQueryEXT                           = (glEndQueryEXTFunc)context.getRenderContext().getProcAddress("glEndQueryEXT");
+       glQueryCounterEXT                       = (glQueryCounterEXTFunc)context.getRenderContext().getProcAddress("glQueryCounterEXT");
+       glGetQueryivEXT                         = (glGetQueryivEXTFunc)context.getRenderContext().getProcAddress("glGetQueryivEXT");
+       glGetQueryObjectivEXT           = (glGetQueryObjectivEXTFunc)context.getRenderContext().getProcAddress("glGetQueryObjectivEXT");
+       glGetQueryObjectuivEXT          = (glGetQueryObjectuivEXTFunc)context.getRenderContext().getProcAddress("glGetQueryObjectuivEXT");
+       glGetQueryObjecti64vEXT         = (glGetQueryObjecti64vEXTFunc)context.getRenderContext().getProcAddress("glGetQueryObjecti64vEXT");
+       glGetQueryObjectui64vEXT        = (glGetQueryObjectui64vEXTFunc)context.getRenderContext().getProcAddress("glGetQueryObjectui64vEXT");
+       glGetInteger64vEXT                      = (glGetInteger64vEXTFunc)context.getRenderContext().getProcAddress("glGetInteger64vEXT");
+}
+
+} // namespace glcts
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.hpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryBase.hpp
new file mode 100644 (file)
index 0000000..0dbc966
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef _ESEXTCDISJOINTTIMERQUERYBASE_HPP
+#define _ESEXTCDISJOINTTIMERQUERYBASE_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextcDisjointTimerQueryBase.hpp
+ * \brief Base class for timer query tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "../esextcTestCaseBase.hpp"
+#include "glw.h"
+
+namespace glcts
+{
+
+class DisjointTimerQueryBase : public TestCaseBase
+{
+public:
+       DisjointTimerQueryBase                  (Context& context, const ExtParameters& extParams, const char* name,
+                                                                        const char* description);
+
+       virtual ~DisjointTimerQueryBase ()
+       {
+       }
+
+protected:
+       typedef void            (*glGenQueriesEXTFunc)(GLsizei n, GLuint* ids);
+       typedef void            (*glDeleteQueriesEXTFunc)(GLsizei n, const GLuint* ids);
+       typedef GLboolean       (*glIsQueryEXTFunc)(GLuint id);
+       typedef void            (*glBeginQueryEXTFunc)(GLenum target, GLuint id);
+       typedef void            (*glEndQueryEXTFunc)(GLenum target);
+       typedef void            (*glQueryCounterEXTFunc)(GLuint id, GLenum target);
+       typedef void            (*glGetQueryivEXTFunc)(GLenum target, GLenum pname, GLint* params);
+       typedef void            (*glGetQueryObjectivEXTFunc)(GLuint id, GLenum pname, GLint* params);
+       typedef void            (*glGetQueryObjectuivEXTFunc)(GLuint id, GLenum pname, GLuint* params);
+       typedef void            (*glGetQueryObjecti64vEXTFunc)(GLuint id, GLenum pname, GLint64* params);
+       typedef void            (*glGetQueryObjectui64vEXTFunc)(GLuint id, GLenum pname, GLuint64* params);
+       typedef void            (*glGetInteger64vEXTFunc)(GLenum pname, GLint64* data);
+
+       glGenQueriesEXTFunc                             glGenQueriesEXT;
+       glDeleteQueriesEXTFunc                  glDeleteQueriesEXT;
+       glIsQueryEXTFunc                                glIsQueryEXT;
+       glBeginQueryEXTFunc                             glBeginQueryEXT;
+       glEndQueryEXTFunc                               glEndQueryEXT;
+       glQueryCounterEXTFunc                   glQueryCounterEXT;
+       glGetQueryivEXTFunc                             glGetQueryivEXT;
+       glGetQueryObjectivEXTFunc               glGetQueryObjectivEXT;
+       glGetQueryObjectuivEXTFunc              glGetQueryObjectuivEXT;
+       glGetQueryObjecti64vEXTFunc             glGetQueryObjecti64vEXT;
+       glGetQueryObjectui64vEXTFunc    glGetQueryObjectui64vEXT;
+       glGetInteger64vEXTFunc                  glGetInteger64vEXT;
+};
+
+} // namespace glcts
+
+#endif // _ESEXTCDISJOINTTIMERQUERYBASE_HPP
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.cpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.cpp
new file mode 100644 (file)
index 0000000..683422b
--- /dev/null
@@ -0,0 +1,118 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextDisjointTimerQueryHandleReuse.cpp
+ * \brief Timer query handle reuse tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "esextcDisjointTimerQueryHandleReuse.hpp"
+#include "gluContextInfo.hpp"
+#include "gluDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+#include "tcuTestLog.hpp"
+#include <vector>
+
+namespace glcts
+{
+
+/** Constructor
+ *
+ *  @param context     Test context
+ *  @param name        Test case's name
+ *  @param description Test case's description
+ **/
+DisjointTimerQueryHandleReuse::DisjointTimerQueryHandleReuse (Context& context, const ExtParameters& extParams,
+                                                                                                                     const char* name, const char* description)
+       : DisjointTimerQueryBase(context, extParams, name, description)
+{
+}
+
+/** Initializes GLES objects used during the test */
+void DisjointTimerQueryHandleReuse::initTest (void)
+{
+       if (!isExtensionSupported("GL_EXT_disjoint_timer_query"))
+       {
+               throw tcu::NotSupportedError(DISJOINT_TIMER_QUERY_NOT_SUPPORTED);
+       }
+}
+
+/** Executes the test.
+ *
+ *  Sets the test result to QP_TEST_RESULT_FAIL if the test failed, QP_TEST_RESULT_PASS otherwise.
+ *
+ *  Note the function throws exception should an error occur!
+ *
+ *  @return STOP if the test has finished, CONTINUE to indicate iterate should be called once again.
+ **/
+tcu::TestNode::IterateResult DisjointTimerQueryHandleReuse::iterate(void)
+{
+       /* Initialize */
+       initTest();
+
+       /* Get Gl entry points */
+       const glw::Functions& gl = m_context.getRenderContext().getFunctions();
+               /* Running tests. */
+       bool is_ok = true;
+
+       glw::GLuint query_id_a = 0;
+       glw::GLuint query_id_b = 0;
+       /* Allocate query object */
+       glGenQueriesEXT(1, &query_id_a);
+       /* Associate object with GL_TIMESTAMP */
+       glQueryCounterEXT(query_id_a, GL_TIMESTAMP);
+       /* Deallocate query object */
+       glDeleteQueriesEXT(1, &query_id_a);
+
+       /* Allocate query object again - should result in the same id */
+       glGenQueriesEXT(1, &query_id_b);
+       /* Use the id with something else */
+       glBeginQueryEXT(GL_TIME_ELAPSED, query_id_b);
+       if (gl.getError() != 0) /* Crash was reported here. */
+               is_ok = false;
+       glEndQueryEXT(GL_TIME_ELAPSED);
+       /* Clean up */
+       glDeleteQueriesEXT(1, &query_id_b);
+
+       if (query_id_a != query_id_b)
+       {
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << "Note: Queries got different id:s, so no actual reuse occurred."
+                       << tcu::TestLog::EndMessage;
+       }
+
+       /* Result's setup. */
+       if (is_ok)
+       {
+               m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       }
+       else
+       {
+               m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+       }
+       return STOP;
+}
+
+} // namespace glcts
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.hpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryHandleReuse.hpp
new file mode 100644 (file)
index 0000000..655f15a
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef _ESEXTCDISJOINTTIMERQUERYHANDLEREUSE_HPP
+#define _ESEXTCDISJOINTTIMERQUERYHANDLEREUSE_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextcDisjointTimerQueryHandleReuse.hpp
+ * \brief Timer query handle reuse tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "../esextcTestCaseBase.hpp"
+#include "esextcDisjointTimerQueryBase.hpp"
+
+namespace glcts
+{
+
+class DisjointTimerQueryHandleReuse : public DisjointTimerQueryBase
+{
+public:
+       DisjointTimerQueryHandleReuse                   (Context& context, const ExtParameters& extParams, const char* name,
+                                                                                        const char* description);
+
+       virtual ~DisjointTimerQueryHandleReuse  ()
+       {
+       }
+
+       virtual IterateResult iterate(void);
+
+private:
+       void            initTest(void);
+};
+
+} // namespace glcts
+
+#endif // _ESEXTCDISJOINTTIMERQUERYHANDLEREUSE_HPP
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.cpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.cpp
new file mode 100644 (file)
index 0000000..d8aab26
--- /dev/null
@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextcDisjointTimerQueryTests.cpp
+ * \brief Base test group for disjoint timer query tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "esextcDisjointTimerQueryTests.hpp"
+#include "esextcDisjointTimerQueryHandleReuse.hpp"
+
+namespace glcts
+{
+
+/** Constructor
+ *
+ * @param context       Test context
+ * @param glslVersion   GLSL version
+ **/
+DisjointTimerQueryTests::DisjointTimerQueryTests (glcts::Context& context, const ExtParameters& extParams)
+       : TestCaseGroupBase(context, extParams, "disjoint_timer_query", "Disjoint timer query tests")
+{
+       /* No implementation needed */
+}
+
+/** Initializes test cases for texture buffer tests
+ **/
+void DisjointTimerQueryTests::init (void)
+{
+       /* Initialize base class */
+       TestCaseGroupBase::init();
+
+
+       addChild(new DisjointTimerQueryHandleReuse(m_context, m_extParams,
+                                                                                          "handle_reuse", "handle reuse"));
+}
+
+} // namespace glcts
diff --git a/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.hpp b/external/openglcts/modules/glesext/disjoint_timer_query/esextcDisjointTimerQueryTests.hpp
new file mode 100644 (file)
index 0000000..87791ba
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef _ESEXTCDISJOINTTIMERQUERYTESTS_HPP
+#define _ESEXTCDISJOINTTIMERQUERYTESTS_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2021 The Khronos Group Inc.
+ * Copyright (c) 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+/*!
+ * \file  esextcDisjointTimerQueryTests.hpp
+ * \brief Base test group for disjoint timer query tests
+ */ /*-------------------------------------------------------------------*/
+
+#include "../esextcTestCaseBase.hpp"
+#include "gluShaderUtil.hpp"
+#include "tcuDefs.hpp"
+
+namespace glcts
+{
+
+/* Base test group for texture buffer tests */
+class DisjointTimerQueryTests : public TestCaseGroupBase
+{
+public:
+       DisjointTimerQueryTests                         (glcts::Context& context, const ExtParameters& extParams);
+
+       virtual ~DisjointTimerQueryTests        (void)
+       {
+       }
+
+       void init (void);
+
+private:
+       DisjointTimerQueryTests                         (const DisjointTimerQueryTests& other);
+       DisjointTimerQueryTests& operator=      (const DisjointTimerQueryTests& other);
+};
+
+} // namespace glcts
+
+#endif // _ESEXTCDISJOINTTIMERQUERYTESTS_HPP
index 97feffd..696dfd4 100644 (file)
@@ -46,6 +46,7 @@
 #define TEXTURE_BUFFER_EXTENSION_NOT_SUPPORTED "Texture buffer functionality not supported, skipping"
 #define DRAW_BUFFERS_INDEXED_NOT_SUPPORTED "Draw buffers indexed functionality not supported, skipping"
 #define VIEWPORT_ARRAY_NOT_SUPPORTED "Viewport array functionality not supported, skipping"
+#define DISJOINT_TIMER_QUERY_NOT_SUPPORTED "Disjoint timer query functionality not supported, skipping"
 
 namespace glcts
 {
index 4e507c5..bf1b375 100644 (file)
@@ -32,7 +32,7 @@
 #include "texture_buffer/esextcTextureBufferTests.hpp"
 #include "texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp"
 #include "texture_shadow_lod/esextcTextureShadowLodFunctionsTest.hpp"
-
+#include "disjoint_timer_query/esextcDisjointTimerQueryTests.hpp"
 #include "glcViewportArrayTests.hpp"
 #include "gluStateReset.hpp"
 #include "tcuTestLog.hpp"
@@ -144,6 +144,8 @@ void ESEXTTestPackage::init(void)
                glcts::ExtParameters viewportParams(glu::GLSL_VERSION_310_ES, glcts::EXTENSIONTYPE_OES);
                addChild(new glcts::ViewportArrayTests(getContext(), viewportParams));
                addChild(new deqp::Functional::TextureShadowLodTest(getContext()));
+               glcts::ExtParameters viewportParams2(glu::GLSL_VERSION_100_ES, glcts::EXTENSIONTYPE_OES);
+               addChild(new glcts::DisjointTimerQueryTests(getContext(), viewportParams2));
        }
        catch (...)
        {