[Piglit] [PATCH 7/7] shader_runner: don't use glMapNamedBufferRange

Nicolai Hähnle nhaehnle at gmail.com
Wed Oct 11 10:12:55 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

We want to be able to run atomic counter tests even when the DSA
entry points are unavailable (e.g. in GLES).
---
 tests/shaders/shader_runner.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 625521cc0..a1e1597cc 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2829,42 +2829,43 @@ static bool
 probe_atomic_counter(unsigned buffer_num, GLint counter_num, const char *op, uint32_t value)
 {
         uint32_t *p;
 	uint32_t observed;
 	enum comparison cmp;
 	bool result;
 
 	REQUIRE(parse_comparison_op(op, &cmp, NULL),
 		"Invalid comparison operation at: %s\n", op);
 
-	p = glMapNamedBufferRange(atomics_bos[buffer_num], counter_num * sizeof(uint32_t),
+	glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, atomics_bos[buffer_num]);
+	p = glMapBufferRange(GL_ATOMIC_COUNTER_BUFFER, counter_num * sizeof(uint32_t),
 			     sizeof(uint32_t), GL_MAP_READ_BIT);
 
         if (!p) {
                 printf("Couldn't map atomic counter to verify expected value.\n");
                 return false;
         }
 
 	observed = *p;
 	result = compare_uint(value, observed, cmp);
 
 	if (!result) {
 		printf("Atomic counter %d test failed: Reference %s Observed\n",
 		       counter_num, comparison_string(cmp));
 		printf("  Reference: %u\n", value);
 		printf("  Observed:  %u\n", observed);
-		glUnmapNamedBuffer(atomics_bos[buffer_num]);
+		glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
 		return false;
-        }
+	}
 
-        glUnmapNamedBuffer(atomics_bos[buffer_num]);
-        return true;
+	glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
+	return true;
 }
 
 static bool
 probe_ssbo_uint(GLint ssbo_index, GLint ssbo_offset, const char *op, uint32_t value)
 {
 	uint32_t *p;
 	uint32_t observed;
 	enum comparison cmp;
 	bool result;
 
-- 
2.11.0



More information about the Piglit mailing list