summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/util/u_suballoc.h
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
commit9130ec005fbc78a62420643414d8354d0929ca50 (patch)
tree6762777acdd2d4eee17ef87290e80dc7afe2b73d /lib/mesa/src/gallium/auxiliary/util/u_suballoc.h
parentca11beabae33eb59fb981b8adf50b1d47a2a98f0 (diff)
Merge Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/util/u_suballoc.h')
-rw-r--r--lib/mesa/src/gallium/auxiliary/util/u_suballoc.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/util/u_suballoc.h b/lib/mesa/src/gallium/auxiliary/util/u_suballoc.h
index e35382f04..ed95e7c32 100644
--- a/lib/mesa/src/gallium/auxiliary/util/u_suballoc.h
+++ b/lib/mesa/src/gallium/auxiliary/util/u_suballoc.h
@@ -31,12 +31,31 @@
#ifndef U_SUBALLOC
#define U_SUBALLOC
-struct u_suballocator;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct pipe_context;
+
+struct u_suballocator {
+ struct pipe_context *pipe;
+
+ unsigned size; /* Size of the whole buffer, in bytes. */
+ unsigned bind; /* Bitmask of PIPE_BIND_* flags. */
+ enum pipe_resource_usage usage;
+ unsigned flags; /* bitmask of PIPE_RESOURCE_FLAG_x */
+ boolean zero_buffer_memory; /* If the buffer contents should be zeroed. */
-struct u_suballocator *
-u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
- enum pipe_resource_usage usage, unsigned flags,
- boolean zero_buffer_memory);
+ struct pipe_resource *buffer; /* The buffer we suballocate from. */
+ unsigned offset; /* Aligned offset pointing at the first unused byte. */
+};
+
+void
+u_suballocator_init(struct u_suballocator *allocator,
+ struct pipe_context *pipe,
+ unsigned size, unsigned bind,
+ enum pipe_resource_usage usage, unsigned flags,
+ boolean zero_buffer_memory);
void
u_suballocator_destroy(struct u_suballocator *allocator);
@@ -46,4 +65,8 @@ u_suballocator_alloc(struct u_suballocator *allocator, unsigned size,
unsigned alignment, unsigned *out_offset,
struct pipe_resource **outbuf);
+#ifdef __cplusplus
+}
+#endif
+
#endif