[Piglit] Testing request for Nvidia owners KHR_debug and ARB_debug_ouput interaction

Timothy Arceri t_arceri at yahoo.com.au
Sat Mar 1 19:07:02 PST 2014


Hi guys, I don't own a Nvidia card and I'm interested in how the binary driver treats interactions
between these two extension. This is a modified version of my KHR_debug push/pop test with
ARB_debug_ouput calls mixed in that should let me know how they interact.
I would be greatful if someone could run this on the Nvidia binary and send me the results in
the main output file.

FYI I've run this on Catalyst and it seems AMD just uses an alias and shares the similar functions.

Thanks
Tim 

---
 tests/all.py                                |    1 +
 tests/spec/khr_debug/CMakeLists.gl.txt      |    1 +
 tests/spec/khr_debug/debug-push-pop-group.c |  293 +++++++++++++++++++++++++++
 3 files changed, 295 insertions(+)
 create mode 100644 tests/spec/khr_debug/debug-push-pop-group.c

diff --git a/tests/all.py b/tests/all.py
index 590c832..93e38b3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1835,6 +1835,7 @@ add_plain_test(arb_debug_output, 'arb_debug_output-api_error')
 khr_debug = Group()
 spec['KHR_debug'] = khr_debug
 khr_debug['object-label'] = concurrent_test('khr_debug-object-label')
+khr_debug['push-pop-group'] = concurrent_test('khr_debug-push-pop-group')
 
 # Group ARB_occlusion_query2
 arb_occlusion_query2 = Group()
diff --git a/tests/spec/khr_debug/CMakeLists.gl.txt b/tests/spec/khr_debug/CMakeLists.gl.txt
index b0079df..f7b32bd 100644
--- a/tests/spec/khr_debug/CMakeLists.gl.txt
+++ b/tests/spec/khr_debug/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 )
 
 piglit_add_executable (khr_debug-object-label debug-object-label.c)
+piglit_add_executable (khr_debug-push-pop-group debug-push-pop-group.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/khr_debug/debug-push-pop-group.c b/tests/spec/khr_debug/debug-push-pop-group.c
new file mode 100644
index 0000000..01caa98
--- /dev/null
+++ b/tests/spec/khr_debug/debug-push-pop-group.c
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2013 Timothy Arceri <t_arceri at yahoo.com.au>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "piglit-util-gl-common.h"
+
+static const char *TestMessage1 = "Piglit Message 1";
+static const char *TestMessage2 = "Piglit Message 2";
+static const char *TestMessage3 = "Piglit Message 3";
+static const char *TestMessage4 = "Piglit Message 4";
+
+static const int MessageId1 = 101;
+static const int MessageId2 = 202;
+static const int MessageId3 = 303;
+static const int MessageId4 = 404;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 11;
+	config.require_debug_context = true;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_PASS;
+}
+
+static GLboolean fetch_one_log_message()
+{
+	char log[4096];
+	GLboolean ret =
+		!!glGetDebugMessageLog(1, 4096, NULL, NULL, NULL, NULL, NULL, log);
+
+	if (ret) {
+		printf("Log: %s\n", log);
+	}
+	return ret;
+}
+
+static bool check_inheritance_messages(int expectedCount, GLuint* expectedIds)
+{
+	bool pass = true;
+	int max_messages = 5;
+	int bufSize = 1280;
+	int i;
+	GLuint count;
+	GLenum types[max_messages];
+	GLuint ids[max_messages];
+
+	GLchar messageLog[bufSize];
+
+	count = glGetDebugMessageLogARB(max_messages,
+				     bufSize,
+				     NULL,
+				     types,
+				     ids,
+				     NULL,
+				     NULL,
+				     messageLog);
+
+	if (count != expectedCount) {
+		fprintf(stderr, "Expected message count: %i Actual message count: %i\n",
+		        expectedCount, count);
+		pass = false;
+	} else {
+		for (i = 0; i < expectedCount; i++) {
+			printf("Type: %x", types[i]);
+			if (expectedIds[i] != ids[i]) {
+				fprintf(stderr, "Expected id: %i Actual id: %i\n",
+				        expectedIds[i], ids[i]);
+				pass = false;
+			}
+		}
+	}
+
+	return pass;
+}
+
+static void insert_inheritance_messages()
+{
+	glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId1,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage1);
+
+	glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId2,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage2);
+
+	glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId3,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage3);
+
+	glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId4,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage4);
+}
+
+/*
+ * Test inheritance of group filtering (nesting)
+ */
+static bool test_push_pop_group_inheritance()
+{
+	bool pass = true;
+	GLuint allowedIds1[] = {MessageId1};
+	GLuint allowedIds2[] = {MessageId2};
+	GLuint allowedIds3[] = {MessageId3};
+
+	GLuint expectedIds1[] = {MessageId1};
+	GLuint expectedIds2[] = {MessageId1, MessageId2};
+	GLuint expectedIds3[] = {MessageId1, MessageId2, MessageId3};
+
+	puts("Testing Push debug group inheritance");
+
+	/* Setup of the default active debug group: Filter everything out */
+	glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE,
+			      GL_DONT_CARE, 0, NULL, GL_FALSE);
+
+	/* Push debug group 1 and allow messages with the id 101*/
+	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, 11, "Push_Pop 1");
+	glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER,
+			      GL_DONT_CARE, 1, allowedIds1, GL_TRUE);
+	insert_inheritance_messages();
+	pass = check_inheritance_messages(1, expectedIds1);
+
+	/* Push debug group 1 and allow messages with the id 101 and 202*/
+	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, 11, "Push_Pop 2");
+	glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER,
+			      GL_DONT_CARE, 1, allowedIds2, GL_TRUE);
+	insert_inheritance_messages();
+	pass = check_inheritance_messages(2, expectedIds2) && pass;
+
+	/* Push debug group 1 and allow messages with the id 101, 202 and 303*/
+	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, 11, "Push_Pop 3");
+	glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER,
+			      GL_DONT_CARE, 1, allowedIds3, GL_TRUE);
+	insert_inheritance_messages();
+	pass = check_inheritance_messages(3, expectedIds3) && pass;
+
+	puts("Testing Pop debug group inheritance");
+
+	/* Pop debug group 3 */
+	glPopDebugGroup();
+	insert_inheritance_messages();
+	pass = check_inheritance_messages(2, expectedIds2) && pass;
+
+	/* Pop debug group 2 */
+	glPopDebugGroup();
+	insert_inheritance_messages();
+	pass = check_inheritance_messages(1, expectedIds1) && pass;
+
+	/* Pop group 1, restore the volume control of the default debug group. */
+	glPopDebugGroup();
+	insert_inheritance_messages();
+
+	if (fetch_one_log_message()) {
+		fprintf(stderr, "The message log should be empty\n");
+		pass = false;
+	}
+
+	return pass;
+}
+
+/*
+ * Test Push/Pop Debug Group
+ */
+static bool test_push_pop_debug_group()
+{
+	bool pass = true;
+	int max_messages = 5;
+	int bufSize = 1280;
+	GLuint count;
+
+	GLsizei lengths[max_messages];
+	GLchar messageLog[bufSize];
+
+	puts("Testing Push Pop debug message group");
+
+	/* Setup of the default active debug group: Filter everything in */
+	glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE,
+			      0, NULL, GL_TRUE);
+
+	/* Generate a debug marker debug output message */
+	glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId1,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage1);
+
+	/* Push debug group 1 */
+	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, 17, TestMessage2);
+
+	/* Setup of the debug group 1: Filter everything out */
+	glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE,
+			      0, NULL, GL_FALSE);
+
+	/* This message shouldn't appear in the debug output log */
+	glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId1,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage3);
+
+	/* Pop group 1, restore the volume control of the default debug group. */
+	glPopDebugGroup();
+
+	/* Generate a debug marker debug output message */
+	glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, MessageId1,
+			     GL_DEBUG_SEVERITY_NOTIFICATION, -1, TestMessage4);
+
+	/* Check that message log has done correct filtering */
+	count = glGetDebugMessageLog(max_messages,
+				     bufSize,
+				     NULL,
+				     NULL,
+				     NULL,
+				     NULL,
+				     lengths,
+				     messageLog);
+
+	if (count != 4) {
+		fprintf(stderr, "The message log should contain 4 messages not %i messages\n", count);
+		pass = false;
+		int nextMessage = lengths[0];
+		if (strcmp(TestMessage2, messageLog+nextMessage) != 0) {
+			fprintf(stderr, "Expected: %s Message: %s\n", TestMessage2, messageLog+nextMessage);
+			pass = false;
+		}
+	}
+
+	if (pass) {
+		int i;
+
+		/* the thrid message should be TestMessage2 from glPopDebugGroup() */
+		int nextMessage = lengths[0] + lengths[1];
+		if (strcmp(TestMessage2, messageLog+nextMessage) != 0) {
+			fprintf(stderr, "Expected: %s Message: %s\n", TestMessage2, messageLog+nextMessage);
+			pass = false;
+		}
+
+		/* double check that TestMessage3 didnt sneak into the list */
+		nextMessage = 0;
+		for (i = 0; i < count; i++) {
+			if (strcmp(TestMessage3, messageLog+nextMessage) == 0) {
+				fprintf(stderr, "The log should not contain the message: %s",
+					messageLog+nextMessage);
+				pass = false;
+			}
+			nextMessage += lengths[i];
+		}
+
+		/* the forth message should be TestMessage4 */
+		nextMessage = lengths[0] + lengths[1] + lengths[3];
+		if (strcmp(TestMessage4, messageLog+nextMessage) != 0) {
+			fprintf(stderr, "Expected: %s Message: %s\n", TestMessage4, messageLog+nextMessage);
+			pass = false;
+		}
+	}
+
+	return pass;
+}
+
+void piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+
+	piglit_require_extension("GL_KHR_debug");
+
+	glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+	glEnable(GL_DEBUG_OUTPUT);
+
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	/* test message control and debug groups */
+	pass = test_push_pop_debug_group();
+	pass = test_push_pop_group_inheritance() && pass;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.9.5



More information about the Piglit mailing list