replace _mesa_logbase2 with util_logbase2
[mesa.git] / src / mesa / state_tracker / st_cb_bufferobjects.h
index dcbb5a52336a61a04d838812acf4a5714d46ac27..534506a62b343bb4714dafe22a1b03565c5f4a13 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2005 VMware, Inc.
  * All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef ST_CB_BUFFEROBJECTS_H
 #define ST_CB_BUFFEROBJECTS_H
 
+#include "main/mtypes.h"
+
+struct dd_function_table;
+struct pipe_resource;
+struct pipe_screen;
 struct st_context;
-struct gl_buffer_object;
-struct pipe_buffer;
 
 /**
  * State_tracker vertex/pixel buffer object, derived from Mesa's
@@ -39,28 +42,26 @@ struct pipe_buffer;
 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[MAP_COUNT];
 };
 
 
-/* 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.
- */
-static INLINE struct st_buffer_object *
+/** 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;
 }
 
 
+enum pipe_transfer_usage
+st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer);
+
+
 extern void
-st_init_bufferobject_functions(struct dd_function_table *functions);
+st_init_bufferobject_functions(struct pipe_screen *screen,
+                               struct dd_function_table *functions);
 
 
 #endif