[Piglit] [PATCH 2/4] shader_runner: only clear handles that are resident

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri May 19 12:52:49 UTC 2017


To avoid potential INVALID_OPERATION errors reported by
glMake{Texture,Image}HandleNonResidentARB().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 tests/shaders/shader_runner.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 933f97fac..625521cc0 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -202,10 +202,13 @@ clear_resident_handle(unsigned idx)
 
 	if (resident_handles[idx].handle) {
 		GLuint64 handle = resident_handles[idx].handle;
-		if (resident_handles[idx].is_tex)
-			glMakeTextureHandleNonResidentARB(handle);
-		else
-			glMakeImageHandleNonResidentARB(handle);
+		if (resident_handles[idx].is_tex) {
+			if (glIsTextureHandleResidentARB(handle))
+				glMakeTextureHandleNonResidentARB(handle);
+		} else {
+			if (glIsImageHandleResidentARB(handle))
+				glMakeImageHandleNonResidentARB(handle);
+		}
 		resident_handles[idx].handle = 0;
 	}
 }
-- 
2.13.0



More information about the Piglit mailing list