[Mesa-dev] [PATCH 03/21] mesa: implement sparse storage buffer allocation
Nicolai Hähnle
nhaehnle at gmail.com
Wed Feb 8 12:42:45 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/mesa/main/bufferobj.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index cbd9228..5f23868 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1531,21 +1531,34 @@ _mesa_buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,
GLenum target, GLsizeiptr size, const GLvoid *data,
GLbitfield flags, const char *func)
{
+ GLbitfield valid_flags;
+
if (size <= 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(size <= 0)", func);
return;
}
- if (flags & ~(GL_MAP_READ_BIT |
+ valid_flags = GL_MAP_READ_BIT |
GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT |
GL_MAP_COHERENT_BIT |
GL_DYNAMIC_STORAGE_BIT |
- GL_CLIENT_STORAGE_BIT)) {
+ GL_CLIENT_STORAGE_BIT;
+
+ if (ctx->Extensions.ARB_sparse_buffer)
+ valid_flags |= GL_SPARSE_STORAGE_BIT_ARB;
+
+ if (flags & ~valid_flags) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(invalid flag bits set)", func);
return;
}
+ if (flags & GL_SPARSE_STORAGE_BIT_ARB &&
+ flags & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(SPARSE_STORAGE and READ/WRITE)", func);
+ return;
+ }
+
if (flags & GL_MAP_PERSISTENT_BIT &&
!(flags & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT))) {
_mesa_error(ctx, GL_INVALID_VALUE,
--
2.9.3
More information about the mesa-dev
mailing list