summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-11-02 09:30:47 -0600
committerBrian Paul <brianp@vmware.com>2010-11-02 09:33:23 -0600
commit670207e6d0f0c5a25a709a4b83987d379ee4b8fe (patch)
treec8669ee7f6c62714591f5058a8f5c2b94115541f /src
parent0fefafb2e46fa7ead35ef05fda10368af0970c88 (diff)
dri/util: add a bunch of comments
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/common/utils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index c195c4fd8f..42be77fd7c 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -738,12 +738,18 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+/**
+ * Return the value of a configuration attribute. The attribute is
+ * indicated by the index.
+ */
static int
driGetConfigAttribIndex(const __DRIconfig *config,
unsigned int index, unsigned int *value)
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
+ /* no support for color index mode */
*value = __DRI_ATTRIB_RGBA_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
@@ -755,13 +761,16 @@ driGetConfigAttribIndex(const __DRIconfig *config,
*value = 0;
break;
case __DRI_ATTRIB_SWAP_METHOD:
+ /* XXX no return value??? */
break;
case __DRI_ATTRIB_FLOAT_MODE:
+ /* this field is not int-sized */
*value = config->modes.floatMode;
break;
default:
+ /* any other int-sized field */
*value = *(unsigned int *)
((char *) &config->modes + attribMap[index].offset);
@@ -771,6 +780,13 @@ driGetConfigAttribIndex(const __DRIconfig *config,
return GL_TRUE;
}
+
+/**
+ * Get the value of a configuration attribute.
+ * \param attrib the attribute (one of the _DRI_ATTRIB_x tokens)
+ * \param value returns the attribute's value
+ * \return 1 for success, 0 for failure
+ */
int
driGetConfigAttrib(const __DRIconfig *config,
unsigned int attrib, unsigned int *value)
@@ -784,6 +800,14 @@ driGetConfigAttrib(const __DRIconfig *config,
return GL_FALSE;
}
+
+/**
+ * Get a configuration attribute name and value, given an index.
+ * \param index which field of the __DRIconfig to query
+ * \param attrib returns the attribute name (one of the _DRI_ATTRIB_x tokens)
+ * \param value returns the attribute's value
+ * \return 1 for success, 0 for failure
+ */
int
driIndexConfigAttrib(const __DRIconfig *config, int index,
unsigned int *attrib, unsigned int *value)