[Piglit] [PATCH 2/2] shader_runner: get proper access bitfield when calling MapBufferRange
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Apr 11 09:14:42 UTC 2019
Current workaround assumes that glMapBuffer and glMapBufferRange
'access' bitfield uses the same values, when it is not.
---
.../shaders/shader_runner_gles_workarounds.h | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h
index 77956f6b9..bbcdc9b4a 100644
--- a/tests/shaders/shader_runner_gles_workarounds.h
+++ b/tests/shaders/shader_runner_gles_workarounds.h
@@ -72,17 +72,32 @@ unsupported_function(const char *name, ...)
#undef glMapBuffer
static GLvoid*
-glMapBuffer(GLenum target, GLbitfield access)
+glMapBuffer(GLenum target, GLbitfield map_buffer_access)
{
/* Emulate with glMapBufferRange. */
GLsizeiptr length = 0;
+ GLbitfield map_buffer_range_access;
glGetBufferParameteri64v(target, GL_BUFFER_SIZE, (GLint64*) &length);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
- return glMapBufferRange(target, 0, length, access);
+ switch (map_buffer_access) {
+ case GL_READ_ONLY:
+ map_buffer_range_access = GL_MAP_READ_BIT;
+ break;
+ case GL_WRITE_ONLY:
+ map_buffer_range_access = GL_MAP_WRITE_BIT;
+ break;
+ case GL_READ_WRITE:
+ map_buffer_range_access = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+ break;
+ default:
+ map_buffer_range_access = 0;
+ break;
+ }
+ return glMapBufferRange(target, 0, length, map_buffer_range_access);
}
#endif /* PIGLIT_USE_OPENGL_ES3 */
--
2.19.1
More information about the Piglit
mailing list