diff options
author | Brian Paul <[email protected]> | 2003-06-10 14:54:37 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-06-10 14:54:37 +0000 |
commit | 9a2121cfb66ac715273dd1fcc5eadc17ee05a73e (patch) | |
tree | 21e50532992e8d5a7b2efed4fb2e210e4df7bc07 /progs/tests | |
parent | cd0fbde699cd61cb037d887f601fe33d97e69ce6 (diff) |
update for new directory tree
Diffstat (limited to 'progs/tests')
-rw-r--r-- | progs/tests/Makefile | 17 | ||||
-rw-r--r-- | progs/tests/getprocaddress.c | 180 | ||||
-rw-r--r-- | progs/tests/getprocaddress.py | 4 |
3 files changed, 190 insertions, 11 deletions
diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 1ab2df91c87..be6c6672536 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -3,10 +3,11 @@ # These programs aren't intended to be included with the normal # distro. They're not too interesting but they're good for testing. +TOP = ../../ CC = gcc -CFLAGS = -g -I../include -LIBS = -L../lib -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXext -lm +CFLAGS = -g -I$(TOP)/include +LIBS = -L$(TOP)/lib -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXext -lm PROGS = antialias \ cva \ @@ -42,7 +43,7 @@ PROGS = antialias \ $(CC) $(CFLAGS) $< $(LIBS) -o $@ .c.o: - $(CC) -c -I. -I../include $(CFLAGS) $< -o $@ + $(CC) -c -I. -I$(TOP)/include $(CFLAGS) $< -o $@ ##### TARGETS ##### @@ -57,7 +58,7 @@ clean: # auto code generation getprocaddress: getprocaddress.c getproclist.h -getproclist.h: ../bin/APIspec getprocaddress.c getprocaddress.py +getproclist.h: $(TOP)/src/mesa/glapi/APIspec getprocaddress.c getprocaddress.py python getprocaddress.py > getproclist.h @@ -71,8 +72,8 @@ readtex.o: readtex.c $(CC) -c $(CFLAGS) $< -o $@ -readtex.h: ../util/readtex.h - ln -s ../util/readtex.h . +readtex.h: $(TOP)/progs/util/readtex.h + ln -s $(TOP)/progs/util/readtex.h . -readtex.c: ../util/readtex.c - ln -s ../util/readtex.c . +readtex.c: $(TOP)/progs/util/readtex.c + ln -s $(TOP)/progs/util/readtex.c . diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index 95f34ade627..02e507fb527 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -1,4 +1,3 @@ -/* $Id: getprocaddress.c,v 1.6 2002/11/08 15:35:46 brianp Exp $ */ /* * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. @@ -36,6 +35,8 @@ #include <string.h> +#define EQUAL(X, Y) (fabs((X) - (Y)) < 0.001) + static GLboolean test_ActiveTextureARB(void *func) { @@ -78,6 +79,183 @@ test_ActiveStencilFaceEXT(void *func) } +static GLboolean +test_VertexAttrib1fvARB(void *func) +{ + PFNGLVERTEXATTRIB1FVARBPROC vertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLfloat v[1] = {25.0}; + const GLfloat def[1] = {0}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib1fvARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (res[0] == 25.0 && res[1] == 0.0 && res[2] == 0.0 && res[3] == 1.0); + (*vertexAttrib1fvARB)(6, def); + return pass; +} + +static GLboolean +test_VertexAttrib4NubvARB(void *func) +{ + PFNGLVERTEXATTRIB4NUBVARBPROC vertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLubyte v[4] = {255, 0, 255, 0}; + const GLubyte def[4] = {0, 0, 0, 255}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4NubvARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0); + (*vertexAttrib4NubvARB)(6, def); + return pass; +} + + +static GLboolean +test_VertexAttrib4NuivARB(void *func) +{ + PFNGLVERTEXATTRIB4NUIVARBPROC vertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLuint v[4] = {0xffffffff, 0, 0xffffffff, 0}; + const GLuint def[4] = {0, 0, 0, 0xffffffff}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4NuivARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); + (*vertexAttrib4NuivARB)(6, def); + return pass; +} + + +static GLboolean +test_VertexAttrib4ivARB(void *func) +{ + PFNGLVERTEXATTRIB4IVARBPROC vertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLint v[4] = {1, 2, -3, 4}; + const GLint def[4] = {0, 0, 0, 1}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4ivARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 2.0) && EQUAL(res[2], -3.0) && EQUAL(res[3], 4.0)); + (*vertexAttrib4ivARB)(6, def); + return pass; +} + + +static GLboolean +test_VertexAttrib4NsvARB(void *func) +{ + PFNGLVERTEXATTRIB4NSVARBPROC vertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLshort v[4] = {0, 32767, 32767, 0}; + const GLshort def[4] = {0, 0, 0, 32767}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4NsvARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (EQUAL(res[0], 0.0) && EQUAL(res[1], 1.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); + (*vertexAttrib4NsvARB)(6, def); + return pass; +} + + +static GLboolean +test_VertexAttrib4NusvARB(void *func) +{ + PFNGLVERTEXATTRIB4NUSVARBPROC vertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC) func; + PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB"); + + const GLushort v[4] = {0xffff, 0, 0xffff, 0}; + const GLushort def[4] = {0, 0, 0, 0xffff}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4NusvARB)(6, v); + (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res); + pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0)); + (*vertexAttrib4NusvARB)(6, def); + return pass; +} + + +static GLboolean +test_VertexAttrib4ubNV(void *func) +{ + PFNGLVERTEXATTRIB4UBNVPROC vertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC) func; + PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); + + const GLubyte v[4] = {255, 0, 255, 0}; + const GLubyte def[4] = {0, 0, 0, 255}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4ubNV)(6, v[0], v[1], v[2], v[3]); + (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); + pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0); + (*vertexAttrib4ubNV)(6, def[0], def[1], def[2], def[3]); + return pass; +} + + +static GLboolean +test_VertexAttrib2sNV(void *func) +{ + PFNGLVERTEXATTRIB2SNVPROC vertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC) func; + PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); + + const GLshort v[2] = {2, -4,}; + const GLshort def[2] = {0, 0}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib2sNV)(6, v[0], v[1]); + (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); + pass = (EQUAL(res[0], 2) && EQUAL(res[1], -4) && EQUAL(res[2], 0) && res[3] == 1.0); + (*vertexAttrib2sNV)(6, def[0], def[1]); + return pass; +} + + +static GLboolean +test_VertexAttrib3fNV(void *func) +{ + PFNGLVERTEXATTRIB3FNVPROC vertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC) func; + PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); + + const GLfloat v[3] = {0.2, 0.4, 0.8}; + const GLfloat def[3] = {0, 0, 0}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib3fNV)(6, v[0], v[1], v[2]); + (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); + pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && res[3] == 1.0); + (*vertexAttrib3fNV)(6, def[0], def[1], def[2]); + return pass; +} + + +static GLboolean +test_VertexAttrib4dvNV(void *func) +{ + PFNGLVERTEXATTRIB4DVNVPROC vertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC) func; + PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV"); + + const GLdouble v[4] = {0.2, 0.4, 0.8, 1.2}; + const GLdouble def[4] = {0, 0, 0, 1}; + GLfloat res[4]; + GLboolean pass; + (*vertexAttrib4dvNV)(6, v); + (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res); + pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && EQUAL(res[3], 1.2)); + (*vertexAttrib4dvNV)(6, def); + return pass; +} /* diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py index 987dfbcbbbd..743a35ebf6a 100644 --- a/progs/tests/getprocaddress.py +++ b/progs/tests/getprocaddress.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# $Id: getprocaddress.py,v 1.2 2002/11/08 15:49:31 brianp Exp $ +# $Id: getprocaddress.py,v 1.3 2003/06/10 14:54:37 brianp Exp $ # Helper for the getprocaddress.c test. @@ -90,7 +90,7 @@ def PrintFunctions(specFile, tests): tests = FindTestFunctions() PrintHead() -PrintFunctions("../bin/APIspec", tests) +PrintFunctions("../../src/mesa/glapi/APIspec", tests) PrintTail() |