summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver McFadden <z3ro.geek@gmail.com>2007-09-30 12:15:11 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-09-30 12:15:11 +0000
commitd0191f67f98cd848aec8c82b79f69002d73d342e (patch)
tree1eee562ce7639897d9017667396c79db884b96a8
parent1bc48fe03976ee8d1f976a0ba95149583b51d64c (diff)
Added maximum texture unit detection.
-rw-r--r--src/detect.c16
-rw-r--r--src/detect.h2
-rw-r--r--src/dump.c2
-rw-r--r--src/test.c2
4 files changed, 21 insertions, 1 deletions
diff --git a/src/detect.c b/src/detect.c
index 3120ae4..6cbf8cb 100644
--- a/src/detect.c
+++ b/src/detect.c
@@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <GL/gl.h>
+#include <GL/glext.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -44,6 +46,8 @@ unsigned int reg_addr = 0;
unsigned int reg_device_id = 0;
unsigned int reg_len = 0;
+unsigned int gl_max_texture_units = 0;
+
static int
is_agp_iomem (int level, char *name)
{
@@ -256,3 +260,15 @@ detect_reg_aperture (void)
pci_cleanup (pacc);
}
}
+
+void
+detect_max_texture_units (void)
+{
+ glGetIntegerv (GL_MAX_TEXTURE_UNITS, &gl_max_texture_units);
+
+ if (option_debug)
+ {
+ printf ("%s: gl_max_texture_units = %d\n", __func__,
+ gl_max_texture_units);
+ }
+}
diff --git a/src/detect.h b/src/detect.h
index 38cdd64..f4a82ce 100644
--- a/src/detect.h
+++ b/src/detect.h
@@ -35,10 +35,12 @@ extern char reg_device_name[BUFSIZ];
extern unsigned int reg_addr;
extern unsigned int reg_device_id;
extern unsigned int reg_len;
+extern unsigned int gl_max_texture_units;
void detect_agp_aperture (void);
void detect_fb_aperture (void);
void detect_pcigart_aperture (void);
void detect_igpgart_aperture (void);
void detect_reg_aperture (void);
+void detect_max_texture_units (void);
#endif
diff --git a/src/dump.c b/src/dump.c
index 6588347..cc653dd 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -66,7 +66,7 @@ dump_reg (unsigned int key, unsigned int val)
ib_addr = ib_size = 0;
}
- for (i = 0; i < /* FIXME */ 16; i++)
+ for (i = 0; i < gl_max_texture_units; i++)
{
if (key == R300_TX_SIZE_0 + (i << 2))
{
diff --git a/src/test.c b/src/test.c
index 85638c8..7ffcfe2 100644
--- a/src/test.c
+++ b/src/test.c
@@ -181,6 +181,8 @@ test (void)
int i;
struct test_t *test;
+ detect_max_texture_units ();
+
dump_device_id ();
dump_device_name ();
dump_fglrx_version ();