- /**************************************************************************
+/**************************************************************************
*
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
#ifndef INTEL_BUFFEROBJ_H
#define INTEL_BUFFEROBJ_H
-#include "mtypes.h"
+#include "main/mtypes.h"
-struct intel_context;
+struct brw_context;
struct gl_buffer_object;
/**
* Intel vertex/pixel buffer object, derived from Mesa's gl_buffer_object.
*/
-struct intel_buffer_object {
+struct intel_buffer_object
+{
struct gl_buffer_object Base;
- dri_bo *buffer; /* the low-level buffer manager's buffer handle */
+ drm_intel_bo *buffer; /* the low-level buffer manager's buffer handle */
+ GLuint offset; /* any offset into that buffer */
+
+ drm_intel_bo *range_map_bo;
+ void *range_map_buffer;
+ unsigned int range_map_offset;
};
/* Get the bm buffer associated with a GL bufferobject:
*/
-dri_bo *intel_bufferobj_buffer( const struct intel_buffer_object *obj );
+drm_intel_bo *intel_bufferobj_buffer(struct brw_context *brw,
+ struct intel_buffer_object *obj,
+ GLuint flag);
+drm_intel_bo *intel_bufferobj_source(struct brw_context *brw,
+ struct intel_buffer_object *obj,
+ GLuint align,
+ GLuint *offset);
-/* Hook the bufferobject implementation into mesa:
- */
-void intel_bufferobj_init( struct intel_context *intel );
+void intel_upload_data(struct brw_context *brw,
+ const void *ptr, GLuint size, GLuint align,
+ drm_intel_bo **return_bo,
+ GLuint *return_offset);
+void *intel_upload_map(struct brw_context *brw,
+ GLuint size, GLuint align);
+void intel_upload_unmap(struct brw_context *brw,
+ const void *ptr, GLuint size, GLuint align,
+ drm_intel_bo **return_bo,
+ GLuint *return_offset);
+void intel_upload_finish(struct brw_context *brw);
-/* 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.
+/* Hook the bufferobject implementation into mesa:
*/
+void intelInitBufferObjectFuncs(struct dd_function_table *functions);
+
static inline struct intel_buffer_object *
-intel_buffer_object( struct gl_buffer_object *obj )
+intel_buffer_object(struct gl_buffer_object *obj)
{
- if (obj->Name)
- return (struct intel_buffer_object *)obj;
- else
- return NULL;
+ return (struct intel_buffer_object *) obj;
}
#endif