diff options
Diffstat (limited to 'progs/tests')
-rw-r--r-- | progs/tests/Makefile | 2 | ||||
-rw-r--r-- | progs/tests/fbotest1.c | 6 | ||||
-rw-r--r-- | progs/tests/fbotest2.c | 52 | ||||
-rw-r--r-- | progs/tests/fbotest3.c | 6 | ||||
-rw-r--r-- | progs/tests/getprocaddress.py | 4 | ||||
-rw-r--r-- | progs/tests/texwrap.c | 32 | ||||
-rw-r--r-- | progs/tests/vao-01.c | 2 | ||||
-rw-r--r-- | progs/tests/vao-02.c | 2 |
8 files changed, 83 insertions, 23 deletions
diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 6c78abcf5e0..67efc3b7a9c 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -158,7 +158,7 @@ clean: # auto code generation getprocaddress: getprocaddress.c getproclist.h -getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py +getproclist.h: $(TOP)/src/mesa/glapi/gen/gl_API.xml getprocaddress.c getprocaddress.py python getprocaddress.py > getproclist.h arraytexture: arraytexture.o readtex.o diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c index 0cd7f95c355..a95fdff74c3 100644 --- a/progs/tests/fbotest1.c +++ b/progs/tests/fbotest1.c @@ -36,8 +36,8 @@ Display( void ) /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -161,7 +161,7 @@ Init( void ) assert(i == MyFB); CheckError(__LINE__); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, MyRB); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c index f9c506193f6..faf0dd87484 100644 --- a/progs/tests/fbotest2.c +++ b/progs/tests/fbotest2.c @@ -33,15 +33,16 @@ CheckError(int line) static void Display( void ) { - GLubyte *buffer = malloc(Width * Height * 4); + GLboolean copyPix = GL_FALSE; + GLboolean blitPix = GL_FALSE; GLenum status; CheckError(__LINE__); /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -63,16 +64,43 @@ Display( void ) glutSolidTeapot(2.0); glPopMatrix(); - /* read from user framebuffer */ - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + if (copyPix) { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + glDrawBuffer(GL_BACK); - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + + glWindowPos2iARB(0, 0); + glCopyPixels(0, 0, Width, Height, GL_COLOR); + } + else if (blitPix) { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + glDrawBuffer(GL_BACK); + + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + + glBlitFramebufferEXT(0, 0, Width, Height, + 0, 0, Width, Height, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + else { + GLubyte *buffer = malloc(Width * Height * 4); + /* read from user framebuffer */ + glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + /* draw to window */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + glWindowPos2iARB(0, 0); + glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + free(buffer); + } - free(buffer); glutSwapBuffers(); CheckError(__LINE__); } @@ -163,7 +191,7 @@ Init( void ) glGenRenderbuffersEXT(1, &ColorRb); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); assert(glIsRenderbufferEXT(ColorRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorRb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/fbotest3.c b/progs/tests/fbotest3.c index 8e288b38b83..c176f82d2ba 100644 --- a/progs/tests/fbotest3.c +++ b/progs/tests/fbotest3.c @@ -50,8 +50,8 @@ Display( void ) /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -189,7 +189,7 @@ Init( void ) glGenRenderbuffersEXT(1, &ColorRb); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb); assert(glIsRenderbufferEXT(ColorRb)); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorRb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py index 699195bd48c..60111cb8010 100644 --- a/progs/tests/getprocaddress.py +++ b/progs/tests/getprocaddress.py @@ -4,7 +4,7 @@ # Helper for the getprocaddress.c test. import sys, getopt, re -sys.path.append("../../src/mesa/glapi/" ) +sys.path.append("../../src/mesa/glapi/gen" ) import gl_XML import license @@ -74,7 +74,7 @@ static struct name_test_pair functions[] = {""" if __name__ == '__main__': - file_name = "../../src/mesa/glapi/gl_API.xml" + file_name = "../../src/mesa/glapi/gen/gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c index 39c55919dd2..bb26635d670 100644 --- a/progs/tests/texwrap.c +++ b/progs/tests/texwrap.c @@ -31,6 +31,7 @@ #define BORDER_TEXTURE 1 #define NO_BORDER_TEXTURE 2 +#define COLOR_TEX_CORNERS 0 #define SIZE 8 static GLubyte BorderImage[SIZE+2][SIZE+2][4]; @@ -281,6 +282,37 @@ static void Init( void ) for (i = 0; i < SIZE; i++) { for (j = 0; j < SIZE; j++) { +#if COLOR_TEX_CORNERS + if (i == 0 && j == 0) { + /* lower-left texel = RED */ + NoBorderImage[i][j][0] = 255; + NoBorderImage[i][j][1] = 0; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else if (i == 0 && j == SIZE-1) { + /* lower-right corner = GREEN */ + NoBorderImage[i][j][0] = 0; + NoBorderImage[i][j][1] = 255; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else if (i == SIZE-1 && j == 0) { + /* upper-left corner = BLUE */ + NoBorderImage[i][j][0] = 0; + NoBorderImage[i][j][1] = 0; + NoBorderImage[i][j][2] = 255; + NoBorderImage[i][j][3] = 255; + } + else if (i == SIZE-1 && j == SIZE-1) { + /* upper-right corner = YELLOW */ + NoBorderImage[i][j][0] = 255; + NoBorderImage[i][j][1] = 255; + NoBorderImage[i][j][2] = 0; + NoBorderImage[i][j][3] = 255; + } + else +#endif if ((i + j) & 1) { /* white */ NoBorderImage[i][j][0] = 255; diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c index e4a89cb19db..ee528d22439 100644 --- a/progs/tests/vao-01.c +++ b/progs/tests/vao-01.c @@ -30,7 +30,7 @@ * it (via \c glPopClientAttrib). After popping, the state of the VAO is * examined. * - * According the the APPLE_vertex_array_object spec, the contents of the VAO + * According to the APPLE_vertex_array_object spec, the contents of the VAO * should be restored to the values that they had when pushed. * * \author Ian Romanick <[email protected]> diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c index 9f7f5c27792..c23b4ab05a6 100644 --- a/progs/tests/vao-02.c +++ b/progs/tests/vao-02.c @@ -30,7 +30,7 @@ * it (via \c glPopClientAttrib). After popping, the state of the VAO is * examined. * - * According the the APPLE_vertex_array_object spec, the contents of the VAO + * According to the APPLE_vertex_array_object spec, the contents of the VAO * should be restored to the values that they had when pushed. * * \author Ian Romanick <[email protected]> |