+ if (offset % ctx->Const.SparseBufferPageSize != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset not aligned to page size)",
+ func);
+ return;
+ }
+
+ if (size % ctx->Const.SparseBufferPageSize != 0 &&
+ offset + size != bufferObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size not aligned to page size)",
+ func);
+ return;
+ }
+
+ ctx->Driver.BufferPageCommitment(ctx, bufferObj, offset, size, commit);
+}
+
+void GLAPIENTRY
+_mesa_BufferPageCommitmentARB(GLenum target, GLintptr offset, GLsizeiptr size,
+ GLboolean commit)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufferObj;
+
+ bufferObj = get_buffer(ctx, "glBufferPageCommitmentARB", target,
+ GL_INVALID_ENUM);
+ if (!bufferObj)
+ return;
+
+ buffer_page_commitment(ctx, bufferObj, offset, size, commit,
+ "glBufferPageCommitmentARB");
+}
+
+void GLAPIENTRY
+_mesa_NamedBufferPageCommitmentARB(GLuint buffer, GLintptr offset,
+ GLsizeiptr size, GLboolean commit)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufferObj;
+
+ bufferObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufferObj || bufferObj == &DummyBufferObject) {
+ /* Note: the extension spec is not clear about the excpected error value. */
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glNamedBufferPageCommitmentARB(name = %u) invalid object",
+ buffer);
+ return;
+ }
+
+ buffer_page_commitment(ctx, bufferObj, offset, size, commit,
+ "glNamedBufferPageCommitmentARB");