[Mesa-dev] [PATCH 15/17] mesa: context carries UBO binding points
Vincent Lejeune
vljn at ovi.com
Sun Dec 25 10:20:10 PST 2011
A binding point is an uint that is referred by BindBuffer* and
UniformBlockBinding API function. A UBO in shader will fetch
data in the buffer that holds the same binding point.
Note that this patch should be reworked : it currently uses a
static array to hold binding points, and does not take care of
hardware capabilities. However it allows to test the whole patch.
---
src/mesa/main/config.h | 4 ++++
src/mesa/main/mtypes.h | 12 ++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 7b7740e..1c4c810 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -357,5 +357,9 @@
*/
#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
+/**
+ * UBO Variables
+ */
+#define MAX_UBO_COUNT 8
#endif /* MESA_CONFIG_H_INCLUDED */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c3f8956..3ac5c2f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1653,6 +1653,15 @@ struct gl_array_attrib
struct gl_buffer_object *ArrayBufferObj;
};
+/**
+ * UBO state
+ */
+struct gl_ubo_attribs
+{
+ struct gl_buffer_object *UniformObj;
+ struct gl_buffer_object *BindingPoint[MAX_UBO_COUNT];
+ unsigned UBOIndexes[MAX_UBO_COUNT];
+};
/**
* Feedback buffer state
@@ -3402,6 +3411,9 @@ struct gl_context
struct gl_pixelstore_attrib DefaultPacking; /**< Default params */
/*@}*/
+ /** \name Attributes for UBO */
+ struct gl_ubo_attribs UniformBufferObject;
+
/** \name Other assorted state (not pushed/popped on attribute stack) */
/*@{*/
struct gl_pixelmaps PixelMaps;
--
1.7.7
More information about the mesa-dev
mailing list