#ifndef ST_CB_BUFFEROBJECTS_H
#define ST_CB_BUFFEROBJECTS_H
+#include "main/compiler.h"
+#include "main/mtypes.h"
+
+struct dd_function_table;
+struct pipe_resource;
struct st_context;
-struct gl_buffer_object;
-struct pipe_buffer;
/**
* State_tracker vertex/pixel buffer object, derived from Mesa's
struct st_buffer_object
{
struct gl_buffer_object Base;
- struct pipe_buffer *buffer;
- GLsizeiptrARB size;
+ struct pipe_resource *buffer; /* GPU storage */
+ struct pipe_transfer *transfer; /* In-progress map information */
};
-/* Are the obj->Name tests necessary? Unfortunately yes, mesa
- * allocates a couple of gl_buffer_object structs statically, and the
- * Name == 0 test is the only way to identify them and avoid casting
- * them erroneously to our structs.
- */
+/** cast wrapper */
static INLINE struct st_buffer_object *
st_buffer_object(struct gl_buffer_object *obj)
{
- if (obj->Name)
- return (struct st_buffer_object *) obj;
- else
- return NULL;
+ return (struct st_buffer_object *) obj;
}
+extern void
+st_bufferobj_validate_usage(struct st_context *st,
+ struct st_buffer_object *obj,
+ unsigned usage);
+
+
extern void
st_init_bufferobject_functions(struct dd_function_table *functions);