[Piglit] Suggested patch to prevent object-namespace-pollution from stomping on existing RBOs

DRC dcommander at users.sourceforge.net
Thu Oct 20 15:57:41 UTC 2022


This modifies the namespace-pollution test to check for existing RBOs in 
the same way that it currently checks for existing textures and FBOs. 
VirtualGL needs this, because it uses RBOs behind the scenes to emulate 
GLX drawables, so it isn't valid to assume that renderbuffers 1 and 2 
are unused.

DRC
-------------- next part --------------
From 3faab89b2885453eb874892c603c774df67d03d5 Mon Sep 17 00:00:00 2001
From: DRC <information at virtualgl.org>
Date: Thu, 20 Oct 2022 10:42:37 -0500
Subject: [PATCH] namespace-pollution: Check for existing RBOs

VirtualGL has a mode that emulates GLX using device-based EGL.  In this
mode, renderbuffer objects are used behind the scenes to emulate
multi-buffered GLX drawables, so it is not valid to assume that
renderbuffers 1 and 2 are unused.  This commit modifies the
object-namespace-pollution test so that it checks for unused
renderbuffers in the same way that it currently checks for unused
textures.
---
 tests/general/object-namespace-pollution.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
index b1857cb0a..e0fd20c9f 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -1488,6 +1488,7 @@ piglit_init(int argc, char **argv)
 	const struct object_type *object_type = NULL;
 	const struct operation *operation = NULL;
 	unsigned first_unused_texture;
+	unsigned first_unused_renderbuffer;
 	unsigned first_unused_framebuffer;
 
 	if (argc != 3)
@@ -1535,6 +1536,16 @@ piglit_init(int argc, char **argv)
 	if (first_unused_texture >= 16)
 		piglit_report_result(PIGLIT_FAIL);
 
+	for (first_unused_renderbuffer = 1;
+	     first_unused_renderbuffer < 16;
+	     first_unused_renderbuffer++) {
+		if (!glIsRenderbufferEXT(first_unused_renderbuffer))
+			break;
+	}
+
+	if (first_unused_renderbuffer >= 16)
+		piglit_report_result(PIGLIT_FAIL);
+
 	for (first_unused_framebuffer = 1;
 	     first_unused_framebuffer < 16;
 	     first_unused_framebuffer++) {
@@ -1554,6 +1565,10 @@ piglit_init(int argc, char **argv)
 		    name < first_unused_texture)
 			continue;
 
+		if (strcmp("renderbuffer", object_type->name) == 0 &&
+		    name < first_unused_renderbuffer)
+			continue;
+
 		if (strcmp("framebuffer", object_type->name) == 0 &&
 		    name < first_unused_framebuffer)
 			continue;
@@ -1572,6 +1587,10 @@ piglit_init(int argc, char **argv)
 		    name < first_unused_texture)
 			continue;
 
+		if (strcmp("renderbuffer", object_type->name) == 0 &&
+		    name < first_unused_renderbuffer)
+			continue;
+
 		if (strcmp("framebuffer", object_type->name) == 0 &&
 		    name < first_unused_framebuffer)
 			continue;
-- 
2.32.0 (Apple Git-132)



More information about the Piglit mailing list