From 6c6896bd25034fb4c457110f45fe73277a9ce463 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:02:02 -0600 Subject: progs/tests: disable texturing before printing text --- progs/tests/texcmp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c index d1e829d1b73..743b1b09b44 100644 --- a/progs/tests/texcmp.c +++ b/progs/tests/texcmp.c @@ -115,6 +115,8 @@ static void Display( void ) glPopMatrix(); + glDisable(GL_TEXTURE_2D); + /* info */ glColor4f(1, 1, 1, 1); -- cgit v1.2.3 From bb659f6e53095d4eeef85a3d586721306a0c3e80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:43:22 -0600 Subject: progs/tests: additional debug code --- progs/tests/packedpixels.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index 1703b271cb0..f4e5d0a7953 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -191,6 +191,16 @@ MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap) format->format, format->type, texBuffer); } + if (0) { + GLint r, g, b, a; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + printf("sizes: %d %d %d %d\n", r, g, b, a); + glGetError(); + } + if (glGetError()) { printf("GL Error for %s\n", format->name); memset(texBuffer, 255, 1000); -- cgit v1.2.3 From f7455ad7af09b5ef31ccc454b79422a13c59af9a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 8 Oct 2009 08:08:11 -0600 Subject: progs/tests: Fix MSVC build. --- progs/tests/minmag.c | 1 - 1 file changed, 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/minmag.c b/progs/tests/minmag.c index 03019f94faa..179be511207 100644 --- a/progs/tests/minmag.c +++ b/progs/tests/minmag.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From d54e9f54d0d62f5a4d40cdf0530156566b84bed0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 6 Oct 2009 16:59:07 +0100 Subject: progs: Remove unused empty file. --- progs/trivial/psb_context.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 progs/trivial/psb_context.c (limited to 'progs') diff --git a/progs/trivial/psb_context.c b/progs/trivial/psb_context.c deleted file mode 100644 index e69de29bb2d..00000000000 -- cgit v1.2.3 From 023bab675ad0c77f7afd23a0fd64c2a8833f6678 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 9 Oct 2009 13:57:23 +0100 Subject: progs/perf: Ignores! --- progs/perf/.gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 progs/perf/.gitignore (limited to 'progs') diff --git a/progs/perf/.gitignore b/progs/perf/.gitignore new file mode 100644 index 00000000000..7e8fe616cd5 --- /dev/null +++ b/progs/perf/.gitignore @@ -0,0 +1,10 @@ +copytex +drawoverhead +fbobind +fill +genmipmap +readpixels +swapbuffers +teximage +vbo +vertexrate -- cgit v1.2.3 From 76d2ec3a0a047a65ffca70f53848241a3225dad3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 9 Oct 2009 07:24:04 -0600 Subject: progs/tests: Add tests to Makefile. --- progs/tests/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 4d9b4e8388c..2b93aa5464f 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -25,6 +25,7 @@ SOURCES = \ arbvptorus.c \ arbvpwarpmesh.c \ arraytexture.c \ + auxbuffer.c \ blendminmax.c \ blendsquare.c \ blendxor.c \ @@ -40,6 +41,7 @@ SOURCES = \ cva.c \ drawbuffers.c \ exactrast.c \ + ext422square.c \ floattex.c \ fbotest1.c \ fbotest2.c \ @@ -65,6 +67,8 @@ SOURCES = \ mipmap_limits.c \ mipmap_view.c \ multipal.c \ + multitexarray.c \ + multiwindow.c \ no_s3tc.c \ packedpixels.c \ pbo.c \ @@ -87,10 +91,12 @@ SOURCES = \ subtex \ subtexrate.c \ tex1d.c \ + texcmp.c \ texcompress2.c \ texcompsub.c \ texdown \ texfilt.c \ + texgenmix.c \ texline.c \ texobj.c \ texobjshare.c \ @@ -100,6 +106,7 @@ SOURCES = \ vao-01.c \ vao-02.c \ vparray.c \ + vpeval.c \ vptest1.c \ vptest2.c \ vptest3.c \ -- cgit v1.2.3 From cbf46ed670ef5a5c8a641730234dd7ae964c3170 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 10 Oct 2009 10:45:16 -0600 Subject: progs/perf: Fix MSVC build. --- progs/tests/texcomp_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/texcomp_image.h b/progs/tests/texcomp_image.h index e63a56774f3..a3884d4d0df 100644 --- a/progs/tests/texcomp_image.h +++ b/progs/tests/texcomp_image.h @@ -1,4 +1,4 @@ -static int ImgSize = 131072; +#define ImgSize 131072 static unsigned char ImgData[131072] = { 0x4d, 0xbc, 0x0b, 0xb4, 0xda, 0x0a, 0x78, 0xa8, 0x8d, 0xbc, 0x0c, 0xac, 0x8b, 0x7f, 0xeb, 0xf7, 0x8d, 0xbc, 0xeb, 0xab, 0xba, 0xb7, 0x82, 0xa2, 0x8d, 0xbc, 0x2b, 0xb4, 0xa2, 0xfd, 0xee, 0x2f, -- cgit v1.2.3 From 96fd13c1a024e3b6c0b1c44394c67c772e52b9c9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 12 Oct 2009 18:05:05 -0600 Subject: prog/tests: Fix MSVC build. --- progs/tests/crossbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c index 3dd21372f9a..bd8e05aee13 100644 --- a/progs/tests/crossbar.c +++ b/progs/tests/crossbar.c @@ -145,7 +145,7 @@ static void Init( void ) { const char * const ver_string = (const char * const) glGetString( GL_VERSION ); - float ver = strtof( ver_string, NULL ); + float ver = strtod( ver_string, NULL ); GLint tex_units; GLint temp[ 256 ]; -- cgit v1.2.3 From ea862ec8ff4a52b30b822e737d93a49330be9e31 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 14 Oct 2009 07:43:18 -0600 Subject: prog/tests: Fix MSVC build. --- progs/tests/arraytexture.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'progs') diff --git a/progs/tests/arraytexture.c b/progs/tests/arraytexture.c index 6c0484df0de..28252a354bf 100644 --- a/progs/tests/arraytexture.c +++ b/progs/tests/arraytexture.c @@ -77,10 +77,6 @@ static GLfloat texZ = 0.0; static GLfloat texZ_dir = 0.01; static GLint num_layers; -static PFNGLBINDPROGRAMARBPROC bind_program; -static PFNGLPROGRAMSTRINGARBPROC program_string; -static PFNGLGENPROGRAMSARBPROC gen_programs; - static void PrintString(const char *s) @@ -125,13 +121,13 @@ static void Display(void) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0); glColor3f(1,1,1); glRasterPos3f(-0.9, -0.9, 0.0); sprintf(str, "Texture Z coordinate = %4.1f", texZ); PrintString(str); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 1); GL_CHECK_ERROR(); glEnable(GL_TEXTURE_2D_ARRAY_EXT); GL_CHECK_ERROR(); @@ -159,7 +155,7 @@ static void Display(void) glDisable(GL_TEXTURE_2D_ARRAY_EXT); GL_CHECK_ERROR(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0); GL_CHECK_ERROR(); glutSwapBuffers(); @@ -226,8 +222,8 @@ compile_fragment_program(GLuint id, const char *prog) int err; err = glGetError(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id); - (*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id); + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(prog), (const GLubyte *) prog); glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos); @@ -264,11 +260,6 @@ static void Init(void) require_extension("GL_MESA_texture_array"); require_extension("GL_SGIS_generate_mipmap"); - bind_program = glutGetProcAddress("glBindProgramARB"); - program_string = glutGetProcAddress("glProgramStringARB"); - gen_programs = glutGetProcAddress("glGenProgramsARB"); - - for (num_layers = 0; textures[num_layers] != NULL; num_layers++) /* empty */ ; -- cgit v1.2.3 From 115edf24a9128b79dfa5f30482c990e2cb898357 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Tue, 13 Oct 2009 10:55:34 -0700 Subject: Fix build when PROGRAM_DIRS is empty. SUBDIRS just takes PROGRAM_DIRS value. If PROGRAM_DIRS gets set to the empty string (as can happen when building only OSMesa), a 'for' loop will lack anything to iterate over, causing a parse error. This fixes the issue by making sure SUBDIRS is the null string when PROGRAM_DIRS is, and wrapping the for loops in if's, causing them only to execute if there are directories to iterate over. --- progs/Makefile | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'progs') diff --git a/progs/Makefile b/progs/Makefile index c99f4eebcc1..064e5a232ee 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -4,7 +4,7 @@ TOP = .. include $(TOP)/configs/current -SUBDIRS = $(PROGRAM_DIRS) +SUBDIRS ="$(PROGRAM_DIRS)" default: message subdirs @@ -15,18 +15,22 @@ message: subdirs: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE)) || exit 1 ; \ - fi \ - done + @if test -n "$(SUBDIRS)" ; then \ + for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done \ + fi # Dummy install target install: clean: - -@for dir in $(SUBDIRS) tests ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) clean) ; \ - fi \ - done + -@if test -n "$(SUBDIRS)" ; then \ + for dir in $(SUBDIRS) tests ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done \ + fi -- cgit v1.2.3 From 91bd87c06ee5427887e1284bd52424387e54397f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 19:13:32 -0600 Subject: progs/demos: try different depth formats in fbo_firecube.c --- progs/demos/fbo_firecube.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c index 4e42924a09e..b3f7e00e5af 100644 --- a/progs/demos/fbo_firecube.c +++ b/progs/demos/fbo_firecube.c @@ -938,7 +938,14 @@ reshape(int width, int height) static void init_fbotexture() { + static const GLenum depthFormats[] = { + GL_DEPTH_COMPONENT, + GL_DEPTH_COMPONENT16, + GL_DEPTH_COMPONENT32 + }; + static int numDepthFormats = sizeof(depthFormats) / sizeof(depthFormats[0]); GLint i; + GLenum stat; /* gen framebuffer id, delete it, do some assertions, just for testing */ glGenFramebuffersEXT(1, &MyFB); @@ -969,18 +976,31 @@ init_fbotexture() /* make depth renderbuffer */ glGenRenderbuffersEXT(1, &DepthRB); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, - TexWidth, TexHeight); - CheckError(__LINE__); + /* we may have to try several formats */ + for (i = 0; i < numDepthFormats; i++) { + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormats[i], + TexWidth, TexHeight); + CheckError(__LINE__); + + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, DepthRB); + CheckError(__LINE__); + stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (stat == GL_FRAMEBUFFER_COMPLETE_EXT) { + break; + } + } + + if (stat != GL_FRAMEBUFFER_COMPLETE_EXT) { + fprintf(stderr, "Error: unable to get usable FBO combination!\n"); + exit(1); + } + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); + GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); CheckError(__LINE__); printf("Depth renderbuffer size = %d bits\n", i); - /* attach DepthRB to MyFB */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, DepthRB); - CheckError(__LINE__); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); /* -- cgit v1.2.3 From 31f7e8efb25a77e3bdfb6e9850cf31e339060976 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 09:37:40 -0600 Subject: progs/Makefile: remove extra quoting This reverts part of commit 115edf24a9128b79dfa5f30482c990e2cb898357 and fixes the error: "/bin/sh: line 0: test: too many arguments". --- progs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/Makefile b/progs/Makefile index 064e5a232ee..3700707dfb1 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -4,7 +4,7 @@ TOP = .. include $(TOP)/configs/current -SUBDIRS ="$(PROGRAM_DIRS)" +SUBDIRS = $(PROGRAM_DIRS) default: message subdirs -- cgit v1.2.3 From 5b7d9053a08d5042206781a664ecd74efac0eb86 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 13:00:03 -0600 Subject: progs/egl: put declarations before code --- progs/egl/eglgears.c | 10 ++++++---- progs/egl/egltri.c | 5 +++-- progs/egl/peglgears.c | 10 ++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'progs') diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c index 0eee9ecf4da..052d0f9e25d 100644 --- a/progs/egl/eglgears.c +++ b/progs/egl/eglgears.c @@ -274,10 +274,10 @@ draw(void) static void reshape(int width, int height) { - glViewport(0, 0, (GLint) width, (GLint) height); - GLfloat h = (GLfloat) height / (GLfloat) width; + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); @@ -333,6 +333,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) double st = current_time(); double ct = st; int frames = 0; + GLfloat seconds, fps; + while (ct - st < ttr) { double tt = current_time(); @@ -352,8 +354,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) frames++; } - GLfloat seconds = ct - st; - GLfloat fps = frames / seconds; + seconds = ct - st; + fps = frames / seconds; printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps); } diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c index 79f6702007e..9bbc3cddaf1 100644 --- a/progs/egl/egltri.c +++ b/progs/egl/egltri.c @@ -127,6 +127,7 @@ static void run(EGLDisplay dpy, EGLSurface surf, int ttr) double st = current_time(); double ct = st; int frames = 0; + GLfloat seconds, fps; while (ct - st < ttr) { @@ -139,8 +140,8 @@ static void run(EGLDisplay dpy, EGLSurface surf, int ttr) frames++; } - GLfloat seconds = ct - st; - GLfloat fps = frames / seconds; + seconds = ct - st; + fps = frames / seconds; printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps); } diff --git a/progs/egl/peglgears.c b/progs/egl/peglgears.c index 1ddb691677f..212d1acf692 100644 --- a/progs/egl/peglgears.c +++ b/progs/egl/peglgears.c @@ -274,10 +274,10 @@ draw(void) static void reshape(int width, int height) { - glViewport(0, 0, (GLint) width, (GLint) height); - GLfloat h = (GLfloat) height / (GLfloat) width; + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); @@ -333,6 +333,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) double st = current_time(); double ct = st; int frames = 0; + GLfloat seconds, fps; + while (ct - st < ttr) { double tt = current_time(); @@ -352,8 +354,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr) frames++; } - GLfloat seconds = ct - st; - GLfloat fps = frames / seconds; + seconds = ct - st; + fps = frames / seconds; printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps); } -- cgit v1.2.3 From 60b6c7458319ff01ecdd9d1650d526ac8f75e194 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 16 Oct 2009 11:36:09 +0100 Subject: prog/tests: Fix MSVC build. --- progs/tests/invert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/invert.c b/progs/tests/invert.c index 63099fbd221..3bc97a460b6 100644 --- a/progs/tests/invert.c +++ b/progs/tests/invert.c @@ -128,7 +128,7 @@ static void Init( void ) { const char * const ver_string = (const char * const) glGetString( GL_VERSION ); - const float ver = strtof( ver_string, NULL ); + const float ver = strtod( ver_string, NULL ); printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); -- cgit v1.2.3 From 699260b19535abaa3af0a5d33eb039e3d6a30ce9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 16 Oct 2009 11:39:29 +0100 Subject: progs/tests: Use rand() instead of random(). More portable. Same implementation on Linux. --- progs/tests/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 6dd956c4023..6123ef7c162 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -116,7 +116,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param, for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); + param[i] = (GLfloat) rand() / (GLfloat) rand(); } /* Try using the "classic" interface. -- cgit v1.2.3 From 166957abebea6aa203eba7e6348e89d53cf0e13e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 16 Oct 2009 11:39:29 +0100 Subject: progs/tests: Use rand() instead of random(). Forgot these on previous commit. --- progs/tests/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 6123ef7c162..28e3b537acd 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -153,7 +153,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param, for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); + param[i] = (GLfloat) rand() / (GLfloat) rand(); } printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count); -- cgit v1.2.3 From 5283a3fb25b2667501eb782fb461c981200a65ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Oct 2009 16:22:03 -0600 Subject: progs/trivial: check if GL_ARB_occlusion_query is supported --- progs/trivial/tri-query.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'progs') diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index 85e39df2dfa..94956a86f33 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -39,6 +39,11 @@ GLenum doubleBuffer; static void Init(void) { + if (!glutExtensionSupported("GL_ARB_occlusion_query")) { + fprintf(stderr, "Sorry, this program requires GL_ARB_occlusion_query\n"); + exit(1); + } + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); -- cgit v1.2.3 From 82ffc5884c29a8d4eb70fde15f27cace4732a4bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 21:51:06 -0600 Subject: progs/tests: draw Z values as luminance, no pixel zoom --- progs/tests/zreaddraw.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'progs') diff --git a/progs/tests/zreaddraw.c b/progs/tests/zreaddraw.c index 7dfed20cfb9..7740695bb66 100644 --- a/progs/tests/zreaddraw.c +++ b/progs/tests/zreaddraw.c @@ -58,6 +58,10 @@ static void Display(void) printf("Depth value range: [%f, %f]\n", min, max); } + /* Draw the Z image as luminance above original rendering */ + glWindowPos2i(0, 100); + glDrawPixels(100, 100, GL_LUMINANCE, depthType, depth); + if (TestPacking) { glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); @@ -100,6 +104,7 @@ static void Display(void) glReadPixels(100, 0, 400, 400, GL_DEPTH_COMPONENT, GL_FLOAT, depth2); /* draw as luminance */ glPixelZoom(1.0, 1.0); + glWindowPos2i(100, 0); glDrawPixels(400, 400, GL_LUMINANCE, GL_FLOAT, depth2); glutSwapBuffers(); -- cgit v1.2.3 From 4e2bdd66352cf9a2e951bb21151edee25c8c0a8c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 18 Oct 2009 13:15:30 +0800 Subject: progs/egl: Add support for pixmap and pbuffer surface to xeglgears. Signed-off-by: Chia-I Wu --- progs/egl/xeglgears.c | 399 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 289 insertions(+), 110 deletions(-) (limited to 'progs') diff --git a/progs/egl/xeglgears.c b/progs/egl/xeglgears.c index 72ed0052832..614a6256037 100644 --- a/progs/egl/xeglgears.c +++ b/progs/egl/xeglgears.c @@ -95,9 +95,6 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; static GLint gear1, gear2, gear3; static GLfloat angle = 0.0; -static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */ - - /* * * Draw a gear wheel. You'll probably want to call this function when @@ -327,122 +324,235 @@ init(void) } -/* - * Create an RGB, double-buffered X window. - * Return the window and context handles. - */ -static void -make_x_window(Display *x_dpy, EGLDisplay egl_dpy, - const char *name, - int x, int y, int width, int height, - Window *winRet, - EGLContext *ctxRet, - EGLSurface *surfRet) -{ - static const EGLint attribs[] = { - EGL_RED_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_BLUE_SIZE, 1, - /*EGL_DOUBLEBUFFER,*/ - EGL_DEPTH_SIZE, 1, - EGL_NONE - }; +struct egl_manager { + EGLNativeDisplayType xdpy; + EGLNativeWindowType xwin; + EGLNativePixmapType xpix; - int scrnum; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - Window win; - XVisualInfo *visInfo, visTemplate; - int num_visuals; + EGLDisplay dpy; + EGLConfig conf; EGLContext ctx; - EGLConfig config; - EGLint num_configs, vid; - scrnum = DefaultScreen( x_dpy ); - root = RootWindow( x_dpy, scrnum ); + EGLSurface win; + EGLSurface pix; + EGLSurface pbuf; - if (fullscreen) { - x = 0; y = 0; - width = DisplayWidth( x_dpy, scrnum ); - height = DisplayHeight( x_dpy, scrnum ); + EGLBoolean verbose; + EGLint major, minor; +}; + +static struct egl_manager * +egl_manager_new(EGLNativeDisplayType xdpy, const EGLint *attrib_list, + EGLBoolean verbose) +{ + struct egl_manager *eman; + const char *ver; + EGLint num_conf; + + eman = calloc(1, sizeof(*eman)); + if (!eman) + return NULL; + + eman->verbose = verbose; + eman->xdpy = xdpy; + + eman->dpy = eglGetDisplay(eman->xdpy); + if (eman->dpy == EGL_NO_DISPLAY) { + printf("eglGetDisplay() failed\n"); + free(eman); + return NULL; } - if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) { - printf("Error: couldn't get an EGL visual config\n"); - exit(1); + if (!eglInitialize(eman->dpy, &eman->major, &eman->minor)) { + printf("eglInitialize() failed\n"); + free(eman); + return NULL; } - if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { - printf("Error: eglGetConfigAttrib() failed\n"); - exit(1); + ver = eglQueryString(eman->dpy, EGL_VERSION); + printf("EGL_VERSION = %s\n", ver); + + if (!eglChooseConfig(eman->dpy, attrib_list, &eman->conf, 1, &num_conf) || + !num_conf) { + printf("eglChooseConfig() failed\n"); + eglTerminate(eman->dpy); + free(eman); + return NULL; } - /* The X window visual must match the EGL config */ - visTemplate.visualid = vid; - visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals); - if (!visInfo) { - printf("Error: couldn't get X visual\n"); - exit(1); + eman->ctx = eglCreateContext(eman->dpy, eman->conf, EGL_NO_CONTEXT, NULL); + if (eman->ctx == EGL_NO_CONTEXT) { + printf("eglCreateContext() failed\n"); + eglTerminate(eman->dpy); + free(eman); + return NULL; + } + + return eman; +} + +static EGLBoolean +egl_manager_create_window(struct egl_manager *eman, const char *name, + EGLint w, EGLint h, EGLBoolean need_surface, + EGLBoolean fullscreen, const EGLint *attrib_list) +{ + XVisualInfo vinfo_template, *vinfo = NULL; + EGLint val, num_vinfo; + Window root; + XSetWindowAttributes attrs; + unsigned long mask; + EGLint x = 0, y = 0; + + if (!eglGetConfigAttrib(eman->dpy, eman->conf, + EGL_NATIVE_VISUAL_ID, &val)) { + printf("eglGetConfigAttrib() failed\n"); + return EGL_FALSE; + } + if (val) { + vinfo_template.visualid = (VisualID) val; + vinfo = XGetVisualInfo(eman->xdpy, VisualIDMask, &vinfo_template, &num_vinfo); + } + /* try harder if window surface is not needed */ + if (!vinfo && !need_surface && + eglGetConfigAttrib(eman->dpy, eman->conf, EGL_BUFFER_SIZE, &val)) { + if (val == 32) + val = 24; + vinfo_template.depth = val; + vinfo = XGetVisualInfo(eman->xdpy, VisualDepthMask, &vinfo_template, &num_vinfo); + } + + if (!vinfo) { + printf("XGetVisualInfo() failed\n"); + return EGL_FALSE; + } + + root = DefaultRootWindow(eman->xdpy); + if (fullscreen) { + x = y = 0; + w = DisplayWidth(eman->xdpy, DefaultScreen(eman->xdpy)); + h = DisplayHeight(eman->xdpy, DefaultScreen(eman->xdpy)); } /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; - attr.override_redirect = fullscreen; + attrs.background_pixel = 0; + attrs.border_pixel = 0; + attrs.colormap = XCreateColormap(eman->xdpy, root, vinfo->visual, AllocNone); + attrs.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + attrs.override_redirect = fullscreen; mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect; - win = XCreateWindow( x_dpy, root, 0, 0, width, height, - 0, visInfo->depth, InputOutput, - visInfo->visual, mask, &attr ); + eman->xwin = XCreateWindow(eman->xdpy, root, x, y, w, h, + 0, vinfo->depth, InputOutput, + vinfo->visual, mask, &attrs); + XFree(vinfo); /* set hints and properties */ { XSizeHints sizehints; sizehints.x = x; sizehints.y = y; - sizehints.width = width; - sizehints.height = height; + sizehints.width = w; + sizehints.height = h; sizehints.flags = USSize | USPosition; - XSetNormalHints(x_dpy, win, &sizehints); - XSetStandardProperties(x_dpy, win, name, name, - None, (char **)NULL, 0, &sizehints); + XSetNormalHints(eman->xdpy, eman->xwin, &sizehints); + XSetStandardProperties(eman->xdpy, eman->xwin, name, name, + None, (char **)NULL, 0, &sizehints); } - eglBindAPI(EGL_OPENGL_API); + if (need_surface) { + eman->win = eglCreateWindowSurface(eman->dpy, eman->conf, + eman->xwin, attrib_list); + if (eman->win == EGL_NO_SURFACE) { + printf("eglCreateWindowSurface() failed\n"); + XDestroyWindow(eman->xdpy, eman->xwin); + eman->xwin = None; + return EGL_FALSE; + } + } + + XMapWindow(eman->xdpy, eman->xwin); + + return EGL_TRUE; +} - ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL ); - if (!ctx) { - printf("Error: glXCreateContext failed\n"); - exit(1); +static EGLBoolean +egl_manager_create_pixmap(struct egl_manager *eman, EGLNativeWindowType xwin, + EGLBoolean need_surface, const EGLint *attrib_list) +{ + XWindowAttributes attrs; + + if (!XGetWindowAttributes(eman->xdpy, xwin, &attrs)) { + printf("XGetWindowAttributes() failed\n"); + return EGL_FALSE; + } + + eman->xpix = XCreatePixmap(eman->xdpy, xwin, + attrs.width, attrs.height, attrs.depth); + + if (need_surface) { + eman->pix = eglCreatePixmapSurface(eman->dpy, eman->conf, + eman->xpix, attrib_list); + if (eman->pix == EGL_NO_SURFACE) { + printf("eglCreatePixmapSurface() failed\n"); + XFreePixmap(eman->xdpy, eman->xpix); + eman->xpix = None; + return EGL_FALSE; + } } - *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL); + return EGL_TRUE; +} - XFree(visInfo); +static EGLBoolean +egl_manager_create_pbuffer(struct egl_manager *eman, const EGLint *attrib_list) +{ + eman->pbuf = eglCreatePbufferSurface(eman->dpy, eman->conf, attrib_list); + if (eman->pbuf == EGL_NO_SURFACE) { + printf("eglCreatePbufferSurface() failed\n"); + return EGL_FALSE; + } - *winRet = win; - *ctxRet = ctx; + return EGL_TRUE; } +static void +egl_manager_destroy(struct egl_manager *eman) +{ + eglMakeCurrent(eman->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(eman->dpy); + + if (eman->xwin != None) + XDestroyWindow(eman->xdpy, eman->xwin); + if (eman->xpix != None) + XFreePixmap(eman->xdpy, eman->xpix); + + free(eman); +} static void -event_loop(Display *dpy, Window win, - EGLDisplay egl_dpy, EGLSurface egl_surf) +event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h) { + GC gc = XCreateGC(eman->xdpy, eman->xwin, 0, NULL); + EGLint orig_w = w, orig_h = h; + + if (surface_type == EGL_PBUFFER_BIT) + printf("there will be no screen update if " + "eglCopyBuffers() is not implemented\n"); + while (1) { - while (XPending(dpy) > 0) { + while (XPending(eman->xdpy) > 0) { XEvent event; - XNextEvent(dpy, &event); + XNextEvent(eman->xdpy, &event); switch (event.type) { - case Expose: + case Expose: /* we'll redraw below */ - break; - case ConfigureNotify: - reshape(event.xconfigure.width, event.xconfigure.height); - break; + break; + case ConfigureNotify: + w = event.xconfigure.width; + h = event.xconfigure.height; + if (surface_type == EGL_WINDOW_BIT) + reshape(w, h); + break; case KeyPress: { char buffer[10]; @@ -476,6 +586,7 @@ event_loop(Display *dpy, Window win, static int frames = 0; static double tRot0 = -1.0, tRate0 = -1.0; double dt, t = current_time(); + int x, y; if (tRot0 < 0.0) tRot0 = t; dt = t - tRot0; @@ -487,7 +598,25 @@ event_loop(Display *dpy, Window win, angle -= 3600.0; draw(); - eglSwapBuffers(egl_dpy, egl_surf); + switch (surface_type) { + case EGL_WINDOW_BIT: + eglSwapBuffers(eman->dpy, eman->win); + break; + case EGL_PBUFFER_BIT: + eglWaitClient(); + if (!eglCopyBuffers(eman->xdpy, eman->pbuf, eman->xpix)) + break; + /* fall through */ + case EGL_PIXMAP_BIT: + eglWaitClient(); + for (x = 0; x < w; x += orig_w) { + for (y = 0; y < h; y += orig_h) { + XCopyArea(eman->xdpy, eman->xpix, eman->xwin, gc, + 0, 0, orig_w, orig_h, x, y); + } + } + break; + } frames++; @@ -503,6 +632,8 @@ event_loop(Display *dpy, Window win, } } } + + XFreeGC(eman->xdpy, gc); } @@ -513,6 +644,8 @@ usage(void) printf(" -display set the display to run on\n"); printf(" -fullscreen run in fullscreen mode\n"); printf(" -info display OpenGL renderer info\n"); + printf(" -pixmap use pixmap surface\n"); + printf(" -pbuffer use pbuffer surface\n"); } @@ -521,15 +654,23 @@ main(int argc, char *argv[]) { const int winWidth = 300, winHeight = 300; Display *x_dpy; - Window win; - EGLSurface egl_surf; - EGLContext egl_ctx; - EGLDisplay egl_dpy; char *dpyName = NULL; + struct egl_manager *eman; + EGLint attribs[] = { + EGL_SURFACE_TYPE, 0, /* filled later */ + EGL_RED_SIZE, 1, + EGL_GREEN_SIZE, 1, + EGL_BLUE_SIZE, 1, + EGL_DEPTH_SIZE, 1, + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, + EGL_NONE + }; + char win_title[] = "xeglgears (window/pixmap/pbuffer)"; + EGLint surface_type = EGL_WINDOW_BIT; GLboolean printInfo = GL_FALSE; - EGLint egl_major, egl_minor; + GLboolean fullscreen = GL_FALSE; + EGLBoolean ret; int i; - const char *s; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-display") == 0) { @@ -542,12 +683,21 @@ main(int argc, char *argv[]) else if (strcmp(argv[i], "-fullscreen") == 0) { fullscreen = GL_TRUE; } + else if (strcmp(argv[i], "-pixmap") == 0) { + surface_type = EGL_PIXMAP_BIT; + } + else if (strcmp(argv[i], "-pbuffer") == 0) { + surface_type = EGL_PBUFFER_BIT; + } else { usage(); return -1; } } + /* set surface type */ + attribs[1] = surface_type; + x_dpy = XOpenDisplay(dpyName); if (!x_dpy) { printf("Error: couldn't open display %s\n", @@ -555,26 +705,60 @@ main(int argc, char *argv[]) return -1; } - egl_dpy = eglGetDisplay(x_dpy); - if (!egl_dpy) { - printf("Error: eglGetDisplay() failed\n"); - return -1; - } + eglBindAPI(EGL_OPENGL_API); - if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) { - printf("Error: eglInitialize() failed\n"); + eman = egl_manager_new(x_dpy, attribs, printInfo); + if (!eman) { + XCloseDisplay(x_dpy); return -1; } - s = eglQueryString(egl_dpy, EGL_VERSION); - printf("EGL_VERSION = %s\n", s); - - make_x_window(x_dpy, egl_dpy, - "glxgears", 0, 0, winWidth, winHeight, - &win, &egl_ctx, &egl_surf); + snprintf(win_title, sizeof(win_title), "xeglgears (%s)", + (surface_type == EGL_WINDOW_BIT) ? "window" : + (surface_type == EGL_PIXMAP_BIT) ? "pixmap" : "pbuffer"); + + /* create surface(s) */ + switch (surface_type) { + case EGL_WINDOW_BIT: + ret = egl_manager_create_window(eman, win_title, winWidth, winHeight, + EGL_TRUE, fullscreen, NULL); + if (ret) + ret = eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx); + break; + case EGL_PIXMAP_BIT: + ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight, + EGL_FALSE, fullscreen, NULL) && + egl_manager_create_pixmap(eman, eman->xwin, + EGL_TRUE, NULL)); + if (ret) + ret = eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx); + break; + case EGL_PBUFFER_BIT: + { + EGLint pbuf_attribs[] = { + EGL_WIDTH, winWidth, + EGL_HEIGHT, winHeight, + EGL_NONE + }; + ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight, + EGL_FALSE, fullscreen, NULL) && + egl_manager_create_pixmap(eman, eman->xwin, + EGL_FALSE, NULL) && + egl_manager_create_pbuffer(eman, pbuf_attribs)); + if (ret) + ret = eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx); + } + break; + default: + ret = EGL_FALSE; + break; + } - XMapWindow(x_dpy, win); - eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx); + if (!ret) { + egl_manager_destroy(eman); + XCloseDisplay(x_dpy); + return -1; + } if (printInfo) { printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); @@ -590,18 +774,13 @@ main(int argc, char *argv[]) */ reshape(winWidth, winHeight); - event_loop(x_dpy, win, egl_dpy, egl_surf); + event_loop(eman, surface_type, winWidth, winHeight); glDeleteLists(gear1, 1); glDeleteLists(gear2, 1); glDeleteLists(gear3, 1); - eglDestroyContext(egl_dpy, egl_ctx); - eglDestroySurface(egl_dpy, egl_surf); - eglTerminate(egl_dpy); - - - XDestroyWindow(x_dpy, win); + egl_manager_destroy(eman); XCloseDisplay(x_dpy); return 0; -- cgit v1.2.3 From 61a96a2ac72b3f071151de436a48c6ec985e3653 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 17:11:59 -0600 Subject: progs/xdemos: fix command line flag typo --- progs/xdemos/glsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c index 34167d339f3..da87306cf2a 100644 --- a/progs/xdemos/glsync.c +++ b/progs/xdemos/glsync.c @@ -95,7 +95,7 @@ enum sync_type { static void usage(char *name) { printf("usage: %s [-w ] [-h ] [-s] " - "[-vc]\n", name); + "[-v]\n", name); printf("\t-s:\n"); printf("\t\tn: none\n"); printf("\t\ts: SGI video sync extension\n"); -- cgit v1.2.3 From 19403935aa4782227a1199cb0355f4bc6c0d02db Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 26 Sep 2009 08:39:57 +0100 Subject: progs/demos: add fps to multiarb --- progs/demos/multiarb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'progs') diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c index 85c4e3a266c..3d89d3a13e9 100644 --- a/progs/demos/multiarb.c +++ b/progs/demos/multiarb.c @@ -27,6 +27,8 @@ #define ANIMATE 10 #define QUIT 100 +static GLint T0 = 0; +static GLint Frames = 0; static GLboolean Animate = GL_TRUE; static GLint NumUnits = 1; static GLboolean TexEnabled[8]; @@ -105,6 +107,20 @@ static void Display( void ) glPopMatrix(); glutSwapBuffers(); + + Frames++; + + { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); + fflush(stdout); + T0 = t; + Frames = 0; + } + } } -- cgit v1.2.3 From 952bf63e2cf442504ef89b0b1d276da0d52b21d4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 23 Oct 2009 13:49:02 -0600 Subject: progs/tests: Fix MSVC build. --- progs/tests/prog_parameter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 28e3b537acd..0241f3a2496 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -203,20 +203,20 @@ static void Init( void ) } - program_local_parameter4fv = glutGetProcAddress( "glProgramLocalParameter4fvARB" ); - program_env_parameter4fv = glutGetProcAddress( "glProgramEnvParameter4fvARB" ); + program_local_parameter4fv = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramLocalParameter4fvARB" ); + program_env_parameter4fv = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramEnvParameter4fvARB" ); - get_program_local_parameterfv = glutGetProcAddress( "glGetProgramLocalParameterfvARB" ); - get_program_env_parameterfv = glutGetProcAddress( "glGetProgramEnvParameterfvARB" ); + get_program_local_parameterfv = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramLocalParameterfvARB" ); + get_program_env_parameterfv = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramEnvParameterfvARB" ); - bind_program = glutGetProcAddress( "glBindProgramARB" ); - get_program = glutGetProcAddress( "glGetProgramivARB" ); + bind_program = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress( "glBindProgramARB" ); + get_program = (PFNGLGETPROGRAMIVARBPROC) glutGetProcAddress( "glGetProgramivARB" ); if ( glutExtensionSupported("GL_EXT_gpu_program_parameters") ) { printf("GL_EXT_gpu_program_parameters available, testing that path.\n"); - program_local_parameters4fv = glutGetProcAddress( "glProgramLocalParameters4fvEXT" ); - program_env_parameters4fv = glutGetProcAddress( "glProgramEnvParameters4fvEXT" ); + program_local_parameters4fv = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramLocalParameters4fvEXT" ); + program_env_parameters4fv = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramEnvParameters4fvEXT" ); } else { printf("GL_EXT_gpu_program_parameters not available.\n"); -- cgit v1.2.3 From b01937a3c967ed23315c7543f97228be06942b7d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 14:52:10 -0600 Subject: progs/tests: print requested/internal format info --- progs/tests/texcmp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c index d1e829d1b73..45935e19a35 100644 --- a/progs/tests/texcmp.c +++ b/progs/tests/texcmp.c @@ -149,7 +149,7 @@ static void Reshape( int width, int height ) static void ReInit( GLenum TC, TEXTURE *Tx ) { - GLint rv; + GLint rv, v; if ((Tx->TC == TC) && (Tx->cData != NULL)) { glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */ @@ -170,6 +170,12 @@ static void ReInit( GLenum TC, TEXTURE *Tx ) GL_UNSIGNED_BYTE, /* texture type */ Tx->data); /* the texture */ + + v = 0; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, + GL_TEXTURE_INTERNAL_FORMAT, &v); + printf("Requested internal format = 0x%x, actual = 0x%x\n", TC, v); + /* okay, now cache the compressed texture */ Tx->TC = TC; if (Tx->cData != NULL) { -- cgit v1.2.3 From 51bc12d62338ad1874c437d692e1182c0bf3d4cd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:08:01 -0600 Subject: progs/tests: fix sub texture offsets --- progs/tests/texcompsub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/tests/texcompsub.c b/progs/tests/texcompsub.c index 50106bf1e22..215f5711d95 100644 --- a/progs/tests/texcompsub.c +++ b/progs/tests/texcompsub.c @@ -35,6 +35,8 @@ LoadCompressedImage(void) unsigned char ImgDataTemp[ImgSize / 4]; unsigned i; const GLenum filter = GL_LINEAR; + const int half = ImgSize / 2; + glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); @@ -42,11 +44,11 @@ LoadCompressedImage(void) glCompressedTexSubImage2DARB(Target, 0, 0, 0, /* pos */ ImgWidth, ImgHeight / 2, - CompFormat, ImgSize / 2, ImgData + ImgSize / 2); + CompFormat, ImgSize / 2, ImgData /*+ ImgSize / 2*/); /* top left */ for (i = 0; i < ImgHeight / 8; i++) { - memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth], ImgWidth); + memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth], ImgWidth); } glCompressedTexSubImage2DARB(Target, 0, 0, ImgHeight / 2, /* pos */ @@ -55,7 +57,7 @@ LoadCompressedImage(void) /* top right */ for (i = 0; i < ImgHeight / 8; i++) { - memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth + ImgWidth], ImgWidth); + memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth + ImgWidth], ImgWidth); } glCompressedTexSubImage2DARB(Target, 0, ImgWidth / 2, ImgHeight / 2, /* pos */ -- cgit v1.2.3 From d8ded352ec45696e88efe6d52a375bbf541354e9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 18:10:45 -0600 Subject: progs/tests: disable blending while drawing text --- progs/tests/texcmp.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'progs') diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c index 743b1b09b44..ebb537272f6 100644 --- a/progs/tests/texcmp.c +++ b/progs/tests/texcmp.c @@ -106,6 +106,8 @@ static void Display( void ) glRotatef(Rot, 0, 0, 1); glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBegin(GL_POLYGON); glTexCoord2f(0, 1); glVertex2f(-1, -0.5); glTexCoord2f(1, 1); glVertex2f( 1, -0.5); @@ -118,6 +120,7 @@ static void Display( void ) glDisable(GL_TEXTURE_2D); /* info */ + glDisable(GL_BLEND); glColor4f(1, 1, 1, 1); glRasterPos3f(-1.2, -0.7, 0); -- cgit v1.2.3 From 50e113e375b4ecfdf5b60ccce7bbcdb1c5f2ca11 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 26 Oct 2009 15:03:31 -0600 Subject: progs/tests: Fix MSVC build. --- progs/tests/stencil_twoside.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c index 1e18ca6b5ea..7d871e5877f 100644 --- a/progs/tests/stencil_twoside.c +++ b/progs/tests/stencil_twoside.c @@ -274,9 +274,9 @@ static void Init( void ) if (atof( ver_string ) < 2.0) { use20syntax = 0; } - stencil_func_separate = glutGetProcAddress( "glStencilFuncSeparate" ); - stencil_func_separate_ati = glutGetProcAddress( "glStencilFuncSeparateATI" ); - stencil_op_separate = glutGetProcAddress( "glStencilOpSeparate" ); + stencil_func_separate = (PFNGLSTENCILFUNCSEPARATEPROC) glutGetProcAddress( "glStencilFuncSeparate" ); + stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) glutGetProcAddress( "glStencilFuncSeparateATI" ); + stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( "glStencilOpSeparate" ); printf("\nAll 5 squares should be the same color.\n"); } -- cgit v1.2.3 From 498fcfd315325365a7c58520ea956f298d6bc94c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:46:07 -0600 Subject: progs/tests: added new blitfb.c test Tests glBlitFramebuffer() between two texture/renderbuffer surfaces. In particular, blit from level[1] of a cube map face to a 2D texture. Used to find/fix bug in intel do_copy_texsubimage(). See commit aef1ab1073f3e30d699b99dae17518ed48b57c72 --- progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/blitfb.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 progs/tests/blitfb.c (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 4d9b4e8388c..8c310df0954 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -28,6 +28,7 @@ SOURCES = \ blendminmax.c \ blendsquare.c \ blendxor.c \ + blitfb.c \ bufferobj.c \ bumpmap.c \ bug_3050.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index bb6a1d2b8a9..3a0da62717c 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -52,6 +52,7 @@ progs = [ 'blendminmax', 'blendsquare', 'blendxor', + 'blitfb', 'bufferobj', 'bug_3050', 'bug_3101', diff --git a/progs/tests/blitfb.c b/progs/tests/blitfb.c new file mode 100644 index 00000000000..18c8380a5e2 --- /dev/null +++ b/progs/tests/blitfb.c @@ -0,0 +1,259 @@ +/** + * Test glFramebufferBlit() + * Brian Paul + * 27 Oct 2009 + */ + +#include +#include +#include +#include +#include +#include +#include + + +static int Win; +static int WinWidth = 1100, WinHeight = 600; + +static int SrcWidth = 512, SrcHeight = 512; +static int DstWidth = 512, DstHeight = 512; + +static GLuint SrcFB, DstFB; +static GLuint SrcTex, DstTex; + +#if 0 +static GLenum SrcTexTarget = GL_TEXTURE_2D, SrcTexFace = GL_TEXTURE_2D; +#else +static GLenum SrcTexTarget = GL_TEXTURE_CUBE_MAP, SrcTexFace = GL_TEXTURE_CUBE_MAP_POSITIVE_X; +#endif + +static GLenum DstTexTarget = GL_TEXTURE_2D, DstTexFace = GL_TEXTURE_2D; + +static GLuint SrcTexLevel = 01, DstTexLevel = 0; + + +static void +Draw(void) +{ + GLboolean rp = GL_FALSE; + GLubyte *buf; + GLint srcWidth = SrcWidth >> SrcTexLevel; + GLint srcHeight = SrcHeight >> SrcTexLevel; + GLint dstWidth = DstWidth >> DstTexLevel; + GLint dstHeight = DstHeight >> DstTexLevel; + GLenum status; + + /* clear window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glClearColor(0.5, 0.5, 0.5, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + + /* clear src buf */ + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + assert(status == GL_FRAMEBUFFER_COMPLETE_EXT); + glClearColor(0, 1, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + /* clear dst buf */ + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + assert(status == GL_FRAMEBUFFER_COMPLETE_EXT); + glClearColor(1, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + /* blit src -> dst */ + glBindFramebufferEXT(GL_READ_FRAMEBUFFER, SrcFB); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, DstFB); + glBlitFramebufferEXT(0, 0, srcWidth, srcHeight, + 0, 0, dstWidth, dstHeight, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + +#if 01 + /* read src results */ + buf = malloc(4 * srcWidth * srcHeight); + memset(buf, 0x88, 4 * srcWidth * srcHeight); + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + if (rp) + glReadPixels(0, 0, srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + else { + glBindTexture(SrcTexTarget, SrcTex); + glGetTexImage(SrcTexFace, SrcTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf); + } + + /* draw dst in window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glWindowPos2i(0, 0); + glDrawPixels(srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + printf("Src Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]); + free(buf); +#endif + + glFinish(); + + /* read dst results */ + buf = malloc(4 * dstWidth * dstHeight); + memset(buf, 0x88, 4 * dstWidth * dstHeight); + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + if (rp) + glReadPixels(0, 0, dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + else { + glBindTexture(DstTexTarget, DstTex); + glGetTexImage(DstTexFace, DstTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf); + } + + /* draw dst in window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glWindowPos2i(srcWidth + 2, 0); + glDrawPixels(dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + printf("Dst Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]); + free(buf); + + glFinish(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + WinWidth = width; + WinHeight = height; + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + } + glutPostRedisplay(); +} + + +static void +InitFBOs(void) +{ + GLuint w, h, lvl; + + /* Src */ + glGenTextures(1, &SrcTex); + glBindTexture(SrcTexTarget, SrcTex); + w = SrcWidth; + h = SrcHeight; + lvl = 0; + for (lvl = 0; ; lvl++) { + if (SrcTexTarget == GL_TEXTURE_CUBE_MAP) { + GLuint f; + for (f = 0; f < 6; f++) { + glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, lvl, GL_RGBA8, + w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + } + else { + /* single face */ + glTexImage2D(SrcTexFace, lvl, GL_RGBA8, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + if (w == 1 && h == 1) + break; + if (w > 1) + w /= 2; + if (h > 1) + h /= 2; + } + + glGenFramebuffersEXT(1, &SrcFB); + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + SrcTexFace, SrcTex, SrcTexLevel); + + /* Dst */ + glGenTextures(1, &DstTex); + glBindTexture(DstTexTarget, DstTex); + w = DstWidth; + h = DstHeight; + lvl = 0; + for (lvl = 0; ; lvl++) { + glTexImage2D(DstTexFace, lvl, GL_RGBA8, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (w == 1 && h == 1) + break; + if (w > 1) + w /= 2; + if (h > 1) + h /= 2; + } + + glGenFramebuffersEXT(1, &DstFB); + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + DstTexFace, DstTex, DstTexLevel); +} + + +static void +Init(void) +{ + if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { + fprintf(stderr, "This test requires GL_EXT_framebuffer_object\n"); + exit(1); + } + + if (!glutExtensionSupported("GL_EXT_framebuffer_blit")) { + fprintf(stderr, "This test requires GL_EXT_framebuffer_blit,\n"); + exit(1); + } + + InitFBOs(); + + printf("Left rect = src FBO, Right rect = dst FBO.\n"); + printf("Both should be green.\n"); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(WinWidth, WinHeight); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Draw); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 3bee7610bef4c201a93e0ad8f670acc1b324e71d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:46:07 -0600 Subject: progs/tests: added new blitfb.c test Tests glBlitFramebuffer() between two texture/renderbuffer surfaces. In particular, blit from level[1] of a cube map face to a 2D texture. Used to find/fix bug in intel do_copy_texsubimage(). See commit aef1ab1073f3e30d699b99dae17518ed48b57c72 --- progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/blitfb.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 progs/tests/blitfb.c (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 2b93aa5464f..197e14d5b00 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -29,6 +29,7 @@ SOURCES = \ blendminmax.c \ blendsquare.c \ blendxor.c \ + blitfb.c \ bufferobj.c \ bumpmap.c \ bug_3050.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index bb6a1d2b8a9..3a0da62717c 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -52,6 +52,7 @@ progs = [ 'blendminmax', 'blendsquare', 'blendxor', + 'blitfb', 'bufferobj', 'bug_3050', 'bug_3101', diff --git a/progs/tests/blitfb.c b/progs/tests/blitfb.c new file mode 100644 index 00000000000..18c8380a5e2 --- /dev/null +++ b/progs/tests/blitfb.c @@ -0,0 +1,259 @@ +/** + * Test glFramebufferBlit() + * Brian Paul + * 27 Oct 2009 + */ + +#include +#include +#include +#include +#include +#include +#include + + +static int Win; +static int WinWidth = 1100, WinHeight = 600; + +static int SrcWidth = 512, SrcHeight = 512; +static int DstWidth = 512, DstHeight = 512; + +static GLuint SrcFB, DstFB; +static GLuint SrcTex, DstTex; + +#if 0 +static GLenum SrcTexTarget = GL_TEXTURE_2D, SrcTexFace = GL_TEXTURE_2D; +#else +static GLenum SrcTexTarget = GL_TEXTURE_CUBE_MAP, SrcTexFace = GL_TEXTURE_CUBE_MAP_POSITIVE_X; +#endif + +static GLenum DstTexTarget = GL_TEXTURE_2D, DstTexFace = GL_TEXTURE_2D; + +static GLuint SrcTexLevel = 01, DstTexLevel = 0; + + +static void +Draw(void) +{ + GLboolean rp = GL_FALSE; + GLubyte *buf; + GLint srcWidth = SrcWidth >> SrcTexLevel; + GLint srcHeight = SrcHeight >> SrcTexLevel; + GLint dstWidth = DstWidth >> DstTexLevel; + GLint dstHeight = DstHeight >> DstTexLevel; + GLenum status; + + /* clear window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glClearColor(0.5, 0.5, 0.5, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + + /* clear src buf */ + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + assert(status == GL_FRAMEBUFFER_COMPLETE_EXT); + glClearColor(0, 1, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + /* clear dst buf */ + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + assert(status == GL_FRAMEBUFFER_COMPLETE_EXT); + glClearColor(1, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + /* blit src -> dst */ + glBindFramebufferEXT(GL_READ_FRAMEBUFFER, SrcFB); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, DstFB); + glBlitFramebufferEXT(0, 0, srcWidth, srcHeight, + 0, 0, dstWidth, dstHeight, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + +#if 01 + /* read src results */ + buf = malloc(4 * srcWidth * srcHeight); + memset(buf, 0x88, 4 * srcWidth * srcHeight); + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + if (rp) + glReadPixels(0, 0, srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + else { + glBindTexture(SrcTexTarget, SrcTex); + glGetTexImage(SrcTexFace, SrcTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf); + } + + /* draw dst in window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glWindowPos2i(0, 0); + glDrawPixels(srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + printf("Src Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]); + free(buf); +#endif + + glFinish(); + + /* read dst results */ + buf = malloc(4 * dstWidth * dstHeight); + memset(buf, 0x88, 4 * dstWidth * dstHeight); + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + if (rp) + glReadPixels(0, 0, dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + else { + glBindTexture(DstTexTarget, DstTex); + glGetTexImage(DstTexFace, DstTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf); + } + + /* draw dst in window */ + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + glWindowPos2i(srcWidth + 2, 0); + glDrawPixels(dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + printf("Dst Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]); + free(buf); + + glFinish(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + WinWidth = width; + WinHeight = height; + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + } + glutPostRedisplay(); +} + + +static void +InitFBOs(void) +{ + GLuint w, h, lvl; + + /* Src */ + glGenTextures(1, &SrcTex); + glBindTexture(SrcTexTarget, SrcTex); + w = SrcWidth; + h = SrcHeight; + lvl = 0; + for (lvl = 0; ; lvl++) { + if (SrcTexTarget == GL_TEXTURE_CUBE_MAP) { + GLuint f; + for (f = 0; f < 6; f++) { + glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, lvl, GL_RGBA8, + w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + } + else { + /* single face */ + glTexImage2D(SrcTexFace, lvl, GL_RGBA8, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + if (w == 1 && h == 1) + break; + if (w > 1) + w /= 2; + if (h > 1) + h /= 2; + } + + glGenFramebuffersEXT(1, &SrcFB); + glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + SrcTexFace, SrcTex, SrcTexLevel); + + /* Dst */ + glGenTextures(1, &DstTex); + glBindTexture(DstTexTarget, DstTex); + w = DstWidth; + h = DstHeight; + lvl = 0; + for (lvl = 0; ; lvl++) { + glTexImage2D(DstTexFace, lvl, GL_RGBA8, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (w == 1 && h == 1) + break; + if (w > 1) + w /= 2; + if (h > 1) + h /= 2; + } + + glGenFramebuffersEXT(1, &DstFB); + glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + DstTexFace, DstTex, DstTexLevel); +} + + +static void +Init(void) +{ + if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { + fprintf(stderr, "This test requires GL_EXT_framebuffer_object\n"); + exit(1); + } + + if (!glutExtensionSupported("GL_EXT_framebuffer_blit")) { + fprintf(stderr, "This test requires GL_EXT_framebuffer_blit,\n"); + exit(1); + } + + InitFBOs(); + + printf("Left rect = src FBO, Right rect = dst FBO.\n"); + printf("Both should be green.\n"); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(WinWidth, WinHeight); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Draw); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 635ea8737488cc2fdcf0fcacb4ca39c8bc3b028a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 10 Oct 2009 11:52:38 -0600 Subject: progs/tests: added test for GL_EXT_texture_compression_s3tc support --- progs/tests/mipmap_comp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'progs') diff --git a/progs/tests/mipmap_comp.c b/progs/tests/mipmap_comp.c index 5842e2b8805..dd2232113b6 100644 --- a/progs/tests/mipmap_comp.c +++ b/progs/tests/mipmap_comp.c @@ -285,6 +285,12 @@ main(int argc, char** argv) glutInitWindowSize (600, 600); glutCreateWindow (argv[0]); glewInit(); + + if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) { + fprintf(stderr, "This test requires GL_EXT_texture_compression_s3tc.\n"); + exit(1); + } + myInit(); glutReshapeFunc (myReshape); glutDisplayFunc(display); -- cgit v1.2.3 From 1e2c51702675ad8093b77c3a37ed630e311cceb2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:49:38 -0600 Subject: progs/tests: also test GL_BGRA format in getteximage.c --- progs/tests/getteximage.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'progs') diff --git a/progs/tests/getteximage.c b/progs/tests/getteximage.c index 71f29b4ac84..e4053b8de1a 100644 --- a/progs/tests/getteximage.c +++ b/progs/tests/getteximage.c @@ -58,6 +58,26 @@ TestGetTexImage(GLboolean npot) abort(); } } + + /* get as BGRA */ + glGetTexImage(GL_TEXTURE_2D, level, GL_BGRA, GL_UNSIGNED_BYTE, data2); + + /* compare */ + { + const GLubyte *rgba = (GLubyte *) data; + const GLubyte *bgra = (GLubyte *) data2; + for (i = 0; i < w * h; i += 4) { + if (rgba[i+0] != bgra[i+2] || + rgba[i+1] != bgra[i+1] || + rgba[i+2] != bgra[i+0] || + rgba[i+3] != bgra[i+3]) { + printf("glTexImage + glGetTexImage(GL_BGRA) failure!\n"); + printf("Expected value %d, found %d\n", data[i], data2[i]); + abort(); + } + } + } + } printf("Passed\n"); -- cgit v1.2.3 From 02b9fb9c80ae9079cd2eab945d58551f9d9cbd7c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 14:46:02 -0600 Subject: progs/tests: fixes for drawbuffers.c Disable GL_DEPTH_TEST before glDrawPixels. Show color buffer 0 on left, color buffer 1 on right. --- progs/tests/drawbuffers.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/tests/drawbuffers.c b/progs/tests/drawbuffers.c index d75a870c26b..7a19933e627 100644 --- a/progs/tests/drawbuffers.c +++ b/progs/tests/drawbuffers.c @@ -43,6 +43,8 @@ Display(void) glUseProgram_func(Program); + glEnable(GL_DEPTH_TEST); + /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); @@ -68,18 +70,23 @@ Display(void) glPopMatrix(); /* read from user framebuffer */ - /* bottom half = colorbuffer 0 */ + /* left half = colorbuffer 0 */ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE, + glPixelStorei(GL_PACK_ROW_LENGTH, Width); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - /* top half = colorbuffer 1 */ + + /* right half = colorbuffer 1 */ glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadPixels(0, Height/2, Width, Height - Height / 2, + glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2); + glReadPixels(Width / 2, 0, Width - Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, - buffer + Width * (Height / 2) * 4); + buffer); /* draw to window */ glUseProgram_func(0); + glDisable(GL_DEPTH_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glWindowPos2iARB(0, 0); glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); -- cgit v1.2.3 From a8ed066858f12290239ddc9165b7c0734ccc0247 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 30 Oct 2009 09:39:51 -0600 Subject: progs/tests: fix MSVC build. Signed-off-by: Brian Paul --- progs/tests/vao-01.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c index 117fae8bd9e..e4a89cb19db 100644 --- a/progs/tests/vao-01.c +++ b/progs/tests/vao-01.c @@ -124,10 +124,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); -- cgit v1.2.3 From 9c3197ef0abc3bf521358ea0c7af0fc6979c82b3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 30 Oct 2009 15:02:21 -0600 Subject: prog/tests: Fix MSVC build. Signed-off-by: Brian Paul --- progs/tests/vao-02.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c index 7764ed51061..9f7f5c27792 100644 --- a/progs/tests/vao-02.c +++ b/progs/tests/vao-02.c @@ -125,10 +125,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); -- cgit v1.2.3 From a017ad2861e8df0cfea7808cf9c094b9c4bcac48 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 10:01:10 -0700 Subject: progs/tests: debug code for getting texture component sizes --- progs/tests/packedpixels.c | 7 +++++-- progs/tests/texcmp.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index f4e5d0a7953..d318cf516aa 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -192,12 +192,15 @@ MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap) } if (0) { - GLint r, g, b, a; + GLint r, g, b, a, l, i; glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); - printf("sizes: %d %d %d %d\n", r, g, b, a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + printf("IntFormat: 0x%x R %d G %d B %d A %d L %d I %d\n", + intFormat, r, g, b, a, l, i); glGetError(); } diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c index 3f2cee6e46d..c5d352fdaed 100644 --- a/progs/tests/texcmp.c +++ b/progs/tests/texcmp.c @@ -181,6 +181,18 @@ static void ReInit( GLenum TC, TEXTURE *Tx ) GL_TEXTURE_INTERNAL_FORMAT, &v); printf("Requested internal format = 0x%x, actual = 0x%x\n", TC, v); + if (0) { + GLint r, g, b, a, l, i; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + printf("Compressed Bits per R: %d G: %d B: %d A: %d L: %d I: %d\n", + r, g, b, a, l, i); + } + /* okay, now cache the compressed texture */ Tx->TC = TC; if (Tx->cData != NULL) { -- cgit v1.2.3 From c475079ef2d901ba4506ebd53e19419cd46793ab Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 3 Nov 2009 14:41:08 -0700 Subject: progs/util: Fix memory leak if fail to load/compile shader Signed-off-by: Brian Paul --- progs/util/shaderutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 4db950016b8..af50d64f510 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -84,6 +84,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) f = fopen(filename, "r"); if (!f) { fprintf(stderr, "Unable to open shader file %s\n", filename); + free(buffer); return 0; } @@ -94,6 +95,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) shader = CompileShaderText(shaderType, buffer); } else { + free(buffer); return 0; } -- cgit v1.2.3 From 60c328db2d5f269267dac7cd64335ba005890fca Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 4 Nov 2009 15:55:39 -0700 Subject: progs/tests: Fix MSVC build. Signed-off-by: Brian Paul --- progs/tests/shader_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/shader_api.c b/progs/tests/shader_api.c index 6453856345c..fa0a992540c 100644 --- a/progs/tests/shader_api.c +++ b/progs/tests/shader_api.c @@ -8,6 +8,10 @@ #include #include +#ifndef APIENTRY +#define APIENTRY +#endif + static void assert_test(const char *file, int line, int cond, const char *msg) { if (!cond) @@ -42,7 +46,7 @@ static void assert_error_test(const char *file, int line, GLenum expect) #define assert_error(err) assert_error_test(__FILE__, __LINE__, (err)) -static void check_status(GLuint id, GLenum pname, void (*query)(GLuint, GLenum, GLint *)) +static void check_status(GLuint id, GLenum pname, void (APIENTRY *query)(GLuint, GLenum, GLint *)) { GLint status; -- cgit v1.2.3 From 5a24c66915a555d72a6377e073a732ab9d6be461 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 6 Nov 2009 09:22:46 +0000 Subject: trivial: add vbo-tri, an even simpler version of tri.c --- progs/trivial/Makefile | 1 + progs/trivial/vbo-tri.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 progs/trivial/vbo-tri.c (limited to 'progs') diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 70728616d28..e15ec33ab59 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -153,6 +153,7 @@ SOURCES = \ tristrip-clip.c \ tristrip-flat.c \ tristrip.c \ + vbo-tri.c \ vbo-drawarrays.c \ vbo-noninterleaved.c \ vbo-drawelements.c \ diff --git a/progs/trivial/vbo-tri.c b/progs/trivial/vbo-tri.c new file mode 100644 index 00000000000..d4cba14414c --- /dev/null +++ b/progs/trivial/vbo-tri.c @@ -0,0 +1,131 @@ +/* Even simpler for many drivers than trivial/tri -- pass-through + * vertex shader and vertex data in a VBO. + */ + +#include +#include +#include +#include +#include +#include +#include + + +struct { + GLfloat pos[4]; + GLfloat color[4]; +} verts[] = +{ + { { -0.9, -0.9, 0.0, 1.0 }, + {.8,0,0, 1}, + }, + + { { 0.9, -0.9, 0.0, 1.0 }, + { 0, .9, 0, 1 }, + }, + + { { 0, 0.9, 0.0, 1.0 }, + {0,0,.7, 1}, + }, +}; + +GLuint arrayObj; + +static void Init( void ) +{ + GLint errno; + GLuint prognum; + + static const char *prog1 = + "!!ARBvp1.0\n" + "MOV result.color, vertex.color;\n" + "MOV result.position, vertex.position;\n" + "END\n"; + + + glGenProgramsARB(1, &prognum); + + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog1), (const GLubyte *) prog1); + + assert(glIsProgramARB(prognum)); + errno = glGetError(); + printf("glGetError = %d\n", errno); + if (errno != GL_NO_ERROR) + { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + + + glEnableClientState( GL_VERTEX_ARRAY ); + glEnableClientState( GL_COLOR_ARRAY ); + + glGenBuffersARB(1, &arrayObj); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); + + glVertexPointer( 4, GL_FLOAT, sizeof(verts[0]), 0 ); + glColorPointer( 4, GL_FLOAT, sizeof(verts[0]), (void *)(4*sizeof(float)) ); +} + + + +static void Display( void ) +{ + glClearColor(0.3, 0.3, 0.3, 1); + glClear( GL_COLOR_BUFFER_BIT ); + + glEnable(GL_VERTEX_PROGRAM_NV); + glDrawArrays( GL_TRIANGLES, 0, 3 ); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + /*glTranslatef( 0.0, 0.0, -15.0 );*/ +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 250, 250 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 8353162a4c7d2798a88a39ea24674e601fe95f6f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 6 Nov 2009 18:40:04 +0000 Subject: progs/trivial: Ignores --- progs/trivial/.gitignore | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore index 4d6e405c500..4317eb607fe 100644 --- a/progs/trivial/.gitignore +++ b/progs/trivial/.gitignore @@ -147,6 +147,7 @@ vbo-drawarrays vbo-drawelements vbo-drawrange vbo-noninterleaved +vbo-tri vp-array vp-array-int vp-clip -- cgit v1.2.3 From 2ff4f5a7fe9b1ab9d46348768cc08e808f045822 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Nov 2009 12:19:20 -0700 Subject: progs/tests: add alpha/blend testing to packedpixels.c --- progs/tests/packedpixels.c | 64 ++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 22 deletions(-) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index d318cf516aa..a08e7c2b922 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -17,53 +17,53 @@ struct pixel_format { GLenum format; GLenum type; GLint bytes; - GLuint redTexel, greenTexel; + GLuint redTexel, greenTexel; /* with approx 51% alpha, when applicable */ }; static const struct pixel_format Formats[] = { { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000000, 0x00ff0000 }, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000080, 0x00ff0080 }, { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x000000ff, 0x0000ff00 }, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x800000ff, 0x8000ff00 }, { "GL_RGBA/GL_UNSIGNED_INT_10_10_10_2", - GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00000, 0x3ff000 }, + GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00002, 0x3ff002 }, { "GL_RGBA/GL_UNSIGNED_INT_2_10_10_10_REV", - GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0x3ff, 0xffc00 }, + GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0xc00003ff, 0xc00ffc00 }, { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf000, 0x0f00 }, + GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf008, 0x0f08 }, { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x000f, 0x00f0 }, + GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x800f, 0x80f0 }, { "GL_RGBA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf800, 0x7c0 }, + GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0x7c1 }, { "GL_RGBA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x1f, 0x3e0 }, + GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x801f, 0x83e0 }, { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff00, 0x00ff0000 }, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff80, 0x00ff0080 }, { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x00ff0000, 0x0000ff00 }, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x80ff0000, 0x8000ff00 }, { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f0, 0x0f00 }, + GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f8, 0x0f08 }, { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x0f00, 0x00f0 }, + GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x8f00, 0x80f0 }, { "GL_BGRA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3e, 0x7c0 }, + GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3f, 0x7c1 }, { "GL_BGRA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x7c00, 0x3e0 }, + GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0xfc00, 0x83e0 }, { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x000000ff, 0x0000ff00 }, + GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x800000ff, 0x8000ff00 }, { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000000, 0x00ff0000 }, + GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000080, 0x00ff0080 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x000f, 0x00f0 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x800f, 0x80f0 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf000, 0x0f00 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf008, 0x0f08 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x1, 0x3e }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0xf83e }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x8000, 0x7c00 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x800f, 0x7c0f }, { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5", GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 }, @@ -108,7 +108,7 @@ static const struct name_format IntFormats[] = { static GLuint CurFormat = 0; static GLboolean Test3D = GL_FALSE; - +static GLboolean Blend = GL_FALSE; static void @@ -234,6 +234,10 @@ Draw(void) glEnable(GL_TEXTURE_3D); else glEnable(GL_TEXTURE_2D); + + if (Blend) + glEnable(GL_BLEND); + glBegin(GL_POLYGON); glTexCoord3f(0, 0, 0.5); glVertex2f(0, 0); glTexCoord3f(1, 0, 0.5); glVertex2f(w, 0); @@ -245,6 +249,9 @@ Draw(void) glDisable(GL_TEXTURE_3D); else glDisable(GL_TEXTURE_2D); + + glDisable(GL_BLEND); + glColor3f(0, 0, 0); glRasterPos2i(8, 6); PrintString(Formats[i].name); @@ -279,6 +286,15 @@ Draw(void) PrintString("Target [2/3]: GL_TEXTURE_2D"); glPopMatrix(); + glPushMatrix(); + glTranslatef(2, (i + 3) * (h + 2), 0); + glRasterPos2i(8, 6); + if (Blend) + PrintString("Blend: Yes"); + else + PrintString("Blend: No"); + glPopMatrix(); + glutSwapBuffers(); } @@ -301,6 +317,9 @@ Key(unsigned char key, int x, int y) (void) x; (void) y; switch (key) { + case 'b': + Blend = !Blend; + break; case 'F': if (CurFormat == 0) CurFormat = NUM_INT_FORMATS - 1; @@ -336,6 +355,7 @@ Init(void) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } -- cgit v1.2.3 From 7dfea5c0722e9da101805c15b9dd26352816bca9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 11 Nov 2009 17:39:58 -0800 Subject: demos/glsl: Add missing break statement to noise test. --- progs/glsl/noise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index fdab263ea6a..bb024b50121 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -119,6 +119,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; -- cgit v1.2.3 From 98c2b5338156513a43cf18d50d731ad15a12fe04 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 6 Nov 2009 20:46:27 +0000 Subject: trivial: make tri-orig more closely match the original version of tri... --- progs/trivial/tri-orig.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c index e7cfee3a367..5300f59ecec 100644 --- a/progs/trivial/tri-orig.c +++ b/progs/trivial/tri-orig.c @@ -51,7 +51,7 @@ static void Reshape(int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); -/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); glMatrixMode(GL_MODELVIEW); } @@ -74,11 +74,11 @@ static void Draw(void) glBegin(GL_TRIANGLES); glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); + glVertex3f( 0.9, -0.9, -30.0); glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); + glVertex3f( 0.9, 0.9, -30.0); glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); + glVertex3f(-0.9, 0.0, -30.0); glEnd(); glFlush(); @@ -119,7 +119,7 @@ int main(int argc, char **argv) glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - type = GLUT_RGB | GLUT_ALPHA; + type = GLUT_RGB; type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; glutInitDisplayMode(type); -- cgit v1.2.3 From 43080e40aa0d34423e10f1d50aad15289b2b9aec Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 12 Nov 2009 16:20:23 -0800 Subject: progs/glsl: Add missing break statement in multinoise.c. --- progs/glsl/multinoise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 0d4026e29cf..06207f78b58 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -125,6 +125,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; -- cgit v1.2.3 From a420056750908f7c2f9a7c18b3ab20f04e49711d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 14 Nov 2009 21:36:18 -0800 Subject: progs: Ignore Mac OS dSYM directories. --- progs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 progs/.gitignore (limited to 'progs') diff --git a/progs/.gitignore b/progs/.gitignore new file mode 100644 index 00000000000..cb77d18a4b3 --- /dev/null +++ b/progs/.gitignore @@ -0,0 +1 @@ +*.dSYM -- cgit v1.2.3 From fcf8dea36ce2bbeabeacc7a062f0c36326825ffa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Nov 2009 23:06:54 -0700 Subject: progs/tests: silence warning --- progs/tests/packedpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index a08e7c2b922..c8884bb79f1 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -272,7 +272,7 @@ Draw(void) glPushMatrix(); glTranslatef(2, (i + 1) * (h + 2), 0); glRasterPos2i(8, 6); - sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)", + sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)", IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); PrintString(s); glPopMatrix(); -- cgit v1.2.3 From aef3218f0bb48fdb286d2008ee07e507ea8aa98e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 14:56:07 -0800 Subject: progs/demos: Fix memory leak in fslight.c. --- progs/demos/fslight.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index f0d76a4a06f..acba3e9583f 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -353,6 +353,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 10, 5); glEndList(); + gluDeleteQuadric(obj); } static void -- cgit v1.2.3 From a1afe303deda320aadacdaf5b1c72631ca3f734f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 15:44:52 -0800 Subject: progs/demos: Fix memory leak in ipers.c. --- progs/demos/ipers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index 5d82b0dc924..ed03673cb62 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -133,6 +133,8 @@ initdlists(void) glEndList(); } + + gluDeleteQuadric(obj); } static void -- cgit v1.2.3 From ee555e3d69c8820f27e71e5ebc028a768cef7d0b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 16:31:34 -0800 Subject: progs/demos: Fix memory leak in projtex.c. --- progs/demos/projtex.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'progs') diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c index 99154d7bdc8..ad205c74137 100644 --- a/progs/demos/projtex.c +++ b/progs/demos/projtex.c @@ -245,6 +245,9 @@ loadImageTextures(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + + free(texData3); + free(texData4); } } -- cgit v1.2.3 From 6b480dc21dd489d48685b2268e495218aea74293 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 18:06:40 -0800 Subject: progs/demos: Fix memory leak in ray.c. --- progs/demos/ray.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/demos/ray.c b/progs/demos/ray.c index c2d8e4f545e..e9211aa3399 100644 --- a/progs/demos/ray.c +++ b/progs/demos/ray.c @@ -834,6 +834,8 @@ initdlists(void) gluQuadricTexture(obj, GL_TRUE); gluSphere(obj, SPHERE_RADIUS, 16, 16); glEndList(); + + gluDeleteQuadric(obj); } int -- cgit v1.2.3 From 0e790ac35327a0b53a4a595a6429135317302269 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 18:22:26 -0800 Subject: progs/util: Fix memory leak if LoadYUVImage fails. --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 8e923b6eb47..134eb79100a 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -438,6 +438,7 @@ GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) fprintf(stderr, "Error in LoadYUVImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } -- cgit v1.2.3 From 28b8e4bcd76cc072b062e4c8575327c05ecb9a55 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 08:29:36 -0800 Subject: progs/util: Fix memory if LoadRGBMipmaps2 fails. --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 134eb79100a..4e22bed81af 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -305,6 +305,7 @@ GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, fprintf(stderr, "Error in LoadRGBMipmaps %d-component images not implemented\n", image->components ); + FreeImage(image); return GL_FALSE; } -- cgit v1.2.3 From 0e783c7d03128aade3ca50b28a56e254fef6b6ab Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 09:53:19 -0800 Subject: progs/glsl: Fix memory leak in deriv.c. --- progs/glsl/deriv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c index 265a5157154..30f2b75fef7 100644 --- a/progs/glsl/deriv.c +++ b/progs/glsl/deriv.c @@ -140,6 +140,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 30, 15); glEndList(); + gluDeleteQuadric(obj); } -- cgit v1.2.3 From 041cd0e110d41b543a0fe9cc484ae8373642912b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 10:11:50 -0800 Subject: progs/util: Fix memory leak if LoadRGBImage fails. --- progs/util/readtex.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 4e22bed81af..ec27e20d681 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -357,6 +357,7 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, fprintf(stderr, "Error in LoadRGBImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } @@ -365,8 +366,10 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, bytes = image->sizeX * image->sizeY * image->components; buffer = (GLubyte *) malloc(bytes); - if (!buffer) + if (!buffer) { + FreeImage(image); return NULL; + } memcpy( (void *) buffer, (void *) image->data, bytes ); -- cgit v1.2.3 From 786d539511eb3c5a4101b11b7f8e90d60123ac46 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 11:04:24 -0800 Subject: progs/util: Fix memory leak if malloc fails in tkRGBImageLoad. --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index ec27e20d681..c57b66bd9d3 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -250,6 +250,7 @@ static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); if (final == NULL) { fprintf(stderr, "Out of memory!\n"); + RawImageClose(raw); return NULL; } final->sizeX = raw->sizeX; -- cgit v1.2.3 From b8dcb79c53796f37234bd2b0f5e2845f817fc218 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 11:37:48 -0800 Subject: progs/glsl: Change tangentAttrib from GLuint to GLint in bump.c. tangentAtrrib is assigned the result of glGetAttribLocation. The assertion 'assert(tangentAtrrib >= 0)' would be a no-op if tangentAttrib is a GLuint. --- progs/glsl/bump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index 87669aec736..50a0900f1c7 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -36,7 +36,7 @@ static GLint win = 0; static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f; -static GLuint tangentAttrib; +static GLint tangentAttrib; static GLboolean Anim = GL_FALSE; -- cgit v1.2.3 From 11905da8836822f7dd60c84b5eefc72e46c94b50 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 12:00:22 -0800 Subject: progs/util: Fix memory leak if fread returns 0 in CompileShaderFile. --- progs/util/shaderutil.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index af50d64f510..aebf23a78c8 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -95,6 +95,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) shader = CompileShaderText(shaderType, buffer); } else { + fclose(f); free(buffer); return 0; } -- cgit v1.2.3 From d888bbc45a84946cafb4f4d2c89681a580cd89bc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 13:39:13 -0700 Subject: progs/xdemos: added -lX11 -lpthread for GNU gold linker --- progs/xdemos/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'progs') diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index 53e1c54ef3c..77f667978ce 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -8,6 +8,9 @@ INCDIR = $(TOP)/include LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) +# Add X11 and pthread libs to satisfy GNU gold. +APP_LIB_DEPS += -lX11 -lpthread + LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS) PROGS = \ -- cgit v1.2.3 From d9508e8df9da4aa13bc223194c406081738bac91 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 13:49:31 -0800 Subject: progs/util: Fix memory leak if fopen fails in RawImageOpen. --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index c57b66bd9d3..3922998fd5b 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -109,6 +109,7 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->file = fopen(baseName + 1, "rb"); if(raw->file == NULL) { perror(fileName); + free(raw); return NULL; } } -- cgit v1.2.3 From 47b5f584a68ceab7c9c1d5279efbc9fe30ff2fcc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 14:10:35 -0800 Subject: progs/redbook: Fix memory leak in quadric.c. --- progs/redbook/quadric.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c index 4e46c85f829..7e99098304a 100644 --- a/progs/redbook/quadric.c +++ b/progs/redbook/quadric.c @@ -116,6 +116,8 @@ void init(void) glNewList(startList+3, GL_COMPILE); gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0); glEndList(); + + gluDeleteQuadric(qobj); } void display(void) -- cgit v1.2.3 From e8eec9385497053a4172deeff9c0ff2726a10f3b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 14:22:35 -0800 Subject: progs/slang: Fix potential null pointer dereference in cltest.c. --- progs/slang/cltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/slang/cltest.c b/progs/slang/cltest.c index 2753f59f85b..dfff6cb226a 100644 --- a/progs/slang/cltest.c +++ b/progs/slang/cltest.c @@ -237,7 +237,7 @@ void RenderScene (void) if (p != NULL) p++; } - if (*p != '\0') + if (p && *p != '\0') printf ("*** %s\n", "I/O error"); nextprogram = program->next; -- cgit v1.2.3 From 1888a7276538a3adfe268e235e56b9931d608243 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:13:12 -0700 Subject: progs/demos: silence warnings --- progs/demos/morph3d.c | 3 ++- progs/demos/textures.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c index 6aca8270ff5..01a06aba0ff 100644 --- a/progs/demos/morph3d.c +++ b/progs/demos/morph3d.c @@ -887,5 +887,6 @@ int main(int argc, char **argv) glutIdleFunc( idle_ ); glutDisplayFunc( draw ); glutMainLoop(); - + + return 0; } diff --git a/progs/demos/textures.c b/progs/demos/textures.c index b7bf135d219..d94154a2008 100644 --- a/progs/demos/textures.c +++ b/progs/demos/textures.c @@ -57,7 +57,7 @@ Idle(void) { Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02; Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04; - //Zrot += 2.0; + /*Zrot += 2.0;*/ glutPostRedisplay(); } -- cgit v1.2.3 From b08f44754762c50456c2cb9d2106e1b6db43ff01 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:14:09 -0700 Subject: progs/glsl: change //-style comments --- progs/glsl/shtest.c | 2 +- progs/glsl/texaaline.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 628a7dd5b98..9d76e018e37 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -627,7 +627,7 @@ Init(void) NumAttribs = GetAttribs(Program, Attribs); PrintAttribs(Attribs); - //assert(glGetError() == 0); + /*assert(glGetError() == 0);*/ glClearColor(0.4f, 0.4f, 0.8f, 0.0f); diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c index 2e4f932ad60..4ad5a761c67 100644 --- a/progs/glsl/texaaline.c +++ b/progs/glsl/texaaline.c @@ -310,8 +310,10 @@ MakeMipmap(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); - ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + /* + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + */ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); #undef SZ -- cgit v1.2.3 From fc3c5ffcc83904b41ec8bde4006c5d5a66a0aac3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:14:20 -0700 Subject: progs/xdemos: change //-style comments --- progs/xdemos/corender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c index f2b8145e52b..ca8ee1eed33 100644 --- a/progs/xdemos/corender.c +++ b/progs/xdemos/corender.c @@ -186,7 +186,7 @@ redraw(Display *dpy) * Without this glClear(), depth buffer for the second process * is pretty much broken. */ - //glClear(GL_DEPTH_BUFFER_BIT); + /*glClear(GL_DEPTH_BUFFER_BIT);*/ glPushMatrix(); glTranslatef(1, 0, 0); -- cgit v1.2.3 From 773de83d3c942186f7e8ab87b5a0180d9a2d9f58 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 15:24:40 -0800 Subject: progs/tests: Fix memory leak in arbgpuprog.c. --- progs/tests/arbgpuprog.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'progs') diff --git a/progs/tests/arbgpuprog.c b/progs/tests/arbgpuprog.c index 23aa899d963..6098dca787b 100644 --- a/progs/tests/arbgpuprog.c +++ b/progs/tests/arbgpuprog.c @@ -134,6 +134,8 @@ static void Init( const char *vertProgFile, } len = fread(buf, 1, 10*1000,f); + fclose(f); + glProgramStringARB_func(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, @@ -170,6 +172,8 @@ static void Init( const char *vertProgFile, } len = fread(buf, 1, 10*1000,f); + fclose(f); + glProgramStringARB_func(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, -- cgit v1.2.3 From 6acb82dab0056f0d5f3522c7b063db8024ef81d8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 19:22:11 -0700 Subject: progs/util: warn when GLSL not supported --- progs/util/shaderutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index aebf23a78c8..4fb3199a190 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -34,7 +34,8 @@ ShadersSupported(void) fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); return GL_TRUE; } - return GL_TRUE; + fprintf(stderr, "Sorry, GLSL not supported with this OpenGL.\n"); + return GL_FALSE; } -- cgit v1.2.3 From 89e20ab3aeff37f0eff79ab0c5e73be3d3185ce8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 19:22:29 -0700 Subject: progs/glsl: use ShadersSupported() --- progs/glsl/multitex.c | 7 ++----- progs/glsl/texdemo1.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'progs') diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index bf46fd5210e..49b32253eed 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -369,12 +369,9 @@ InitPrograms(void) static void InitGL(void) { - const char *version = (const char *) glGetString(GL_VERSION); + if (!ShadersSupported()) + exit(1); - if (version[0] != '2' || version[1] != '.') { - printf("Warning: this program expects OpenGL 2.0\n"); - /*exit(1);*/ - } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); printf("Usage:\n"); printf(" a - toggle arrays vs. immediate mode rendering\n"); diff --git a/progs/glsl/texdemo1.c b/progs/glsl/texdemo1.c index 5b1913a722b..2076e6aef94 100644 --- a/progs/glsl/texdemo1.c +++ b/progs/glsl/texdemo1.c @@ -400,11 +400,8 @@ InitPrograms(void) static void Init(GLboolean useImageFiles) { - const char *version = (const char *) glGetString(GL_VERSION); - - if (version[0] != '2' || version[1] != '.') { - printf("Warning: this program expects OpenGL 2.0\n"); - /*exit(1);*/ + if (!ShadersSupported()) { + exit(1); } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); -- cgit v1.2.3 From 04442841fb7e9138eb50ff692952ad7e8c3877d8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 23:15:25 -0800 Subject: progs/glsl: Fix mandelbrot GLSL compilation error on Mac OS. --- progs/glsl/CH18-mandel.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/CH18-mandel.frag b/progs/glsl/CH18-mandel.frag index a472d812526..a972d68bcfb 100644 --- a/progs/glsl/CH18-mandel.frag +++ b/progs/glsl/CH18-mandel.frag @@ -31,7 +31,7 @@ void main() float iter; // for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter) - for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter) + for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter) { float tempreal = real; -- cgit v1.2.3 From d4dc2e30dada1be425e95ba270920db6eb210982 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 12:49:31 -0800 Subject: progs/glsl: Fix multinoise GLSL compilation errors on Mac OS. --- progs/glsl/multinoise.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 06207f78b58..d504ba1cc4e 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = { "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n" }; @@ -194,7 +194,7 @@ LoadAndCompileShader(GLuint shader, const char *text) GLchar log[1000]; GLsizei len; glGetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "noise: problem compiling shader: %s\n", log); + fprintf(stderr, "multinoise: problem compiling shader: %s\n", log); exit(1); } else { -- cgit v1.2.3 From 0d31990b4742eccdf6ae6a3b3e16c81cc863085d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 13:50:49 -0800 Subject: progs/glsl: Fix noise GLSL compilation error on Mac OS. --- progs/glsl/noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index bb024b50121..1148580ff4d 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -28,7 +28,7 @@ static const char *FragShaderText = " vec4 p;\n" " p.xy = gl_TexCoord[0].xy;\n" " p.z = Slice;\n" - " p.w = 0;\n" + " p.w = 0.0;\n" " vec4 n = noise4(p * scale);\n" " gl_FragColor = n * Scale + Bias;\n" "}\n"; -- cgit v1.2.3 From 4b3ec2acf2cc2830b0907e4fb4db8bd1ff4a18e3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 14:02:20 -0800 Subject: progs/glsl: Fix trirast GLSL compilation errors on Mac OS. --- progs/glsl/trirast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c index 53bd91ef976..857342636dc 100644 --- a/progs/glsl/trirast.c +++ b/progs/glsl/trirast.c @@ -179,9 +179,9 @@ Init(void) "\n" "void main() {\n" " vec2 p = gl_FragCoord.xy; \n" - " if (crs(v1 - v0, p - v0) >= 0 && \n" - " crs(v2 - v1, p - v1) >= 0 && \n" - " crs(v0 - v2, p - v2) >= 0) \n" + " if (crs(v1 - v0, p - v0) >= 0.0 && \n" + " crs(v2 - v1, p - v1) >= 0.0 && \n" + " crs(v0 - v2, p - v2) >= 0.0) \n" " gl_FragColor = vec4(1.0); \n" " else \n" " gl_FragColor = vec4(0.5); \n" -- cgit v1.2.3 From cde66437247feb8b14b6d8f3ec3a8b4665fefa08 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 14:41:40 -0800 Subject: progs/fp: Redraw upon keypress. --- progs/fp/fp-tri.c | 2 +- progs/fp/point-position.c | 2 +- progs/fp/tri-depth.c | 2 +- progs/fp/tri-depth2.c | 2 +- progs/fp/tri-depthwrite.c | 2 +- progs/fp/tri-depthwrite2.c | 2 +- progs/fp/tri-param.c | 2 +- progs/fp/tri-tex.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 52a8fcfc22a..26af66ad84e 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -197,7 +197,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c index c0963d7a0b5..1ae753c1d05 100644 --- a/progs/fp/point-position.c +++ b/progs/fp/point-position.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c index 5488469e806..a9f3a6a5be3 100644 --- a/progs/fp/tri-depth.c +++ b/progs/fp/tri-depth.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c index 6ed23071157..8c4336817be 100644 --- a/progs/fp/tri-depth2.c +++ b/progs/fp/tri-depth2.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c index 8e4f3e62451..7b9d70f292a 100644 --- a/progs/fp/tri-depthwrite.c +++ b/progs/fp/tri-depthwrite.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c index 3c0b4d30c97..599949551d1 100644 --- a/progs/fp/tri-depthwrite2.c +++ b/progs/fp/tri-depthwrite2.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c index 57443d71bd0..26a804d4b38 100644 --- a/progs/fp/tri-param.c +++ b/progs/fp/tri-param.c @@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c index 1dbbb201cef..64299e94531 100644 --- a/progs/fp/tri-tex.c +++ b/progs/fp/tri-tex.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From e3cfd78969cd4a94fc83a5d6fb2f33730cc4e70f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 17:30:50 -0800 Subject: progs/tests: Fix memory leak in texdown.c if malloc fails. --- progs/tests/texdown.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c index 7e460458325..e6881d39a0a 100644 --- a/progs/tests/texdown.c +++ b/progs/tests/texdown.c @@ -176,6 +176,8 @@ MeasureDownloadRate(void) orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); if (!orig_texImage || !orig_getImage) { DownloadRate = 0.0; + free(orig_texImage); + free(orig_getImage); return; } -- cgit v1.2.3 From 3790c6a13b86dfe0afd4bb0bf9a4d9f4b429cfd8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 13:03:12 -0800 Subject: progs/trivial: Redraw upon keypress. --- progs/trivial/clear-fbo-tex.c | 2 +- progs/trivial/clear-fbo.c | 2 +- progs/trivial/clear-random.c | 2 +- progs/trivial/clear-scissor.c | 2 +- progs/trivial/clear.c | 2 +- progs/trivial/createwin.c | 2 +- progs/trivial/dlist-begin-call-end.c | 2 +- progs/trivial/dlist-dangling.c | 2 +- progs/trivial/dlist-edgeflag-dangling.c | 2 +- progs/trivial/dlist-edgeflag.c | 2 +- progs/trivial/dlist-flat-tri.c | 2 +- progs/trivial/dlist-mat-tri.c | 2 +- progs/trivial/dlist-recursive-call.c | 2 +- progs/trivial/dlist-tri-flat-tri.c | 2 +- progs/trivial/dlist-tri-mat-tri.c | 2 +- progs/trivial/line-clip.c | 2 +- progs/trivial/line-cull.c | 2 +- progs/trivial/line-flat.c | 2 +- progs/trivial/line-stipple-wide.c | 2 +- progs/trivial/line-userclip-clip.c | 2 +- progs/trivial/line-userclip-nop-clip.c | 2 +- progs/trivial/line-userclip-nop.c | 2 +- progs/trivial/line-userclip.c | 2 +- progs/trivial/line-wide.c | 2 +- progs/trivial/line.c | 2 +- progs/trivial/lineloop-clip.c | 2 +- progs/trivial/lineloop.c | 2 +- progs/trivial/linestrip-stipple-wide.c | 2 +- progs/trivial/linestrip-stipple.c | 2 +- progs/trivial/point-clip.c | 2 +- progs/trivial/point-param.c | 2 +- progs/trivial/point-sprite.c | 2 +- progs/trivial/point-wide-smooth.c | 2 +- progs/trivial/point-wide.c | 2 +- progs/trivial/point.c | 2 +- progs/trivial/poly-flat-clip.c | 2 +- progs/trivial/poly-flat-unfilled-clip.c | 2 +- progs/trivial/poly-flat.c | 2 +- progs/trivial/poly-unfilled.c | 2 +- progs/trivial/poly.c | 2 +- progs/trivial/quad-clip-all-vertices.c | 2 +- progs/trivial/quad-clip.c | 2 +- progs/trivial/quad-degenerate.c | 2 +- progs/trivial/quad-flat.c | 2 +- progs/trivial/quad-offset-factor.c | 2 +- progs/trivial/quad-offset-unfilled.c | 2 +- progs/trivial/quad-offset-units.c | 2 +- progs/trivial/quad-tex-alpha.c | 2 +- progs/trivial/quad-tex-pbo.c | 2 +- progs/trivial/quad-unfilled-clip.c | 2 +- progs/trivial/quad-unfilled-stipple.c | 2 +- progs/trivial/quad-unfilled.c | 2 +- progs/trivial/quad.c | 2 +- progs/trivial/quads.c | 2 +- progs/trivial/quadstrip-cont.c | 2 +- progs/trivial/quadstrip-flat.c | 2 +- progs/trivial/quadstrip.c | 2 +- progs/trivial/readpixels.c | 2 +- progs/trivial/tri-alpha-tex.c | 2 +- progs/trivial/tri-alpha.c | 2 +- progs/trivial/tri-blend-color.c | 2 +- progs/trivial/tri-clear.c | 2 +- progs/trivial/tri-clip.c | 2 +- progs/trivial/tri-cull-both.c | 2 +- progs/trivial/tri-dlist.c | 2 +- progs/trivial/tri-fbo.c | 2 +- progs/trivial/tri-flat-clip.c | 2 +- progs/trivial/tri-flat.c | 2 +- progs/trivial/tri-fog.c | 2 +- progs/trivial/tri-fp-const-imm.c | 2 +- progs/trivial/tri-fp.c | 2 +- progs/trivial/tri-lit-material.c | 2 +- progs/trivial/tri-lit.c | 2 +- progs/trivial/tri-multitex-vbo.c | 2 +- progs/trivial/tri-orig.c | 2 +- progs/trivial/tri-query.c | 2 +- progs/trivial/tri-scissor-tri.c | 2 +- progs/trivial/tri-square.c | 2 +- progs/trivial/tri-stipple.c | 2 +- progs/trivial/tri-tex-3d.c | 2 +- progs/trivial/tri-tex.c | 2 +- progs/trivial/tri-tri.c | 2 +- progs/trivial/tri-unfilled-clip.c | 2 +- progs/trivial/tri-unfilled-edgeflag.c | 2 +- progs/trivial/tri-unfilled-point.c | 2 +- progs/trivial/tri-unfilled-smooth.c | 2 +- progs/trivial/tri-unfilled-tri-lit.c | 2 +- progs/trivial/tri-unfilled-userclip-stip.c | 2 +- progs/trivial/tri-unfilled-userclip.c | 2 +- progs/trivial/tri-unfilled.c | 2 +- progs/trivial/tri-userclip.c | 2 +- progs/trivial/tri-z-9.c | 2 +- progs/trivial/tri-z-eq.c | 2 +- progs/trivial/trifan-flat-clip.c | 2 +- progs/trivial/trifan-flat-unfilled-clip.c | 2 +- progs/trivial/trifan-flat.c | 2 +- progs/trivial/trifan-unfilled.c | 2 +- progs/trivial/trifan.c | 2 +- progs/trivial/tristrip-clip.c | 2 +- progs/trivial/tristrip-flat.c | 2 +- progs/trivial/tristrip.c | 2 +- progs/trivial/vp-tri-cb-pos.c | 2 +- progs/trivial/vp-tri-cb-tex.c | 2 +- progs/trivial/vp-tri-invariant.c | 2 +- 104 files changed, 104 insertions(+), 104 deletions(-) (limited to 'progs') diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index a206676e48e..238f634bf59 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c index 0aeb45489f2..6435c901adc 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c index e3da23a8f55..ab67f84518d 100644 --- a/progs/trivial/clear-random.c +++ b/progs/trivial/clear-random.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c index 01735327480..2b6dee77a96 100644 --- a/progs/trivial/clear-scissor.c +++ b/progs/trivial/clear-scissor.c @@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c index 03857b4b893..56c3ea52e6a 100644 --- a/progs/trivial/clear.c +++ b/progs/trivial/clear.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c index f2cc6f1cffc..04a088642b8 100644 --- a/progs/trivial/createwin.c +++ b/progs/trivial/createwin.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c index 0d0aed7c729..da3864a02a4 100644 --- a/progs/trivial/dlist-begin-call-end.c +++ b/progs/trivial/dlist-begin-call-end.c @@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c index de106280092..756ab93f870 100644 --- a/progs/trivial/dlist-dangling.c +++ b/progs/trivial/dlist-dangling.c @@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c index 3d3aaeb6944..51504471e2c 100644 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ b/progs/trivial/dlist-edgeflag-dangling.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c index 8002129ed14..9456b964732 100644 --- a/progs/trivial/dlist-edgeflag.c +++ b/progs/trivial/dlist-edgeflag.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-flat-tri.c b/progs/trivial/dlist-flat-tri.c index c3dd7921e39..3ee9b283a44 100644 --- a/progs/trivial/dlist-flat-tri.c +++ b/progs/trivial/dlist-flat-tri.c @@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-mat-tri.c b/progs/trivial/dlist-mat-tri.c index ed3a4c5981a..d17c4b913b8 100644 --- a/progs/trivial/dlist-mat-tri.c +++ b/progs/trivial/dlist-mat-tri.c @@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-recursive-call.c b/progs/trivial/dlist-recursive-call.c index fe06b2bbd72..90224f63cb2 100644 --- a/progs/trivial/dlist-recursive-call.c +++ b/progs/trivial/dlist-recursive-call.c @@ -118,7 +118,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-flat-tri.c b/progs/trivial/dlist-tri-flat-tri.c index 4dbb7884869..3265a4d6dcd 100644 --- a/progs/trivial/dlist-tri-flat-tri.c +++ b/progs/trivial/dlist-tri-flat-tri.c @@ -99,7 +99,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-mat-tri.c b/progs/trivial/dlist-tri-mat-tri.c index f69854ae586..053bb124a23 100644 --- a/progs/trivial/dlist-tri-mat-tri.c +++ b/progs/trivial/dlist-tri-mat-tri.c @@ -102,7 +102,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c index 5276baffd5d..e4e388ed5cd 100644 --- a/progs/trivial/line-clip.c +++ b/progs/trivial/line-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c index 1e1b77a942c..c531ff132f5 100644 --- a/progs/trivial/line-cull.c +++ b/progs/trivial/line-cull.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c index 14f0ac07825..e2ddb87b9ef 100644 --- a/progs/trivial/line-flat.c +++ b/progs/trivial/line-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c index 1804ffad3f0..767583bbea5 100644 --- a/progs/trivial/line-stipple-wide.c +++ b/progs/trivial/line-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c index 8e030b47cea..3265b2c3bfe 100644 --- a/progs/trivial/line-userclip-clip.c +++ b/progs/trivial/line-userclip-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c index 6fcd4bcfe73..0198e27807e 100644 --- a/progs/trivial/line-userclip-nop-clip.c +++ b/progs/trivial/line-userclip-nop-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c index e59fd133a5f..6c863a3c82b 100644 --- a/progs/trivial/line-userclip-nop.c +++ b/progs/trivial/line-userclip-nop.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c index e30be5580bd..6cfcb6fc732 100644 --- a/progs/trivial/line-userclip.c +++ b/progs/trivial/line-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c index b74021dea73..1945712c5d0 100644 --- a/progs/trivial/line-wide.c +++ b/progs/trivial/line-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line.c b/progs/trivial/line.c index e1d73280bfc..58ab96836f8 100644 --- a/progs/trivial/line.c +++ b/progs/trivial/line.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c index 45fa47491f8..5e6b6217a1a 100644 --- a/progs/trivial/lineloop-clip.c +++ b/progs/trivial/lineloop-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c index c290dbd8cb3..82eccd24f8f 100644 --- a/progs/trivial/lineloop.c +++ b/progs/trivial/lineloop.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c index 701c82c266a..0296941a0de 100644 --- a/progs/trivial/linestrip-stipple-wide.c +++ b/progs/trivial/linestrip-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c index df2eef96b5d..a847d47deeb 100644 --- a/progs/trivial/linestrip-stipple.c +++ b/progs/trivial/linestrip-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c index 4c89ba598d7..23cfd778637 100644 --- a/progs/trivial/point-clip.c +++ b/progs/trivial/point-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c index 6f43720a892..46bd773265f 100644 --- a/progs/trivial/point-param.c +++ b/progs/trivial/point-param.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c index 5d29a6a3cf9..16e6771514b 100644 --- a/progs/trivial/point-sprite.c +++ b/progs/trivial/point-sprite.c @@ -96,7 +96,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c index f6e9b8df5f9..752cb8aee38 100644 --- a/progs/trivial/point-wide-smooth.c +++ b/progs/trivial/point-wide-smooth.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c index 8abd64c6a99..3b00ee9e500 100644 --- a/progs/trivial/point-wide.c +++ b/progs/trivial/point-wide.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point.c b/progs/trivial/point.c index 49959dcc487..8f5299cf6b5 100644 --- a/progs/trivial/point.c +++ b/progs/trivial/point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c index 5490068b08e..2a968bed40e 100644 --- a/progs/trivial/poly-flat-clip.c +++ b/progs/trivial/poly-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c index 26b90ef9645..89f4e0656ab 100644 --- a/progs/trivial/poly-flat-unfilled-clip.c +++ b/progs/trivial/poly-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c index a4e3cdb6334..33c2e04e0f8 100644 --- a/progs/trivial/poly-flat.c +++ b/progs/trivial/poly-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c index 2ad443dc159..c8c0d7a9e37 100644 --- a/progs/trivial/poly-unfilled.c +++ b/progs/trivial/poly-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c index e5b788ea5be..964eb42d789 100644 --- a/progs/trivial/poly.c +++ b/progs/trivial/poly.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c index 60c87fc9ce1..7712d8ca5b7 100644 --- a/progs/trivial/quad-clip-all-vertices.c +++ b/progs/trivial/quad-clip-all-vertices.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c index 063de6106a6..2847c9f9608 100644 --- a/progs/trivial/quad-clip.c +++ b/progs/trivial/quad-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c index fdc142bcd61..85e129d4be2 100644 --- a/progs/trivial/quad-degenerate.c +++ b/progs/trivial/quad-degenerate.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c index e3147b3b3fe..bed98e31a4e 100644 --- a/progs/trivial/quad-flat.c +++ b/progs/trivial/quad-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c index dfe99bbae68..1fc57a54ae7 100644 --- a/progs/trivial/quad-offset-factor.c +++ b/progs/trivial/quad-offset-factor.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c index 06590021fed..62f50fb98cc 100644 --- a/progs/trivial/quad-offset-unfilled.c +++ b/progs/trivial/quad-offset-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c index 922529d977e..1ac2338692f 100644 --- a/progs/trivial/quad-offset-units.c +++ b/progs/trivial/quad-offset-units.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c index eebaf9170ec..9db6792fad3 100644 --- a/progs/trivial/quad-tex-alpha.c +++ b/progs/trivial/quad-tex-alpha.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c index ad41a9a22e5..b7aa1db4360 100644 --- a/progs/trivial/quad-tex-pbo.c +++ b/progs/trivial/quad-tex-pbo.c @@ -105,7 +105,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c index 761878bd4b6..d2e87187751 100644 --- a/progs/trivial/quad-unfilled-clip.c +++ b/progs/trivial/quad-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c index cd7d2769284..8c1737e6756 100644 --- a/progs/trivial/quad-unfilled-stipple.c +++ b/progs/trivial/quad-unfilled-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c index d64f17fdf95..b756449d7a8 100644 --- a/progs/trivial/quad-unfilled.c +++ b/progs/trivial/quad-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c index d360e309d30..582de783d59 100644 --- a/progs/trivial/quad.c +++ b/progs/trivial/quad.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c index fe11fef207c..de7854a255e 100644 --- a/progs/trivial/quads.c +++ b/progs/trivial/quads.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c index 329523531aa..44412698dc5 100644 --- a/progs/trivial/quadstrip-cont.c +++ b/progs/trivial/quadstrip-cont.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c index 228c6c255e5..0e0b3b49fa6 100644 --- a/progs/trivial/quadstrip-flat.c +++ b/progs/trivial/quadstrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c index d49a9a53020..1be815fb8cd 100644 --- a/progs/trivial/quadstrip.c +++ b/progs/trivial/quadstrip.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c index 5671618446a..b063f179569 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -39,7 +39,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c index 780ebe6be5b..853d564ae7b 100644 --- a/progs/trivial/tri-alpha-tex.c +++ b/progs/trivial/tri-alpha-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c index aec1cbb3772..bd1c88ecf8e 100644 --- a/progs/trivial/tri-alpha.c +++ b/progs/trivial/tri-alpha.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c index 92f019259ec..629b35c4abb 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c index f49186bd8ae..e52ed81bf44 100644 --- a/progs/trivial/tri-clear.c +++ b/progs/trivial/tri-clear.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c index e1deca1bdcf..3e3879c9859 100644 --- a/progs/trivial/tri-clip.c +++ b/progs/trivial/tri-clip.c @@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c index 864be710c2a..809599d4a6d 100644 --- a/progs/trivial/tri-cull-both.c +++ b/progs/trivial/tri-cull-both.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c index c410be221a7..62d0a965d82 100644 --- a/progs/trivial/tri-dlist.c +++ b/progs/trivial/tri-dlist.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c index 1ed177ffdfb..089180f97ad 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c index 2aab5ba00a5..a23f8a382b0 100644 --- a/progs/trivial/tri-flat-clip.c +++ b/progs/trivial/tri-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c index ea703ec6f3f..0614321844e 100644 --- a/progs/trivial/tri-flat.c +++ b/progs/trivial/tri-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c index 0cea3d32582..7fc254a4675 100644 --- a/progs/trivial/tri-fog.c +++ b/progs/trivial/tri-fog.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c index d2df442abfc..accea62042d 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -92,7 +92,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index 4d1508120ea..8f933befd3d 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -90,7 +90,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit-material.c b/progs/trivial/tri-lit-material.c index ff9fb2c4dd6..16cebb2b984 100644 --- a/progs/trivial/tri-lit-material.c +++ b/progs/trivial/tri-lit-material.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c index 15a7ad24c51..26ebd99d917 100644 --- a/progs/trivial/tri-lit.c +++ b/progs/trivial/tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c index e319447ac15..ca4edaa5ddc 100644 --- a/progs/trivial/tri-multitex-vbo.c +++ b/progs/trivial/tri-multitex-vbo.c @@ -192,7 +192,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c index e7cfee3a367..d86d34c39de 100644 --- a/progs/trivial/tri-orig.c +++ b/progs/trivial/tri-orig.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index 94956a86f33..8898f182c78 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c index 608ebf29cff..d65502d91b9 100644 --- a/progs/trivial/tri-scissor-tri.c +++ b/progs/trivial/tri-scissor-tri.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c index 0b82a1dd8e3..2014bd489c3 100644 --- a/progs/trivial/tri-square.c +++ b/progs/trivial/tri-square.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c index aa94fa224b7..15a08fec7c8 100644 --- a/progs/trivial/tri-stipple.c +++ b/progs/trivial/tri-stipple.c @@ -77,7 +77,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c index 3ccbe125105..073a080d7a7 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -97,7 +97,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c index 56afb4748d7..244e1545042 100644 --- a/progs/trivial/tri-tex.c +++ b/progs/trivial/tri-tex.c @@ -94,7 +94,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c index f996bd01a16..7bf400793ea 100644 --- a/progs/trivial/tri-tri.c +++ b/progs/trivial/tri-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c index 2fd894a49a8..585919e16d1 100644 --- a/progs/trivial/tri-unfilled-clip.c +++ b/progs/trivial/tri-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c index 11c21d1bf68..f536f642296 100644 --- a/progs/trivial/tri-unfilled-edgeflag.c +++ b/progs/trivial/tri-unfilled-edgeflag.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c index 750a254669a..11e276e1a5b 100644 --- a/progs/trivial/tri-unfilled-point.c +++ b/progs/trivial/tri-unfilled-point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c index eddae176e5f..fa31667e658 100644 --- a/progs/trivial/tri-unfilled-smooth.c +++ b/progs/trivial/tri-unfilled-smooth.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c index 1d42b40b713..d6baeb46978 100644 --- a/progs/trivial/tri-unfilled-tri-lit.c +++ b/progs/trivial/tri-unfilled-tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c index ddc0dffd4f4..02bfa92f835 100644 --- a/progs/trivial/tri-unfilled-userclip-stip.c +++ b/progs/trivial/tri-unfilled-userclip-stip.c @@ -67,7 +67,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c index 0dec0bfc9b4..11e53fc7cc9 100644 --- a/progs/trivial/tri-unfilled-userclip.c +++ b/progs/trivial/tri-unfilled-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c index b98cb9a842a..afa1058dad4 100644 --- a/progs/trivial/tri-unfilled.c +++ b/progs/trivial/tri-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c index 8f37e0fae20..5651c738325 100644 --- a/progs/trivial/tri-userclip.c +++ b/progs/trivial/tri-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c index 099e89f6f4a..37b9e2f8732 100644 --- a/progs/trivial/tri-z-9.c +++ b/progs/trivial/tri-z-9.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c index b81c992f7d1..6bdac474196 100644 --- a/progs/trivial/tri-z-eq.c +++ b/progs/trivial/tri-z-eq.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c index 199f91a637e..89bc471191e 100644 --- a/progs/trivial/trifan-flat-clip.c +++ b/progs/trivial/trifan-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c index ea3e1553872..3a1a226e546 100644 --- a/progs/trivial/trifan-flat-unfilled-clip.c +++ b/progs/trivial/trifan-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c index d69b4887e39..d25abdf49eb 100644 --- a/progs/trivial/trifan-flat.c +++ b/progs/trivial/trifan-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c index 91447e4e44d..2e3ff8218f0 100644 --- a/progs/trivial/trifan-unfilled.c +++ b/progs/trivial/trifan-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c index 84eb4172de1..b8a76151148 100644 --- a/progs/trivial/trifan.c +++ b/progs/trivial/trifan.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c index 343e2938049..4e6ee1fbca2 100644 --- a/progs/trivial/tristrip-clip.c +++ b/progs/trivial/tristrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c index 02da97efcea..a90b8b6cb68 100644 --- a/progs/trivial/tristrip-flat.c +++ b/progs/trivial/tristrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c index 77bf2fad282..29915ff111d 100644 --- a/progs/trivial/tristrip.c +++ b/progs/trivial/tristrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c index 42bf9806b19..9cbc4d1193a 100644 --- a/progs/trivial/vp-tri-cb-pos.c +++ b/progs/trivial/vp-tri-cb-pos.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c index 8290226675e..e543e2ec3fd 100644 --- a/progs/trivial/vp-tri-cb-tex.c +++ b/progs/trivial/vp-tri-cb-tex.c @@ -114,7 +114,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c index ff241393659..4dbe95eb9a1 100644 --- a/progs/trivial/vp-tri-invariant.c +++ b/progs/trivial/vp-tri-invariant.c @@ -69,7 +69,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From 4ab8dbe5935d5c946cbc9af6982461073a784d07 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 14:20:26 -0800 Subject: progs/xdemos: Add missing break statement in offset.c. --- progs/xdemos/offset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c index 6c5abf383be..314a4fcdd17 100644 --- a/progs/xdemos/offset.c +++ b/progs/xdemos/offset.c @@ -294,6 +294,7 @@ process_input(Display *dpy, Window win) { default: break; } + break; case ButtonPress: prevx = event.xbutton.x; prevy = event.xbutton.y; -- cgit v1.2.3 From 881f55236ad85f95745e70f8363726fa3c201f80 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:46:19 -0800 Subject: progs/glsl: Redraw upon keypress. --- progs/glsl/convolutions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c index c2fb76e1aa5..350e61bbdc5 100644 --- a/progs/glsl/convolutions.c +++ b/progs/glsl/convolutions.c @@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } -- cgit v1.2.3 From 9553a42f638bd98eb90e5b7fb37d6b82758b6363 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:52:05 -0800 Subject: progs/trivial: Redraw upon keypress. --- progs/trivial/linestrip-clip.c | 2 +- progs/trivial/linestrip-flat-stipple.c | 2 +- progs/trivial/linestrip.c | 2 +- progs/trivial/tri-unfilled-tri.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c index f2528229218..5e90ea2eb05 100644 --- a/progs/trivial/linestrip-clip.c +++ b/progs/trivial/linestrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c index 5caa7244235..bae5c3a1c3b 100644 --- a/progs/trivial/linestrip-flat-stipple.c +++ b/progs/trivial/linestrip-flat-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c index 0219b1ab70e..b6d68821463 100644 --- a/progs/trivial/linestrip.c +++ b/progs/trivial/linestrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c index 695cc890955..75a70b8a412 100644 --- a/progs/trivial/tri-unfilled-tri.c +++ b/progs/trivial/tri-unfilled-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From 760cf71572a071ce43da576ebfeff4a8099150bc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:59:01 -0800 Subject: progs/vp: Fix memory leak in vp-tris.c. --- progs/vp/vp-tris.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index 1356242d971..29cd027b00c 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -99,9 +99,11 @@ static void Init( void ) sz = (GLuint) fread(buf, 1, sizeof(buf), f); if (!feof(f)) { fprintf(stderr, "file too long\n"); + fclose(f); exit(1); } + fclose(f); fprintf(stderr, "%.*s\n", sz, buf); if (strncmp( buf, "!!VP", 4 ) == 0) { -- cgit v1.2.3 From b98db7bf697c3ed6e6df303e9dd66f7ac31eb3e2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 23:56:07 -0800 Subject: progs/vpglsl: Fix psiz-mul.glsl compilation error on Mac OS. --- progs/vpglsl/psiz-mul.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl index 77f4a46b520..d2a90d8578e 100644 --- a/progs/vpglsl/psiz-mul.glsl +++ b/progs/vpglsl/psiz-mul.glsl @@ -1,6 +1,6 @@ void main() { gl_FrontColor = gl_Color; - gl_PointSize = 10 * gl_Color.x; + gl_PointSize = 10.0 * gl_Color.x; gl_Position = gl_Vertex; } -- cgit v1.2.3 From d36cb2396c942f05ba56c5b899792a507bb0f0fd Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 11:22:13 -0800 Subject: progs/util: Fix memory leak if malloc fails in RawImageOpen. --- progs/util/readtex.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 3922998fd5b..1e1183cf9ac 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -130,6 +130,12 @@ static rawImageRec *RawImageOpen(const char *fileName) if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || raw->tmpB == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw); return NULL; } @@ -139,6 +145,14 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->rowSize = (GLint *)malloc(x); if (raw->rowStart == NULL || raw->rowSize == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw->rowStart); + free(raw->rowSize); + free(raw); return NULL; } raw->rleEnd = 512 + (2 * x); -- cgit v1.2.3 From c88b18a4df753205321ce1f7ddcd99244b670a1e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 11:34:21 -0800 Subject: progs/slang: Check for ftell failure in vstest.c. --- progs/slang/vstest.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'progs') diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c index 472ea9b62e2..33c6f09dc55 100644 --- a/progs/slang/vstest.c +++ b/progs/slang/vstest.c @@ -220,6 +220,12 @@ static void load_test_file (const char *filename) fseek (f, 0, SEEK_END); size = ftell (f); + + if (size == -1) { + fclose (f); + return; + } + fseek (f, 0, SEEK_SET); code = (char *) (malloc (size)); -- cgit v1.2.3 From e26135a744f740430e3dc341fa692544ba99c11e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 12:11:55 -0800 Subject: progs/util: Exit RawImageGetData early if malloc fails. Prevents a null pointer deference later on. --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 1e1183cf9ac..81cb626e911 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -230,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); if (final->data == NULL) { fprintf(stderr, "Out of memory!\n"); + return; } ptr = final->data; -- cgit v1.2.3 From 48deddaa6f81e58f0ad6ab1c6cbd31c0184a0a3b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 12:34:21 -0800 Subject: progs/tests: Initialize variable in getprocaddress.c. --- progs/tests/getprocaddress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index a09ea58e1da..b905eeaf81b 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -3516,7 +3516,7 @@ check_functions( const char *extensions ) struct name_test_pair *entry; int failures = 0, passes = 0, untested = 0; int totalFail = 0, totalPass = 0, totalUntested = 0, totalUnsupported = 0; - int doTests; + int doTests = 0; const char *version = (const char *) glGetString(GL_VERSION); /* The functions list will have "real" entries (consisting of -- cgit v1.2.3 From 02c3e0b82da6877a7e170bb3fafd591bc2d76115 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 12:48:44 -0800 Subject: progs/tests: Silence unused value warnings in sharedtex.c. --- progs/tests/sharedtex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/sharedtex.c b/progs/tests/sharedtex.c index c07ebd719c7..2337b88d3ff 100644 --- a/progs/tests/sharedtex.c +++ b/progs/tests/sharedtex.c @@ -424,13 +424,13 @@ main(int argc, char *argv[]) { const char *dpyName = XDisplayName(NULL); - struct window *h0, *h1, *h2, *h3; + struct window *h0; /* four windows and contexts sharing display lists and texture objects */ h0 = AddWindow(dpyName, 10, 10, NULL); - h1 = AddWindow(dpyName, 330, 10, h0); - h2 = AddWindow(dpyName, 10, 350, h0); - h3 = AddWindow(dpyName, 330, 350, h0); + (void) AddWindow(dpyName, 330, 10, h0); + (void) AddWindow(dpyName, 10, 350, h0); + (void) AddWindow(dpyName, 330, 350, h0); InitGLstuff(h0); -- cgit v1.2.3 From f080567f4c4018c4885c105a154cb0eb39e6234f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 13:01:22 -0800 Subject: progs/xdemos: Fix memory leak in glxinfo.c. --- progs/xdemos/glxinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index 445d3ea94b6..c1a032872cd 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -964,8 +964,10 @@ print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode) /* get list of all fbconfigs on this screen */ fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs); - if (numFBConfigs == 0) + if (numFBConfigs == 0) { + XFree(fbconfigs); return; + } printf("%d GLXFBConfigs:\n", numFBConfigs); if (mode == Normal) -- cgit v1.2.3 From 8556fad75124e1ade9af095e112ebb6ac5cbff61 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 13:09:42 -0800 Subject: progs/xdemos: Silence unused value warnings in sharedtex_mt.c. --- progs/xdemos/sharedtex_mt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c index 07c1bfcc388..f924448cc43 100644 --- a/progs/xdemos/sharedtex_mt.c +++ b/progs/xdemos/sharedtex_mt.c @@ -447,7 +447,7 @@ main(int argc, char *argv[]) const char *dpyName = XDisplayName(NULL); pthread_t t0, t1, t2, t3; struct thread_init_arg tia0, tia1, tia2, tia3; - struct window *h0, *h1, *h2, *h3; + struct window *h0; XInitThreads(); @@ -462,9 +462,9 @@ main(int argc, char *argv[]) /* four windows and contexts sharing display lists and texture objects */ h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx); - h1 = AddWindow(gDpy, dpyName, 330, 10, gCtx); - h2 = AddWindow(gDpy, dpyName, 10, 350, gCtx); - h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 10, gCtx); + (void) AddWindow(gDpy, dpyName, 10, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 350, gCtx); if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) { Error(dpyName, "glXMakeCurrent failed for init thread."); -- cgit v1.2.3 From 8f24e863c3745b59e00978fbba306077629b5684 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Wed, 18 Nov 2009 20:19:29 -0700 Subject: progs: Fix quoting issue with empty set of PROGRAM_DIRS. Quotes are important to make sure the argument to test -n really is the empty string, but that requires stringifying PROGRAM_DIRS. Signed-off-by: Brian Paul --- progs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/Makefile b/progs/Makefile index 3700707dfb1..d5852fa416c 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -4,7 +4,7 @@ TOP = .. include $(TOP)/configs/current -SUBDIRS = $(PROGRAM_DIRS) +SUBDIRS = "$(strip "$(PROGRAM_DIRS)")" default: message subdirs -- cgit v1.2.3 From 7e5cd3eb14c4924e3aa6962bc244cd9fad656e43 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 19 Nov 2009 16:53:02 -0800 Subject: progs/fp: add simple imm, param tests --- progs/fp/fp-tri.c | 11 +++++++++++ progs/fp/mov-imm.txt | 3 +++ progs/fp/mov-param.txt | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 progs/fp/mov-imm.txt create mode 100644 progs/fp/mov-param.txt (limited to 'progs') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 52a8fcfc22a..a39818726bd 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -176,6 +176,17 @@ static void Init( void ) } + { + const float Ambient[4] = { 0.0, 1.0, 0.0, 0.0 }; + const float Diffuse[4] = { 1.0, 0.0, 0.0, 0.0 }; + const float Specular[4] = { 0.0, 0.0, 1.0, 0.0 }; + const float Emission[4] = { 0.0, 0.0, 0.0, 1.0 }; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission); + } + glClearColor(.1, .3, .5, 0); } diff --git a/progs/fp/mov-imm.txt b/progs/fp/mov-imm.txt new file mode 100644 index 00000000000..38e48079d09 --- /dev/null +++ b/progs/fp/mov-imm.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MOV result.color, {0.5, 0.8, 0.3, 1.0}; +END diff --git a/progs/fp/mov-param.txt b/progs/fp/mov-param.txt new file mode 100644 index 00000000000..13d82fe00b8 --- /dev/null +++ b/progs/fp/mov-param.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +PARAM Diffuse = state.material.diffuse; +MOV result.color, Diffuse; +END -- cgit v1.2.3 From 3fafe2b9692f294338d47ad12caecf9fa32703d4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 19 Nov 2009 19:50:19 -0800 Subject: progs/vp: add param and imm test --- progs/vp/add-param-imm.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 progs/vp/add-param-imm.txt (limited to 'progs') diff --git a/progs/vp/add-param-imm.txt b/progs/vp/add-param-imm.txt new file mode 100644 index 00000000000..90bcf96528f --- /dev/null +++ b/progs/vp/add-param-imm.txt @@ -0,0 +1,7 @@ +!!ARBvp1.0 +TEMP R0; +PARAM Emission = state.material.emission; +ADD R0, vertex.color, {-0.5}.x; +ADD result.color, R0, Emission.w; +MOV result.position, vertex.position; +END -- cgit v1.2.3 From 66a4ec14c38d407256545e0cf31c98974d621fe4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:03:16 -0800 Subject: progs/xdemos: Add assert in corender.c. --- progs/xdemos/corender.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c index ca8ee1eed33..8c705354829 100644 --- a/progs/xdemos/corender.c +++ b/progs/xdemos/corender.c @@ -55,6 +55,7 @@ setup_ipc(void) printf("Waiting for connection from another 'corender'\n"); Sock = AcceptConnection(k); + assert(Sock != -1); printf("Got connection, sending windowID\n"); -- cgit v1.2.3 From a4720a1a3206dd2edecf47a21fce547a79b67610 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:06:56 -0800 Subject: progs/xdemos: Remove duplicate code in glxinfo.c. --- progs/xdemos/glxinfo.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index c1a032872cd..b182a3091d1 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -426,8 +426,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) GLXFBConfig *configs = NULL; int nConfigs; - if (!visinfo) - configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs); if (!visinfo) configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs); -- cgit v1.2.3 From 538a8df65238994f70617a79ec1a0dbcd381001d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:18:19 -0800 Subject: progs/xdemos: Fix memory leak in glxpbdemo.c. --- progs/xdemos/glxpbdemo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/glxpbdemo.c b/progs/xdemos/glxpbdemo.c index 91fd30dcaa6..ecf318ec6a7 100644 --- a/progs/xdemos/glxpbdemo.c +++ b/progs/xdemos/glxpbdemo.c @@ -106,6 +106,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height ) if (0 == nConfigs || !fbConfigs) { printf("Error: glxChooseFBConfig failed\n"); + XFree(fbConfigs); XCloseDisplay(dpy); return 0; } -- cgit v1.2.3 From e0857962b911ef317238498305651515d83029ae Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:48:29 -0800 Subject: progs/xdemos: Fix memory leak in pbdemo.c. --- progs/xdemos/pbdemo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/pbdemo.c b/progs/xdemos/pbdemo.c index 2573209336c..277df729246 100644 --- a/progs/xdemos/pbdemo.c +++ b/progs/xdemos/pbdemo.c @@ -131,6 +131,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height ) fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs); if (nConfigs==0 || !fbConfigs) { printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]); + XFree(fbConfigs); continue; } -- cgit v1.2.3 From e19195c1855ca0a12697ed3196f3d9a763d1363d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:52:53 -0800 Subject: progs/xdemos: Fix memory leak in pbinfo.c. --- progs/xdemos/pbinfo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/pbinfo.c b/progs/xdemos/pbinfo.c index b43adf1bb70..edfa9c1f3b0 100644 --- a/progs/xdemos/pbinfo.c +++ b/progs/xdemos/pbinfo.c @@ -27,6 +27,7 @@ PrintConfigs(Display *dpy, int screen, Bool horizFormat) fbConfigs = GetAllFBConfigs(dpy, screen, &nConfigs); if (!nConfigs || !fbConfigs) { printf("Error: glxGetFBConfigs failed\n"); + XFree(fbConfigs); return; } -- cgit v1.2.3 From da0883114b1dceceff8a38deea1bb870fda40464 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 23 Nov 2009 18:32:27 -0800 Subject: shaderutil: Fix detection of shaders Check for versions >= 2.0 (because some drivers return 3.0), and return GL_FALSE if shaders are not detected. --- progs/util/shaderutil.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 4db950016b8..629b6f1d972 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -25,7 +25,11 @@ GLboolean ShadersSupported(void) { const char *version = (const char *) glGetString(GL_VERSION); - if (version[0] == '2' && version[1] == '.') { + + /* NVIDIA binary drivers will return "3.0.0", and they clearly support + * shaders. + */ + if (version[0] >= '2' && version[1] == '.') { return GL_TRUE; } else if (glutExtensionSupported("GL_ARB_vertex_shader") @@ -34,7 +38,7 @@ ShadersSupported(void) fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); return GL_TRUE; } - return GL_TRUE; + return GL_FALSE; } -- cgit v1.2.3 From cddc7e3a9cd321247c2298ef1b94cced1122a8e5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 30 Nov 2009 13:39:21 +0000 Subject: brw: add dumping to gem winsys --- progs/demos/gears.c | 7 ++ src/gallium/drivers/i965/Makefile | 1 + src/gallium/drivers/i965/brw_batchbuffer.c | 2 - src/gallium/drivers/i965/brw_context.h | 5 - src/gallium/drivers/i965/brw_debug.h | 1 + src/gallium/drivers/i965/brw_disasm.c | 4 +- src/gallium/drivers/i965/brw_eu_emit.c | 1 + src/gallium/drivers/i965/brw_screen.c | 11 ++ src/gallium/drivers/i965/brw_vs_emit.c | 1 + src/gallium/drivers/i965/brw_winsys.h | 21 ++++ src/gallium/drivers/i965/brw_winsys_debug.c | 87 ++++++++++++++ src/gallium/drivers/i965/brw_wm_emit.c | 1 + src/gallium/winsys/drm/i965/gem/i965_drm_api.c | 21 ++++ src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c | 133 +++++++++++++++++++--- src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h | 2 + src/gallium/winsys/drm/i965/xlib/xlib_i965.c | 91 +-------------- 16 files changed, 280 insertions(+), 109 deletions(-) create mode 100644 src/gallium/drivers/i965/brw_winsys_debug.c (limited to 'progs') diff --git a/progs/demos/gears.c b/progs/demos/gears.c index 6016162d6f7..cf2c0a5443c 100644 --- a/progs/demos/gears.c +++ b/progs/demos/gears.c @@ -92,6 +92,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, glNormal3f(0.0, 0.0, -1.0); +#if 0 /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { @@ -160,6 +161,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); } glEnd(); +#endif } @@ -195,6 +197,7 @@ draw(void) glCallList(gear1); glPopMatrix(); +#if 0 glPushMatrix(); glTranslatef(3.1, -2.0, 0.0); glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); @@ -206,6 +209,7 @@ draw(void) glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); glCallList(gear3); glPopMatrix(); +#endif glPopMatrix(); @@ -213,6 +217,9 @@ draw(void) Frames++; + if (Frames == 2) + exit(0); + { GLint t = glutGet(GLUT_ELAPSED_TIME); if (t - T0 >= 5000) { diff --git a/src/gallium/drivers/i965/Makefile b/src/gallium/drivers/i965/Makefile index 8df07d1c10e..95fd3cd69bd 100644 --- a/src/gallium/drivers/i965/Makefile +++ b/src/gallium/drivers/i965/Makefile @@ -68,6 +68,7 @@ C_SOURCES = \ brw_screen_texture.c \ brw_screen_surface.c \ brw_batchbuffer.c \ + brw_winsys_debug.c \ intel_decode.c include ../../Makefile.template diff --git a/src/gallium/drivers/i965/brw_batchbuffer.c b/src/gallium/drivers/i965/brw_batchbuffer.c index d725e8b27e0..22607dc6083 100644 --- a/src/gallium/drivers/i965/brw_batchbuffer.c +++ b/src/gallium/drivers/i965/brw_batchbuffer.c @@ -28,12 +28,10 @@ #include "util/u_memory.h" #include "brw_batchbuffer.h" -//#include "brw_decode.h" #include "brw_reg.h" #include "brw_winsys.h" #include "brw_debug.h" #include "brw_structs.h" -#include "intel_decode.h" #define ALWAYS_EMIT_MI_FLUSH 1 diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h index 598e747fe08..b7330f00f49 100644 --- a/src/gallium/drivers/i965/brw_context.h +++ b/src/gallium/drivers/i965/brw_context.h @@ -832,11 +832,6 @@ int brw_upload_urb_fence(struct brw_context *brw); */ int brw_upload_cs_urb_state(struct brw_context *brw); -/* brw_disasm.c */ -int brw_disasm_insn (FILE *file, const struct brw_instruction *inst); -int brw_disasm (FILE *file, - const struct brw_instruction *inst, - unsigned count); /*====================================================================== * Inline conversion functions. These are better-typed than the diff --git a/src/gallium/drivers/i965/brw_debug.h b/src/gallium/drivers/i965/brw_debug.h index 0deddbf9770..98407a06eda 100644 --- a/src/gallium/drivers/i965/brw_debug.h +++ b/src/gallium/drivers/i965/brw_debug.h @@ -39,4 +39,5 @@ extern int BRW_DEBUG; #endif + #endif diff --git a/src/gallium/drivers/i965/brw_disasm.c b/src/gallium/drivers/i965/brw_disasm.c index 4100f11d48f..65db27248b1 100644 --- a/src/gallium/drivers/i965/brw_disasm.c +++ b/src/gallium/drivers/i965/brw_disasm.c @@ -27,7 +27,9 @@ #include #include -#include "brw_context.h" +#include "brw_disasm.h" +#include "brw_structs.h" +#include "brw_reg.h" #include "brw_defines.h" struct { diff --git a/src/gallium/drivers/i965/brw_eu_emit.c b/src/gallium/drivers/i965/brw_eu_emit.c index 7776b4f9655..3ee50899fba 100644 --- a/src/gallium/drivers/i965/brw_eu_emit.c +++ b/src/gallium/drivers/i965/brw_eu_emit.c @@ -34,6 +34,7 @@ #include "brw_defines.h" #include "brw_eu.h" #include "brw_debug.h" +#include "brw_disasm.h" diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 05da72ebb2b..70e2d9c47a3 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -65,7 +65,16 @@ static const struct debug_named_value debug_names[] = { { NULL, 0 } }; +static const struct debug_named_value dump_names[] = { + { "asm", DUMP_ASM}, + { "state", DUMP_STATE}, + { "batch", DUMP_BATCH}, + { NULL, 0 } +}; + int BRW_DEBUG = 0; +int BRW_DUMP = 0; + #endif @@ -327,6 +336,8 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id) BRW_DEBUG = debug_get_flags_option("BRW_DEBUG", debug_names, 0); BRW_DEBUG |= debug_get_flags_option("INTEL_DEBUG", debug_names, 0); BRW_DEBUG |= DEBUG_STATS | DEBUG_MIN_URB | DEBUG_WM; + + BRW_DUMP = debug_get_flags_option("BRW_DUMP", dump_names, 0); #endif memset(&chipset, 0, sizeof chipset); diff --git a/src/gallium/drivers/i965/brw_vs_emit.c b/src/gallium/drivers/i965/brw_vs_emit.c index 00f0af2d07f..20cec0f59b4 100644 --- a/src/gallium/drivers/i965/brw_vs_emit.c +++ b/src/gallium/drivers/i965/brw_vs_emit.c @@ -41,6 +41,7 @@ #include "brw_context.h" #include "brw_vs.h" #include "brw_debug.h" +#include "brw_disasm.h" /* Choose one of the 4 vec4's which can be packed into each 16-wide reg. */ diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h index a723244960a..9e86a1256e1 100644 --- a/src/gallium/drivers/i965/brw_winsys.h +++ b/src/gallium/drivers/i965/brw_winsys.h @@ -111,6 +111,7 @@ enum brw_buffer_data_type { }; + /* Relocations to be applied with subdata in a call to sws->bo_subdata, below. * * Effectively this encodes: @@ -274,6 +275,26 @@ brw_texture_blanket_winsys_buffer(struct pipe_screen *screen, struct brw_winsys_buffer *buffer); +/************************************************************************* + * Cooperative dumping between winsys and driver. TODO: make this + * driver-only by wrapping calls to winsys->bo_subdata(). + */ + +#ifdef DEBUG +extern int BRW_DUMP; +#else +#define BRW_DUMP 0 +#endif + +#define DUMP_ASM 0x1 +#define DUMP_STATE 0x2 +#define DUMP_BATCH 0x4 + +void brw_dump_data( unsigned pci_id, + enum brw_buffer_data_type data_type, + unsigned offset, + const void *data, + size_t size ); #endif diff --git a/src/gallium/drivers/i965/brw_winsys_debug.c b/src/gallium/drivers/i965/brw_winsys_debug.c new file mode 100644 index 00000000000..f8f6a539bc9 --- /dev/null +++ b/src/gallium/drivers/i965/brw_winsys_debug.c @@ -0,0 +1,87 @@ +#include "brw_winsys.h" +#include "brw_disasm.h" +#include "brw_structs_dump.h" +#include "brw_structs.h" +#include "intel_decode.h" + + +void brw_dump_data( unsigned pci_id, + enum brw_buffer_data_type data_type, + unsigned offset, + const void *data, + size_t size ) +{ + if (BRW_DUMP & DUMP_ASM) { + switch (data_type) { + case BRW_DATA_GS_WM_PROG: + case BRW_DATA_GS_SF_PROG: + case BRW_DATA_GS_VS_PROG: + case BRW_DATA_GS_GS_PROG: + case BRW_DATA_GS_CLIP_PROG: + brw_disasm( stderr, data, size / sizeof(struct brw_instruction) ); + break; + default: + break; + } + } + + if (BRW_DUMP & DUMP_STATE) { + switch (data_type) { + case BRW_DATA_GS_CC_VP: + brw_dump_cc_viewport( data ); + break; + case BRW_DATA_GS_CC_UNIT: + brw_dump_cc_unit_state( data ); + break; + case BRW_DATA_GS_SAMPLER_DEFAULT_COLOR: + brw_dump_sampler_default_color( data ); + break; + case BRW_DATA_GS_SAMPLER: + brw_dump_sampler_state( data ); + break; + case BRW_DATA_GS_WM_UNIT: + brw_dump_wm_unit_state( data ); + break; + case BRW_DATA_GS_SF_VP: + brw_dump_sf_viewport( data ); + break; + case BRW_DATA_GS_SF_UNIT: + brw_dump_sf_unit_state( data ); + break; + case BRW_DATA_GS_VS_UNIT: + brw_dump_vs_unit_state( data ); + break; + case BRW_DATA_GS_GS_UNIT: + brw_dump_gs_unit_state( data ); + break; + case BRW_DATA_GS_CLIP_VP: + brw_dump_clipper_viewport( data ); + break; + case BRW_DATA_GS_CLIP_UNIT: + brw_dump_clip_unit_state( data ); + break; + case BRW_DATA_SS_SURFACE: + brw_dump_surface_state( data ); + break; + case BRW_DATA_SS_SURF_BIND: + break; + case BRW_DATA_OTHER: + break; + case BRW_DATA_CONSTANT_BUFFER: + break; + default: + break; + } + } + + if (BRW_DUMP & DUMP_BATCH) { + switch (data_type) { + case BRW_DATA_BATCH_BUFFER: + intel_decode(data, size / 4, offset, pci_id); + break; + default: + break; + } + } +} + diff --git a/src/gallium/drivers/i965/brw_wm_emit.c b/src/gallium/drivers/i965/brw_wm_emit.c index 3250db18486..0b82f4e1562 100644 --- a/src/gallium/drivers/i965/brw_wm_emit.c +++ b/src/gallium/drivers/i965/brw_wm_emit.c @@ -35,6 +35,7 @@ #include "brw_context.h" #include "brw_wm.h" #include "brw_debug.h" +#include "brw_disasm.h" /* Not quite sure how correct this is - need to understand horiz * vs. vertical strides a little better. diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c index 191a733c368..5d5dfdae464 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c @@ -44,6 +44,9 @@ i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws, struct i965_libdrm_buffer *buf = CALLOC_STRUCT(i965_libdrm_buffer); uint32_t tile = 0, swizzle = 0; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (!buf) return NULL; pipe_reference_init(&buf->base.reference, 1); @@ -89,6 +92,9 @@ i965_libdrm_texture_from_shared_handle(struct drm_api *api, struct i965_libdrm_winsys *idws = i965_libdrm_winsys(brw_screen(screen)->sws); struct i965_libdrm_buffer *buffer; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + buffer = i965_libdrm_buffer_from_handle(idws, name, handle); if (!buffer) return NULL; @@ -106,6 +112,10 @@ i965_libdrm_shared_handle_from_texture(struct drm_api *api, { struct i965_libdrm_buffer *buf = NULL; struct brw_winsys_buffer *buffer = NULL; + + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch)) return FALSE; @@ -129,6 +139,10 @@ i965_libdrm_local_handle_from_texture(struct drm_api *api, unsigned *handle) { struct brw_winsys_buffer *buffer = NULL; + + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch)) return FALSE; @@ -142,6 +156,9 @@ i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws) { struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws); + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + drm_intel_bufmgr_destroy(idws->gem); FREE(idws); @@ -154,6 +171,8 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD, struct i965_libdrm_winsys *idws; unsigned int deviceID; + debug_printf("%s\n", __FUNCTION__); + if (arg != NULL) { switch(arg->mode) { case DRM_CREATE_NORMAL: @@ -194,6 +213,8 @@ i965_libdrm_create_context(struct drm_api *api, struct pipe_screen *screen) static void destroy(struct drm_api *api) { + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); } diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c b/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c index 1f3f19ab725..d4a0c97262a 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c @@ -5,16 +5,59 @@ #include "i915_drm.h" #include "intel_bufmgr.h" + + const char *names[BRW_BUFFER_TYPE_MAX] = { - "texture", - "scanout", - "vertex", - "curbe", - "query", - "shader_constants", - "wm_scratch", - "batch", - "state_cache", + "TEXTURE", + "SCANOUT", + "VERTEX", + "CURBE", + "QUERY", + "SHADER_CONSTANTS", + "WM_SCRATCH", + "BATCH", + "GENERAL_STATE", + "SURFACE_STATE", + "PIXEL", + "GENERIC", +}; + +const char *usages[BRW_USAGE_MAX] = { + "STATE", + "QUERY_RESULT", + "RENDER_TARGET", + "DEPTH_BUFFER", + "BLIT_SOURCE", + "BLIT_DEST", + "SAMPLER", + "VERTEX", + "SCRATCH" +}; + + +const char *data_types[BRW_DATA_MAX] = +{ + "GS: CC_VP", + "GS: CC_UNIT", + "GS: WM_PROG", + "GS: SAMPLER_DEFAULT_COLOR", + "GS: SAMPLER", + "GS: WM_UNIT", + "GS: SF_PROG", + "GS: SF_VP", + "GS: SF_UNIT", + "GS: VS_UNIT", + "GS: VS_PROG", + "GS: GS_UNIT", + "GS: GS_PROG", + "GS: CLIP_VP", + "GS: CLIP_UNIT", + "GS: CLIP_PROG", + "SS: SURFACE", + "SS: SURF_BIND", + "CONSTANT DATA", + "BATCH DATA", + "(untyped)" }; static enum pipe_error @@ -27,6 +70,9 @@ i965_libdrm_bo_alloc(struct brw_winsys_screen *sws, struct i965_libdrm_winsys *idws = i965_libdrm_winsys(sws); struct i965_libdrm_buffer *buf; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + buf = CALLOC_STRUCT(i965_libdrm_buffer); if (!buf) return PIPE_ERROR_OUT_OF_MEMORY; @@ -79,6 +125,9 @@ i965_libdrm_bo_destroy(struct brw_winsys_buffer *buffer) { struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + drm_intel_bo_unreference(buf->bo); FREE(buffer); } @@ -95,6 +144,12 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer, int read, write; int ret; + if (BRW_DUMP) + debug_printf("%s buf %p offset %x delta %x buf2 %p/%s/%s\n", + __FUNCTION__, (void *)buffer, + offset, delta, + (void *)buffer2, names[buf2->data_type], usages[usage]); + switch (usage) { case BRW_USAGE_STATE: read = I915_GEM_DOMAIN_INSTRUCTION; @@ -104,7 +159,11 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer, read = I915_GEM_DOMAIN_INSTRUCTION; write = I915_GEM_DOMAIN_INSTRUCTION; break; - case BRW_USAGE_BLIT_DEST: + case BRW_USAGE_RENDER_TARGET: + read = I915_GEM_DOMAIN_RENDER; + write = 0; + break; + case BRW_USAGE_DEPTH_BUFFER: read = I915_GEM_DOMAIN_RENDER; write = I915_GEM_DOMAIN_RENDER; break; @@ -112,11 +171,7 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer, read = 0; write = I915_GEM_DOMAIN_RENDER; break; - case BRW_USAGE_RENDER_TARGET: - read = I915_GEM_DOMAIN_RENDER; - write = 0; - break; - case BRW_USAGE_DEPTH_BUFFER: + case BRW_USAGE_BLIT_DEST: read = I915_GEM_DOMAIN_RENDER; write = I915_GEM_DOMAIN_RENDER; break; @@ -137,6 +192,11 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer, return -1; } + /* Needed?? + ((uint32_t *)buf->bo->virtual)[offset/4] = (delta + + buf2->bo->offset); + */ + ret = dri_bo_emit_reloc( buf->bo, read, write, delta, offset, buf2->bo ); if (ret) return -1; @@ -152,6 +212,9 @@ i965_libdrm_bo_exec(struct brw_winsys_buffer *buffer, struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws); int ret; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (idws->send_cmd) { ret = dri_bo_exec(buf->bo, bytes_used, NULL, 0, 0); if (ret) @@ -171,10 +234,20 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer, unsigned nr_reloc) { struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws); int ret, i; (void)data_type; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + + if (BRW_DUMP) + brw_dump_data( idws->id, + data_type, + buf->bo->offset + offset, + data, size ); + /* XXX: use bo_map_gtt/memcpy/unmap_gtt under some circumstances??? */ ret = drm_intel_bo_subdata(buf->bo, offset, size, (void*)data); @@ -194,6 +267,9 @@ i965_libdrm_bo_is_busy(struct brw_winsys_buffer *buffer) { struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + return drm_intel_bo_busy(buf->bo); } @@ -204,6 +280,9 @@ i965_libdrm_bo_references(struct brw_winsys_buffer *a, struct i965_libdrm_buffer *bufa = i965_libdrm_buffer(a); struct i965_libdrm_buffer *bufb = i965_libdrm_buffer(b); + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + /* XXX: can't find this func: */ return drm_intel_bo_references(bufa->bo, bufb->bo); @@ -220,6 +299,9 @@ i965_libdrm_check_aperture_space(struct brw_winsys_screen *iws, static drm_intel_bo *bos[128]; int i; + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (count > Elements(bos)) { assert(0); return FALSE; @@ -243,6 +325,12 @@ i965_libdrm_bo_map(struct brw_winsys_buffer *buffer, struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); int ret; + + if (BRW_DUMP) + debug_printf("%s %p %s %s\n", __FUNCTION__, (void *)buffer, + write ? "read/write" : "read", + write ? data_types[data_type] : ""); + if (!buf->map_count) { if (buf->map_gtt) { ret = drm_intel_gem_bo_map_gtt(buf->bo); @@ -256,6 +344,7 @@ i965_libdrm_bo_map(struct brw_winsys_buffer *buffer, } } + buf->data_type = data_type; buf->map_count++; return buf->bo->virtual; } @@ -265,7 +354,18 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer, unsigned offset, unsigned length) { + struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws); + if (BRW_DUMP) + debug_printf("%s offset %d len %d\n", __FUNCTION__, offset, length); + + if (BRW_DUMP) + brw_dump_data( idws->id, + buf->data_type, + buf->bo->offset + offset, + buf->bo->virtual + offset, + length ); } static void @@ -273,6 +373,9 @@ i965_libdrm_bo_unmap(struct brw_winsys_buffer *buffer) { struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + if (--buf->map_count > 0) return; diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h b/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h index 79457112636..5b556b18f0f 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h @@ -52,6 +52,8 @@ struct i965_libdrm_buffer { boolean flinked; unsigned flink; + unsigned data_type; /* valid while mapped */ + unsigned cheesy_refcount; }; diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c index 9d2bfae090d..e712de6307e 100644 --- a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c +++ b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c @@ -228,89 +228,7 @@ xlib_brw_bo_exec( struct brw_winsys_buffer *buffer, return 0; } -static void dump_data( struct xlib_brw_winsys *xbw, - enum brw_buffer_data_type data_type, - unsigned offset, - const void *data, - size_t size ) -{ - static int DUMP_ASM = 0; - static int DUMP_STATE = 0; - static int DUMP_BATCH = 1; - - if (DUMP_ASM) { - switch (data_type) { - case BRW_DATA_GS_WM_PROG: - case BRW_DATA_GS_SF_PROG: - case BRW_DATA_GS_VS_PROG: - case BRW_DATA_GS_GS_PROG: - case BRW_DATA_GS_CLIP_PROG: - brw_disasm( stderr, data, size / sizeof(struct brw_instruction) ); - break; - default: - break; - } - } - - if (DUMP_STATE) { - switch (data_type) { - case BRW_DATA_GS_CC_VP: - brw_dump_cc_viewport( data ); - break; - case BRW_DATA_GS_CC_UNIT: - brw_dump_cc_unit_state( data ); - break; - case BRW_DATA_GS_SAMPLER_DEFAULT_COLOR: - brw_dump_sampler_default_color( data ); - break; - case BRW_DATA_GS_SAMPLER: - brw_dump_sampler_state( data ); - break; - case BRW_DATA_GS_WM_UNIT: - brw_dump_wm_unit_state( data ); - break; - case BRW_DATA_GS_SF_VP: - brw_dump_sf_viewport( data ); - break; - case BRW_DATA_GS_SF_UNIT: - brw_dump_sf_unit_state( data ); - break; - case BRW_DATA_GS_VS_UNIT: - brw_dump_vs_unit_state( data ); - break; - case BRW_DATA_GS_GS_UNIT: - brw_dump_gs_unit_state( data ); - break; - case BRW_DATA_GS_CLIP_VP: - brw_dump_clipper_viewport( data ); - break; - case BRW_DATA_GS_CLIP_UNIT: - brw_dump_clip_unit_state( data ); - break; - case BRW_DATA_SS_SURFACE: - brw_dump_surface_state( data ); - break; - case BRW_DATA_SS_SURF_BIND: - break; - case BRW_DATA_OTHER: - break; - case BRW_DATA_CONSTANT_BUFFER: - break; - default: - break; - } - } - if (DUMP_BATCH) { - switch (data_type) { - case BRW_DATA_BATCH_BUFFER: - intel_decode(data, size / 4, offset, xbw->chipset.pci_id); - break; - default: - break; - } - } -} static int @@ -346,10 +264,11 @@ xlib_brw_bo_subdata(struct brw_winsys_buffer *buffer, xlib_brw_buffer(reloc[i].bo)->offset + reloc[i].delta; } - if (1) - dump_data( xbw, data_type, - buf->offset + offset, - buf->virtual + offset, size ); + if (BRW_DUMP) + brw_dump_data( xbw->chipset.pci_id, + data_type, + buf->offset + offset, + buf->virtual + offset, size ); return 0; -- cgit v1.2.3 From b9f4a0bd2b0104ce5f15dcd7d1698db710330418 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Tue, 24 Nov 2009 16:46:31 -0700 Subject: Simplify hackery added to fix AIX build. Borrow an idiom from the GNU build system which can handle `for' loops over empty lists. --- progs/Makefile | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'progs') diff --git a/progs/Makefile b/progs/Makefile index d5852fa416c..5bc444e9524 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -4,7 +4,7 @@ TOP = .. include $(TOP)/configs/current -SUBDIRS = "$(strip "$(PROGRAM_DIRS)")" +SUBDIRS = $(PROGRAM_DIRS) default: message subdirs @@ -15,22 +15,18 @@ message: subdirs: - @if test -n "$(SUBDIRS)" ; then \ - for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE)) || exit 1 ; \ - fi \ - done \ - fi + @list='$(SUBDIRS)'; for dir in $$list ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done # Dummy install target install: clean: - -@if test -n "$(SUBDIRS)" ; then \ - for dir in $(SUBDIRS) tests ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) clean) ; \ - fi \ - done \ - fi + @list='$(SUBDIRS)'; for dir in $$list tests ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done -- cgit v1.2.3 From ba97b98842ebe0178406258f29c93ca9fa415ff7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 30 Nov 2009 09:54:27 -0700 Subject: progs/demos: remove unused glFogCoordPointer_ext var --- progs/demos/fogcoord.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'progs') diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c index 6f50993c98f..7d5c11aabf3 100644 --- a/progs/demos/fogcoord.c +++ b/progs/demos/fogcoord.c @@ -15,8 +15,6 @@ #define DEPTH 5.0f -static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext; - static GLfloat camz; static GLint fogMode; -- cgit v1.2.3 From 67a0628ab2830371fc0a80b58aa4757c099471dc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 14 Nov 2009 21:36:18 -0800 Subject: progs: Ignore Mac OS dSYM directories. (cherry picked from commit a420056750908f7c2f9a7c18b3ab20f04e49711d) --- progs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 progs/.gitignore (limited to 'progs') diff --git a/progs/.gitignore b/progs/.gitignore new file mode 100644 index 00000000000..cb77d18a4b3 --- /dev/null +++ b/progs/.gitignore @@ -0,0 +1 @@ +*.dSYM -- cgit v1.2.3 From ccea09cd3a3f18c28ebdc07c7fe879a59cd72f60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Sep 2009 15:49:33 -0600 Subject: progs/glsl: minor Makefile clean-ups (cherry picked from commit 4df2f7af5e9b2c00ead92fe0ae49ed8491aef1d0) --- progs/glsl/Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 8103a5cbca0..a8e4cf3e661 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -10,16 +10,15 @@ LIB_DEP = \ $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -INCLUDE_DIRS = -I$(TOP)/progs/util +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) \ + -l$(GL_LIB) $(APP_LIB_DEPS) # using : to avoid APP_CC pointing to CC loop -CC:=$(APP_CC) +CC := $(APP_CC) CFLAGS += -I$(INCDIR) -LDLIBS=$(LIBS) +LDLIBS = $(LIBS) -DEMO_SOURCES = \ +PROG_SOURCES = \ array.c \ bitmap.c \ brick.c \ @@ -59,8 +58,8 @@ UTIL_SOURCES = \ readtex.c UTIL_OBJS = $(UTIL_SOURCES:.c=.o) -PROG_OBJS = $(DEMO_SOURCES:.c=.o) -PROGS = $(DEMO_SOURCES:%.c=%) +PROG_OBJS = $(PROG_SOURCES:.c=.o) +PROGS = $(PROG_SOURCES:%.c=%) ##### TARGETS ##### -- cgit v1.2.3 From 2a5cd95e243a0e8db25a8c7614c9b9fe5f116044 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 21 Sep 2009 08:44:53 -0600 Subject: progs/glsl: Include local headers before installed headers during compilation. Fixes compilation errors on platforms with insufficient older installed GL headers. (cherry picked from commit d17af7d1e19e637e29db47bd8f6e3e579760c530) --- progs/glsl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index a8e4cf3e661..8928c833c0e 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -15,7 +15,7 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) \ # using : to avoid APP_CC pointing to CC loop CC := $(APP_CC) -CFLAGS += -I$(INCDIR) +CFLAGS := -I$(INCDIR) $(CFLAGS) LDLIBS = $(LIBS) PROG_SOURCES = \ -- cgit v1.2.3 From 832593772dac9b83db1ed44c8654352978e756eb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 23:15:25 -0800 Subject: progs/glsl: Fix mandelbrot GLSL compilation error on Mac OS. (cherry picked from commit 04442841fb7e9138eb50ff692952ad7e8c3877d8) --- progs/glsl/CH18-mandel.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/CH18-mandel.frag b/progs/glsl/CH18-mandel.frag index a472d812526..a972d68bcfb 100644 --- a/progs/glsl/CH18-mandel.frag +++ b/progs/glsl/CH18-mandel.frag @@ -31,7 +31,7 @@ void main() float iter; // for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter) - for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter) + for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter) { float tempreal = real; -- cgit v1.2.3 From 9ed77d12b10c2ed830647bfcadfb3478b2e418d1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 12 Nov 2009 16:20:23 -0800 Subject: progs/glsl: Add missing break statement in multinoise.c. (cherry picked from commit 43080e40aa0d34423e10f1d50aad15289b2b9aec) --- progs/glsl/multinoise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 0d4026e29cf..06207f78b58 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -125,6 +125,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; -- cgit v1.2.3 From 8f4d3613daa5684ff8aba75158ef7585a8005ed0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 12:49:31 -0800 Subject: progs/glsl: Fix multinoise GLSL compilation errors on Mac OS. (cherry picked from commit d4dc2e30dada1be425e95ba270920db6eb210982) --- progs/glsl/multinoise.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 06207f78b58..d504ba1cc4e 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = { "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n" }; @@ -194,7 +194,7 @@ LoadAndCompileShader(GLuint shader, const char *text) GLchar log[1000]; GLsizei len; glGetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "noise: problem compiling shader: %s\n", log); + fprintf(stderr, "multinoise: problem compiling shader: %s\n", log); exit(1); } else { -- cgit v1.2.3 From 592c8522a280898ba7a797923c0e054ac6df038f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 11 Nov 2009 17:39:58 -0800 Subject: demos/glsl: Add missing break statement to noise test. (cherry picked from commit 7dfea5c0722e9da101805c15b9dd26352816bca9) --- progs/glsl/noise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index fdab263ea6a..bb024b50121 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -119,6 +119,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; -- cgit v1.2.3 From b094683e7c2f14f61cf3511f286b4cea450609c8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 13:50:49 -0800 Subject: progs/glsl: Fix noise GLSL compilation error on Mac OS. (cherry picked from commit 0d31990b4742eccdf6ae6a3b3e16c81cc863085d) --- progs/glsl/noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index bb024b50121..1148580ff4d 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -28,7 +28,7 @@ static const char *FragShaderText = " vec4 p;\n" " p.xy = gl_TexCoord[0].xy;\n" " p.z = Slice;\n" - " p.w = 0;\n" + " p.w = 0.0;\n" " vec4 n = noise4(p * scale);\n" " gl_FragColor = n * Scale + Bias;\n" "}\n"; -- cgit v1.2.3 From 0a107d36c2f290cd42e29008dec5194df55b7690 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 14:02:20 -0800 Subject: progs/glsl: Fix trirast GLSL compilation errors on Mac OS. (cherry picked from commit 4b3ec2acf2cc2830b0907e4fb4db8bd1ff4a18e3) --- progs/glsl/trirast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c index 53bd91ef976..857342636dc 100644 --- a/progs/glsl/trirast.c +++ b/progs/glsl/trirast.c @@ -179,9 +179,9 @@ Init(void) "\n" "void main() {\n" " vec2 p = gl_FragCoord.xy; \n" - " if (crs(v1 - v0, p - v0) >= 0 && \n" - " crs(v2 - v1, p - v1) >= 0 && \n" - " crs(v0 - v2, p - v2) >= 0) \n" + " if (crs(v1 - v0, p - v0) >= 0.0 && \n" + " crs(v2 - v1, p - v1) >= 0.0 && \n" + " crs(v0 - v2, p - v2) >= 0.0) \n" " gl_FragColor = vec4(1.0); \n" " else \n" " gl_FragColor = vec4(0.5); \n" -- cgit v1.2.3 From 235c0c81346c44e24909b6e48394ea62b136a36b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 23:56:07 -0800 Subject: progs/vpglsl: Fix psiz-mul.glsl compilation error on Mac OS. (cherry picked from commit b98db7bf697c3ed6e6df303e9dd66f7ac31eb3e2) --- progs/vpglsl/psiz-mul.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl index 77f4a46b520..d2a90d8578e 100644 --- a/progs/vpglsl/psiz-mul.glsl +++ b/progs/vpglsl/psiz-mul.glsl @@ -1,6 +1,6 @@ void main() { gl_FrontColor = gl_Color; - gl_PointSize = 10 * gl_Color.x; + gl_PointSize = 10.0 * gl_Color.x; gl_Position = gl_Vertex; } -- cgit v1.2.3 From 3910e88ebf636cb34ae75bc4a7916fc8c2f1a9e1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 14 Oct 2009 07:43:18 -0600 Subject: prog/tests: Fix MSVC build. (cherry picked from commit ea862ec8ff4a52b30b822e737d93a49330be9e31) --- progs/tests/arraytexture.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'progs') diff --git a/progs/tests/arraytexture.c b/progs/tests/arraytexture.c index 6c0484df0de..28252a354bf 100644 --- a/progs/tests/arraytexture.c +++ b/progs/tests/arraytexture.c @@ -77,10 +77,6 @@ static GLfloat texZ = 0.0; static GLfloat texZ_dir = 0.01; static GLint num_layers; -static PFNGLBINDPROGRAMARBPROC bind_program; -static PFNGLPROGRAMSTRINGARBPROC program_string; -static PFNGLGENPROGRAMSARBPROC gen_programs; - static void PrintString(const char *s) @@ -125,13 +121,13 @@ static void Display(void) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0); glColor3f(1,1,1); glRasterPos3f(-0.9, -0.9, 0.0); sprintf(str, "Texture Z coordinate = %4.1f", texZ); PrintString(str); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 1); GL_CHECK_ERROR(); glEnable(GL_TEXTURE_2D_ARRAY_EXT); GL_CHECK_ERROR(); @@ -159,7 +155,7 @@ static void Display(void) glDisable(GL_TEXTURE_2D_ARRAY_EXT); GL_CHECK_ERROR(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0); GL_CHECK_ERROR(); glutSwapBuffers(); @@ -226,8 +222,8 @@ compile_fragment_program(GLuint id, const char *prog) int err; err = glGetError(); - (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id); - (*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id); + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(prog), (const GLubyte *) prog); glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos); @@ -264,11 +260,6 @@ static void Init(void) require_extension("GL_MESA_texture_array"); require_extension("GL_SGIS_generate_mipmap"); - bind_program = glutGetProcAddress("glBindProgramARB"); - program_string = glutGetProcAddress("glProgramStringARB"); - gen_programs = glutGetProcAddress("glGenProgramsARB"); - - for (num_layers = 0; textures[num_layers] != NULL; num_layers++) /* empty */ ; -- cgit v1.2.3 From 5a25adb646faa970dacec0dbfa2e2bd905e87eba Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 6 Oct 2009 16:02:47 -0600 Subject: progs/tests: fix MSVC build. (cherry picked from commit 9c778a90ea24f25437b68bb67856c81add61e261) --- progs/tests/copypixrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/copypixrate.c b/progs/tests/copypixrate.c index aa4acfc18b5..f63d59f3cec 100644 --- a/progs/tests/copypixrate.c +++ b/progs/tests/copypixrate.c @@ -69,7 +69,7 @@ DrawTestImage(void) static int Rand(int max) { - return ((int) random()) % max; + return ((int) rand()) % max; } -- cgit v1.2.3 From 89e747920f35f28d651ad89380f58250aab7c2d4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 12 Oct 2009 18:05:05 -0600 Subject: prog/tests: Fix MSVC build. (cherry picked from commit 96fd13c1a024e3b6c0b1c44394c67c772e52b9c9) --- progs/tests/crossbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c index 3dd21372f9a..bd8e05aee13 100644 --- a/progs/tests/crossbar.c +++ b/progs/tests/crossbar.c @@ -145,7 +145,7 @@ static void Init( void ) { const char * const ver_string = (const char * const) glGetString( GL_VERSION ); - float ver = strtof( ver_string, NULL ); + float ver = strtod( ver_string, NULL ); GLint tex_units; GLint temp[ 256 ]; -- cgit v1.2.3 From 791b7546876e72dcbcc012a855df7f610d777297 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 16 Oct 2009 11:36:09 +0100 Subject: prog/tests: Fix MSVC build. (cherry picked from commit 60b6c7458319ff01ecdd9d1650d526ac8f75e194) --- progs/tests/invert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/invert.c b/progs/tests/invert.c index 63099fbd221..3bc97a460b6 100644 --- a/progs/tests/invert.c +++ b/progs/tests/invert.c @@ -128,7 +128,7 @@ static void Init( void ) { const char * const ver_string = (const char * const) glGetString( GL_VERSION ); - const float ver = strtof( ver_string, NULL ); + const float ver = strtod( ver_string, NULL ); printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); -- cgit v1.2.3 From a38776419b1e18a43e8bab1371dfe802af44d14a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 8 Oct 2009 08:08:11 -0600 Subject: progs/tests: Fix MSVC build. (cherry picked from commit f7455ad7af09b5ef31ccc454b79422a13c59af9a) --- progs/tests/minmag.c | 1 - 1 file changed, 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/minmag.c b/progs/tests/minmag.c index 03019f94faa..179be511207 100644 --- a/progs/tests/minmag.c +++ b/progs/tests/minmag.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From bb6e3af93920ca15d19fbb9685e5b6f612cc502c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 16 Oct 2009 11:39:29 +0100 Subject: progs/tests: Use rand() instead of random(). More portable. Same implementation on Linux. (cherry picked from commit 699260b19535abaa3af0a5d33eb039e3d6a30ce9) --- progs/tests/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 6dd956c4023..6123ef7c162 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -116,7 +116,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param, for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); + param[i] = (GLfloat) rand() / (GLfloat) rand(); } /* Try using the "classic" interface. -- cgit v1.2.3 From 28474e1225866e6b73928f79722f14cc5d6b35c7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 16 Oct 2009 11:39:29 +0100 Subject: progs/tests: Use rand() instead of random(). Forgot these on previous commit. (cherry picked from commit 166957abebea6aa203eba7e6348e89d53cf0e13e) --- progs/tests/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 6123ef7c162..28e3b537acd 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -153,7 +153,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param, for ( i = 0 ; i < (4 * count) ; i++ ) { - param[i] = (GLfloat) random() / (GLfloat) random(); + param[i] = (GLfloat) rand() / (GLfloat) rand(); } printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count); -- cgit v1.2.3 From a99bf51bc845617c2086468a814685672b5de224 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 23 Oct 2009 13:49:02 -0600 Subject: progs/tests: Fix MSVC build. (cherry picked from commit 952bf63e2cf442504ef89b0b1d276da0d52b21d4) --- progs/tests/prog_parameter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 28e3b537acd..0241f3a2496 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -203,20 +203,20 @@ static void Init( void ) } - program_local_parameter4fv = glutGetProcAddress( "glProgramLocalParameter4fvARB" ); - program_env_parameter4fv = glutGetProcAddress( "glProgramEnvParameter4fvARB" ); + program_local_parameter4fv = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramLocalParameter4fvARB" ); + program_env_parameter4fv = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramEnvParameter4fvARB" ); - get_program_local_parameterfv = glutGetProcAddress( "glGetProgramLocalParameterfvARB" ); - get_program_env_parameterfv = glutGetProcAddress( "glGetProgramEnvParameterfvARB" ); + get_program_local_parameterfv = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramLocalParameterfvARB" ); + get_program_env_parameterfv = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramEnvParameterfvARB" ); - bind_program = glutGetProcAddress( "glBindProgramARB" ); - get_program = glutGetProcAddress( "glGetProgramivARB" ); + bind_program = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress( "glBindProgramARB" ); + get_program = (PFNGLGETPROGRAMIVARBPROC) glutGetProcAddress( "glGetProgramivARB" ); if ( glutExtensionSupported("GL_EXT_gpu_program_parameters") ) { printf("GL_EXT_gpu_program_parameters available, testing that path.\n"); - program_local_parameters4fv = glutGetProcAddress( "glProgramLocalParameters4fvEXT" ); - program_env_parameters4fv = glutGetProcAddress( "glProgramEnvParameters4fvEXT" ); + program_local_parameters4fv = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramLocalParameters4fvEXT" ); + program_env_parameters4fv = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramEnvParameters4fvEXT" ); } else { printf("GL_EXT_gpu_program_parameters not available.\n"); -- cgit v1.2.3 From 97cbf4943a5926dc1bbec213ff8c919ece66555e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 26 Oct 2009 15:03:31 -0600 Subject: progs/tests: Fix MSVC build. (cherry picked from commit 50e113e375b4ecfdf5b60ccce7bbcdb1c5f2ca11) --- progs/tests/stencil_twoside.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c index 1e18ca6b5ea..7d871e5877f 100644 --- a/progs/tests/stencil_twoside.c +++ b/progs/tests/stencil_twoside.c @@ -274,9 +274,9 @@ static void Init( void ) if (atof( ver_string ) < 2.0) { use20syntax = 0; } - stencil_func_separate = glutGetProcAddress( "glStencilFuncSeparate" ); - stencil_func_separate_ati = glutGetProcAddress( "glStencilFuncSeparateATI" ); - stencil_op_separate = glutGetProcAddress( "glStencilOpSeparate" ); + stencil_func_separate = (PFNGLSTENCILFUNCSEPARATEPROC) glutGetProcAddress( "glStencilFuncSeparate" ); + stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) glutGetProcAddress( "glStencilFuncSeparateATI" ); + stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( "glStencilOpSeparate" ); printf("\nAll 5 squares should be the same color.\n"); } -- cgit v1.2.3 From d3208678c2ea0e50be7b8eb68106f7650b37dfc6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 30 Oct 2009 09:39:51 -0600 Subject: progs/tests: fix MSVC build. Signed-off-by: Brian Paul (cherry picked from commit a8ed066858f12290239ddc9165b7c0734ccc0247) --- progs/tests/vao-01.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c index 117fae8bd9e..e4a89cb19db 100644 --- a/progs/tests/vao-01.c +++ b/progs/tests/vao-01.c @@ -124,10 +124,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); -- cgit v1.2.3 From 005242f1664afdd6f4b832863d569e9e3c583454 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 30 Oct 2009 15:02:21 -0600 Subject: prog/tests: Fix MSVC build. Signed-off-by: Brian Paul (cherry picked from commit 9c3197ef0abc3bf521358ea0c7af0fc6979c82b3) --- progs/tests/vao-02.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c index 7764ed51061..9f7f5c27792 100644 --- a/progs/tests/vao-02.c +++ b/progs/tests/vao-02.c @@ -125,10 +125,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); -- cgit v1.2.3 From d6a993135f151fca892609f7cf6f471416192217 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 14:41:40 -0800 Subject: progs/fp: Redraw upon keypress. (cherry picked from commit cde66437247feb8b14b6d8f3ec3a8b4665fefa08) --- progs/fp/fp-tri.c | 2 +- progs/fp/point-position.c | 2 +- progs/fp/tri-depth.c | 2 +- progs/fp/tri-depth2.c | 2 +- progs/fp/tri-depthwrite.c | 2 +- progs/fp/tri-depthwrite2.c | 2 +- progs/fp/tri-param.c | 2 +- progs/fp/tri-tex.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'progs') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 52a8fcfc22a..26af66ad84e 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -197,7 +197,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c index c0963d7a0b5..1ae753c1d05 100644 --- a/progs/fp/point-position.c +++ b/progs/fp/point-position.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c index 5488469e806..a9f3a6a5be3 100644 --- a/progs/fp/tri-depth.c +++ b/progs/fp/tri-depth.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c index 6ed23071157..8c4336817be 100644 --- a/progs/fp/tri-depth2.c +++ b/progs/fp/tri-depth2.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c index 8e4f3e62451..7b9d70f292a 100644 --- a/progs/fp/tri-depthwrite.c +++ b/progs/fp/tri-depthwrite.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c index 3c0b4d30c97..599949551d1 100644 --- a/progs/fp/tri-depthwrite2.c +++ b/progs/fp/tri-depthwrite2.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c index 57443d71bd0..26a804d4b38 100644 --- a/progs/fp/tri-param.c +++ b/progs/fp/tri-param.c @@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c index 1dbbb201cef..64299e94531 100644 --- a/progs/fp/tri-tex.c +++ b/progs/fp/tri-tex.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From 4ca8e1680ed2e8437653c6f16f39438e51ce24ae Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 18:22:26 -0800 Subject: progs/util: Fix memory leak if LoadYUVImage fails. (cherry picked from commit 0e790ac35327a0b53a4a595a6429135317302269) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 8e923b6eb47..134eb79100a 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -438,6 +438,7 @@ GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) fprintf(stderr, "Error in LoadYUVImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } -- cgit v1.2.3 From 84de1672d3efbfc3b2ae51633b0e503f15e5d62d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 08:29:36 -0800 Subject: progs/util: Fix memory if LoadRGBMipmaps2 fails. (cherry picked from commit 28b8e4bcd76cc072b062e4c8575327c05ecb9a55) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 134eb79100a..4e22bed81af 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -305,6 +305,7 @@ GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, fprintf(stderr, "Error in LoadRGBMipmaps %d-component images not implemented\n", image->components ); + FreeImage(image); return GL_FALSE; } -- cgit v1.2.3 From f1172c4030dd0952dfdecda059beb39b1224a8ae Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 10:11:50 -0800 Subject: progs/util: Fix memory leak if LoadRGBImage fails. (cherry picked from commit 041cd0e110d41b543a0fe9cc484ae8373642912b) --- progs/util/readtex.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 4e22bed81af..ec27e20d681 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -357,6 +357,7 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, fprintf(stderr, "Error in LoadRGBImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } @@ -365,8 +366,10 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, bytes = image->sizeX * image->sizeY * image->components; buffer = (GLubyte *) malloc(bytes); - if (!buffer) + if (!buffer) { + FreeImage(image); return NULL; + } memcpy( (void *) buffer, (void *) image->data, bytes ); -- cgit v1.2.3 From 772e00478124074c7b954fad52974057f0669a9b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 11:04:24 -0800 Subject: progs/util: Fix memory leak if malloc fails in tkRGBImageLoad. (cherry picked from commit 786d539511eb3c5a4101b11b7f8e90d60123ac46) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index ec27e20d681..c57b66bd9d3 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -250,6 +250,7 @@ static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); if (final == NULL) { fprintf(stderr, "Out of memory!\n"); + RawImageClose(raw); return NULL; } final->sizeX = raw->sizeX; -- cgit v1.2.3 From 305d4f147ea86d87706dbaf2caad6a131c59fe80 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 13:49:31 -0800 Subject: progs/util: Fix memory leak if fopen fails in RawImageOpen. (cherry picked from commit d9508e8df9da4aa13bc223194c406081738bac91) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index c57b66bd9d3..3922998fd5b 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -109,6 +109,7 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->file = fopen(baseName + 1, "rb"); if(raw->file == NULL) { perror(fileName); + free(raw); return NULL; } } -- cgit v1.2.3 From 0a6acecb35aa5701ee82cf17c2561c172612cb6e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 11:22:13 -0800 Subject: progs/util: Fix memory leak if malloc fails in RawImageOpen. (cherry picked from commit d36cb2396c942f05ba56c5b899792a507bb0f0fd) --- progs/util/readtex.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 3922998fd5b..1e1183cf9ac 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -130,6 +130,12 @@ static rawImageRec *RawImageOpen(const char *fileName) if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || raw->tmpB == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw); return NULL; } @@ -139,6 +145,14 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->rowSize = (GLint *)malloc(x); if (raw->rowStart == NULL || raw->rowSize == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw->rowStart); + free(raw->rowSize); + free(raw); return NULL; } raw->rleEnd = 512 + (2 * x); -- cgit v1.2.3 From a0ac8fc7d8d946183ba0506a8134a6e55819e151 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 12:11:55 -0800 Subject: progs/util: Exit RawImageGetData early if malloc fails. Prevents a null pointer deference later on. (cherry picked from commit e26135a744f740430e3dc341fa692544ba99c11e) --- progs/util/readtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 1e1183cf9ac..81cb626e911 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -230,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); if (final->data == NULL) { fprintf(stderr, "Out of memory!\n"); + return; } ptr = final->data; -- cgit v1.2.3 From 9e29242331335796c8eeb3d669111844161067f8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:46:19 -0800 Subject: progs/glsl: Redraw upon keypress. (cherry picked from commit 881f55236ad85f95745e70f8363726fa3c201f80) --- progs/glsl/convolutions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c index c2fb76e1aa5..350e61bbdc5 100644 --- a/progs/glsl/convolutions.c +++ b/progs/glsl/convolutions.c @@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } -- cgit v1.2.3 From 34a0b22a741a136687e4feb7216595bf0f8445cb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 13:03:12 -0800 Subject: progs/trivial: Redraw upon keypress. (cherry picked from commit 3790c6a13b86dfe0afd4bb0bf9a4d9f4b429cfd8) --- progs/trivial/clear-fbo-tex.c | 2 +- progs/trivial/clear-fbo.c | 2 +- progs/trivial/clear-random.c | 2 +- progs/trivial/clear-scissor.c | 2 +- progs/trivial/clear.c | 2 +- progs/trivial/createwin.c | 2 +- progs/trivial/dlist-begin-call-end.c | 2 +- progs/trivial/dlist-dangling.c | 2 +- progs/trivial/dlist-edgeflag-dangling.c | 2 +- progs/trivial/dlist-edgeflag.c | 2 +- progs/trivial/dlist-flat-tri.c | 2 +- progs/trivial/dlist-mat-tri.c | 2 +- progs/trivial/dlist-recursive-call.c | 2 +- progs/trivial/dlist-tri-flat-tri.c | 2 +- progs/trivial/dlist-tri-mat-tri.c | 2 +- progs/trivial/line-clip.c | 2 +- progs/trivial/line-cull.c | 2 +- progs/trivial/line-flat.c | 2 +- progs/trivial/line-stipple-wide.c | 2 +- progs/trivial/line-userclip-clip.c | 2 +- progs/trivial/line-userclip-nop-clip.c | 2 +- progs/trivial/line-userclip-nop.c | 2 +- progs/trivial/line-userclip.c | 2 +- progs/trivial/line-wide.c | 2 +- progs/trivial/line.c | 2 +- progs/trivial/lineloop-clip.c | 2 +- progs/trivial/lineloop.c | 2 +- progs/trivial/linestrip-stipple-wide.c | 2 +- progs/trivial/linestrip-stipple.c | 2 +- progs/trivial/point-clip.c | 2 +- progs/trivial/point-param.c | 2 +- progs/trivial/point-sprite.c | 2 +- progs/trivial/point-wide-smooth.c | 2 +- progs/trivial/point-wide.c | 2 +- progs/trivial/point.c | 2 +- progs/trivial/poly-flat-clip.c | 2 +- progs/trivial/poly-flat-unfilled-clip.c | 2 +- progs/trivial/poly-flat.c | 2 +- progs/trivial/poly-unfilled.c | 2 +- progs/trivial/poly.c | 2 +- progs/trivial/quad-clip-all-vertices.c | 2 +- progs/trivial/quad-clip.c | 2 +- progs/trivial/quad-degenerate.c | 2 +- progs/trivial/quad-flat.c | 2 +- progs/trivial/quad-offset-factor.c | 2 +- progs/trivial/quad-offset-unfilled.c | 2 +- progs/trivial/quad-offset-units.c | 2 +- progs/trivial/quad-tex-alpha.c | 2 +- progs/trivial/quad-tex-pbo.c | 2 +- progs/trivial/quad-unfilled-clip.c | 2 +- progs/trivial/quad-unfilled-stipple.c | 2 +- progs/trivial/quad-unfilled.c | 2 +- progs/trivial/quad.c | 2 +- progs/trivial/quads.c | 2 +- progs/trivial/quadstrip-cont.c | 2 +- progs/trivial/quadstrip-flat.c | 2 +- progs/trivial/quadstrip.c | 2 +- progs/trivial/readpixels.c | 2 +- progs/trivial/tri-alpha-tex.c | 2 +- progs/trivial/tri-alpha.c | 2 +- progs/trivial/tri-blend-color.c | 2 +- progs/trivial/tri-clear.c | 2 +- progs/trivial/tri-clip.c | 2 +- progs/trivial/tri-cull-both.c | 2 +- progs/trivial/tri-dlist.c | 2 +- progs/trivial/tri-fbo.c | 2 +- progs/trivial/tri-flat-clip.c | 2 +- progs/trivial/tri-flat.c | 2 +- progs/trivial/tri-fog.c | 2 +- progs/trivial/tri-fp-const-imm.c | 2 +- progs/trivial/tri-fp.c | 2 +- progs/trivial/tri-lit-material.c | 2 +- progs/trivial/tri-lit.c | 2 +- progs/trivial/tri-multitex-vbo.c | 2 +- progs/trivial/tri-orig.c | 2 +- progs/trivial/tri-query.c | 2 +- progs/trivial/tri-scissor-tri.c | 2 +- progs/trivial/tri-square.c | 2 +- progs/trivial/tri-stipple.c | 2 +- progs/trivial/tri-tex-3d.c | 2 +- progs/trivial/tri-tex.c | 2 +- progs/trivial/tri-tri.c | 2 +- progs/trivial/tri-unfilled-clip.c | 2 +- progs/trivial/tri-unfilled-edgeflag.c | 2 +- progs/trivial/tri-unfilled-point.c | 2 +- progs/trivial/tri-unfilled-smooth.c | 2 +- progs/trivial/tri-unfilled-tri-lit.c | 2 +- progs/trivial/tri-unfilled-userclip-stip.c | 2 +- progs/trivial/tri-unfilled-userclip.c | 2 +- progs/trivial/tri-unfilled.c | 2 +- progs/trivial/tri-userclip.c | 2 +- progs/trivial/tri-z-9.c | 2 +- progs/trivial/tri-z-eq.c | 2 +- progs/trivial/trifan-flat-clip.c | 2 +- progs/trivial/trifan-flat-unfilled-clip.c | 2 +- progs/trivial/trifan-flat.c | 2 +- progs/trivial/trifan-unfilled.c | 2 +- progs/trivial/trifan.c | 2 +- progs/trivial/tristrip-clip.c | 2 +- progs/trivial/tristrip-flat.c | 2 +- progs/trivial/tristrip.c | 2 +- progs/trivial/vp-tri-cb-pos.c | 2 +- progs/trivial/vp-tri-cb-tex.c | 2 +- progs/trivial/vp-tri-invariant.c | 2 +- 104 files changed, 104 insertions(+), 104 deletions(-) (limited to 'progs') diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index a206676e48e..238f634bf59 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c index 0aeb45489f2..6435c901adc 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c index e3da23a8f55..ab67f84518d 100644 --- a/progs/trivial/clear-random.c +++ b/progs/trivial/clear-random.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c index 01735327480..2b6dee77a96 100644 --- a/progs/trivial/clear-scissor.c +++ b/progs/trivial/clear-scissor.c @@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c index 03857b4b893..56c3ea52e6a 100644 --- a/progs/trivial/clear.c +++ b/progs/trivial/clear.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c index f2cc6f1cffc..04a088642b8 100644 --- a/progs/trivial/createwin.c +++ b/progs/trivial/createwin.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c index 0d0aed7c729..da3864a02a4 100644 --- a/progs/trivial/dlist-begin-call-end.c +++ b/progs/trivial/dlist-begin-call-end.c @@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c index de106280092..756ab93f870 100644 --- a/progs/trivial/dlist-dangling.c +++ b/progs/trivial/dlist-dangling.c @@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c index 3d3aaeb6944..51504471e2c 100644 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ b/progs/trivial/dlist-edgeflag-dangling.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c index 8002129ed14..9456b964732 100644 --- a/progs/trivial/dlist-edgeflag.c +++ b/progs/trivial/dlist-edgeflag.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-flat-tri.c b/progs/trivial/dlist-flat-tri.c index c3dd7921e39..3ee9b283a44 100644 --- a/progs/trivial/dlist-flat-tri.c +++ b/progs/trivial/dlist-flat-tri.c @@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-mat-tri.c b/progs/trivial/dlist-mat-tri.c index ed3a4c5981a..d17c4b913b8 100644 --- a/progs/trivial/dlist-mat-tri.c +++ b/progs/trivial/dlist-mat-tri.c @@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-recursive-call.c b/progs/trivial/dlist-recursive-call.c index fe06b2bbd72..90224f63cb2 100644 --- a/progs/trivial/dlist-recursive-call.c +++ b/progs/trivial/dlist-recursive-call.c @@ -118,7 +118,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-flat-tri.c b/progs/trivial/dlist-tri-flat-tri.c index 4dbb7884869..3265a4d6dcd 100644 --- a/progs/trivial/dlist-tri-flat-tri.c +++ b/progs/trivial/dlist-tri-flat-tri.c @@ -99,7 +99,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-mat-tri.c b/progs/trivial/dlist-tri-mat-tri.c index f69854ae586..053bb124a23 100644 --- a/progs/trivial/dlist-tri-mat-tri.c +++ b/progs/trivial/dlist-tri-mat-tri.c @@ -102,7 +102,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c index 5276baffd5d..e4e388ed5cd 100644 --- a/progs/trivial/line-clip.c +++ b/progs/trivial/line-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c index 1e1b77a942c..c531ff132f5 100644 --- a/progs/trivial/line-cull.c +++ b/progs/trivial/line-cull.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c index 14f0ac07825..e2ddb87b9ef 100644 --- a/progs/trivial/line-flat.c +++ b/progs/trivial/line-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c index 1804ffad3f0..767583bbea5 100644 --- a/progs/trivial/line-stipple-wide.c +++ b/progs/trivial/line-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c index 8e030b47cea..3265b2c3bfe 100644 --- a/progs/trivial/line-userclip-clip.c +++ b/progs/trivial/line-userclip-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c index 6fcd4bcfe73..0198e27807e 100644 --- a/progs/trivial/line-userclip-nop-clip.c +++ b/progs/trivial/line-userclip-nop-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c index e59fd133a5f..6c863a3c82b 100644 --- a/progs/trivial/line-userclip-nop.c +++ b/progs/trivial/line-userclip-nop.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c index e30be5580bd..6cfcb6fc732 100644 --- a/progs/trivial/line-userclip.c +++ b/progs/trivial/line-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c index b74021dea73..1945712c5d0 100644 --- a/progs/trivial/line-wide.c +++ b/progs/trivial/line-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line.c b/progs/trivial/line.c index e1d73280bfc..58ab96836f8 100644 --- a/progs/trivial/line.c +++ b/progs/trivial/line.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c index 45fa47491f8..5e6b6217a1a 100644 --- a/progs/trivial/lineloop-clip.c +++ b/progs/trivial/lineloop-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c index c290dbd8cb3..82eccd24f8f 100644 --- a/progs/trivial/lineloop.c +++ b/progs/trivial/lineloop.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c index 701c82c266a..0296941a0de 100644 --- a/progs/trivial/linestrip-stipple-wide.c +++ b/progs/trivial/linestrip-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c index df2eef96b5d..a847d47deeb 100644 --- a/progs/trivial/linestrip-stipple.c +++ b/progs/trivial/linestrip-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c index 4c89ba598d7..23cfd778637 100644 --- a/progs/trivial/point-clip.c +++ b/progs/trivial/point-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c index 6f43720a892..46bd773265f 100644 --- a/progs/trivial/point-param.c +++ b/progs/trivial/point-param.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c index 5d29a6a3cf9..16e6771514b 100644 --- a/progs/trivial/point-sprite.c +++ b/progs/trivial/point-sprite.c @@ -96,7 +96,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c index f6e9b8df5f9..752cb8aee38 100644 --- a/progs/trivial/point-wide-smooth.c +++ b/progs/trivial/point-wide-smooth.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c index 8abd64c6a99..3b00ee9e500 100644 --- a/progs/trivial/point-wide.c +++ b/progs/trivial/point-wide.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point.c b/progs/trivial/point.c index 49959dcc487..8f5299cf6b5 100644 --- a/progs/trivial/point.c +++ b/progs/trivial/point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c index 5490068b08e..2a968bed40e 100644 --- a/progs/trivial/poly-flat-clip.c +++ b/progs/trivial/poly-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c index 26b90ef9645..89f4e0656ab 100644 --- a/progs/trivial/poly-flat-unfilled-clip.c +++ b/progs/trivial/poly-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c index a4e3cdb6334..33c2e04e0f8 100644 --- a/progs/trivial/poly-flat.c +++ b/progs/trivial/poly-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c index 2ad443dc159..c8c0d7a9e37 100644 --- a/progs/trivial/poly-unfilled.c +++ b/progs/trivial/poly-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c index e5b788ea5be..964eb42d789 100644 --- a/progs/trivial/poly.c +++ b/progs/trivial/poly.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c index 60c87fc9ce1..7712d8ca5b7 100644 --- a/progs/trivial/quad-clip-all-vertices.c +++ b/progs/trivial/quad-clip-all-vertices.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c index 063de6106a6..2847c9f9608 100644 --- a/progs/trivial/quad-clip.c +++ b/progs/trivial/quad-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c index fdc142bcd61..85e129d4be2 100644 --- a/progs/trivial/quad-degenerate.c +++ b/progs/trivial/quad-degenerate.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c index e3147b3b3fe..bed98e31a4e 100644 --- a/progs/trivial/quad-flat.c +++ b/progs/trivial/quad-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c index dfe99bbae68..1fc57a54ae7 100644 --- a/progs/trivial/quad-offset-factor.c +++ b/progs/trivial/quad-offset-factor.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c index 06590021fed..62f50fb98cc 100644 --- a/progs/trivial/quad-offset-unfilled.c +++ b/progs/trivial/quad-offset-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c index 922529d977e..1ac2338692f 100644 --- a/progs/trivial/quad-offset-units.c +++ b/progs/trivial/quad-offset-units.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c index eebaf9170ec..9db6792fad3 100644 --- a/progs/trivial/quad-tex-alpha.c +++ b/progs/trivial/quad-tex-alpha.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c index ad41a9a22e5..b7aa1db4360 100644 --- a/progs/trivial/quad-tex-pbo.c +++ b/progs/trivial/quad-tex-pbo.c @@ -105,7 +105,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c index 761878bd4b6..d2e87187751 100644 --- a/progs/trivial/quad-unfilled-clip.c +++ b/progs/trivial/quad-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c index cd7d2769284..8c1737e6756 100644 --- a/progs/trivial/quad-unfilled-stipple.c +++ b/progs/trivial/quad-unfilled-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c index d64f17fdf95..b756449d7a8 100644 --- a/progs/trivial/quad-unfilled.c +++ b/progs/trivial/quad-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c index d360e309d30..582de783d59 100644 --- a/progs/trivial/quad.c +++ b/progs/trivial/quad.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c index fe11fef207c..de7854a255e 100644 --- a/progs/trivial/quads.c +++ b/progs/trivial/quads.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c index 329523531aa..44412698dc5 100644 --- a/progs/trivial/quadstrip-cont.c +++ b/progs/trivial/quadstrip-cont.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c index 228c6c255e5..0e0b3b49fa6 100644 --- a/progs/trivial/quadstrip-flat.c +++ b/progs/trivial/quadstrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c index d49a9a53020..1be815fb8cd 100644 --- a/progs/trivial/quadstrip.c +++ b/progs/trivial/quadstrip.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c index 5671618446a..b063f179569 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -39,7 +39,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c index 780ebe6be5b..853d564ae7b 100644 --- a/progs/trivial/tri-alpha-tex.c +++ b/progs/trivial/tri-alpha-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c index aec1cbb3772..bd1c88ecf8e 100644 --- a/progs/trivial/tri-alpha.c +++ b/progs/trivial/tri-alpha.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c index 92f019259ec..629b35c4abb 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c index f49186bd8ae..e52ed81bf44 100644 --- a/progs/trivial/tri-clear.c +++ b/progs/trivial/tri-clear.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c index e1deca1bdcf..3e3879c9859 100644 --- a/progs/trivial/tri-clip.c +++ b/progs/trivial/tri-clip.c @@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c index 864be710c2a..809599d4a6d 100644 --- a/progs/trivial/tri-cull-both.c +++ b/progs/trivial/tri-cull-both.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c index c410be221a7..62d0a965d82 100644 --- a/progs/trivial/tri-dlist.c +++ b/progs/trivial/tri-dlist.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c index 1ed177ffdfb..089180f97ad 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c index 2aab5ba00a5..a23f8a382b0 100644 --- a/progs/trivial/tri-flat-clip.c +++ b/progs/trivial/tri-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c index ea703ec6f3f..0614321844e 100644 --- a/progs/trivial/tri-flat.c +++ b/progs/trivial/tri-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c index 0cea3d32582..7fc254a4675 100644 --- a/progs/trivial/tri-fog.c +++ b/progs/trivial/tri-fog.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c index d2df442abfc..accea62042d 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -92,7 +92,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index 4d1508120ea..8f933befd3d 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -90,7 +90,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit-material.c b/progs/trivial/tri-lit-material.c index ff9fb2c4dd6..16cebb2b984 100644 --- a/progs/trivial/tri-lit-material.c +++ b/progs/trivial/tri-lit-material.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c index 15a7ad24c51..26ebd99d917 100644 --- a/progs/trivial/tri-lit.c +++ b/progs/trivial/tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c index e319447ac15..ca4edaa5ddc 100644 --- a/progs/trivial/tri-multitex-vbo.c +++ b/progs/trivial/tri-multitex-vbo.c @@ -192,7 +192,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c index e7cfee3a367..d86d34c39de 100644 --- a/progs/trivial/tri-orig.c +++ b/progs/trivial/tri-orig.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index 94956a86f33..8898f182c78 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c index 608ebf29cff..d65502d91b9 100644 --- a/progs/trivial/tri-scissor-tri.c +++ b/progs/trivial/tri-scissor-tri.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c index 0b82a1dd8e3..2014bd489c3 100644 --- a/progs/trivial/tri-square.c +++ b/progs/trivial/tri-square.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c index aa94fa224b7..15a08fec7c8 100644 --- a/progs/trivial/tri-stipple.c +++ b/progs/trivial/tri-stipple.c @@ -77,7 +77,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c index 3ccbe125105..073a080d7a7 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -97,7 +97,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c index 56afb4748d7..244e1545042 100644 --- a/progs/trivial/tri-tex.c +++ b/progs/trivial/tri-tex.c @@ -94,7 +94,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c index f996bd01a16..7bf400793ea 100644 --- a/progs/trivial/tri-tri.c +++ b/progs/trivial/tri-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c index 2fd894a49a8..585919e16d1 100644 --- a/progs/trivial/tri-unfilled-clip.c +++ b/progs/trivial/tri-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c index 11c21d1bf68..f536f642296 100644 --- a/progs/trivial/tri-unfilled-edgeflag.c +++ b/progs/trivial/tri-unfilled-edgeflag.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c index 750a254669a..11e276e1a5b 100644 --- a/progs/trivial/tri-unfilled-point.c +++ b/progs/trivial/tri-unfilled-point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c index eddae176e5f..fa31667e658 100644 --- a/progs/trivial/tri-unfilled-smooth.c +++ b/progs/trivial/tri-unfilled-smooth.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c index 1d42b40b713..d6baeb46978 100644 --- a/progs/trivial/tri-unfilled-tri-lit.c +++ b/progs/trivial/tri-unfilled-tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c index ddc0dffd4f4..02bfa92f835 100644 --- a/progs/trivial/tri-unfilled-userclip-stip.c +++ b/progs/trivial/tri-unfilled-userclip-stip.c @@ -67,7 +67,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c index 0dec0bfc9b4..11e53fc7cc9 100644 --- a/progs/trivial/tri-unfilled-userclip.c +++ b/progs/trivial/tri-unfilled-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c index b98cb9a842a..afa1058dad4 100644 --- a/progs/trivial/tri-unfilled.c +++ b/progs/trivial/tri-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c index 8f37e0fae20..5651c738325 100644 --- a/progs/trivial/tri-userclip.c +++ b/progs/trivial/tri-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c index 099e89f6f4a..37b9e2f8732 100644 --- a/progs/trivial/tri-z-9.c +++ b/progs/trivial/tri-z-9.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c index b81c992f7d1..6bdac474196 100644 --- a/progs/trivial/tri-z-eq.c +++ b/progs/trivial/tri-z-eq.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c index 199f91a637e..89bc471191e 100644 --- a/progs/trivial/trifan-flat-clip.c +++ b/progs/trivial/trifan-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c index ea3e1553872..3a1a226e546 100644 --- a/progs/trivial/trifan-flat-unfilled-clip.c +++ b/progs/trivial/trifan-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c index d69b4887e39..d25abdf49eb 100644 --- a/progs/trivial/trifan-flat.c +++ b/progs/trivial/trifan-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c index 91447e4e44d..2e3ff8218f0 100644 --- a/progs/trivial/trifan-unfilled.c +++ b/progs/trivial/trifan-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c index 84eb4172de1..b8a76151148 100644 --- a/progs/trivial/trifan.c +++ b/progs/trivial/trifan.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c index 343e2938049..4e6ee1fbca2 100644 --- a/progs/trivial/tristrip-clip.c +++ b/progs/trivial/tristrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c index 02da97efcea..a90b8b6cb68 100644 --- a/progs/trivial/tristrip-flat.c +++ b/progs/trivial/tristrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c index 77bf2fad282..29915ff111d 100644 --- a/progs/trivial/tristrip.c +++ b/progs/trivial/tristrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c index 42bf9806b19..9cbc4d1193a 100644 --- a/progs/trivial/vp-tri-cb-pos.c +++ b/progs/trivial/vp-tri-cb-pos.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c index 8290226675e..e543e2ec3fd 100644 --- a/progs/trivial/vp-tri-cb-tex.c +++ b/progs/trivial/vp-tri-cb-tex.c @@ -114,7 +114,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c index ff241393659..4dbe95eb9a1 100644 --- a/progs/trivial/vp-tri-invariant.c +++ b/progs/trivial/vp-tri-invariant.c @@ -69,7 +69,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From 56de7e222ee0f5e44b87ce05dc94733fdd41e4ed Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:52:05 -0800 Subject: progs/trivial: Redraw upon keypress. (cherry picked from commit 9553a42f638bd98eb90e5b7fb37d6b82758b6363) --- progs/trivial/linestrip-clip.c | 2 +- progs/trivial/linestrip-flat-stipple.c | 2 +- progs/trivial/linestrip.c | 2 +- progs/trivial/tri-unfilled-tri.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c index f2528229218..5e90ea2eb05 100644 --- a/progs/trivial/linestrip-clip.c +++ b/progs/trivial/linestrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c index 5caa7244235..bae5c3a1c3b 100644 --- a/progs/trivial/linestrip-flat-stipple.c +++ b/progs/trivial/linestrip-flat-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c index 0219b1ab70e..b6d68821463 100644 --- a/progs/trivial/linestrip.c +++ b/progs/trivial/linestrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c index 695cc890955..75a70b8a412 100644 --- a/progs/trivial/tri-unfilled-tri.c +++ b/progs/trivial/tri-unfilled-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From d245a951f39fe480c6268dbcc1fa06d59c40109e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 14:56:07 -0800 Subject: progs/demos: Fix memory leak in fslight.c. (cherry picked from commit aef3218f0bb48fdb286d2008ee07e507ea8aa98e) --- progs/demos/fslight.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index f0d76a4a06f..acba3e9583f 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -353,6 +353,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 10, 5); glEndList(); + gluDeleteQuadric(obj); } static void -- cgit v1.2.3 From fc5f07de1aabddaf2c9d599a85ec74cde674275e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 15:44:52 -0800 Subject: progs/demos: Fix memory leak in ipers.c. (cherry picked from commit a1afe303deda320aadacdaf5b1c72631ca3f734f) --- progs/demos/ipers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index 5d82b0dc924..ed03673cb62 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -133,6 +133,8 @@ initdlists(void) glEndList(); } + + gluDeleteQuadric(obj); } static void -- cgit v1.2.3 From 5820dae4ecad11097ddc024441ea45aa9fefa290 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 16:31:34 -0800 Subject: progs/demos: Fix memory leak in projtex.c. (cherry picked from commit ee555e3d69c8820f27e71e5ebc028a768cef7d0b) --- progs/demos/projtex.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'progs') diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c index 99154d7bdc8..ad205c74137 100644 --- a/progs/demos/projtex.c +++ b/progs/demos/projtex.c @@ -245,6 +245,9 @@ loadImageTextures(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + + free(texData3); + free(texData4); } } -- cgit v1.2.3 From b803abbaad3135047b931c322300b2d12ff255e1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 16 Nov 2009 18:06:40 -0800 Subject: progs/demos: Fix memory leak in ray.c. (cherry picked from commit 6b480dc21dd489d48685b2268e495218aea74293) --- progs/demos/ray.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/demos/ray.c b/progs/demos/ray.c index c2d8e4f545e..e9211aa3399 100644 --- a/progs/demos/ray.c +++ b/progs/demos/ray.c @@ -834,6 +834,8 @@ initdlists(void) gluQuadricTexture(obj, GL_TRUE); gluSphere(obj, SPHERE_RADIUS, 16, 16); glEndList(); + + gluDeleteQuadric(obj); } int -- cgit v1.2.3 From 25fd168f03162d4cb25b50ea9bd5ff56283f6854 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 11:37:48 -0800 Subject: progs/glsl: Change tangentAttrib from GLuint to GLint in bump.c. tangentAtrrib is assigned the result of glGetAttribLocation. The assertion 'assert(tangentAtrrib >= 0)' would be a no-op if tangentAttrib is a GLuint. (cherry picked from commit b8dcb79c53796f37234bd2b0f5e2845f817fc218) --- progs/glsl/bump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index 87669aec736..50a0900f1c7 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -36,7 +36,7 @@ static GLint win = 0; static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f; -static GLuint tangentAttrib; +static GLint tangentAttrib; static GLboolean Anim = GL_FALSE; -- cgit v1.2.3 From b1a87a3e0b8a4008be0e544f1b55f6facb01547d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 09:53:19 -0800 Subject: progs/glsl: Fix memory leak in deriv.c. (cherry picked from commit 0e783c7d03128aade3ca50b28a56e254fef6b6ab) --- progs/glsl/deriv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c index 265a5157154..30f2b75fef7 100644 --- a/progs/glsl/deriv.c +++ b/progs/glsl/deriv.c @@ -140,6 +140,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 30, 15); glEndList(); + gluDeleteQuadric(obj); } -- cgit v1.2.3 From b210739aad1233ece4c12e93700768f331f3cac5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 14:10:35 -0800 Subject: progs/redbook: Fix memory leak in quadric.c. (cherry picked from commit 47b5f584a68ceab7c9c1d5279efbc9fe30ff2fcc) --- progs/redbook/quadric.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c index 4e46c85f829..7e99098304a 100644 --- a/progs/redbook/quadric.c +++ b/progs/redbook/quadric.c @@ -116,6 +116,8 @@ void init(void) glNewList(startList+3, GL_COMPILE); gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0); glEndList(); + + gluDeleteQuadric(qobj); } void display(void) -- cgit v1.2.3 From efb582fde7d1375b21ecb28d8ba5690181a02a93 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 18 Nov 2009 17:30:50 -0800 Subject: progs/tests: Fix memory leak in texdown.c if malloc fails. (cherry picked from commit e3cfd78969cd4a94fc83a5d6fb2f33730cc4e70f) --- progs/tests/texdown.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c index 7e460458325..e6881d39a0a 100644 --- a/progs/tests/texdown.c +++ b/progs/tests/texdown.c @@ -176,6 +176,8 @@ MeasureDownloadRate(void) orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); if (!orig_texImage || !orig_getImage) { DownloadRate = 0.0; + free(orig_texImage); + free(orig_getImage); return; } -- cgit v1.2.3 From 69ed1147a8a576fb28ba1dc2b030d903ae094eda Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 22:59:01 -0800 Subject: progs/vp: Fix memory leak in vp-tris.c. (cherry picked from commit 760cf71572a071ce43da576ebfeff4a8099150bc) --- progs/vp/vp-tris.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index 1356242d971..29cd027b00c 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -99,9 +99,11 @@ static void Init( void ) sz = (GLuint) fread(buf, 1, sizeof(buf), f); if (!feof(f)) { fprintf(stderr, "file too long\n"); + fclose(f); exit(1); } + fclose(f); fprintf(stderr, "%.*s\n", sz, buf); if (strncmp( buf, "!!VP", 4 ) == 0) { -- cgit v1.2.3 From 68d206fafa4398826cb26da1c66f1bbc4dc66f0c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:03:16 -0800 Subject: progs/xdemos: Add assert in corender.c. (cherry picked from commit 66a4ec14c38d407256545e0cf31c98974d621fe4) --- progs/xdemos/corender.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c index f2b8145e52b..1b18d9f54e7 100644 --- a/progs/xdemos/corender.c +++ b/progs/xdemos/corender.c @@ -55,6 +55,7 @@ setup_ipc(void) printf("Waiting for connection from another 'corender'\n"); Sock = AcceptConnection(k); + assert(Sock != -1); printf("Got connection, sending windowID\n"); -- cgit v1.2.3 From 7324c22024297d1307f511ee320ebdfd47926228 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 13:01:22 -0800 Subject: progs/xdemos: Fix memory leak in glxinfo.c. (cherry picked from commit f080567f4c4018c4885c105a154cb0eb39e6234f) --- progs/xdemos/glxinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index 445d3ea94b6..c1a032872cd 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -964,8 +964,10 @@ print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode) /* get list of all fbconfigs on this screen */ fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs); - if (numFBConfigs == 0) + if (numFBConfigs == 0) { + XFree(fbconfigs); return; + } printf("%d GLXFBConfigs:\n", numFBConfigs); if (mode == Normal) -- cgit v1.2.3 From 83506484010d38dd6d3e17aa4e0d06dc8467992f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:06:56 -0800 Subject: progs/xdemos: Remove duplicate code in glxinfo.c. (cherry picked from commit a4720a1a3206dd2edecf47a21fce547a79b67610) --- progs/xdemos/glxinfo.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index c1a032872cd..b182a3091d1 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -426,8 +426,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) GLXFBConfig *configs = NULL; int nConfigs; - if (!visinfo) - configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs); if (!visinfo) configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs); -- cgit v1.2.3 From ba3fedf24610a3db2db0b49b8b84ac3af99a87cb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 14:20:26 -0800 Subject: progs/xdemos: Add missing break statement in offset.c. (cherry picked from commit 4ab8dbe5935d5c946cbc9af6982461073a784d07) --- progs/xdemos/offset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c index 6c5abf383be..314a4fcdd17 100644 --- a/progs/xdemos/offset.c +++ b/progs/xdemos/offset.c @@ -294,6 +294,7 @@ process_input(Display *dpy, Window win) { default: break; } + break; case ButtonPress: prevx = event.xbutton.x; prevy = event.xbutton.y; -- cgit v1.2.3 From 4bf96ebdaeac780a5f28c0413b4e2fc5848f923c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 15:48:29 -0800 Subject: progs/xdemos: Fix memory leak in pbdemo.c. (cherry picked from commit e0857962b911ef317238498305651515d83029ae) --- progs/xdemos/pbdemo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/xdemos/pbdemo.c b/progs/xdemos/pbdemo.c index 2573209336c..277df729246 100644 --- a/progs/xdemos/pbdemo.c +++ b/progs/xdemos/pbdemo.c @@ -131,6 +131,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height ) fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs); if (nConfigs==0 || !fbConfigs) { printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]); + XFree(fbConfigs); continue; } -- cgit v1.2.3 From 12a440abfb5a9cb786ed93d9041a6ae0752b9a18 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 13:09:42 -0800 Subject: progs/xdemos: Silence unused value warnings in sharedtex_mt.c. (cherry picked from commit 8556fad75124e1ade9af095e112ebb6ac5cbff61) --- progs/xdemos/sharedtex_mt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c index 07c1bfcc388..f924448cc43 100644 --- a/progs/xdemos/sharedtex_mt.c +++ b/progs/xdemos/sharedtex_mt.c @@ -447,7 +447,7 @@ main(int argc, char *argv[]) const char *dpyName = XDisplayName(NULL); pthread_t t0, t1, t2, t3; struct thread_init_arg tia0, tia1, tia2, tia3; - struct window *h0, *h1, *h2, *h3; + struct window *h0; XInitThreads(); @@ -462,9 +462,9 @@ main(int argc, char *argv[]) /* four windows and contexts sharing display lists and texture objects */ h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx); - h1 = AddWindow(gDpy, dpyName, 330, 10, gCtx); - h2 = AddWindow(gDpy, dpyName, 10, 350, gCtx); - h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 10, gCtx); + (void) AddWindow(gDpy, dpyName, 10, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 350, gCtx); if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) { Error(dpyName, "glXMakeCurrent failed for init thread."); -- cgit v1.2.3 From ca7cd3ade0f27f8f1d9532ad6281659e2522f0cf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Dec 2009 08:09:55 -0700 Subject: progs/xdemos: fix some visual/fbconfig logic in glxinfo.c The fbAttribSingle/Double arrays had wrong GLX_DOUBLEBUFFER values. We only need to use the glXChooseFBConfig() code when glXChooseVisual() fails (but I don't know when that would happen). Other recent commits errantly removed some code in this area too. --- progs/xdemos/glxinfo.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index b182a3091d1..23df82f6f90 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -401,6 +401,10 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) root = RootWindow(dpy, scrnum); + /* + * Find a basic GLX visual. We'll then create a rendering context and + * query various info strings. + */ visinfo = glXChooseVisual(dpy, scrnum, attribSingle); if (!visinfo) visinfo = glXChooseVisual(dpy, scrnum, attribDouble); @@ -409,24 +413,29 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect ); #ifdef GLX_VERSION_1_3 - { + /* Try glXChooseFBConfig() if glXChooseVisual didn't work. + * XXX when would that happen? + */ + if (!visinfo) { int fbAttribSingle[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, GL_TRUE, + GLX_DOUBLEBUFFER, GL_FALSE, None }; int fbAttribDouble[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, GL_TRUE, None }; GLXFBConfig *configs = NULL; int nConfigs; - if (!visinfo) + configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs); + if (!configs) configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs); if (configs) { -- cgit v1.2.3 From e5bc2a19bdaeeda2aa60562f6a580e27c74e9569 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 4 Dec 2009 17:29:53 -0800 Subject: progs/fp: Add tri-inv.c to Makefile. --- progs/fp/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/fp/Makefile b/progs/fp/Makefile index 681928cf260..d77cd32b4df 100755 --- a/progs/fp/Makefile +++ b/progs/fp/Makefile @@ -17,6 +17,7 @@ SOURCES = \ tri-depth2.c \ tri-depthwrite.c \ tri-depthwrite2.c \ + tri-inv.c \ tri-param.c \ fp-tri.c -- cgit v1.2.3 From 5683d7d43fd5a02b72f30a2a6d6a9bfeaf2fa781 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 3 Nov 2009 14:41:08 -0700 Subject: progs/util: Fix memory leak if fail to load/compile shader Signed-off-by: Brian Paul (cherry picked from commit c475079ef2d901ba4506ebd53e19419cd46793ab) --- progs/util/shaderutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 629b6f1d972..36e07842c6d 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -88,6 +88,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) f = fopen(filename, "r"); if (!f) { fprintf(stderr, "Unable to open shader file %s\n", filename); + free(buffer); return 0; } @@ -98,6 +99,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) shader = CompileShaderText(shaderType, buffer); } else { + free(buffer); return 0; } -- cgit v1.2.3 From 4fb5ae7233e5c358e579ced6155f32461f6edf2d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Nov 2009 12:00:22 -0800 Subject: progs/util: Fix memory leak if fread returns 0 in CompileShaderFile. (cherry picked from commit 11905da8836822f7dd60c84b5eefc72e46c94b50) --- progs/util/shaderutil.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 36e07842c6d..adcf2149e21 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -99,6 +99,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) shader = CompileShaderText(shaderType, buffer); } else { + fclose(f); free(buffer); return 0; } -- cgit v1.2.3 From 8d2f3434c5904e28b5e1bccceba7e89a94502ac1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 4 Dec 2009 23:31:39 -0800 Subject: progs/fp: Redraw upon keypress. --- progs/fp/tri-inv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c index 7e8d8c5ce29..7e490fa61ca 100644 --- a/progs/fp/tri-inv.c +++ b/progs/fp/tri-inv.c @@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); -- cgit v1.2.3 From d642edd2d10e93c32077a729b13a7c7b0d37d25b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Dec 2009 01:11:26 -0800 Subject: progs/vpglsl: Assign glGetUniformLocationARB return value to GLint. The return type of glGetUniformLocationARB is GLint, not GLuint. --- progs/vpglsl/vp-tris.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'progs') diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c index b2b05080910..6a1fa3d3bf0 100644 --- a/progs/vpglsl/vp-tris.c +++ b/progs/vpglsl/vp-tris.c @@ -84,9 +84,9 @@ static void check_link(GLuint prog) static void setup_uniforms() { { - GLuint loc1f = glGetUniformLocationARB(program, "Offset1f"); - GLuint loc2f = glGetUniformLocationARB(program, "Offset2f"); - GLuint loc4f = glGetUniformLocationARB(program, "Offset4f"); + GLint loc1f = glGetUniformLocationARB(program, "Offset1f"); + GLint loc2f = glGetUniformLocationARB(program, "Offset2f"); + GLint loc4f = glGetUniformLocationARB(program, "Offset4f"); GLfloat vecKer[] = { 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, @@ -105,9 +105,9 @@ static void setup_uniforms() } { - GLuint loc1f = glGetUniformLocationARB(program, "KernelValue1f"); - GLuint loc2f = glGetUniformLocationARB(program, "KernelValue2f"); - GLuint loc4f = glGetUniformLocationARB(program, "KernelValue4f"); + GLint loc1f = glGetUniformLocationARB(program, "KernelValue1f"); + GLint loc2f = glGetUniformLocationARB(program, "KernelValue2f"); + GLint loc4f = glGetUniformLocationARB(program, "KernelValue4f"); GLfloat vecKer[] = { 1.0, 0.0, 0.0, 0.25, 0.0, 1.0, 0.0, 0.25, -- cgit v1.2.3 From 2cd2341ce88a3d485f81d920290a9c1d0ab988da Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Dec 2009 01:22:34 -0800 Subject: progs/tests: Removed unused variable from texdown.c. --- progs/tests/texdown.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c index e6881d39a0a..92df01b83d2 100644 --- a/progs/tests/texdown.c +++ b/progs/tests/texdown.c @@ -162,7 +162,7 @@ MeasureDownloadRate(void) const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN); const int bytes = image_bytes * NR_TEXOBJ; GLubyte *orig_texImage, *orig_getImage; - GLubyte *texImage, *getImage; + GLubyte *texImage; GLdouble t0, t1, time; int count; int i; @@ -184,7 +184,6 @@ MeasureDownloadRate(void) printf("alloc %p %p\n", orig_texImage, orig_getImage); texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN); - getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN); for (i = 1; !(((unsigned long)texImage) & i); i<<=1) ; -- cgit v1.2.3 From 6212c8103a5011e08003c8946732edad39fa74c3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Dec 2009 01:28:47 -0800 Subject: progs/samples: Add rgbtoppm to Makefile. --- progs/samples/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/samples/Makefile b/progs/samples/Makefile index b300e38b9c2..64fa47addb5 100644 --- a/progs/samples/Makefile +++ b/progs/samples/Makefile @@ -10,7 +10,7 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(T LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \ - font line logo nurb olympic overlay point prim quad select \ + font line logo nurb olympic overlay point prim rgbtoppm quad select \ shape sphere star stencil stretch texture tri wave -- cgit v1.2.3 From 412aeeed1c392ab5796c85287fc6ebdccd74880c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Dec 2009 01:38:14 -0800 Subject: progs/samples: Fix memory leak if fopen fails in rgbtoppm.c. --- progs/samples/rgbtoppm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index 116d9a8cfa5..6652bb32ec1 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -86,7 +86,8 @@ static ImageRec *ImageOpen(char *fileName) exit(1); } if ((image->file = fopen(fileName, "rb")) == NULL) { - return NULL; + free(image); + return NULL; } fread(image, 1, 12, image->file); -- cgit v1.2.3 From 1446f30875bfb3b633942bc710b061019472f788 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Dec 2009 01:43:29 -0800 Subject: progs/samples: Fix memory leak if malloc fails in rgbtoppm.c. --- progs/samples/rgbtoppm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index 6652bb32ec1..56ca5b0efe9 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -225,6 +225,7 @@ read_rgb_texture(char *name, int *width, int *height) if (gbuf) free(gbuf); if (bbuf) free(bbuf); if (abuf) free(abuf); + ImageClose(image); return NULL; } ptr = base; -- cgit v1.2.3 From d13c603e37bf7fb4c84b215775eb547761c1e2ec Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 5 Dec 2009 17:20:03 +0100 Subject: Add 'texture leak' test. --- progs/tests/Makefile | 1 + progs/tests/texleak.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 progs/tests/texleak.c (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 197e14d5b00..3e2541186b1 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -98,6 +98,7 @@ SOURCES = \ texdown \ texfilt.c \ texgenmix.c \ + texleak.c \ texline.c \ texobj.c \ texobjshare.c \ diff --git a/progs/tests/texleak.c b/progs/tests/texleak.c new file mode 100644 index 00000000000..5cf4ff32393 --- /dev/null +++ b/progs/tests/texleak.c @@ -0,0 +1,140 @@ +/* + * 'Texture leak' test + * + * Allocates and uses an additional texture of the maximum supported size for + * each frame. This tests the system's ability to cope with using increasing + * amounts of texture memory. + * + * Michel Dänzer July 2009 This program is in the public domain. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + + +GLint size; +GLvoid *image; +static GLuint numTexObj; +static GLuint *texObj; + + +static void Idle( void ) +{ + glutPostRedisplay(); +} + + +static void DrawObject(void) +{ + static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 }; + static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 }; + GLint i, j; + + glEnable(GL_TEXTURE_2D); + + for (i = 0; i < numTexObj; i++) { + glBindTexture(GL_TEXTURE_2D, texObj[i]); + glBegin(GL_QUADS); + for (j = 0; j < 4; j++ ) { + glTexCoord2f(tex_coords[j], tex_coords[j+1]); + glVertex2f( vtx_coords[j], vtx_coords[j+1] ); + } + glEnd(); + } +} + + +static void Display( void ) +{ + struct timeval start, end; + + texObj = realloc(texObj, ++numTexObj * sizeof(*texObj)); + + /* allocate a texture object */ + glGenTextures(1, texObj + (numTexObj - 1)); + + glBindTexture(GL_TEXTURE_2D, texObj[numTexObj - 1]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + memset(image, (16 * numTexObj) & 0xff, 4 * size * size); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, + GL_RGBA, GL_UNSIGNED_BYTE, image); + + gettimeofday(&start, NULL); + + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + glScalef(5.0, 5.0, 5.0); + DrawObject(); + glPopMatrix(); + + glutSwapBuffers(); + + glFinish(); + gettimeofday(&end, NULL); + printf("Rendering frame took %lu ms using %u MB of textures\n", + end.tv_sec * 1000 + end.tv_usec / 1000 - start.tv_sec * 1000 - + start.tv_usec / 1000, numTexObj * 4 * size / 1024 * size / 1024); + + sleep(1); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -70.0 ); +} + + +static void Init( int argc, char *argv[] ) +{ + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); + printf("%d x %d max texture size\n", size, size); + + image = malloc(4 * size * size); + if (!image) { + fprintf(stderr, "Failed to allocate %u bytes of memory\n", 4 * size * size); + exit(1); + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glShadeModel(GL_FLAT); + glClearColor(0.3, 0.3, 0.4, 1.0); + + Idle(); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowSize( 300, 300 ); + glutInitWindowPosition( 0, 0 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0] ); + glewInit(); + + Init( argc, argv ); + + glutReshapeFunc( Reshape ); + glutDisplayFunc( Display ); + glutIdleFunc(Idle); + + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 978b80c8e35b465273921a28540ed15f07d1afbf Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 9 Oct 2009 07:24:04 -0600 Subject: progs/tests: Add tests to Makefile. (cherry picked from commit 76d2ec3a0a047a65ffca70f53848241a3225dad3) --- progs/tests/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 8c310df0954..197e14d5b00 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -25,6 +25,7 @@ SOURCES = \ arbvptorus.c \ arbvpwarpmesh.c \ arraytexture.c \ + auxbuffer.c \ blendminmax.c \ blendsquare.c \ blendxor.c \ @@ -41,6 +42,7 @@ SOURCES = \ cva.c \ drawbuffers.c \ exactrast.c \ + ext422square.c \ floattex.c \ fbotest1.c \ fbotest2.c \ @@ -66,6 +68,8 @@ SOURCES = \ mipmap_limits.c \ mipmap_view.c \ multipal.c \ + multitexarray.c \ + multiwindow.c \ no_s3tc.c \ packedpixels.c \ pbo.c \ @@ -88,10 +92,12 @@ SOURCES = \ subtex \ subtexrate.c \ tex1d.c \ + texcmp.c \ texcompress2.c \ texcompsub.c \ texdown \ texfilt.c \ + texgenmix.c \ texline.c \ texobj.c \ texobjshare.c \ @@ -101,6 +107,7 @@ SOURCES = \ vao-01.c \ vao-02.c \ vparray.c \ + vpeval.c \ vptest1.c \ vptest2.c \ vptest3.c \ -- cgit v1.2.3 From 8796dbf5196bcc75d39372570fa6347cd018354d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Dec 2009 09:49:27 -0700 Subject: progs/glsl: added texture mapping to bump demo Press 't' to toggle texture map. --- progs/glsl/CH11-bumpmaptex.frag | 47 +++++++++++++++++++++++++++++++++++ progs/glsl/bump.c | 55 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 progs/glsl/CH11-bumpmaptex.frag (limited to 'progs') diff --git a/progs/glsl/CH11-bumpmaptex.frag b/progs/glsl/CH11-bumpmaptex.frag new file mode 100644 index 00000000000..b1f93b784d9 --- /dev/null +++ b/progs/glsl/CH11-bumpmaptex.frag @@ -0,0 +1,47 @@ +// +// Fragment shader for procedural bumps +// +// Authors: John Kessenich, Randi Rost +// +// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. +// +// See 3Dlabs-License.txt for license information +// +// Texture mapping/modulation added by Brian Paul +// + +varying vec3 LightDir; +varying vec3 EyeDir; + +uniform float BumpDensity; // = 16.0 +uniform float BumpSize; // = 0.15 +uniform float SpecularFactor; // = 0.5 + +sampler2D Tex; + +void main() +{ + vec3 ambient = vec3(0.25); + vec3 litColor; + vec2 c = BumpDensity * gl_TexCoord[0].st; + vec2 p = fract(c) - vec2(0.5); + + float d, f; + d = p.x * p.x + p.y * p.y; + f = inversesqrt(d + 1.0); + + if (d >= BumpSize) + { p = vec2(0.0); f = 1.0; } + + vec3 SurfaceColor = texture2D(Tex, gl_TexCoord[0].st).xyz; + + vec3 normDelta = vec3(p.x, p.y, 1.0) * f; + litColor = SurfaceColor * (ambient + max(dot(normDelta, LightDir), 0.0)); + vec3 reflectDir = reflect(LightDir, normDelta); + + float spec = max(dot(EyeDir, reflectDir), 0.0); + spec *= SpecularFactor; + litColor = min(litColor + spec, vec3(1.0)); + + gl_FragColor = vec4(litColor, 1.0); +} diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index 50a0900f1c7..e31afab9392 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -12,15 +12,20 @@ #include #include #include "shaderutil.h" +#include "readtex.h" static char *FragProgFile = "CH11-bumpmap.frag"; +static char *FragTexProgFile = "CH11-bumpmaptex.frag"; static char *VertProgFile = "CH11-bumpmap.vert"; +static char *TextureFile = "../images/tile.rgb"; /* program/shader objects */ static GLuint fragShader; +static GLuint fragTexShader; static GLuint vertShader; static GLuint program; +static GLuint texProgram; static struct uniform_info Uniforms[] = { @@ -32,13 +37,26 @@ static struct uniform_info Uniforms[] = { END_OF_UNIFORMS }; +static struct uniform_info TexUniforms[] = { + { "LightPosition", 1, GL_FLOAT_VEC3, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 }, + { "Tex", 1, GL_INT, { 0, 0, 0, 0 }, -1 }, + { "BumpDensity", 1, GL_FLOAT, { 10.0, 0, 0, 0 }, -1 }, + { "BumpSize", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 }, + { "SpecularFactor", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 }, + END_OF_UNIFORMS +}; + static GLint win = 0; static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f; static GLint tangentAttrib; +static GLint tangentAttribTex; + +static GLuint Texture; static GLboolean Anim = GL_FALSE; +static GLboolean Textured = GL_FALSE; static void @@ -135,6 +153,11 @@ Redisplay(void) glRotatef(yRot, 0.0f, 1.0f, 0.0f); glRotatef(zRot, 0.0f, 0.0f, 1.0f); + if (Textured) + glUseProgram(texProgram); + else + glUseProgram(program); + Cube(1.5); glPopMatrix(); @@ -163,8 +186,10 @@ static void CleanUp(void) { glDeleteShader(fragShader); + glDeleteShader(fragTexShader); glDeleteShader(vertShader); glDeleteProgram(program); + glDeleteProgram(texProgram); glutDestroyWindow(win); } @@ -181,6 +206,9 @@ Key(unsigned char key, int x, int y) Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); break; + case 't': + Textured = !Textured; + break; case 'z': zRot += step; break; @@ -254,6 +282,26 @@ Init(void) CheckError(__LINE__); + + /* + * As above, but fragment shader also uses a texture map. + */ + fragTexShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragTexProgFile); + texProgram = LinkShaders(vertShader, fragTexShader); + glUseProgram(texProgram); + assert(glIsProgram(texProgram)); + assert(glIsShader(fragTexShader)); + SetUniformValues(texProgram, TexUniforms); + PrintUniforms(TexUniforms); + + /* + * Load tex image. + */ + glGenTextures(1, &Texture); + glBindTexture(GL_TEXTURE_2D, Texture); + LoadRGBMipmaps(TextureFile, GL_RGB); + + glClearColor(0.4f, 0.4f, 0.8f, 0.0f); glEnable(GL_DEPTH_TEST); @@ -268,10 +316,13 @@ ParseOptions(int argc, char *argv[]) int i; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-fs") == 0) { - FragProgFile = argv[i+1]; + FragProgFile = argv[++i]; } else if (strcmp(argv[i], "-vs") == 0) { - VertProgFile = argv[i+1]; + VertProgFile = argv[++i]; + } + else if (strcmp(argv[i], "-t") == 0) { + TextureFile = argv[++i]; } } } -- cgit v1.2.3 From 0311d9ccf4b717300a99355a02eff23935b4c08a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Dec 2009 09:03:39 -0700 Subject: progs/glsl: updates to deriv.c test Pass window size into the shader so scaling the window doesn't effect the colors. --- progs/glsl/deriv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c index 30f2b75fef7..588246b71ac 100644 --- a/progs/glsl/deriv.c +++ b/progs/glsl/deriv.c @@ -27,11 +27,15 @@ static GLuint SphereList, RectList, CurList; static GLint win = 0; static GLboolean anim = GL_TRUE; static GLfloat xRot = 0.0f, yRot = 0.0f; +static GLint WinSize[2]; +static GLint WinSizeUniform = -1; static void Redisplay(void) { + glUniform2iv(WinSizeUniform, 1, WinSize); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); @@ -55,6 +59,8 @@ Idle(void) static void Reshape(int width, int height) { + WinSize[0] = width; + WinSize[1] = height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -163,8 +169,10 @@ static void Init(void) { static const char *fragShaderText = + "uniform ivec2 WinSize; \n" "void main() {\n" - " gl_FragColor = abs(dFdy(gl_TexCoord[0])) * 50.0;\n" + " vec2 d = dFdy(gl_TexCoord[0].xy) * vec2(WinSize); \n" + " gl_FragColor = vec4(d.x, d.y, 0.0, 1.0);\n" " // gl_FragColor = gl_TexCoord[0];\n" "}\n"; static const char *vertShaderText = @@ -181,6 +189,7 @@ Init(void) program = LinkShaders(vertShader, fragShader); glUseProgram(program); + WinSizeUniform = glGetUniformLocation(program, "WinSize"); /*assert(glGetError() == 0);*/ @@ -220,8 +229,10 @@ ParseOptions(int argc, char *argv[]) int main(int argc, char *argv[]) { + WinSize[0] = WinSize[1] = 200; + glutInit(&argc, argv); - glutInitWindowSize(200, 200); + glutInitWindowSize(WinSize[0], WinSize[1]); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); win = glutCreateWindow(argv[0]); glewInit(); -- cgit v1.2.3 From 7d84169865f5907a02ff2283ca7bd45a3bb2f3c9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 7 Dec 2009 12:31:08 -0800 Subject: progs/demos: Fix memory leak in projtex.c. --- progs/demos/projtex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'progs') diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c index ad205c74137..503cf5de088 100644 --- a/progs/demos/projtex.c +++ b/progs/demos/projtex.c @@ -248,6 +248,7 @@ loadImageTextures(void) free(texData3); free(texData4); + free(image); } } -- cgit v1.2.3 From 3e8b2fda215689b9a77c73020a1efc523995931e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 7 Dec 2009 18:40:37 -0800 Subject: progs/test: Initialize variable in prog_parameter. Silences uninitialized variable compiler warning. --- progs/tests/prog_parameter.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'progs') diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 0241f3a2496..2de7e2994af 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -192,6 +192,7 @@ static void Init( void ) GLfloat * params; GLint max_program_env_parameters; GLint max_program_local_parameters; + int i; printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); @@ -238,6 +239,10 @@ static void Init( void ) params = malloc(max_program_env_parameters * 4 * sizeof(GLfloat)); + for (i = 0; i < max_program_env_parameters * 4; i++) { + params[i] = 0.0F; + } + pass &= set_parameter_batch(max_program_env_parameters, params, "Env", program_env_parameter4fv, program_env_parameters4fv, -- cgit v1.2.3 From bc0509bba8cc962a4ee2dafd684e153b3060262d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 13:24:15 -0800 Subject: progs/util: Byte swap individual members of struct _rawImageRec. --- progs/util/readtex.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 81cb626e911..d1c50a494aa 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -117,7 +117,12 @@ static rawImageRec *RawImageOpen(const char *fileName) fread(raw, 1, 12, raw->file); if (swapFlag) { - ConvertShort(&raw->imagic, 6); + ConvertShort(&raw->imagic, 1); + ConvertShort(&raw->type, 1); + ConvertShort(&raw->dim, 1); + ConvertShort(&raw->sizeX, 1); + ConvertShort(&raw->sizeY, 1); + ConvertShort(&raw->sizeZ, 1); } raw->tmp = (unsigned char *)malloc(raw->sizeX*256); -- cgit v1.2.3 From 1cf60c981091d7a46cb404fd607f85553c427761 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 15:41:13 -0800 Subject: progs/samples: Byte swap individual members of struct _rawImageRec. --- progs/samples/rgbtoppm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index 56ca5b0efe9..dcb74228dff 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -93,7 +93,12 @@ static ImageRec *ImageOpen(char *fileName) fread(image, 1, 12, image->file); if (swapFlag) { - ConvertShort(&image->imagic, 6); + ConvertShort(&image->imagic, 1); + ConvertShort(&image->type, 1); + ConvertShort(&image->dim, 1); + ConvertShort(&image->xsize, 1); + ConvertShort(&image->ysize, 1); + ConvertShort(&image->zsize, 1); } image->tmp = (unsigned char *)malloc(image->xsize*256); -- cgit v1.2.3 From 9e2eee4ab203773fa4b420d3782f0074f5b3bf32 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 01:02:16 -0800 Subject: progs/redbook: Silence compiler warnings in aaindex.c. --- progs/redbook/aaindex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/redbook/aaindex.c b/progs/redbook/aaindex.c index 7dbc7b4b9b2..6011ec44b67 100644 --- a/progs/redbook/aaindex.c +++ b/progs/redbook/aaindex.c @@ -56,7 +56,7 @@ static float rotAngle = 0.; * at RAMP1START, and a blue color ramp starting * at RAMP2START. The ramps must be a multiple of 16. */ -void init(void) +static void init(void) { int i; @@ -76,7 +76,7 @@ void init(void) /* Draw 2 diagonal lines to form an X */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -101,7 +101,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -117,7 +117,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'r': -- cgit v1.2.3 From 44d6ab6de5d5c02c38146086d3f03523968df49e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 01:11:56 -0800 Subject: progs/tests: Silence compiler warnings in cva.c. --- progs/tests/cva.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/tests/cva.c b/progs/tests/cva.c index 80483900cb7..02d1dcba2ec 100644 --- a/progs/tests/cva.c +++ b/progs/tests/cva.c @@ -39,7 +39,7 @@ GLboolean compiled = GL_TRUE; GLboolean doubleBuffer = GL_TRUE; -void init( void ) +static void init( void ) { glClearColor( 0.0, 0.0, 0.0, 0.0 ); glShadeModel( GL_SMOOTH ); @@ -69,7 +69,7 @@ void init( void ) #endif } -void display( void ) +static void display( void ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); @@ -81,7 +81,7 @@ void display( void ) } } -void keyboard( unsigned char key, int x, int y ) +static void keyboard( unsigned char key, int x, int y ) { switch ( key ) { case 27: @@ -92,7 +92,7 @@ void keyboard( unsigned char key, int x, int y ) glutPostRedisplay(); } -GLboolean args( int argc, char **argv ) +static GLboolean args( int argc, char **argv ) { GLint i; -- cgit v1.2.3 From d5be33477e4a5cb73a5ccc24c2ad6518adddeb40 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 01:34:33 -0800 Subject: progs/tests: Silence compiler warnings in vpeval.c. --- progs/tests/vpeval.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/tests/vpeval.c b/progs/tests/vpeval.c index f07737f9736..3e8a732df59 100644 --- a/progs/tests/vpeval.c +++ b/progs/tests/vpeval.c @@ -94,16 +94,16 @@ GLfloat colorPoints[4][4][4] = }; -void +static void initlights(void) { +#if 0 /* no lighting for now */ GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; GLfloat position[] = {0.0, 0.0, 2.0, 1.0}; GLfloat mat_diffuse[] = {0.6, 0.6, 0.6, 1.0}; GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0}; GLfloat mat_shininess[] = {50.0}; -#if 0 /* no lighting for now */ glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); @@ -116,7 +116,7 @@ initlights(void) #endif } -void +static void display(void) { glClearColor(.3, .3, .3, 0); @@ -130,7 +130,7 @@ display(void) glFlush(); } -void +static void myinit(int argc, char *argv[]) { glClearColor(0.0, 0.0, 0.0, 1.0); @@ -186,7 +186,7 @@ myinit(int argc, char *argv[]) } } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); -- cgit v1.2.3 From 15c6558a2e6b613a6a058bb7f23b678a32e01846 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 02:06:51 -0800 Subject: progs/xdemos: Silence compiler warnings in glxinfo.c. --- progs/xdemos/glxinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index 23df82f6f90..30cd5680642 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -116,7 +116,7 @@ print_extension_list(const char *ext) return; width = indent; - printf(indentString); + printf("%s", indentString); i = j = 0; while (1) { if (ext[j] == ' ' || ext[j] == 0) { @@ -126,7 +126,7 @@ print_extension_list(const char *ext) /* start a new line */ printf("\n"); width = indent; - printf(indentString); + printf("%s", indentString); } /* print the extension name between ext[i] and ext[j] */ while (i < j) { -- cgit v1.2.3 From 786899f1532046526bcc94683112d79a5f59a660 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 14:20:17 -0800 Subject: progs/trivial: Silence compiler warnings in tri-blend-max.c --- progs/trivial/tri-blend-max.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/trivial/tri-blend-max.c b/progs/trivial/tri-blend-max.c index b39f8f3f12a..b173dab8ec1 100644 --- a/progs/trivial/tri-blend-max.c +++ b/progs/trivial/tri-blend-max.c @@ -83,7 +83,7 @@ static void drawRightTriangle(void) glDisable (GL_BLEND); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -99,7 +99,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -111,7 +111,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': -- cgit v1.2.3 From 588e9f69c4994d4e5bccdc8257a5aeb1e0b740d8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 12 Dec 2009 15:47:17 -0800 Subject: progs/trivial: Silence compiler warnings in tri-blend-min.c. --- progs/trivial/tri-blend-min.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/trivial/tri-blend-min.c b/progs/trivial/tri-blend-min.c index 656297c0ce0..629139acae7 100644 --- a/progs/trivial/tri-blend-min.c +++ b/progs/trivial/tri-blend-min.c @@ -83,7 +83,7 @@ static void drawRightTriangle(void) glDisable (GL_BLEND); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -99,7 +99,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -111,7 +111,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': -- cgit v1.2.3 From 0a8d508854c6dd354e611b046e375b8633059a40 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 14 Dec 2009 18:11:57 -0800 Subject: progs/trivial: Silence compiler warnings. --- progs/trivial/tri-blend-revsub.c | 6 +++--- progs/trivial/tri-blend-sub.c | 6 +++--- progs/trivial/tri-blend.c | 6 +++--- progs/trivial/tri-fbo-tex.c | 3 --- progs/trivial/tri-z.c | 6 +++--- 5 files changed, 12 insertions(+), 15 deletions(-) (limited to 'progs') diff --git a/progs/trivial/tri-blend-revsub.c b/progs/trivial/tri-blend-revsub.c index fe225f1f4e0..ef1e92c85dc 100644 --- a/progs/trivial/tri-blend-revsub.c +++ b/progs/trivial/tri-blend-revsub.c @@ -83,7 +83,7 @@ static void drawRightTriangle(void) glDisable (GL_BLEND); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -99,7 +99,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -111,7 +111,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': diff --git a/progs/trivial/tri-blend-sub.c b/progs/trivial/tri-blend-sub.c index cc1aeaf4a48..3c560ae6ef7 100644 --- a/progs/trivial/tri-blend-sub.c +++ b/progs/trivial/tri-blend-sub.c @@ -83,7 +83,7 @@ static void drawRightTriangle(void) glDisable (GL_BLEND); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -99,7 +99,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -111,7 +111,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': diff --git a/progs/trivial/tri-blend.c b/progs/trivial/tri-blend.c index 58c451c9769..f41be89b097 100644 --- a/progs/trivial/tri-blend.c +++ b/progs/trivial/tri-blend.c @@ -81,7 +81,7 @@ static void drawRightTriangle(void) glDisable (GL_BLEND); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -97,7 +97,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -109,7 +109,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': diff --git a/progs/trivial/tri-fbo-tex.c b/progs/trivial/tri-fbo-tex.c index 72b4cf3683d..8d1f871328d 100644 --- a/progs/trivial/tri-fbo-tex.c +++ b/progs/trivial/tri-fbo-tex.c @@ -189,9 +189,6 @@ Key(unsigned char key, int x, int y) static void Init(int argc, char *argv[]) { - static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 }; - GLint i; - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { printf("GL_EXT_framebuffer_object not found!\n"); exit(0); diff --git a/progs/trivial/tri-z.c b/progs/trivial/tri-z.c index 014aaa071a5..092249dd765 100644 --- a/progs/trivial/tri-z.c +++ b/progs/trivial/tri-z.c @@ -101,7 +101,7 @@ static void drawRightTriangle(void) glEnd(); } -void display(void) +static void display(void) { printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n", clearVal, funcs[curFunc].str, minZ, maxZ); @@ -124,7 +124,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -136,7 +136,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'n': -- cgit v1.2.3 From b1ed72ebe2599ec178f51d86fd42f26486b9a19b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 17 Dec 2009 23:41:57 +0100 Subject: Move the remaining format pf_get_* functions to u_format.h. Previously they depended on format blocks, but after removing those they started depending on format encoding. --- progs/rbug/bin_to_bmp.c | 13 +- src/gallium/auxiliary/util/u_blitter.c | 4 +- src/gallium/auxiliary/util/u_debug.c | 7 +- src/gallium/auxiliary/util/u_format.h | 83 ++++++++++++- src/gallium/auxiliary/util/u_gen_mipmap.c | 12 +- src/gallium/auxiliary/util/u_rect.c | 21 ++-- src/gallium/auxiliary/util/u_tile.c | 9 +- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 4 +- src/gallium/drivers/cell/ppu/cell_texture.c | 20 +-- src/gallium/drivers/i915/i915_surface.c | 19 +-- src/gallium/drivers/i915/i915_texture.c | 75 ++++++------ src/gallium/drivers/llvmpipe/lp_setup.c | 3 +- src/gallium/drivers/llvmpipe/lp_texture.c | 18 +-- src/gallium/drivers/nv04/nv04_surface_2d.c | 13 +- src/gallium/drivers/nv04/nv04_transfer.c | 3 +- src/gallium/drivers/nv10/nv10_miptree.c | 5 +- src/gallium/drivers/nv10/nv10_transfer.c | 3 +- src/gallium/drivers/nv20/nv20_miptree.c | 5 +- src/gallium/drivers/nv20/nv20_transfer.c | 3 +- src/gallium/drivers/nv30/nv30_miptree.c | 5 +- src/gallium/drivers/nv30/nv30_transfer.c | 3 +- src/gallium/drivers/nv40/nv40_miptree.c | 5 +- src/gallium/drivers/nv40/nv40_transfer.c | 3 +- src/gallium/drivers/nv50/nv50_miptree.c | 9 +- src/gallium/drivers/nv50/nv50_transfer.c | 23 ++-- src/gallium/drivers/r300/r300_emit.c | 8 +- src/gallium/drivers/r300/r300_screen.c | 5 +- src/gallium/drivers/r300/r300_texture.c | 8 +- src/gallium/drivers/softpipe/sp_texture.c | 14 +-- src/gallium/drivers/softpipe/sp_tile_cache.c | 2 +- src/gallium/drivers/svga/svga_screen_texture.c | 14 +-- src/gallium/drivers/svga/svga_state_vs.c | 2 +- src/gallium/drivers/trace/tr_rbug.c | 15 +-- src/gallium/drivers/trace/tr_screen.c | 3 +- src/gallium/include/pipe/p_format.h | 134 --------------------- src/gallium/state_trackers/python/st_sample.c | 15 +-- .../state_trackers/python/st_softpipe_winsys.c | 4 +- .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 2 +- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 5 +- src/gallium/winsys/egl_xlib/sw_winsys.c | 4 +- src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 4 +- src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c | 4 +- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 8 +- src/gallium/winsys/xlib/xlib_cell.c | 4 +- src/gallium/winsys/xlib/xlib_llvmpipe.c | 10 +- src/gallium/winsys/xlib/xlib_softpipe.c | 10 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- src/mesa/state_tracker/st_cb_fbo.c | 4 +- src/mesa/state_tracker/st_cb_texture.c | 26 ++-- src/mesa/state_tracker/st_gen_mipmap.c | 5 +- 50 files changed, 322 insertions(+), 360 deletions(-) (limited to 'progs') diff --git a/progs/rbug/bin_to_bmp.c b/progs/rbug/bin_to_bmp.c index cdae3486ce0..03ff622fee7 100644 --- a/progs/rbug/bin_to_bmp.c +++ b/progs/rbug/bin_to_bmp.c @@ -25,6 +25,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_format.h" #include "pipe/p_state.h" +#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_debug.h" #include "util/u_network.h" @@ -54,10 +55,7 @@ static void dump(unsigned width, unsigned height, unsigned src_stride, enum pipe_format src_format, uint8_t *data, unsigned src_size) { - struct pipe_format_block src_block; - enum pipe_format dst_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - struct pipe_format_block dst_block; unsigned dst_stride; unsigned dst_size; float *rgba; @@ -65,14 +63,11 @@ static void dump(unsigned width, unsigned height, char filename[512]; { - pf_get_block(src_format, &src_block); - assert(src_stride >= pf_get_stride(&src_block, width)); - assert(src_size >= pf_get_2d_size(&src_block, src_stride, width)); + assert(src_stride >= util_format_get_stride(src_format, width)); } { - pf_get_block(dst_format, &dst_block); - dst_stride = pf_get_stride(&dst_block, width); - dst_size = pf_get_2d_size(&dst_block, dst_stride, width); + dst_stride = util_format_get_stride(dst_format, width); + dst_size = util_format_get_2d_size(dst_format, dst_stride, width); rgba = MALLOC(dst_size); } diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 895af2c8d00..0242b796155 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -579,8 +579,8 @@ void util_blitter_copy(struct blitter_context *blitter, if (!dst->texture || !src->texture) return; - is_depth = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_Z) != 0; - is_stencil = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_S) != 0; + is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0; + is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0; dst_tex_usage = is_depth || is_stencil ? PIPE_TEXTURE_USAGE_DEPTH_STENCIL : PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 40633574b08..27e0b0d1595 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -64,6 +64,7 @@ #include "pipe/p_format.h" #include "pipe/p_state.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_string.h" #include "util/u_stream.h" @@ -670,9 +671,9 @@ void debug_dump_surface(const char *prefix, debug_dump_image(prefix, texture->format, - pf_get_blocksize(texture->format), - pf_get_nblocksx(texture->format, transfer->width), - pf_get_nblocksy(texture->format, transfer->height), + util_format_get_blocksize(texture->format), + util_format_get_nblocksx(texture->format, transfer->width), + util_format_get_nblocksy(texture->format, transfer->height), transfer->stride, data); diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 72da2a44c74..97e4d959bc7 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -200,7 +200,7 @@ util_format_is_depth_and_stencil(enum pipe_format format) * Return total bits needed for the pixel format. */ static INLINE uint -util_format_get_bits(enum pipe_format format) +util_format_get_blocksizebits(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); @@ -216,15 +216,92 @@ util_format_get_bits(enum pipe_format format) * Return bytes per pixel for the given format. */ static INLINE uint -util_format_get_size(enum pipe_format format) +util_format_get_blocksize(enum pipe_format format) { - uint bits = util_format_get_bits(format); + uint bits = util_format_get_blocksizebits(format); assert(bits % 8 == 0); return bits / 8; } +static INLINE uint +util_format_get_blockwidth(enum pipe_format format) +{ + const struct util_format_description *desc = util_format_description(format); + + assert(format); + if (!format) { + return 1; + } + + switch (desc->layout) { + case UTIL_FORMAT_LAYOUT_YUV: + return 2; + case UTIL_FORMAT_LAYOUT_DXT: + return 4; + default: + return 1; + } +} + +static INLINE uint +util_format_get_blockheight(enum pipe_format format) +{ + const struct util_format_description *desc = util_format_description(format); + + assert(format); + if (!format) { + return 1; + } + + switch (desc->layout) { + case UTIL_FORMAT_LAYOUT_DXT: + return 4; + default: + return 1; + } +} + +static INLINE unsigned +util_format_get_nblocksx(enum pipe_format format, + unsigned x) +{ + unsigned blockwidth = util_format_get_blockwidth(format); + return (x + blockwidth - 1) / blockwidth; +} + +static INLINE unsigned +util_format_get_nblocksy(enum pipe_format format, + unsigned y) +{ + unsigned blockheight = util_format_get_blockheight(format); + return (y + blockheight - 1) / blockheight; +} + +static INLINE unsigned +util_format_get_nblocks(enum pipe_format format, + unsigned width, + unsigned height) +{ + return util_format_get_nblocksx(format, width) * util_format_get_nblocksy(format, height); +} + +static INLINE size_t +util_format_get_stride(enum pipe_format format, + unsigned width) +{ + return util_format_get_nblocksx(format, width) * util_format_get_blocksize(format); +} + +static INLINE size_t +util_format_get_2d_size(enum pipe_format format, + size_t stride, + unsigned height) +{ + return util_format_get_nblocksy(format, height) * stride; +} + static INLINE uint util_format_get_component_bits(enum pipe_format format, enum util_format_colorspace colorspace, diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 2931dfac478..0dad6ccbc0a 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -998,7 +998,7 @@ reduce_2d(enum pipe_format pformat, { enum dtype datatype; uint comps; - const int bpt = util_format_get_size(pformat); + const int bpt = util_format_get_blocksize(pformat); const ubyte *srcA, *srcB; ubyte *dst; int row; @@ -1037,7 +1037,7 @@ reduce_3d(enum pipe_format pformat, int dstWidth, int dstHeight, int dstDepth, int dstRowStride, ubyte *dstPtr) { - const int bpt = util_format_get_size(pformat); + const int bpt = util_format_get_blocksize(pformat); const int border = 0; int img, row; int bytesPerSrcImage, bytesPerDstImage; @@ -1161,8 +1161,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, const uint zslice = 0; uint dstLevel; - assert(pf_get_blockwidth(pt->format) == 1); - assert(pf_get_blockheight(pt->format) == 1); + assert(util_format_get_blockwidth(pt->format) == 1); + assert(util_format_get_blockheight(pt->format) == 1); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; @@ -1206,8 +1206,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, struct pipe_screen *screen = pipe->screen; uint dstLevel, zslice = 0; - assert(pf_get_blockwidth(pt->format) == 1); - assert(pf_get_blockheight(pt->format) == 1); + assert(util_format_get_blockwidth(pt->format) == 1); + assert(util_format_get_blockheight(pt->format) == 1); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 72725b59d2c..298fbacecba 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -34,6 +34,7 @@ #include "pipe/p_format.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" +#include "util/u_format.h" #include "util/u_rect.h" @@ -57,9 +58,9 @@ util_copy_rect(ubyte * dst, { unsigned i; int src_stride_pos = src_stride < 0 ? -src_stride : src_stride; - int blocksize = pf_get_blocksize(format); - int blockwidth = pf_get_blockwidth(format); - int blockheight = pf_get_blockheight(format); + int blocksize = util_format_get_blocksize(format); + int blockwidth = util_format_get_blockwidth(format); + int blockheight = util_format_get_blockheight(format); assert(blocksize > 0); assert(blockwidth > 0); @@ -105,9 +106,9 @@ util_fill_rect(ubyte * dst, { unsigned i, j; unsigned width_size; - int blocksize = pf_get_blocksize(format); - int blockwidth = pf_get_blockwidth(format); - int blockheight = pf_get_blockheight(format); + int blocksize = util_format_get_blocksize(format); + int blockwidth = util_format_get_blockwidth(format); + int blockheight = util_format_get_blockheight(format); assert(blocksize > 0); assert(blockwidth > 0); @@ -203,9 +204,9 @@ util_surface_copy(struct pipe_context *pipe, PIPE_TRANSFER_WRITE, dst_x, dst_y, w, h); - assert(pf_get_blocksize(dst_format) == pf_get_blocksize(src_format)); - assert(pf_get_blockwidth(dst_format) == pf_get_blockwidth(src_format)); - assert(pf_get_blockheight(dst_format) == pf_get_blockheight(src_format)); + assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format)); + assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); + assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); src_map = pipe->screen->transfer_map(screen, src_trans); dst_map = pipe->screen->transfer_map(screen, dst_trans); @@ -270,7 +271,7 @@ util_surface_fill(struct pipe_context *pipe, if (dst_map) { assert(dst_trans->stride > 0); - switch (pf_get_blocksize(dst_trans->texture->format)) { + switch (util_format_get_blocksize(dst_trans->texture->format)) { case 1: case 2: case 4: diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 88c9a1f0977..5b8dd1abb94 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -34,6 +34,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_rect.h" @@ -52,7 +53,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt, const void *src; if (dst_stride == 0) - dst_stride = pf_get_stride(pt->texture->format, w); + dst_stride = util_format_get_stride(pt->texture->format, w); if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -81,7 +82,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt, enum pipe_format format = pt->texture->format; if (src_stride == 0) - src_stride = pf_get_stride(format, w); + src_stride = util_format_get_stride(format, w); if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -1275,7 +1276,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format)); + packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format)); if (!packed) return; @@ -1303,7 +1304,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format)); + packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format)); if (!packed) return; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 8f0185b42ab..ab196c21f87 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1444,7 +1444,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, assert(r); assert(blocks); - tex_pitch = r->tex_transfer[0]->stride / pf_get_blocksize(r->tex_transfer[0]->texture->format); + tex_pitch = r->tex_transfer[0]->stride / util_format_get_blocksize(r->tex_transfer[0]->texture->format); texels = r->texels[0] + mbpy * tex_pitch + mbpx; for (y = 0; y < 2; ++y) { @@ -1483,7 +1483,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, mbpy /= 2; for (tb = 0; tb < 2; ++tb) { - tex_pitch = r->tex_transfer[tb + 1]->stride / pf_get_blocksize(r->tex_transfer[tb + 1]->texture->format); + tex_pitch = r->tex_transfer[tb + 1]->stride / util_format_get_blocksize(r->tex_transfer[tb + 1]->texture->format); texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx; if ((cbp >> (1 - tb)) & 1) { diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index bc2e625f54b..998944f77a3 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -67,11 +67,11 @@ cell_texture_layout(struct cell_texture *ct) w_tile = align(width, TILE_SIZE); h_tile = align(height, TILE_SIZE); - ct->stride[level] = pf_get_stride(pt->format, w_tile); + ct->stride[level] = util_format_get_stride(pt->format, w_tile); ct->level_offset[level] = ct->buffer_size; - size = ct->stride[level] * pf_get_nblocksy(pt->format, h_tile); + size = ct->stride[level] * util_format_get_nblocksy(pt->format, h_tile); if (pt->target == PIPE_TEXTURE_CUBE) size *= 6; else @@ -283,11 +283,11 @@ cell_get_tex_surface(struct pipe_screen *screen, if (pt->target == PIPE_TEXTURE_CUBE) { unsigned h_tile = align(ps->height, TILE_SIZE); - ps->offset += face * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level]; + ps->offset += face * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { unsigned h_tile = align(ps->height, TILE_SIZE); - ps->offset += zslice * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level]; + ps->offset += zslice * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level]; } else { assert(face == 0); @@ -342,11 +342,11 @@ cell_get_tex_transfer(struct pipe_screen *screen, if (texture->target == PIPE_TEXTURE_CUBE) { unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE); - ctrans->offset += face * pf_get_nblocksy(texture->format, h_tile) * pt->stride; + ctrans->offset += face * util_format_get_nblocksy(texture->format, h_tile) * pt->stride; } else if (texture->target == PIPE_TEXTURE_3D) { unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE); - ctrans->offset += zslice * pf_get_nblocksy(texture->format, h_tile) * pt->stride; + ctrans->offset += zslice * util_format_get_nblocksy(texture->format, h_tile) * pt->stride; } else { assert(face == 0); @@ -399,8 +399,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) * Create a buffer of ordinary memory for the linear texture. * This is the memory that the user will read/write. */ - size = pf_get_stride(pt->format, align(texWidth, TILE_SIZE)) * - pf_get_nblocksy(pt->format, align(texHeight, TILE_SIZE)); + size = util_format_get_stride(pt->format, align(texWidth, TILE_SIZE)) * + util_format_get_nblocksy(pt->format, align(texHeight, TILE_SIZE)); ctrans->map = align_malloc(size, 16); if (!ctrans->map) @@ -408,7 +408,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) if (transfer->usage & PIPE_TRANSFER_READ) { /* need to untwiddle the texture to make a linear version */ - const uint bpp = util_format_get_size(ct->base.format); + const uint bpp = util_format_get_blocksize(ct->base.format); if (bpp == 4) { const uint *src = (uint *) (ct->mapped + ctrans->offset); uint *dst = ctrans->map; @@ -451,7 +451,7 @@ cell_transfer_unmap(struct pipe_screen *screen, /* The user wrote new texture data into the mapped buffer. * We need to convert the new linear data into the twiddled/tiled format. */ - const uint bpp = util_format_get_size(ct->base.format); + const uint bpp = util_format_get_blocksize(ct->base.format); if (bpp == 4) { const uint *src = ctrans->map; uint *dst = (uint *) (ct->mapped + ctrans->offset); diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index 24e1024aaa3..c693eb30e87 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -32,6 +32,7 @@ #include "pipe/p_inlines.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" +#include "util/u_format.h" #include "util/u_tile.h" #include "util/u_rect.h" @@ -52,15 +53,15 @@ i915_surface_copy(struct pipe_context *pipe, struct pipe_texture *spt = &src_tex->base; assert( dst != src ); - assert( pf_get_blocksize(dpt->format) == pf_get_blocksize(spt->format) ); - assert( pf_get_blockwidth(dpt->format) == pf_get_blockwidth(spt->format) ); - assert( pf_get_blockheight(dpt->format) == pf_get_blockheight(spt->format) ); - assert( pf_get_blockwidth(dpt->format) == 1 ); - assert( pf_get_blockheight(dpt->format) == 1 ); + assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) ); + assert( util_format_get_blockwidth(dpt->format) == util_format_get_blockwidth(spt->format) ); + assert( util_format_get_blockheight(dpt->format) == util_format_get_blockheight(spt->format) ); + assert( util_format_get_blockwidth(dpt->format) == 1 ); + assert( util_format_get_blockheight(dpt->format) == 1 ); i915_copy_blit( i915_context(pipe), FALSE, - pf_get_blocksize(dpt->format), + util_format_get_blocksize(dpt->format), (unsigned short) src_tex->stride, src_tex->buffer, src->offset, (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset, (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height ); @@ -76,11 +77,11 @@ i915_surface_fill(struct pipe_context *pipe, struct i915_texture *tex = (struct i915_texture *)dst->texture; struct pipe_texture *pt = &tex->base; - assert(pf_get_blockwidth(pt->format) == 1); - assert(pf_get_blockheight(pt->format) == 1); + assert(util_format_get_blockwidth(pt->format) == 1); + assert(util_format_get_blockheight(pt->format) == 1); i915_fill_blit( i915_context(pipe), - pf_get_blocksize(pt->format), + util_format_get_blocksize(pt->format), (unsigned short) tex->stride, tex->buffer, dst->offset, (short) dstx, (short) dsty, diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index b28b413771d..50a9e19094b 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -35,6 +35,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" +#include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -129,7 +130,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex, assert(img < tex->nr_images[level]); - tex->image_offset[level][img] = y * tex->stride + x * pf_get_blocksize(tex->base.format); + tex->image_offset[level][img] = y * tex->stride + x * util_format_get_blocksize(tex->base.format); /* printf("%s level %d img %d pos %d,%d image_offset %x\n", @@ -151,7 +152,7 @@ i915_scanout_layout(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4) + if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4) return FALSE; i915_miptree_set_level_info(tex, 0, 1, @@ -161,18 +162,18 @@ i915_scanout_layout(struct i915_texture *tex) i915_miptree_set_image_offset(tex, 0, 0, 0, 0); if (pt->width0 >= 240) { - tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); - tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); + tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); tex->hw_tiled = INTEL_TILE_X; } else if (pt->width0 == 64 && pt->height0 == 64) { - tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); - tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); + tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); } else { return FALSE; } debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - pt->width0, pt->height0, pf_get_blocksize(pt->format), + pt->width0, pt->height0, util_format_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -186,7 +187,7 @@ i915_display_target_layout(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4) + if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4) return FALSE; /* fallback to normal textures for small textures */ @@ -199,12 +200,12 @@ i915_display_target_layout(struct i915_texture *tex) 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); - tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); + tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); tex->hw_tiled = INTEL_TILE_X; debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - pt->width0, pt->height0, pf_get_blocksize(pt->format), + pt->width0, pt->height0, util_format_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -217,7 +218,7 @@ i915_miptree_layout_2d(struct i915_texture *tex) unsigned level; unsigned width = pt->width0; unsigned height = pt->height0; - unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0); + unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0); /* used for scanouts that need special layouts */ if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) @@ -229,7 +230,7 @@ i915_miptree_layout_2d(struct i915_texture *tex) if (i915_display_target_layout(tex)) return; - tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); + tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4); tex->total_nblocksy = 0; for (level = 0; level <= pt->last_level; level++) { @@ -242,7 +243,7 @@ i915_miptree_layout_2d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); - nblocksy = pf_get_nblocksy(pt->format, height); + nblocksy = util_format_get_nblocksy(pt->format, height); } } @@ -255,12 +256,12 @@ i915_miptree_layout_3d(struct i915_texture *tex) unsigned width = pt->width0; unsigned height = pt->height0; unsigned depth = pt->depth0; - unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0); + unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0); unsigned stack_nblocksy = 0; /* Calculate the size of a single slice. */ - tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); + tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4); /* XXX: hardware expects/requires 9 levels at minimum. */ @@ -271,7 +272,7 @@ i915_miptree_layout_3d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); - nblocksy = pf_get_nblocksy(pt->format, height); + nblocksy = util_format_get_nblocksy(pt->format, height); } /* Fixup depth image_offsets: @@ -296,14 +297,14 @@ i915_miptree_layout_cube(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; unsigned width = pt->width0, height = pt->height0; - const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0); + const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0); unsigned level; unsigned face; assert(width == height); /* cubemap images are square */ /* double pitch for cube layouts */ - tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4); + tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4); tex->total_nblocksy = nblocks * 4; for (level = 0; level <= pt->last_level; level++) { @@ -366,8 +367,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) unsigned y = 0; unsigned width = pt->width0; unsigned height = pt->height0; - unsigned nblocksx = pf_get_nblocksx(pt->format, pt->width0); - unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0); + unsigned nblocksx = util_format_get_nblocksx(pt->format, pt->width0); + unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0); /* used for scanouts that need special layouts */ if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) @@ -379,7 +380,7 @@ i945_miptree_layout_2d(struct i915_texture *tex) if (i915_display_target_layout(tex)) return; - tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); + tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4); /* May need to adjust pitch to accomodate the placement of * the 2nd mipmap level. This occurs when the alignment @@ -388,11 +389,11 @@ i945_miptree_layout_2d(struct i915_texture *tex) */ if (pt->last_level > 0) { unsigned mip1_nblocksx - = align(pf_get_nblocksx(pt->format, u_minify(width, 1)), align_x) - + pf_get_nblocksx(pt->format, u_minify(width, 2)); + = align(util_format_get_nblocksx(pt->format, u_minify(width, 1)), align_x) + + util_format_get_nblocksx(pt->format, u_minify(width, 2)); if (mip1_nblocksx > nblocksx) - tex->stride = mip1_nblocksx * pf_get_blocksize(pt->format); + tex->stride = mip1_nblocksx * util_format_get_blocksize(pt->format); } /* Pitch must be a whole number of dwords @@ -422,8 +423,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); - nblocksx = pf_get_nblocksx(pt->format, width); - nblocksy = pf_get_nblocksy(pt->format, height); + nblocksx = util_format_get_nblocksx(pt->format, width); + nblocksy = util_format_get_nblocksy(pt->format, height); } } @@ -434,16 +435,16 @@ i945_miptree_layout_3d(struct i915_texture *tex) unsigned width = pt->width0; unsigned height = pt->height0; unsigned depth = pt->depth0; - unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0); + unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0); unsigned pack_x_pitch, pack_x_nr; unsigned pack_y_pitch; unsigned level; - tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); + tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4); tex->total_nblocksy = 0; pack_y_pitch = MAX2(nblocksy, 2); - pack_x_pitch = tex->stride / pf_get_blocksize(pt->format); + pack_x_pitch = tex->stride / util_format_get_blocksize(pt->format); pack_x_nr = 1; for (level = 0; level <= pt->last_level; level++) { @@ -468,7 +469,7 @@ i945_miptree_layout_3d(struct i915_texture *tex) if (pack_x_pitch > 4) { pack_x_pitch >>= 1; pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr * pf_get_blocksize(pt->format) <= tex->stride); + assert(pack_x_pitch * pack_x_nr * util_format_get_blocksize(pt->format) <= tex->stride); } if (pack_y_pitch > 2) { @@ -478,7 +479,7 @@ i945_miptree_layout_3d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); depth = u_minify(depth, 1); - nblocksy = pf_get_nblocksy(pt->format, height); + nblocksy = util_format_get_nblocksy(pt->format, height); } } @@ -488,7 +489,7 @@ i945_miptree_layout_cube(struct i915_texture *tex) struct pipe_texture *pt = &tex->base; unsigned level; - const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0); + const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0); unsigned face; unsigned width = pt->width0; unsigned height = pt->height0; @@ -508,9 +509,9 @@ i945_miptree_layout_cube(struct i915_texture *tex) * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (nblocks > 32) - tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4); + tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4); else - tex->stride = 14 * 8 * pf_get_blocksize(pt->format); + tex->stride = 14 * 8 * util_format_get_blocksize(pt->format); tex->total_nblocksy = nblocks * 4; @@ -840,8 +841,8 @@ i915_transfer_map(struct pipe_screen *screen, return NULL; return map + i915_transfer(transfer)->offset + - transfer->y / pf_get_blockheight(format) * transfer->stride + - transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); + transfer->y / util_format_get_blockheight(format) * transfer->stride + + transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } static void diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index b4aabd4d7cc..b18f17c0cd3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -41,6 +41,7 @@ #include "draw/draw_vertex.h" #include "pipe/p_shader_tokens.h" #include "pipe/p_thread.h" +#include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" #include "lp_bld_debug.h" @@ -166,7 +167,7 @@ shade_quads(struct llvmpipe_context *llvmpipe, assert((y % 2) == 0); depth = llvmpipe->zsbuf_map + y*llvmpipe->zsbuf_transfer->stride + - 2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format); + 2*x*util_format_get_blocksize(llvmpipe->zsbuf_transfer->texture->format); } else depth = NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 9e41bc40745..2c135029ea2 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -69,10 +69,10 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, /* Allocate storage for whole quads. This is particularly important * for depth surfaces, which are currently stored in a swizzled format. */ - nblocksx = pf_get_nblocksx(pt->format, align(width, 2)); - nblocksy = pf_get_nblocksy(pt->format, align(height, 2)); + nblocksx = util_format_get_nblocksx(pt->format, align(width, 2)); + nblocksy = util_format_get_nblocksy(pt->format, align(height, 2)); - lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16); + lpt->stride[level] = align(nblocksx * util_format_get_blocksize(pt->format), 16); lpt->level_offset[level] = buffer_size; @@ -251,11 +251,11 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen, */ if (pt->target == PIPE_TEXTURE_CUBE) { unsigned tex_height = ps->height; - ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; + ps->offset += face * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { unsigned tex_height = ps->height; - ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; + ps->offset += zslice * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; } else { assert(face == 0); @@ -314,11 +314,11 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen, */ if (texture->target == PIPE_TEXTURE_CUBE) { unsigned tex_height = u_minify(texture->height0, level); - lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride; + lpt->offset += face * util_format_get_nblocksy(texture->format, tex_height) * pt->stride; } else if (texture->target == PIPE_TEXTURE_3D) { unsigned tex_height = u_minify(texture->height0, level); - lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride; + lpt->offset += zslice * util_format_get_nblocksy(texture->format, tex_height) * pt->stride; } else { assert(face == 0); @@ -379,8 +379,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, } xfer_map = map + llvmpipe_transfer(transfer)->offset + - transfer->y / pf_get_blockheight(format) * transfer->stride + - transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); + transfer->y / util_format_get_blockheight(format) * transfer->stride + + transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); /*printf("map = %p xfer map = %p\n", map, xfer_map);*/ return xfer_map; } diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 3020806c5d6..12df7fd1997 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -1,5 +1,6 @@ #include "pipe/p_context.h" #include "pipe/p_format.h" +#include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -158,10 +159,10 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, sub_w = MIN2(sub_w, w - x); /* Must be 64-byte aligned */ - assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format)) & 63)); + assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_get_blocksize(dst->texture->format)) & 63)); BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); - OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format), + OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_get_blocksize(dst->texture->format), NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9); @@ -180,7 +181,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, OUT_RING (chan, src_pitch | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); - OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * pf_get_blocksize(src->texture->format), + OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * util_format_get_blocksize(src->texture->format), NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); OUT_RING (chan, 0); } @@ -201,9 +202,9 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, unsigned src_pitch = ((struct nv04_surface *)src)->pitch; unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; unsigned dst_offset = dst->offset + dy * dst_pitch + - dx * pf_get_blocksize(dst->texture->format); + dx * util_format_get_blocksize(dst->texture->format); unsigned src_offset = src->offset + sy * src_pitch + - sx * pf_get_blocksize(src->texture->format); + sx * util_format_get_blocksize(src->texture->format); MARK_RING (chan, 3 + ((h / 2047) + 1) * 9, 2 + ((h / 2047) + 1) * 2); BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); @@ -222,7 +223,7 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR); OUT_RING (chan, src_pitch); OUT_RING (chan, dst_pitch); - OUT_RING (chan, w * pf_get_blocksize(src->texture->format)); + OUT_RING (chan, w * util_format_get_blocksize(src->texture->format)); OUT_RING (chan, count); OUT_RING (chan, 0x0101); OUT_RING (chan, 0); diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index d66d6c6346c..8446073ae80 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index 6a52b6af362..908482ad854 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "nv10_context.h" @@ -23,9 +24,9 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) for (l = 0; l <= pt->last_level; l++) { if (swizzled) - nv10mt->level[l].pitch = pf_get_stride(pt->format, width); + nv10mt->level[l].pitch = util_format_get_stride(pt->format, width); else - nv10mt->level[l].pitch = pf_get_stride(pt->format, pt->width0); + nv10mt->level[l].pitch = util_format_get_stride(pt->format, pt->width0); nv10mt->level[l].pitch = (nv10mt->level[l].pitch + 63) & ~63; nv10mt->level[l].image_offset = diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index 06bb5134173..c664973e904 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index e2e01bd849b..d1291a92e0a 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "nv20_context.h" @@ -27,9 +28,9 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt) for (l = 0; l <= pt->last_level; l++) { if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv20mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); + nv20mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64); else - nv20mt->level[l].pitch = pf_get_stride(pt->format, width); + nv20mt->level[l].pitch = util_format_get_stride(pt->format, width); nv20mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index 26a73c5143a..69b79c809f4 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 920fe64c32f..ce95d9700f6 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "nv30_context.h" @@ -29,9 +30,9 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt) for (l = 0; l <= pt->last_level; l++) { if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv30mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); + nv30mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64); else - nv30mt->level[l].pitch = pf_get_stride(pt->format, width); + nv30mt->level[l].pitch = util_format_get_stride(pt->format, width); nv30mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index e29bfbd3efd..2255a02caed 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index 89ddf373e9e..b974e68a077 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "nv40_context.h" @@ -31,9 +32,9 @@ nv40_miptree_layout(struct nv40_miptree *mt) for (l = 0; l <= pt->last_level; l++) { if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); + mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64); else - mt->level[l].pitch = pf_get_stride(pt->format, width); + mt->level[l].pitch = util_format_get_stride(pt->format, width); mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index ed5be1cf879..b084a38b482 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 9e083b662dd..3f1edf0a139 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -23,6 +23,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "nv50_context.h" @@ -105,10 +106,10 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; - unsigned nblocksy = pf_get_nblocksy(pt->format, height); + unsigned nblocksy = util_format_get_nblocksy(pt->format, height); lvl->image_offset = CALLOC(mt->image_nr, sizeof(int)); - lvl->pitch = align(pf_get_stride(pt->format, width), 64); + lvl->pitch = align(util_format_get_stride(pt->format, width), 64); lvl->tile_mode = get_tile_mode(nblocksy, depth); width = u_minify(width, 1); @@ -130,7 +131,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) unsigned tile_d = get_tile_depth(lvl->tile_mode); size = lvl->pitch; - size *= align(pf_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h); + size *= align(util_format_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h); size *= align(u_minify(pt->depth0, l), tile_d); lvl->image_offset[i] = mt->total_size; @@ -222,7 +223,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ps->offset = lvl->image_offset[img]; if (pt->target == PIPE_TEXTURE_3D) { - unsigned nb_h = pf_get_nblocksy(pt->format, ps->height); + unsigned nb_h = util_format_get_nblocksy(pt->format, ps->height); ps->offset += get_zslice_offset(lvl->tile_mode, zslice, lvl->pitch, nb_h); } diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 6240a0c757a..4d9afa6fedc 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_math.h" #include "nv50_context.h" @@ -140,11 +141,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->nblocksx = pf_get_nblocksx(pt->format, u_minify(pt->width0, level)); - tx->nblocksy = pf_get_nblocksy(pt->format, u_minify(pt->height0, level)); + tx->nblocksx = util_format_get_nblocksx(pt->format, u_minify(pt->width0, level)); + tx->nblocksy = util_format_get_nblocksy(pt->format, u_minify(pt->height0, level)); tx->base.width = w; tx->base.height = h; - tx->base.stride = tx->nblocksx * pf_get_blocksize(pt->format); + tx->base.stride = tx->nblocksx * util_format_get_blocksize(pt->format); tx->base.usage = usage; tx->level_pitch = lvl->pitch; @@ -154,8 +155,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_offset = lvl->image_offset[image]; tx->level_tiling = lvl->tile_mode; tx->level_z = zslice; - tx->level_x = pf_get_nblocksx(pt->format, x); - tx->level_y = pf_get_nblocksy(pt->format, y); + tx->level_x = util_format_get_nblocksx(pt->format, x); + tx->level_y = util_format_get_nblocksy(pt->format, y); ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, tx->nblocksy * tx->base.stride, &tx->bo); if (ret) { @@ -164,8 +165,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, } if (usage & PIPE_TRANSFER_READ) { - nx = pf_get_nblocksx(pt->format, tx->base.width); - ny = pf_get_nblocksy(pt->format, tx->base.height); + nx = util_format_get_nblocksx(pt->format, tx->base.width); + ny = util_format_get_nblocksy(pt->format, tx->base.height); nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, @@ -176,7 +177,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.stride, tx->bo->tile_mode, 0, 0, 0, tx->nblocksx, tx->nblocksy, 1, - pf_get_blocksize(pt->format), nx, ny, + util_format_get_blocksize(pt->format), nx, ny, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART, NOUVEAU_BO_GART); } @@ -191,8 +192,8 @@ nv50_transfer_del(struct pipe_transfer *ptx) struct nv50_miptree *mt = nv50_miptree(ptx->texture); struct pipe_texture *pt = ptx->texture; - unsigned nx = pf_get_nblocksx(pt->format, tx->base.width); - unsigned ny = pf_get_nblocksy(pt->format, tx->base.height); + unsigned nx = util_format_get_nblocksx(pt->format, tx->base.width); + unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height); if (ptx->usage & PIPE_TRANSFER_WRITE) { struct pipe_screen *pscreen = pt->screen; @@ -206,7 +207,7 @@ nv50_transfer_del(struct pipe_transfer *ptx) tx->level_x, tx->level_y, tx->level_z, tx->nblocksx, tx->nblocksy, tx->level_depth, - pf_get_blocksize(pt->format), nx, ny, + util_format_get_blocksize(pt->format), nx, ny, NOUVEAU_BO_GART, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); } diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 52a8388ead3..d7b6511d6d5 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -657,7 +657,7 @@ static boolean r300_validate_aos(struct r300_context *r300) /* Check if formats and strides are aligned to the size of DWORD. */ for (i = 0; i < r300->vertex_element_count; i++) { if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 || - pf_get_blocksize(velem[i].src_format) % 4 != 0) { + util_format_get_blocksize(velem[i].src_format) % 4 != 0) { return FALSE; } } @@ -686,8 +686,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) for (i = 0; i < aos_count - 1; i += 2) { vb1 = &vbuf[velem[i].vertex_buffer_index]; vb2 = &vbuf[velem[i+1].vertex_buffer_index]; - size1 = util_format_get_size(velem[i].src_format); - size2 = util_format_get_size(velem[i+1].src_format); + size1 = util_format_get_blocksize(velem[i].src_format); + size2 = util_format_get_blocksize(velem[i+1].src_format); OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) | R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride)); @@ -697,7 +697,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) if (aos_count & 1) { vb1 = &vbuf[velem[i].vertex_buffer_index]; - size1 = util_format_get_size(velem[i].src_format); + size1 = util_format_get_blocksize(velem[i].src_format); OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride)); OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride); diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index feb571a23dd..a7ef3dbcc29 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -21,6 +21,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_simple_screen.h" @@ -357,8 +358,8 @@ static void* r300_transfer_map(struct pipe_screen* screen, } return map + r300_transfer(transfer)->offset + - transfer->y / pf_get_blockheight(format) * transfer->stride + - transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); + transfer->y / util_format_get_blockheight(format) * transfer->stride + + transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } static void r300_transfer_unmap(struct pipe_screen* screen, diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 170483b9bb0..9a96206a4dc 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -106,7 +106,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) return 0; } - return align(pf_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32); + return align(util_format_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32); } static void r300_setup_miptree(struct r300_texture* tex) @@ -116,7 +116,7 @@ static void r300_setup_miptree(struct r300_texture* tex) int i; for (i = 0; i <= base->last_level; i++) { - unsigned nblocksy = pf_get_nblocksy(base->format, u_minify(base->height0, i)); + unsigned nblocksy = util_format_get_nblocksy(base->format, u_minify(base->height0, i)); stride = r300_texture_get_stride(tex, i); layer_size = stride * nblocksy; @@ -129,7 +129,7 @@ static void r300_setup_miptree(struct r300_texture* tex) tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; tex->layer_size[i] = layer_size; - tex->pitch[i] = stride / pf_get_blocksize(base->format); + tex->pitch[i] = stride / util_format_get_blocksize(base->format); debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", @@ -245,7 +245,7 @@ static struct pipe_texture* tex->tex.screen = screen; tex->stride_override = *stride; - tex->pitch[0] = *stride / pf_get_blocksize(base->format); + tex->pitch[0] = *stride / util_format_get_blocksize(base->format); r300_setup_flags(tex); r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 9e83410fcd0..a9436a33942 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -65,11 +65,11 @@ softpipe_texture_layout(struct pipe_screen *screen, pt->depth0 = depth; for (level = 0; level <= pt->last_level; level++) { - spt->stride[level] = pf_get_stride(pt->format, width); + spt->stride[level] = util_format_get_stride(pt->format, width); spt->level_offset[level] = buffer_size; - buffer_size += (pf_get_nblocksy(pt->format, height) * + buffer_size += (util_format_get_nblocksy(pt->format, height) * ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * spt->stride[level]); @@ -239,11 +239,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen, ps->zslice = zslice; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset += face * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) * + ps->offset += face * util_format_get_nblocksy(pt->format, u_minify(pt->height0, level)) * spt->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset += zslice * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) * + ps->offset += zslice * util_format_get_nblocksy(pt->format, u_minify(pt->height0, level)) * spt->stride[level]; } else { @@ -299,7 +299,7 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, spt = CALLOC_STRUCT(softpipe_transfer); if (spt) { struct pipe_transfer *pt = &spt->base; - int nblocksy = pf_get_nblocksy(texture->format, u_minify(texture->height0, level)); + int nblocksy = util_format_get_nblocksy(texture->format, u_minify(texture->height0, level)); pipe_texture_reference(&pt->texture, texture); pt->x = x; pt->y = y; @@ -376,8 +376,8 @@ softpipe_transfer_map( struct pipe_screen *screen, } xfer_map = map + softpipe_transfer(transfer)->offset + - transfer->y / pf_get_blockheight(format) * transfer->stride + - transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); + transfer->y / util_format_get_blockheight(format) * transfer->stride + + transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); /*printf("map = %p xfer map = %p\n", map, xfer_map);*/ return xfer_map; } diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 49e1ab0ca71..112a6fe0cf3 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -239,7 +239,7 @@ clear_tile(struct softpipe_cached_tile *tile, { uint i, j; - switch (util_format_get_size(format)) { + switch (util_format_get_blocksize(format)) { case 1: memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE); break; diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index ab93dab2239..2224c2d3945 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -159,8 +159,8 @@ svga_transfer_dma_band(struct svga_transfer *st, st->base.x + st->base.width, y + h, st->base.zslice + 1, - pf_get_blocksize(texture->base.format)*8/ - (pf_get_blockwidth(texture->base.format)*pf_get_blockheight(texture->base.format))); + util_format_get_blocksize(texture->base.format)*8/ + (util_format_get_blockwidth(texture->base.format)*util_format_get_blockheight(texture->base.format))); box.x = st->base.x; box.y = y; @@ -210,7 +210,7 @@ svga_transfer_dma(struct svga_transfer *st, } else { unsigned y, h, srcy; - unsigned blockheight = pf_get_blockheight(st->base.texture->format); + unsigned blockheight = util_format_get_blockheight(st->base.texture->format); h = st->hw_nblocksy * blockheight; srcy = 0; for(y = 0; y < st->base.height; y += h) { @@ -772,8 +772,8 @@ svga_get_tex_transfer(struct pipe_screen *screen, struct svga_screen *ss = svga_screen(screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st; - unsigned nblocksx = pf_get_nblocksx(texture->format, w); - unsigned nblocksy = pf_get_nblocksy(texture->format, h); + unsigned nblocksx = util_format_get_nblocksx(texture->format, w); + unsigned nblocksy = util_format_get_nblocksy(texture->format, h); /* We can't map texture storage directly */ if (usage & PIPE_TRANSFER_MAP_DIRECTLY) @@ -787,7 +787,7 @@ svga_get_tex_transfer(struct pipe_screen *screen, st->base.y = y; st->base.width = w; st->base.height = h; - st->base.stride = nblocksx*pf_get_blocksize(texture->format); + st->base.stride = nblocksx*util_format_get_blocksize(texture->format); st->base.usage = usage; st->base.face = face; st->base.level = level; @@ -1071,7 +1071,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture, svga_translate_format(texture->format), stex->handle); - *stride = pf_get_stride(texture->format, texture->width0); + *stride = util_format_get_stride(texture->format, texture->width0); return *buffer != NULL; } diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c index 9e339577c75..44b7ceb4fa4 100644 --- a/src/gallium/drivers/svga/svga_state_vs.c +++ b/src/gallium/drivers/svga/svga_state_vs.c @@ -211,7 +211,7 @@ static int update_zero_stride( struct svga_context *svga, mapped_buffer = pipe_buffer_map_range(svga->pipe.screen, vbuffer->buffer, vel->src_offset, - util_format_get_size(vel->src_format), + util_format_get_blocksize(vel->src_format), PIPE_BUFFER_USAGE_CPU_READ); translate->set_buffer(translate, vel->vertex_buffer_index, mapped_buffer, diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index af1d7f3224e..c31b1d86986 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -26,6 +26,7 @@ **************************************************************************/ +#include "util/u_format.h" #include "util/u_string.h" #include "util/u_memory.h" #include "util/u_simple_list.h" @@ -203,9 +204,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, &t->width0, 1, &t->height0, 1, &t->depth0, 1, - pf_get_blockwidth(t->format), - pf_get_blockheight(t->format), - pf_get_blocksize(t->format), + util_format_get_blockwidth(t->format), + util_format_get_blockheight(t->format), + util_format_get_blocksize(t->format), t->last_level, t->nr_samples, t->tex_usage, @@ -254,11 +255,11 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, rbug_send_texture_read_reply(tr_rbug->con, serial, t->texture->format, - pf_get_blockwidth(t->texture->format), - pf_get_blockheight(t->texture->format), - pf_get_blocksize(t->texture->format), + util_format_get_blockwidth(t->texture->format), + util_format_get_blockheight(t->texture->format), + util_format_get_blocksize(t->texture->format), (uint8_t*)map, - t->stride * pf_get_nblocksy(t->texture->format, t->height), + t->stride * util_format_get_nblocksy(t->texture->format, t->height), t->stride, NULL); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index f69f7da000d..ac20a47af1e 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -25,6 +25,7 @@ * **************************************************************************/ +#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_simple_list.h" @@ -425,7 +426,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen, struct pipe_transfer *transfer = tr_trans->transfer; if(tr_trans->map) { - size_t size = pf_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride; + size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride; trace_dump_call_begin("pipe_screen", "transfer_write"); diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index d334114d62a..6bfff1cc59c 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -174,140 +174,6 @@ enum pipe_format { */ extern const char *pf_name( enum pipe_format format ); -/** - * Return bits for a particular component. - * \param comp component index, starting at 0 - */ -static INLINE uint pf_get_component_bits( enum pipe_format format, uint comp ) -{ - uint size; - - if (pf_swizzle_x(format) == comp) { - size = pf_size_x(format); - } - else if (pf_swizzle_y(format) == comp) { - size = pf_size_y(format); - } - else if (pf_swizzle_z(format) == comp) { - size = pf_size_z(format); - } - else if (pf_swizzle_w(format) == comp) { - size = pf_size_w(format); - } - else { - size = 0; - } - if (pf_layout( format ) == PIPE_FORMAT_LAYOUT_RGBAZS) - return size << pf_exp2( format ); - return size << (pf_mixed_scale8( format ) * 3); -} - - -/** - * Return total bits needed for the pixel format per block. - */ -static INLINE uint pf_get_blocksizebits( enum pipe_format format ) -{ - switch (pf_layout(format)) { - case PIPE_FORMAT_LAYOUT_RGBAZS: - case PIPE_FORMAT_LAYOUT_MIXED: - return - pf_get_component_bits( format, PIPE_FORMAT_COMP_0 ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_1 ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_R ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_G ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_B ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_A ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_S ); - case PIPE_FORMAT_LAYOUT_YCBCR: - assert( format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV ); - return 32; - case PIPE_FORMAT_LAYOUT_DXT: - switch(format) { - case PIPE_FORMAT_DXT1_RGBA: - case PIPE_FORMAT_DXT1_RGB: - case PIPE_FORMAT_DXT1_SRGBA: - case PIPE_FORMAT_DXT1_SRGB: - return 64; - case PIPE_FORMAT_DXT3_RGBA: - case PIPE_FORMAT_DXT5_RGBA: - case PIPE_FORMAT_DXT3_SRGBA: - case PIPE_FORMAT_DXT5_SRGBA: - return 128; - default: - assert( 0 ); - return 0; - } - - default: - assert( 0 ); - return 0; - } -} - -/** - * Return bytes per element for the given format. - */ -static INLINE uint pf_get_blocksize( enum pipe_format format ) -{ - assert(pf_get_blocksizebits(format) % 8 == 0); - return pf_get_blocksizebits(format) / 8; -} - -static INLINE uint pf_get_blockwidth( enum pipe_format format ) -{ - switch (pf_layout(format)) { - case PIPE_FORMAT_LAYOUT_YCBCR: - return 2; - case PIPE_FORMAT_LAYOUT_DXT: - return 4; - default: - return 1; - } -} - -static INLINE uint pf_get_blockheight( enum pipe_format format ) -{ - switch (pf_layout(format)) { - case PIPE_FORMAT_LAYOUT_DXT: - return 4; - default: - return 1; - } -} - -static INLINE unsigned -pf_get_nblocksx(enum pipe_format format, unsigned x) -{ - unsigned blockwidth = pf_get_blockwidth(format); - return (x + blockwidth - 1) / blockwidth; -} - -static INLINE unsigned -pf_get_nblocksy(enum pipe_format format, unsigned y) -{ - unsigned blockheight = pf_get_blockheight(format); - return (y + blockheight - 1) / blockheight; -} - -static INLINE unsigned -pf_get_nblocks(enum pipe_format format, unsigned width, unsigned height) -{ - return pf_get_nblocksx(format, width) * pf_get_nblocksy(format, height); -} - -static INLINE size_t -pf_get_stride(enum pipe_format format, unsigned width) -{ - return pf_get_nblocksx(format, width) * pf_get_blocksize(format); -} - -static INLINE size_t -pf_get_2d_size(enum pipe_format format, size_t stride, unsigned height) -{ - return pf_get_nblocksy(format, height) * stride; -} enum pipe_video_chroma_format { diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index 97ca2afc543..96377414211 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -30,6 +30,7 @@ #include "pipe/p_format.h" #include "pipe/p_state.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_tile.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -461,7 +462,7 @@ st_sample_dxt_pixel_block(enum pipe_format format, for(ch = 0; ch < 4; ++ch) rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f; - memcpy(raw, data[i].raw, pf_get_blocksize(format)); + memcpy(raw, data[i].raw, util_format_get_blocksize(format)); } @@ -473,7 +474,7 @@ st_sample_generic_pixel_block(enum pipe_format format, { unsigned i; unsigned x, y, ch; - int blocksize = pf_get_blocksize(format); + int blocksize = util_format_get_blocksize(format); for(i = 0; i < blocksize; ++i) raw[i] = (uint8_t)st_random(); @@ -548,11 +549,11 @@ st_sample_surface(struct st_surface *surface, float *rgba) if (raw) { enum pipe_format format = texture->format; uint x, y; - int nblocksx = pf_get_nblocksx(format, width); - int nblocksy = pf_get_nblocksy(format, height); - int blockwidth = pf_get_blockwidth(format); - int blockheight = pf_get_blockheight(format); - int blocksize = pf_get_blocksize(format); + int nblocksx = util_format_get_nblocksx(format, width); + int nblocksy = util_format_get_nblocksy(format, height); + int blockwidth = util_format_get_blockwidth(format); + int blockheight = util_format_get_blockheight(format); + int blocksize = util_format_get_blocksize(format); for (y = 0; y < nblocksy; ++y) { diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index b8535a4217b..a3294e877a6 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -169,8 +169,8 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys, const unsigned alignment = 64; unsigned nblocksy; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 6fd402cee4a..7106a06492d 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -247,7 +247,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen, return false; *handle = mt->bo->handle; - *stride = pf_get_stride(mt->base.format, mt->base.width0); + *stride = util_format_get_stride(mt->base.format, mt->base.width0); return true; } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 76acc99ad73..dfecb8a728f 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -35,6 +35,7 @@ #include "radeon_bo_gem.h" #include "softpipe/sp_texture.h" #include "r300_context.h" +#include "util/u_format.h" #include "util/u_math.h" #include @@ -121,8 +122,8 @@ static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws, const unsigned alignment = 64; unsigned nblocksy, size; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); size = *stride * nblocksy; return radeon_buffer_create(ws, 64, usage, size); diff --git a/src/gallium/winsys/egl_xlib/sw_winsys.c b/src/gallium/winsys/egl_xlib/sw_winsys.c index a36a9e52a65..6ee3ede38cb 100644 --- a/src/gallium/winsys/egl_xlib/sw_winsys.c +++ b/src/gallium/winsys/egl_xlib/sw_winsys.c @@ -163,8 +163,8 @@ surface_buffer_create(struct pipe_winsys *winsys, const unsigned alignment = 64; unsigned nblocksy; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 3fc44925a8f..f15bcd37b50 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -141,8 +141,8 @@ static struct pipe_buffer* xsp_surface_buffer_create const unsigned int ALIGNMENT = 1; unsigned nblocksy; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), ALIGNMENT); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), ALIGNMENT); return pws->buffer_create(pws, ALIGNMENT, usage, *stride * nblocksy); diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c index 71223650279..7d076be3a31 100644 --- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c @@ -137,8 +137,8 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys, gdt->width = width; gdt->height = height; - bpp = util_format_get_bits(format); - cpp = util_format_get_size(format); + bpp = util_format_get_blocksizebits(format); + cpp = util_format_get_blocksize(format); gdt->stride = align(width * cpp, alignment); gdt->size = gdt->stride * height; diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index 40f612e8931..2ad794c3f0f 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -163,8 +163,8 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys, const unsigned alignment = 64; unsigned nblocksy; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, @@ -271,10 +271,10 @@ gdi_softpipe_present(struct pipe_screen *screen, memset(&bmi, 0, sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = texture->stride[surface->level] / util_format_get_size(surface->format); + bmi.bmiHeader.biWidth = texture->stride[surface->level] / util_format_get_blocksize(surface->format); bmi.bmiHeader.biHeight= -(long)surface->height; bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = util_format_get_bits(surface->format); + bmi.bmiHeader.biBitCount = util_format_get_blocksizebits(surface->format); bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = 0; bmi.bmiHeader.biXPelsPerMeter = 0; diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c index cd838e73227..47ae0519a4b 100644 --- a/src/gallium/winsys/xlib/xlib_cell.c +++ b/src/gallium/winsys/xlib/xlib_cell.c @@ -289,8 +289,8 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, const unsigned alignment = 64; unsigned nblocksy; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/xlib/xlib_llvmpipe.c index d96311e4520..2a434b5fd21 100644 --- a/src/gallium/winsys/xlib/xlib_llvmpipe.c +++ b/src/gallium/winsys/xlib/xlib_llvmpipe.c @@ -262,10 +262,10 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer, { if (xm_dt->tempImage == NULL) { - assert(pf_get_blockwidth(xm_dt->format) == 1); - assert(pf_get_blockheight(xm_dt->format) == 1); + assert(util_format_get_blockwidth(xm_dt->format) == 1); + assert(util_format_get_blockheight(xm_dt->format) == 1); alloc_shm_ximage(xm_dt, xm_buffer, - xm_dt->stride / pf_get_blocksize(xm_dt->format), + xm_dt->stride / util_format_get_blocksize(xm_dt->format), xm_dt->height); } @@ -331,8 +331,8 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys, xm_dt->width = width; xm_dt->height = height; - nblocksy = pf_get_nblocksy(format, height); - xm_dt->stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + xm_dt->stride = align(util_format_get_stride(format, width), alignment); size = xm_dt->stride * nblocksy; #ifdef USE_XSHM diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 48cee0a41dc..f7c0099584e 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -255,10 +255,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, { if (xm_buf->tempImage == NULL) { - assert(pf_get_blockwidth(surf->texture->format) == 1); - assert(pf_get_blockheight(surf->texture->format) == 1); + assert(util_format_get_blockwidth(surf->texture->format) == 1); + assert(util_format_get_blockheight(surf->texture->format) == 1); alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] / - pf_get_blocksize(surf->texture->format), surf->height); + util_format_get_blocksize(surf->texture->format), surf->height); } ximage = xm_buf->tempImage; @@ -363,8 +363,8 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, const unsigned alignment = 64; unsigned nblocksy, size; - nblocksy = pf_get_nblocksy(format, height); - *stride = align(pf_get_stride(format, width), alignment); + nblocksy = util_format_get_nblocksy(format, height); + *stride = align(util_format_get_stride(format, width), alignment); size = *stride * nblocksy; #ifdef USE_XSHM diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c61c77479e0..7c664267d4e 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -857,8 +857,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, usage, dstx, dsty, width, height); - assert(pf_get_blockwidth(ptDraw->texture->format) == 1); - assert(pf_get_blockheight(ptDraw->texture->format) == 1); + assert(util_format_get_blockwidth(ptDraw->texture->format) == 1); + assert(util_format_get_blockheight(ptDraw->texture->format) == 1); /* map the stencil buffer */ drawMap = screen->transfer_map(screen, ptDraw); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 78aed07bf91..45ce34a85f7 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -105,8 +105,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, assert(strb->format != PIPE_FORMAT_NONE); - strb->stride = pf_get_stride(strb->format, width); - size = pf_get_2d_size(strb->format, strb->stride, height); + strb->stride = util_format_get_stride(strb->format, width); + size = util_format_get_2d_size(strb->format, strb->stride, height); strb->data = _mesa_malloc(size); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 000e6eb2a5d..6e1ecb1c502 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -833,7 +833,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, /* copy/pack data into user buffer */ if (st_equal_formats(stImage->pt->format, format, type)) { /* memcpy */ - const uint bytesPerRow = width * util_format_get_size(stImage->pt->format); + const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format); ubyte *map = screen->transfer_map(screen, tex_xfer); GLuint row; for (row = 0; row < height; row++) { @@ -915,7 +915,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, PIPE_TRANSFER_READ, 0, 0, stImage->base.Width, stImage->base.Height); - texImage->RowStride = stImage->transfer->stride / pf_get_blocksize(stImage->pt->format); + texImage->RowStride = stImage->transfer->stride / util_format_get_blocksize(stImage->pt->format); } else { /* Otherwise, the image should actually be stored in @@ -1178,7 +1178,7 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, xoffset, yoffset, width, height); - srcBlockStride = pf_get_stride(pformat, width); + srcBlockStride = util_format_get_stride(pformat, width); dstBlockStride = stImage->transfer->stride; } else { assert(stImage->pt); @@ -1192,16 +1192,16 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, return; } - assert(xoffset % pf_get_blockwidth(pformat) == 0); - assert(yoffset % pf_get_blockheight(pformat) == 0); - assert(width % pf_get_blockwidth(pformat) == 0); - assert(height % pf_get_blockheight(pformat) == 0); + assert(xoffset % util_format_get_blockwidth(pformat) == 0); + assert(yoffset % util_format_get_blockheight(pformat) == 0); + assert(width % util_format_get_blockwidth(pformat) == 0); + assert(height % util_format_get_blockheight(pformat) == 0); - for (y = 0; y < height; y += pf_get_blockheight(pformat)) { + for (y = 0; y < height; y += util_format_get_blockheight(pformat)) { /* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */ - const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(pformat, y); - char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(pformat, y); - memcpy(dst, src, pf_get_stride(pformat, width)); + const char *src = (const char*)data + srcBlockStride * util_format_get_nblocksy(pformat, y); + char *dst = (char*)texImage->Data + dstBlockStride * util_format_get_nblocksy(pformat, y); + memcpy(dst, src, util_format_get_stride(pformat, width)); } if (stImage->pt) { @@ -1691,10 +1691,10 @@ copy_image_data_to_texture(struct st_context *st, dstLevel, stImage->base.Data, stImage->base.RowStride * - pf_get_blocksize(stObj->pt->format), + util_format_get_blocksize(stObj->pt->format), stImage->base.RowStride * stImage->base.Height * - pf_get_blocksize(stObj->pt->format)); + util_format_get_blocksize(stObj->pt->format)); _mesa_align_free(stImage->base.Data); stImage->base.Data = NULL; } diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 77005518302..5a433dd7b90 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -37,6 +37,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_format.h" #include "util/u_gen_mipmap.h" #include "util/u_math.h" @@ -146,8 +147,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); - srcStride = srcTrans->stride / pf_get_blocksize(srcTrans->texture->format); - dstStride = dstTrans->stride / pf_get_blocksize(dstTrans->texture->format); + srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format); + dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format); _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, -- cgit v1.2.3 From 263f4322e7bfa03a6c025dbc2b280e7f60e2cab1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 18 Dec 2009 08:12:55 -0700 Subject: progs/demos: fix glut initialization calls Remove glutInitWindowPosition() calls to play nicer with window managers. Move glutInitWindowSize() calls before glutInit() so the the default window size can be overridden by the -geometry cmd line option. --- progs/demos/arbfplight.c | 3 +-- progs/demos/arbfslight.c | 3 +-- progs/demos/arbocclude.c | 3 +-- progs/demos/bounce.c | 4 +--- progs/demos/clearspd.c | 3 +-- progs/demos/copypix.c | 7 +++---- progs/demos/cubemap.c | 3 +-- progs/demos/drawpix.c | 7 +++---- progs/demos/engine.c | 2 +- progs/demos/fbo_firecube.c | 2 +- progs/demos/fire.c | 1 - progs/demos/fogcoord.c | 2 +- progs/demos/fplight.c | 3 +-- progs/demos/fslight.c | 3 +-- progs/demos/gamma.c | 5 +---- progs/demos/gearbox.c | 2 +- progs/demos/gears.c | 4 +--- progs/demos/geartrain.c | 13 ++++++------- progs/demos/gloss.c | 2 +- progs/demos/gltestperf.c | 3 +-- progs/demos/ipers.c | 1 - progs/demos/isosurf.c | 3 +-- progs/demos/lodbias.c | 3 +-- progs/demos/morph3d.c | 3 +-- progs/demos/multiarb.c | 3 +-- progs/demos/paltex.c | 5 +---- progs/demos/pointblast.c | 4 ++-- progs/demos/projtex.c | 9 ++++----- progs/demos/ray.c | 1 - progs/demos/readpix.c | 5 ++--- progs/demos/renormal.c | 5 +---- progs/demos/shadowtex.c | 3 +-- progs/demos/spectex.c | 6 +----- progs/demos/spriteblast.c | 4 ++-- progs/demos/teapot.c | 1 - progs/demos/terrain.c | 1 - progs/demos/tessdemo.c | 3 +-- progs/demos/texcyl.c | 4 +--- progs/demos/texenv.c | 3 +-- progs/demos/textures.c | 3 +-- progs/demos/trispd.c | 7 ++----- progs/demos/tunnel.c | 1 - progs/demos/tunnel2.c | 1 - progs/demos/vao_demo.c | 3 +-- progs/demos/winpos.c | 3 +-- 45 files changed, 54 insertions(+), 106 deletions(-) (limited to 'progs') diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c index 7b7a12bf88d..861b3b72522 100644 --- a/progs/demos/arbfplight.c +++ b/progs/demos/arbfplight.c @@ -388,9 +388,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 200, 200 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); diff --git a/progs/demos/arbfslight.c b/progs/demos/arbfslight.c index 275c85105ed..a0ce7f3f5bc 100644 --- a/progs/demos/arbfslight.c +++ b/progs/demos/arbfslight.c @@ -311,9 +311,8 @@ static void Init (void) int main (int argc, char *argv[]) { - glutInit (&argc, argv); - glutInitWindowPosition ( 0, 0); glutInitWindowSize (200, 200); + glutInit (&argc, argv); glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow (argv[0]); glutReshapeFunc (Reshape); diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c index 9188ad5a565..f669a1f26ba 100644 --- a/progs/demos/arbocclude.c +++ b/progs/demos/arbocclude.c @@ -268,9 +268,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 400, 400 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/bounce.c b/progs/demos/bounce.c index 436bc7d1fb8..a9a291e0a6f 100644 --- a/progs/demos/bounce.c +++ b/progs/demos/bounce.c @@ -192,10 +192,8 @@ visible(int vis) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(600, 450); - + glutInit(&argc, argv); IndexMode = argc > 1 && strcmp(argv[1], "-ci") == 0; if (IndexMode) diff --git a/progs/demos/clearspd.c b/progs/demos/clearspd.c index 42953f6675e..c40f118a64b 100644 --- a/progs/demos/clearspd.c +++ b/progs/demos/clearspd.c @@ -187,9 +187,8 @@ int main( int argc, char *argv[] ) Init( argc, argv ); - glutInit( &argc, argv ); glutInitWindowSize( (int) Width, (int) Height ); - glutInitWindowPosition( 0, 0 ); + glutInit( &argc, argv ); mode = ColorMode | GLUT_DOUBLE; if (BufferMask & GL_STENCIL_BUFFER_BIT) diff --git a/progs/demos/copypix.c b/progs/demos/copypix.c index a13339ea62f..98c835f44f8 100644 --- a/progs/demos/copypix.c +++ b/progs/demos/copypix.c @@ -237,6 +237,9 @@ int main( int argc, char *argv[] ) const char *filename = IMAGE_FILE; int i = 1; + glutInitWindowSize( WinWidth, WinHeight ); + glutInit( &argc, argv ); + if (argc > i && strcmp(argv[i], "-ci")==0) { ciMode = GL_TRUE; i++; @@ -245,10 +248,6 @@ int main( int argc, char *argv[] ) filename = argv[i]; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( WinWidth, WinHeight ); - if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/cubemap.c b/progs/demos/cubemap.c index 20332b1d960..3e79d6a5589 100644 --- a/progs/demos/cubemap.c +++ b/progs/demos/cubemap.c @@ -613,9 +613,8 @@ static void parse_args(int argc, char *argv[]) int main( int argc, char *argv[] ) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(600, 500); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); glutCreateWindow("Texture Cube Mapping"); glewInit(); diff --git a/progs/demos/drawpix.c b/progs/demos/drawpix.c index 5490bcc6355..9bc7086e04b 100644 --- a/progs/demos/drawpix.c +++ b/progs/demos/drawpix.c @@ -328,6 +328,9 @@ int main( int argc, char *argv[] ) const char *filename = IMAGE_FILE; int i = 1; + glutInitWindowSize( 500, 400 ); + glutInit( &argc, argv ); + if (argc > i && strcmp(argv[i], "-ci")==0) { ciMode = GL_TRUE; i++; @@ -336,10 +339,6 @@ int main( int argc, char *argv[] ) filename = argv[i]; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 500, 400 ); - if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/engine.c b/progs/demos/engine.c index 3cf311e7782..c54e3b8fb80 100644 --- a/progs/demos/engine.c +++ b/progs/demos/engine.c @@ -1308,8 +1308,8 @@ Init(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); glutInitWindowSize(WinWidth, WinHeight); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("OpenGL Engine Demo"); glewInit(); diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c index b3f7e00e5af..17767a148f9 100644 --- a/progs/demos/fbo_firecube.c +++ b/progs/demos/fbo_firecube.c @@ -1051,11 +1051,11 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(WinWidth, WinHeight); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(WinWidth, WinHeight); Win = glutCreateWindow("fbo_firecube"); glewInit(); init(argc, argv); diff --git a/progs/demos/fire.c b/progs/demos/fire.c index dd70f6141db..3db45418fad 100644 --- a/progs/demos/fire.c +++ b/progs/demos/fire.c @@ -733,7 +733,6 @@ main(int ac, char **av) HEIGHT = atoi(av[3]); } - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c index 7d5c11aabf3..336aa580755 100644 --- a/progs/demos/fogcoord.c +++ b/progs/demos/fogcoord.c @@ -404,8 +404,8 @@ Init(void) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize( 600, 600 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/fplight.c b/progs/demos/fplight.c index c297354103f..f52a4f78686 100644 --- a/progs/demos/fplight.c +++ b/progs/demos/fplight.c @@ -268,9 +268,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 200, 200 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index acba3e9583f..395b7caa2c1 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -600,9 +600,8 @@ ParseOptions(int argc, char *argv[]) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition( 0, 0); glutInitWindowSize(200, 200); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); diff --git a/progs/demos/gamma.c b/progs/demos/gamma.c index 9b2c3e1052b..61c6d125fbe 100644 --- a/progs/demos/gamma.c +++ b/progs/demos/gamma.c @@ -146,12 +146,9 @@ display(void) int main(int argc, char **argv) { + glutInitWindowSize(500, 400); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); - - glutInitWindowPosition(50, 50); - glutInitWindowSize(500, 400); - glutCreateWindow("gamma test patterns"); glutReshapeFunc(Reshape); glutDisplayFunc(display); diff --git a/progs/demos/gearbox.c b/progs/demos/gearbox.c index 2dcf32f92ff..71d0281904b 100644 --- a/progs/demos/gearbox.c +++ b/progs/demos/gearbox.c @@ -474,10 +474,10 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(WinWidth, WinHeight); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(WinWidth, WinHeight); Win = glutCreateWindow("gearbox"); init(argc, argv); diff --git a/progs/demos/gears.c b/progs/demos/gears.c index 6016162d6f7..31a5b79eab9 100644 --- a/progs/demos/gears.c +++ b/progs/demos/gears.c @@ -385,11 +385,9 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(300, 300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - - glutInitWindowPosition(0, 0); - glutInitWindowSize(300, 300); win = glutCreateWindow("Gears"); init(argc, argv); diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c index 8fe405e8076..d2a195f39a2 100644 --- a/progs/demos/geartrain.c +++ b/progs/demos/geartrain.c @@ -1049,19 +1049,18 @@ main (int argc, char *argv[]) { char *file; - if (argc < 2) - file = "geartrain.dat"; - else - file = argv[1]; - - glutInit(&argc, argv); - glutInitWindowPosition (0, 0); glutInitWindowSize(640,480); + glutInit(&argc, argv); glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); if (glutCreateWindow ("Gear Train Simulation") == GL_FALSE) exit (1); + if (argc < 2) + file = "geartrain.dat"; + else + file = argv[1]; + getdata (file); process (); init (); diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c index 69694b23a09..578736b4e27 100644 --- a/progs/demos/gloss.c +++ b/progs/demos/gloss.c @@ -436,8 +436,8 @@ static void Init( int argc, char *argv[] ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize(WinWidth, WinHeight); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutCreateWindow(argv[0] ); glewInit(); diff --git a/progs/demos/gltestperf.c b/progs/demos/gltestperf.c index 2188b024192..3658a395988 100644 --- a/progs/demos/gltestperf.c +++ b/progs/demos/gltestperf.c @@ -569,10 +569,9 @@ main(int ac, char **av) if (ac == 2) frontbuffer = 0; + glutInitWindowSize(640, 480); glutInit(&ac, av); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowPosition(0, 0); - glutInitWindowSize(640, 480); glutCreateWindow("OpenGL/Mesa Performances"); glutDisplayFunc(display); glutMainLoop(); diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index ed03673cb62..265378b90a9 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -682,7 +682,6 @@ main(int ac, char **av) fprintf(stderr, "IperS V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 2e9dff17261..56781f68189 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -1061,9 +1061,8 @@ int main(int argc, char **argv) read_surface( "isosurf.dat" ); - glutInit( &argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(400, 400); + glutInit( &argc, argv); type = GLUT_DEPTH; type |= GLUT_RGB; diff --git a/progs/demos/lodbias.c b/progs/demos/lodbias.c index 8d39bd605a7..23488b1616e 100644 --- a/progs/demos/lodbias.c +++ b/progs/demos/lodbias.c @@ -282,9 +282,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 350, 350 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c index 01a06aba0ff..0f8ac426f33 100644 --- a/progs/demos/morph3d.c +++ b/progs/demos/morph3d.c @@ -841,9 +841,8 @@ int main(int argc, char **argv) object=1; - glutInit(&argc, argv); - glutInitWindowPosition(0,0); glutInitWindowSize(640,480); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c index 3d89d3a13e9..82796a0c3f4 100644 --- a/progs/demos/multiarb.c +++ b/progs/demos/multiarb.c @@ -338,9 +338,8 @@ int main( int argc, char *argv[] ) { GLint i; - glutInit( &argc, argv ); glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutCreateWindow(argv[0] ); glewInit(); diff --git a/progs/demos/paltex.c b/progs/demos/paltex.c index d0cbcfb5e9a..5d4b8662b5c 100644 --- a/progs/demos/paltex.c +++ b/progs/demos/paltex.c @@ -248,12 +248,9 @@ static void Init2( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 400, 300 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/pointblast.c b/progs/demos/pointblast.c index 2d70b725894..b4d0a67f993 100644 --- a/progs/demos/pointblast.c +++ b/progs/demos/pointblast.c @@ -427,10 +427,10 @@ int main(int argc, char **argv) { int i; + + glutInitWindowSize(300, 300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); - glutInitWindowPosition(0, 0); - glutInitWindowSize(300, 300); for (i=1; i 1) { NumTextures = atoi(argv[1]); } assert(NumTextures <= MAX_TEX); - glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(500,500); - (void) glutCreateWindow("projtex"); - glewInit(); - loadTexture = loadImageTextures; drawObject = drawCube; initialize(); diff --git a/progs/demos/ray.c b/progs/demos/ray.c index e9211aa3399..9cc464d2390 100644 --- a/progs/demos/ray.c +++ b/progs/demos/ray.c @@ -856,7 +856,6 @@ main(int ac, char **av) } */ - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index bbb3a68effa..05f89bb53ea 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -382,12 +382,11 @@ int main( int argc, char *argv[] ) { GLboolean ciMode = GL_FALSE; + glutInitWindowSize( 750, 250 ); + glutInit( &argc, argv ); if (argc > 1 && strcmp(argv[1], "-ci")==0) { ciMode = GL_TRUE; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 750, 250 ); if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/renormal.c b/progs/demos/renormal.c index 9e5da95484c..61dd860ddbe 100644 --- a/progs/demos/renormal.c +++ b/progs/demos/renormal.c @@ -112,12 +112,9 @@ key(unsigned char k, int x, int y) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); Init(); diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c index dc5a4bbc480..036f73d40b6 100644 --- a/progs/demos/shadowtex.c +++ b/progs/demos/shadowtex.c @@ -1022,9 +1022,8 @@ PrintHelp(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(WindowWidth, WindowHeight); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL); glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/spectex.c b/progs/demos/spectex.c index 6ab1191579c..c1dada9d634 100644 --- a/progs/demos/spectex.c +++ b/progs/demos/spectex.c @@ -239,13 +239,9 @@ static void ModeMenu(int entry) int main( int argc, char *argv[] ) { - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 300, 300 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow( "spectex" ); Init(); diff --git a/progs/demos/spriteblast.c b/progs/demos/spriteblast.c index d73b680b791..36e226e1d07 100644 --- a/progs/demos/spriteblast.c +++ b/progs/demos/spriteblast.c @@ -493,6 +493,8 @@ int main(int argc, char **argv) { int i; + + glutInitWindowSize(600,300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); @@ -506,8 +508,6 @@ main(int argc, char **argv) linearFiltering = 0; } } - glutInitWindowPosition(0, 0); - glutInitWindowSize(600,300); glutCreateWindow("sprite blast"); glewInit(); glutReshapeFunc(reshape); diff --git a/progs/demos/teapot.c b/progs/demos/teapot.c index 6bf6e064095..04a675f36e6 100644 --- a/progs/demos/teapot.c +++ b/progs/demos/teapot.c @@ -638,7 +638,6 @@ int main(int ac, char **av) } */ - glutInitWindowPosition(0,0); glutInitWindowSize(WIDTH,HEIGHT); glutInit(&ac,av); diff --git a/progs/demos/terrain.c b/progs/demos/terrain.c index be78ea4950f..627c3bfb57a 100644 --- a/progs/demos/terrain.c +++ b/progs/demos/terrain.c @@ -623,7 +623,6 @@ init(void) int main(int ac, char **av) { - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/tessdemo.c b/progs/demos/tessdemo.c index f71cea12744..8b988e36c13 100644 --- a/progs/demos/tessdemo.c +++ b/progs/demos/tessdemo.c @@ -503,10 +503,9 @@ int main( int argc, char **argv ) usage(); + glutInitWindowSize( 400, 400 ); glutInit( &argc, argv ); glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); - glutInitWindowPosition(0, 0); - glutInitWindowSize( 400, 400 ); glutCreateWindow( argv[0] ); /* GH: Bit of a hack... diff --git a/progs/demos/texcyl.c b/progs/demos/texcyl.c index 0e6089bced5..4df97ec4f50 100644 --- a/progs/demos/texcyl.c +++ b/progs/demos/texcyl.c @@ -261,10 +261,8 @@ static void Init( int argc, char *argv[] ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize( 400, 400 ); - glutInitWindowPosition( 0, 0 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); Win = glutCreateWindow(argv[0] ); diff --git a/progs/demos/texenv.c b/progs/demos/texenv.c index c5a8b13f35f..260ca8718f0 100644 --- a/progs/demos/texenv.c +++ b/progs/demos/texenv.c @@ -765,6 +765,7 @@ int main( int argc, char *argv[] ) GLboolean info = GL_FALSE; int i; + glutInitWindowSize( winWidth, winHeight ); glutInit( &argc, argv ); for ( i = 1 ; i < argc ; i++ ) { @@ -786,8 +787,6 @@ int main( int argc, char *argv[] ) glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); } - glutInitWindowSize( winWidth, winHeight ); - glutInitWindowPosition( 0, 0 ); Win = glutCreateWindow( "Texture Environment Test" ); initialize(); diff --git a/progs/demos/textures.c b/progs/demos/textures.c index d94154a2008..773d7378b19 100644 --- a/progs/demos/textures.c +++ b/progs/demos/textures.c @@ -356,9 +356,8 @@ Usage(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(700, 700); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); diff --git a/progs/demos/trispd.c b/progs/demos/trispd.c index 165d088e3d3..c07c3409472 100644 --- a/progs/demos/trispd.c +++ b/progs/demos/trispd.c @@ -227,15 +227,12 @@ static void Help( const char *program ) int main( int argc, char *argv[] ) { - printf("For options: %s -help\n", argv[0]); - glutInit( &argc, argv ); glutInitWindowSize( (int) Width, (int) Height ); - glutInitWindowPosition( 0, 0 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow( argv[0] ); + printf("For options: %s -help\n", argv[0]); if (argc==2 && strcmp(argv[1],"-help")==0) { Help(argv[0]); return 0; diff --git a/progs/demos/tunnel.c b/progs/demos/tunnel.c index 6981da32988..efc007c79aa 100644 --- a/progs/demos/tunnel.c +++ b/progs/demos/tunnel.c @@ -491,7 +491,6 @@ main(int ac, char **av) fprintf(stderr, "Tunnel V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/tunnel2.c b/progs/demos/tunnel2.c index 0288ea0f8ce..f15da95b18b 100644 --- a/progs/demos/tunnel2.c +++ b/progs/demos/tunnel2.c @@ -559,7 +559,6 @@ main(int ac, char **av) fprintf(stderr, "Tunnel2 V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTHC0, HEIGHTC0); glutInit(&ac, av); diff --git a/progs/demos/vao_demo.c b/progs/demos/vao_demo.c index 206e06fc6c7..5ce07ecc63b 100644 --- a/progs/demos/vao_demo.c +++ b/progs/demos/vao_demo.c @@ -317,9 +317,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( Width, Height ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow( "GL_APPLE_vertex_array_object demo" ); glutReshapeFunc( Reshape ); diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c index 13a9c7e9a8f..f935f9bee0f 100644 --- a/progs/demos/winpos.c +++ b/progs/demos/winpos.c @@ -96,9 +96,8 @@ static void init( void ) int main( int argc, char *argv[] ) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(500, 500); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB ); if (glutCreateWindow("winpos") <= 0) { -- cgit v1.2.3 From 41377942d321c6ff858a81241f01f9c15f9ca347 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 18 Dec 2009 23:34:28 -0800 Subject: progs/demos: Use C-style comment. --- progs/demos/textures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/demos/textures.c b/progs/demos/textures.c index b7bf135d219..31e1bbb3db0 100644 --- a/progs/demos/textures.c +++ b/progs/demos/textures.c @@ -57,7 +57,7 @@ Idle(void) { Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02; Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04; - //Zrot += 2.0; + /* Zrot += 2.0; */ glutPostRedisplay(); } -- cgit v1.2.3 From 121ff55d81f3bff1c298ed84b2dc2d82fd572b0e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 18 Dec 2009 23:38:15 -0800 Subject: progs/glsl: Use C-style comments. --- progs/glsl/shtest.c | 2 +- progs/glsl/texaaline.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'progs') diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 628a7dd5b98..88315d74614 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -627,7 +627,7 @@ Init(void) NumAttribs = GetAttribs(Program, Attribs); PrintAttribs(Attribs); - //assert(glGetError() == 0); + /* assert(glGetError() == 0); */ glClearColor(0.4f, 0.4f, 0.8f, 0.0f); diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c index 2e4f932ad60..00edab73108 100644 --- a/progs/glsl/texaaline.c +++ b/progs/glsl/texaaline.c @@ -310,8 +310,8 @@ MakeMipmap(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); - ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); */ + /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); */ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); #undef SZ -- cgit v1.2.3 From 695adf41e24a16599e004fe539928ab04a9fa62e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 18 Dec 2009 23:46:14 -0800 Subject: progs/demos: Silence compiler warning in morph3d.c. --- progs/demos/morph3d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c index 6aca8270ff5..70b90d733f9 100644 --- a/progs/demos/morph3d.c +++ b/progs/demos/morph3d.c @@ -887,5 +887,5 @@ int main(int argc, char **argv) glutIdleFunc( idle_ ); glutDisplayFunc( draw ); glutMainLoop(); - + return 0; } -- cgit v1.2.3 From 3340fd65fba8bbd426c5e0b74b1d8f1592b36499 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 19 Dec 2009 00:00:56 -0800 Subject: progs/xdemos: Use C-style comment. --- progs/xdemos/corender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c index 1b18d9f54e7..640c902c136 100644 --- a/progs/xdemos/corender.c +++ b/progs/xdemos/corender.c @@ -187,7 +187,7 @@ redraw(Display *dpy) * Without this glClear(), depth buffer for the second process * is pretty much broken. */ - //glClear(GL_DEPTH_BUFFER_BIT); + /* glClear(GL_DEPTH_BUFFER_BIT); */ glPushMatrix(); glTranslatef(1, 0, 0); -- cgit v1.2.3 From d87d71036cf546488981d3bd174fde967533bad2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 19 Dec 2009 00:28:01 -0800 Subject: progs/trivial: Use C-style comments. --- progs/trivial/clear-fbo-tex.c | 4 ++-- progs/trivial/createwin.c | 2 +- progs/trivial/dlist-begin-call-end.c | 2 +- progs/trivial/draw2arrays.c | 2 +- progs/trivial/drawarrays.c | 2 +- progs/trivial/tri-fp.c | 2 +- progs/trivial/tri-logicop-none.c | 2 +- progs/trivial/tri-logicop-xor.c | 2 +- progs/trivial/vbo-drawarrays.c | 2 +- progs/trivial/vbo-noninterleaved.c | 4 ++-- 10 files changed, 12 insertions(+), 12 deletions(-) (limited to 'progs') diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index 238f634bf59..ff31706fd1c 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -102,8 +102,8 @@ static void Draw( void ) /* draw to texture image */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); -// glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); -// glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + /* glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); */ + /* glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); */ glViewport(0, 0, TexWidth, TexHeight); diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c index 04a088642b8..93da30ee294 100644 --- a/progs/trivial/createwin.c +++ b/progs/trivial/createwin.c @@ -116,6 +116,6 @@ int main(int argc, char **argv) glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Draw); -// glutMainLoop(); + /* glutMainLoop(); */ return 0; } diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c index da3864a02a4..dbfaef3978f 100644 --- a/progs/trivial/dlist-begin-call-end.c +++ b/progs/trivial/dlist-begin-call-end.c @@ -49,7 +49,7 @@ static void Init(void) */ first_list = glGenLists(1); glNewList(first_list, GL_COMPILE); -// glColor3f(0,1,0); + /* glColor3f(0,1,0); */ glEndList(); diff --git a/progs/trivial/draw2arrays.c b/progs/trivial/draw2arrays.c index 95a89981d3a..2345ae9e9ed 100644 --- a/progs/trivial/draw2arrays.c +++ b/progs/trivial/draw2arrays.c @@ -66,7 +66,7 @@ static void Display( void ) glEnable(GL_VERTEX_PROGRAM_ARB); -// glDrawArrays( GL_TRIANGLES, 0, 3 ); + /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ glDrawArrays( GL_TRIANGLES, 1, 3 ); glFlush(); diff --git a/progs/trivial/drawarrays.c b/progs/trivial/drawarrays.c index 27d86682f75..f5c0a50f9a9 100644 --- a/progs/trivial/drawarrays.c +++ b/progs/trivial/drawarrays.c @@ -77,7 +77,7 @@ static void Display( void ) glEnable(GL_VERTEX_PROGRAM_ARB); -// glDrawArrays( GL_TRIANGLES, 0, 3 ); + /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ glDrawArrays( GL_TRIANGLES, 1, 3 ); glFlush(); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index 8f933befd3d..6ecfef4d2ac 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -42,7 +42,7 @@ static void Init(void) static const char *prog1 = "!!ARBfp1.0\n" "MOV result.color, fragment.texcoord[1];\n" -// "MOV result.color, fragment.color;\n" + /* "MOV result.color, fragment.color;\n" */ "END\n"; diff --git a/progs/trivial/tri-logicop-none.c b/progs/trivial/tri-logicop-none.c index 53c2614ac32..2b6a3d6f5c8 100644 --- a/progs/trivial/tri-logicop-none.c +++ b/progs/trivial/tri-logicop-none.c @@ -101,7 +101,7 @@ static void Draw(void) glVertex3f( 0.5, -0.5, -30.0); glEnd(); -// glLineWidth(12.0); + /* glLineWidth(12.0); */ /* Redraw parts of the lines: */ diff --git a/progs/trivial/tri-logicop-xor.c b/progs/trivial/tri-logicop-xor.c index f018a851ace..b8207cd6d8a 100644 --- a/progs/trivial/tri-logicop-xor.c +++ b/progs/trivial/tri-logicop-xor.c @@ -105,7 +105,7 @@ static void Draw(void) glVertex3f( 0.5, -0.5, -30.0); glEnd(); -// glLineWidth(12.0); + /* glLineWidth(12.0); */ /* Redraw parts of the lines to remove them: */ diff --git a/progs/trivial/vbo-drawarrays.c b/progs/trivial/vbo-drawarrays.c index c29954b9033..cb26e841156 100644 --- a/progs/trivial/vbo-drawarrays.c +++ b/progs/trivial/vbo-drawarrays.c @@ -83,7 +83,7 @@ static void Display( void ) glEnable(GL_VERTEX_PROGRAM_ARB); -// glDrawArrays( GL_TRIANGLES, 0, 3 ); + /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ glDrawArrays( GL_TRIANGLES, 1, 3 ); glFlush(); diff --git a/progs/trivial/vbo-noninterleaved.c b/progs/trivial/vbo-noninterleaved.c index 0672ca50ff1..f7c42a89818 100644 --- a/progs/trivial/vbo-noninterleaved.c +++ b/progs/trivial/vbo-noninterleaved.c @@ -87,8 +87,8 @@ static void Display( void ) glEnable(GL_VERTEX_PROGRAM_ARB); -// glDrawArrays( GL_TRIANGLES, 0, 3 ); -// glDrawArrays( GL_TRIANGLES, 1, 3 ); + /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ + /* glDrawArrays( GL_TRIANGLES, 1, 3 ); */ glDrawArrays( GL_QUADS, 0, 4 ); glFlush(); -- cgit v1.2.3 From 0dd951387405fc67b93c675d6a462ce020504719 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 20 Dec 2009 01:01:00 -0800 Subject: progs/tests: Silence compiler warnings. --- progs/tests/bug_texstore_i8.c | 2 +- progs/tests/crossbar.c | 2 +- progs/tests/fptest1.c | 2 ++ progs/tests/invert.c | 2 +- progs/tests/packedpixels.c | 4 ++-- progs/tests/quads.c | 3 +++ progs/tests/scissor-viewport.c | 4 ++-- progs/tests/scissor.c | 4 ++-- progs/tests/stencilwrap.c | 2 +- progs/tests/tex1d.c | 2 ++ progs/tests/unfilledclip.c | 2 ++ 11 files changed, 19 insertions(+), 10 deletions(-) (limited to 'progs') diff --git a/progs/tests/bug_texstore_i8.c b/progs/tests/bug_texstore_i8.c index 10e5eba7c5e..b070011bd2e 100644 --- a/progs/tests/bug_texstore_i8.c +++ b/progs/tests/bug_texstore_i8.c @@ -73,7 +73,7 @@ static void Init(void) 0, sourceFormat, GL_UNSIGNED_BYTE, - //GL_UNSIGNED_INT, + /* GL_UNSIGNED_INT, */ tex2d); glEnable(Target); diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c index bd8e05aee13..2988e209200 100644 --- a/progs/tests/crossbar.c +++ b/progs/tests/crossbar.c @@ -174,7 +174,7 @@ static void Init( void ) exit(1); } - printf("\nAll %u squares should be the same color.\n", NUM_TESTS + 1); + printf("\nAll %lu squares should be the same color.\n", (unsigned long) NUM_TESTS + 1); (void) memset( temp, 0x00, sizeof( temp ) ); glBindTexture( GL_TEXTURE_2D, 1 ); diff --git a/progs/tests/fptest1.c b/progs/tests/fptest1.c index 2b8f8d0f5ec..1f30d5733e7 100644 --- a/progs/tests/fptest1.c +++ b/progs/tests/fptest1.c @@ -57,6 +57,7 @@ static void Key( unsigned char key, int x, int y ) static void Init( void ) { +#if 0 static const char *prog0 = "!!FP1.0\n" "MUL o[COLR], R0, f[WPOS]; \n" @@ -73,6 +74,7 @@ static void Init( void ) "MOV HC, H2; \n" "END \n" ; +#endif /* masked updates, defines, declarations */ static const char *prog1 = diff --git a/progs/tests/invert.c b/progs/tests/invert.c index 3bc97a460b6..45001b44d07 100644 --- a/progs/tests/invert.c +++ b/progs/tests/invert.c @@ -165,7 +165,7 @@ static void Init( void ) "square should look upside-down.\n"); - image = LoadRGBImage( IMAGE_FILE, & img_width, & img_height, + image = LoadRGBImage( IMAGE_FILE, (GLint *) & img_width, (GLint *) & img_height, & img_format ); if ( image == NULL ) { printf( "Could not open image file \"%s\".\n", IMAGE_FILE ); diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index 1703b271cb0..1a9c2fedf01 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -252,8 +252,8 @@ Draw(void) glPushMatrix(); glTranslatef(2, (i + 1) * (h + 2), 0); glRasterPos2i(8, 6); - sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)", - IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); + sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)", + IntFormats[CurFormat].name, CurFormat + 1, (unsigned long) NUM_INT_FORMATS); PrintString(s); glPopMatrix(); diff --git a/progs/tests/quads.c b/progs/tests/quads.c index 2098b51ccd2..e5b9920b66d 100644 --- a/progs/tests/quads.c +++ b/progs/tests/quads.c @@ -17,7 +17,10 @@ static GLfloat Xrot = 40, Yrot = 0, Zrot = 0; static GLboolean Anim = GL_TRUE; static GLuint Vbuffer = 0; +#if 1 +#else static GLfloat buf[NUM_QUADS * 6 * 4]; +#endif static GLboolean doSwapBuffers = GL_TRUE; diff --git a/progs/tests/scissor-viewport.c b/progs/tests/scissor-viewport.c index 582e65fb72b..4ef307b424e 100644 --- a/progs/tests/scissor-viewport.c +++ b/progs/tests/scissor-viewport.c @@ -104,7 +104,7 @@ static void draw(void) glDisable(GL_SCISSOR_TEST); - //glutSwapBuffers(); + /* glutSwapBuffers(); */ glFlush(); } @@ -120,7 +120,7 @@ int main(int argc, char **argv) glutInitWindowPosition(100, 0); glutInitWindowSize(prog.width, prog.height); - //type = GLUT_RGB | GLUT_DOUBLE; + /* type = GLUT_RGB | GLUT_DOUBLE; */ type = GLUT_RGB | GLUT_SINGLE; glutInitDisplayMode(type); diff --git a/progs/tests/scissor.c b/progs/tests/scissor.c index 2dfd2174e82..e5a68ffabd3 100644 --- a/progs/tests/scissor.c +++ b/progs/tests/scissor.c @@ -134,7 +134,7 @@ static void draw(void) glDisable(GL_SCISSOR_TEST); - //glutSwapBuffers(); + /* glutSwapBuffers(); */ glFlush(); } @@ -150,7 +150,7 @@ int main(int argc, char **argv) glutInitWindowPosition(100, 0); glutInitWindowSize(prog.width, prog.height); - //type = GLUT_RGB | GLUT_DOUBLE; + /* type = GLUT_RGB | GLUT_DOUBLE; */ type = GLUT_RGB | GLUT_SINGLE; glutInitDisplayMode(type); diff --git a/progs/tests/stencilwrap.c b/progs/tests/stencilwrap.c index 2e219fd8b50..d396fc2a533 100644 --- a/progs/tests/stencilwrap.c +++ b/progs/tests/stencilwrap.c @@ -257,7 +257,7 @@ static void Init( void ) * part of GL 1.4. */ - ver_str = glGetString( GL_VERSION ); + ver_str = (char *) glGetString( GL_VERSION ); version = (ver_str == NULL) ? 1.0 : atof( ver_str ); wrapping = (glutExtensionSupported("GL_EXT_stencil_wrap") || (version >= 1.4)); diff --git a/progs/tests/tex1d.c b/progs/tests/tex1d.c index 4abe1068c7b..7d67451c0da 100644 --- a/progs/tests/tex1d.c +++ b/progs/tests/tex1d.c @@ -39,11 +39,13 @@ static void draw( void ) +/* static void idle( void ) { Angle += 2.0; glutPostRedisplay(); } +*/ diff --git a/progs/tests/unfilledclip.c b/progs/tests/unfilledclip.c index db6fffa3e89..331cbf2f6b1 100644 --- a/progs/tests/unfilledclip.c +++ b/progs/tests/unfilledclip.c @@ -31,6 +31,7 @@ static int win_width, win_height; +#if 0 static void line(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { @@ -39,6 +40,7 @@ line(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) glVertex2f(x2, y2); glEnd(); } +#endif static void line3(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2) -- cgit v1.2.3 From 66e779c22ba67834a35f71c8878670c38c071cb2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 21 Dec 2009 19:19:01 +0000 Subject: i965g: back out unintentional changes to gears --- progs/demos/gears.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'progs') diff --git a/progs/demos/gears.c b/progs/demos/gears.c index cf2c0a5443c..6016162d6f7 100644 --- a/progs/demos/gears.c +++ b/progs/demos/gears.c @@ -92,7 +92,6 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, glNormal3f(0.0, 0.0, -1.0); -#if 0 /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { @@ -161,7 +160,6 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); } glEnd(); -#endif } @@ -197,7 +195,6 @@ draw(void) glCallList(gear1); glPopMatrix(); -#if 0 glPushMatrix(); glTranslatef(3.1, -2.0, 0.0); glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); @@ -209,7 +206,6 @@ draw(void) glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); glCallList(gear3); glPopMatrix(); -#endif glPopMatrix(); @@ -217,9 +213,6 @@ draw(void) Frames++; - if (Frames == 2) - exit(0); - { GLint t = glutGet(GLUT_ELAPSED_TIME); if (t - T0 >= 5000) { -- cgit v1.2.3 From d26cdaaa234f3f31063559011287cc70041f3ec4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Dec 2009 13:37:11 -0700 Subject: progs/osmes: add missing libGL dependency, remove unneeded lines --- progs/osdemos/Makefile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'progs') diff --git a/progs/osdemos/Makefile b/progs/osdemos/Makefile index 023ea02ae27..f53515cb0a7 100644 --- a/progs/osdemos/Makefile +++ b/progs/osdemos/Makefile @@ -5,7 +5,7 @@ include $(TOP)/configs/current INCDIR = $(TOP)/include -OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS) +OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS) OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa16 -l$(GLU_LIB) \ -l$(GL_LIB) $(APP_LIB_DEPS) @@ -13,12 +13,6 @@ OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa16 -l$(GLU_LIB) \ OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa32 -l$(GLU_LIB) \ -l$(GL_LIB) $(APP_LIB_DEPS) -LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ - $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ - $(APP_LIB_DEPS) - PROGS = \ osdemo \ ostest1 @@ -30,11 +24,6 @@ PROGS = \ .SUFFIXES: .c -# make executable from .c file: -.c: $(LIB_DEP) readtex.o - $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< readtex.o $(LIBS) -o $@ - - ##### TARGETS ##### default: readtex.o $(PROGS) -- cgit v1.2.3 From 79e74cda7347170f1015829ceafb0f5f18dd9236 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Dec 2009 15:22:17 -0700 Subject: progs/demos: report pixel rate in million pixels / sec --- progs/demos/readpix.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'progs') diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index bbb3a68effa..182b01d7ffc 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -219,7 +219,7 @@ Display( void ) GLint reads = 0; GLint endTime; GLint startTime = glutGet(GLUT_ELAPSED_TIME); - GLdouble seconds, pixelsPerSecond; + GLdouble seconds, mpixels, mpixelsPerSecond; printf("Benchmarking...\n"); do { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, @@ -228,9 +228,10 @@ Display( void ) endTime = glutGet(GLUT_ELAPSED_TIME); } while (endTime - startTime < 4000); /* 4 seconds */ seconds = (double) (endTime - startTime) / 1000.0; - pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; - printf("Result: %d reads in %f seconds = %f pixels/sec\n", - reads, seconds, pixelsPerSecond); + mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0)); + mpixelsPerSecond = mpixels / seconds; + printf("Result: %d reads in %f seconds = %f Mpixels/sec\n", + reads, seconds, mpixelsPerSecond); Benchmark = GL_FALSE; } else { -- cgit v1.2.3 From fdae39c28908801709d081fbb7319e70d0ba89ba Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Dec 2009 13:48:58 -0700 Subject: progs/perf: added check for GL_ARB_framebuffer_object --- progs/perf/genmipmap.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'progs') diff --git a/progs/perf/genmipmap.c b/progs/perf/genmipmap.c index 4b7d6ad155b..20e2fa34107 100644 --- a/progs/perf/genmipmap.c +++ b/progs/perf/genmipmap.c @@ -27,6 +27,7 @@ */ #include +#include #include "glmain.h" #include "common.h" @@ -53,6 +54,11 @@ static const struct vertex vertices[1] = { void PerfInit(void) { + if (!PerfExtensionSupported("GL_ARB_framebuffer_object")) { + printf("Sorry, this test requires GL_ARB_framebuffer_object\n"); + exit(1); + } + /* setup VBO w/ vertex data */ glGenBuffersARB(1, &VBO); glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO); -- cgit v1.2.3 From 07b54fe35b93ccfd9eebd2cebe637c20044200f2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 21 Dec 2009 15:20:01 -0800 Subject: progs/redbook: Silence compiler warnings. --- progs/redbook/aapoly.c | 8 ++++---- progs/redbook/aargb.c | 8 ++++---- progs/redbook/accanti.c | 8 ++++---- progs/redbook/accpersp.c | 14 +++++++------- progs/redbook/alpha.c | 6 +++--- progs/redbook/alpha3D.c | 8 ++++---- progs/redbook/anti.c | 6 +++--- progs/redbook/bezcurve.c | 8 ++++---- progs/redbook/bezmesh.c | 8 ++++---- progs/redbook/checker.c | 8 ++++---- progs/redbook/clip.c | 8 ++++---- progs/redbook/colormat.c | 10 +++++----- progs/redbook/cube.c | 8 ++++---- progs/redbook/depthcue.c | 6 +++--- progs/redbook/dof.c | 12 ++++++------ progs/redbook/double.c | 12 ++++++------ progs/redbook/drawf.c | 8 ++++---- progs/redbook/feedback.c | 14 +++++++------- progs/redbook/fog.c | 10 +++++----- progs/redbook/fogindex.c | 6 +++--- progs/redbook/font.c | 12 ++++++------ progs/redbook/hello.c | 4 ++-- progs/redbook/image.c | 12 ++++++------ progs/redbook/light.c | 8 ++++---- progs/redbook/lines.c | 8 ++++---- progs/redbook/list.c | 6 +++--- progs/redbook/material.c | 6 +++--- progs/redbook/mipmap.c | 8 ++++---- progs/redbook/model.c | 10 +++++----- progs/redbook/movelight.c | 10 +++++----- progs/redbook/nurbs.c | 6 +++--- progs/redbook/pickdepth.c | 12 ++++++------ progs/redbook/picksquare.c | 14 +++++++------- progs/redbook/plane.c | 8 ++++---- progs/redbook/planet.c | 8 ++++---- progs/redbook/polyoff.c | 25 ++++++------------------- progs/redbook/polys.c | 4 ++-- progs/redbook/quadric.c | 10 +++++----- progs/redbook/robot.c | 8 ++++---- progs/redbook/sccolorlight.c | 6 +++--- progs/redbook/scene.c | 6 +++--- progs/redbook/scenebamb.c | 6 +++--- progs/redbook/sceneflat.c | 6 +++--- progs/redbook/select.c | 18 +++++++++--------- progs/redbook/smooth.c | 10 +++++----- progs/redbook/stencil.c | 6 +++--- progs/redbook/stroke.c | 8 ++++---- progs/redbook/surface.c | 14 +++++++------- progs/redbook/teaambient.c | 6 +++--- progs/redbook/teapots.c | 8 ++++---- progs/redbook/tess.c | 18 +++++++++--------- progs/redbook/tesswind.c | 18 +++++++++--------- progs/redbook/texbind.c | 10 +++++----- progs/redbook/texgen.c | 10 +++++----- progs/redbook/texprox.c | 6 +++--- progs/redbook/texsub.c | 10 +++++----- progs/redbook/texturesurf.c | 8 ++++---- progs/redbook/torus.c | 6 +++--- progs/redbook/trim.c | 12 ++++++------ progs/redbook/unproject.c | 8 ++++---- progs/redbook/varray.c | 14 +++++++------- progs/redbook/wrap.c | 10 +++++----- 62 files changed, 283 insertions(+), 296 deletions(-) (limited to 'progs') diff --git a/progs/redbook/aapoly.c b/progs/redbook/aapoly.c index 757f0f48c43..b7b2b270902 100644 --- a/progs/redbook/aapoly.c +++ b/progs/redbook/aapoly.c @@ -59,7 +59,7 @@ static void init(void) #define NFACE 6 #define NVERT 8 -void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1, +static void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1, GLdouble z0, GLdouble z1) { static GLfloat v[8][3]; @@ -101,7 +101,7 @@ void drawCube(GLdouble x0, GLdouble x1, GLdouble y0, GLdouble y1, /* Note: polygons must be drawn from front to back * for proper blending. */ -void display(void) +static void display(void) { if (polySmooth) { glClear (GL_COLOR_BUFFER_BIT); @@ -126,7 +126,7 @@ void display(void) glFlush (); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -137,7 +137,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': diff --git a/progs/redbook/aargb.c b/progs/redbook/aargb.c index f51984170e6..0021b549c2e 100644 --- a/progs/redbook/aargb.c +++ b/progs/redbook/aargb.c @@ -51,7 +51,7 @@ static float rotAngle = 0.; * blending, hint, and line width. Print out implementation * specific info on line width granularity and width. */ -void init(void) +static void init(void) { GLfloat values[2]; glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values); @@ -72,7 +72,7 @@ void init(void) /* Draw 2 diagonal lines to form an X */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -97,7 +97,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); @@ -113,7 +113,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'r': diff --git a/progs/redbook/accanti.c b/progs/redbook/accanti.c index 12ca16f7a52..d1b25678419 100644 --- a/progs/redbook/accanti.c +++ b/progs/redbook/accanti.c @@ -45,7 +45,7 @@ /* Initialize lighting and other values. */ -void myinit(void) +static void myinit(void) { GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -68,7 +68,7 @@ void myinit(void) glClearAccum(0.0, 0.0, 0.0, 0.0); } -void displayObjects(void) +static void displayObjects(void) { GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 }; @@ -111,7 +111,7 @@ void displayObjects(void) #define ACSIZE 8 -void display(void) +static void display(void) { GLint viewport[4]; int jitter; @@ -137,7 +137,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/accpersp.c b/progs/redbook/accpersp.c index 46e369ae631..e172d0a917f 100644 --- a/progs/redbook/accpersp.c +++ b/progs/redbook/accpersp.c @@ -62,7 +62,7 @@ * probably want to insure that your ModelView matrix has been * initialized to identity before calling accFrustum(). */ -void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, +static void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) { @@ -99,7 +99,7 @@ void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, * * Note that accPerspective() calls accFrustum(). */ -void accPerspective(GLdouble fovy, GLdouble aspect, +static void accPerspective(GLdouble fovy, GLdouble aspect, GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) { @@ -119,7 +119,7 @@ void accPerspective(GLdouble fovy, GLdouble aspect, /* Initialize lighting and other values. */ -void init(void) +static void init(void) { GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -141,7 +141,7 @@ void init(void) glClearAccum(0.0, 0.0, 0.0, 0.0); } -void displayObjects(void) +static void displayObjects(void) { GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 }; @@ -185,7 +185,7 @@ void displayObjects(void) #define ACSIZE 8 -void display(void) +static void display(void) { GLint viewport[4]; int jitter; @@ -205,13 +205,13 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/alpha.c b/progs/redbook/alpha.c index 6eeb45b96f1..b77c65e2c83 100644 --- a/progs/redbook/alpha.c +++ b/progs/redbook/alpha.c @@ -80,7 +80,7 @@ static void drawRightTriangle(void) glEnd(); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -96,7 +96,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -108,7 +108,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 't': diff --git a/progs/redbook/alpha3D.c b/progs/redbook/alpha3D.c index 6169bd162be..494b1879d22 100644 --- a/progs/redbook/alpha3D.c +++ b/progs/redbook/alpha3D.c @@ -80,7 +80,7 @@ static void init(void) glEndList(); } -void display(void) +static void display(void) { GLfloat mat_solid[] = { 0.75, 0.75, 0.0, 1.0 }; GLfloat mat_zero[] = { 0.0, 0.0, 0.0, 1.0 }; @@ -113,7 +113,7 @@ void display(void) glutSwapBuffers(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLint) w, (GLint) h); glMatrixMode(GL_PROJECTION); @@ -128,7 +128,7 @@ void reshape(int w, int h) glLoadIdentity(); } -void animate(void) +static void animate(void) { static double t0 = -1.; if (solidZ <= MINZ || transparentZ >= MAXZ) @@ -150,7 +150,7 @@ void animate(void) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'a': diff --git a/progs/redbook/anti.c b/progs/redbook/anti.c index 9eab0bc3511..a97a3ebc948 100644 --- a/progs/redbook/anti.c +++ b/progs/redbook/anti.c @@ -49,7 +49,7 @@ * blending, hint, and line width. Print out implementation * specific info on line width granularity and width. */ -void myinit(void) +static void myinit(void) { GLfloat values[2]; glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values); @@ -73,7 +73,7 @@ void myinit(void) /* display() draws an icosahedron with a large alpha value, 1.0. */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor4f (1.0, 1.0, 1.0, 1.0); @@ -81,7 +81,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/bezcurve.c b/progs/redbook/bezcurve.c index 5dee440396b..60a9c680802 100644 --- a/progs/redbook/bezcurve.c +++ b/progs/redbook/bezcurve.c @@ -45,7 +45,7 @@ GLfloat ctrlpoints[4][3] = { { -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0}, {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}}; -void init(void) +static void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -53,7 +53,7 @@ void init(void) glEnable(GL_MAP1_VERTEX_3); } -void display(void) +static void display(void) { int i; @@ -73,7 +73,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -89,7 +89,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/bezmesh.c b/progs/redbook/bezmesh.c index 55e7e827f2b..1abc7488bcb 100644 --- a/progs/redbook/bezmesh.c +++ b/progs/redbook/bezmesh.c @@ -68,7 +68,7 @@ GLfloat ctrlpoints[4][4][3] = {1.5, 1.5, -1.0}} }; -void +static void initlights(void) { GLfloat ambient[] = @@ -93,7 +93,7 @@ initlights(void) glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); } -void +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -104,7 +104,7 @@ display(void) glFlush(); } -void +static void myinit(void) { glClearColor(0.0, 0.0, 0.0, 1.0); @@ -118,7 +118,7 @@ myinit(void) initlights(); /* for lighted version only */ } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/checker.c b/progs/redbook/checker.c index 06cbae7dd7e..60e6f7b60c8 100644 --- a/progs/redbook/checker.c +++ b/progs/redbook/checker.c @@ -50,7 +50,7 @@ #define checkImageHeight 64 GLubyte checkImage[checkImageWidth][checkImageHeight][3]; -void makeCheckImage(void) +static void makeCheckImage(void) { int i, j, c; @@ -64,7 +64,7 @@ void makeCheckImage(void) } } -void myinit(void) +static void myinit(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); @@ -84,7 +84,7 @@ void myinit(void) glShadeModel(GL_FLAT); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_QUADS); @@ -101,7 +101,7 @@ void display(void) glutSwapBuffers(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/clip.c b/progs/redbook/clip.c index 90816f2e278..85c464720db 100644 --- a/progs/redbook/clip.c +++ b/progs/redbook/clip.c @@ -42,13 +42,13 @@ #include #include -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { GLdouble eqn[4] = {0.0, 1.0, 0.0, 0.0}; GLdouble eqn2[4] = {1.0, 0.0, 0.0, 0.0}; @@ -73,7 +73,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -83,7 +83,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/colormat.c b/progs/redbook/colormat.c index 9db4491bac5..d77fcb1ed46 100644 --- a/progs/redbook/colormat.c +++ b/progs/redbook/colormat.c @@ -49,7 +49,7 @@ GLfloat diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 }; /* Initialize material property, light source, lighting model, * and depth buffer. */ -void init(void) +static void init(void) { GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; @@ -68,14 +68,14 @@ void init(void) glEnable(GL_COLOR_MATERIAL); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glutSolidSphere(1.0, 20, 16); glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -91,7 +91,7 @@ void reshape (int w, int h) } /* ARGSUSED2 */ -void mouse(int button, int state, int x, int y) +static void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: @@ -127,7 +127,7 @@ void mouse(int button, int state, int x, int y) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/cube.c b/progs/redbook/cube.c index 5ecc6280f33..3c6becb2157 100644 --- a/progs/redbook/cube.c +++ b/progs/redbook/cube.c @@ -44,13 +44,13 @@ #include #include -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -62,7 +62,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -72,7 +72,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/depthcue.c b/progs/redbook/depthcue.c index a3e5b743aa7..d4b604baf13 100644 --- a/progs/redbook/depthcue.c +++ b/progs/redbook/depthcue.c @@ -48,7 +48,7 @@ /* Initialize linear fog for depth cueing. */ -void myinit(void) +static void myinit(void) { GLfloat fogColor[4] = {0.0, 0.0, 0.0, 1.0}; @@ -67,7 +67,7 @@ void myinit(void) /* display() draws an icosahedron. */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -75,7 +75,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/dof.c b/progs/redbook/dof.c index 6673dc2d54f..8558f02deea 100644 --- a/progs/redbook/dof.c +++ b/progs/redbook/dof.c @@ -68,7 +68,7 @@ * probably want to insure that your ModelView matrix has been * initialized to identity before calling accFrustum(). */ -void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, +static void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) { @@ -105,7 +105,7 @@ void accFrustum(GLdouble left, GLdouble right, GLdouble bottom, * * Note that accPerspective() calls accFrustum(). */ -void accPerspective(GLdouble fovy, GLdouble aspect, +static void accPerspective(GLdouble fovy, GLdouble aspect, GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus) { @@ -123,7 +123,7 @@ void accPerspective(GLdouble fovy, GLdouble aspect, pixdx, pixdy, eyedx, eyedy, focus); } -void myinit(void) +static void myinit(void) { GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -155,7 +155,7 @@ void myinit(void) glClearAccum(0.0, 0.0, 0.0, 0.0); } -void renderTeapot (GLfloat x, GLfloat y, GLfloat z, +static void renderTeapot (GLfloat x, GLfloat y, GLfloat z, GLfloat ambr, GLfloat ambg, GLfloat ambb, GLfloat difr, GLfloat difg, GLfloat difb, GLfloat specr, GLfloat specg, GLfloat specb, GLfloat shine) @@ -182,7 +182,7 @@ void renderTeapot (GLfloat x, GLfloat y, GLfloat z, * magnitude of the accPerspective() jitter; in this example, 0.33. * In this example, the teapots are drawn 8 times. See jitter.h */ -void display(void) +static void display(void) { int jitter; GLint viewport[4]; @@ -214,7 +214,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); } diff --git a/progs/redbook/double.c b/progs/redbook/double.c index 3153c70cc1d..c4ead224dc8 100644 --- a/progs/redbook/double.c +++ b/progs/redbook/double.c @@ -47,7 +47,7 @@ static GLfloat spin = 0.0; static GLdouble t0 = 0.; -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); @@ -59,12 +59,12 @@ void display(void) glutSwapBuffers(); } -GLdouble gettime(void) +static GLdouble gettime(void) { return (GLdouble)(glutGet(GLUT_ELAPSED_TIME)) / 1000.; } -void spinDisplay(void) +static void spinDisplay(void) { GLdouble t, dt; t = gettime(); @@ -76,13 +76,13 @@ void spinDisplay(void) glutPostRedisplay(); } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -93,7 +93,7 @@ void reshape(int w, int h) } /* ARGSUSED2 */ -void mouse(int button, int state, int x, int y) +static void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: diff --git a/progs/redbook/drawf.c b/progs/redbook/drawf.c index 5bcccb6aeac..6c048be7844 100644 --- a/progs/redbook/drawf.c +++ b/progs/redbook/drawf.c @@ -48,13 +48,13 @@ GLubyte rasters[24] = { 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0}; -void init(void) +static void init(void) { glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glClearColor (0.0, 0.0, 0.0, 0.0); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -65,7 +65,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -75,7 +75,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/feedback.c b/progs/redbook/feedback.c index cc685d55d34..3c8c8cc7eaf 100644 --- a/progs/redbook/feedback.c +++ b/progs/redbook/feedback.c @@ -48,7 +48,7 @@ /* Initialize lighting. */ -void init(void) +static void init(void) { glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); @@ -58,7 +58,7 @@ void init(void) * be clipped. If in feedback mode, a passthrough token * is issued between the each primitive. */ -void drawGeometry (GLenum mode) +static void drawGeometry (GLenum mode) { glBegin (GL_LINE_STRIP); glNormal3f (0.0, 0.0, 1.0); @@ -80,8 +80,8 @@ void drawGeometry (GLenum mode) } /* Write contents of one vertex to stdout. */ -void print3DcolorVertex (GLint size, GLint *count, - GLfloat *buffer) +static void print3DcolorVertex (GLint size, GLint *count, + GLfloat *buffer) { int i; @@ -94,7 +94,7 @@ void print3DcolorVertex (GLint size, GLint *count, } /* Write contents of entire buffer. (Parse tokens!) */ -void printBuffer(GLint size, GLfloat *buffer) +static void printBuffer(GLint size, GLfloat *buffer) { GLint count; GLfloat token; @@ -124,7 +124,7 @@ void printBuffer(GLint size, GLfloat *buffer) } } -void display(void) +static void display(void) { GLfloat feedBuffer[1024]; GLint size; @@ -148,7 +148,7 @@ void display(void) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/fog.c b/progs/redbook/fog.c index 14c7700eccf..4f4b8e3cc0a 100644 --- a/progs/redbook/fog.c +++ b/progs/redbook/fog.c @@ -52,7 +52,7 @@ GLint fogMode; -void +static void selectFog(int mode) { switch(mode) { @@ -73,7 +73,7 @@ selectFog(int mode) /* Initialize z-buffer, projection matrix, light source, * and lighting model. Do not specify a material property here. */ -void +static void myinit(void) { GLfloat position[] = @@ -106,7 +106,7 @@ myinit(void) } } -void +static void renderRedTeapot(GLfloat x, GLfloat y, GLfloat z) { float mat[4]; @@ -133,7 +133,7 @@ renderRedTeapot(GLfloat x, GLfloat y, GLfloat z) /* display() draws 5 teapots at different z positions. */ -void +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -145,7 +145,7 @@ display(void) glFlush(); } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/fogindex.c b/progs/redbook/fogindex.c index b8bb691e288..6b5aa353caa 100644 --- a/progs/redbook/fogindex.c +++ b/progs/redbook/fogindex.c @@ -53,7 +53,7 @@ #define NUM_COLORS 32 #define RAMPSTART 16 -void +static void myinit(void) { int i; @@ -77,7 +77,7 @@ myinit(void) /* display() renders 3 cones at different z positions. */ -void +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -104,7 +104,7 @@ display(void) glFlush(); } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/font.c b/progs/redbook/font.c index 2d92e9b6003..c7a1035aa99 100644 --- a/progs/redbook/font.c +++ b/progs/redbook/font.c @@ -80,7 +80,7 @@ GLubyte letters[][13] = { GLuint fontOffset; -void makeRasterFont(void) +static void makeRasterFont(void) { GLuint i, j; glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -96,13 +96,13 @@ void makeRasterFont(void) glEndList(); } -void init(void) +static void init(void) { glShadeModel (GL_FLAT); makeRasterFont(); } -void printString(char *s) +static void printString(char *s) { glPushAttrib (GL_LIST_BIT); glListBase(fontOffset); @@ -115,7 +115,7 @@ void printString(char *s) * to call makeRasterFont() before you start making * calls to printString(). */ -void display(void) +static void display(void) { GLfloat white[3] = { 1.0, 1.0, 1.0 }; @@ -129,7 +129,7 @@ void display(void) glFlush (); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -139,7 +139,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/hello.c b/progs/redbook/hello.c index fb3dae13252..84183b25b9f 100644 --- a/progs/redbook/hello.c +++ b/progs/redbook/hello.c @@ -42,7 +42,7 @@ #include #include -void display(void) +static void display(void) { /* clear all pixels */ glClear (GL_COLOR_BUFFER_BIT); @@ -64,7 +64,7 @@ void display(void) glFlush (); } -void init (void) +static void init (void) { /* select clearing color */ glClearColor (0.0, 0.0, 0.0, 0.0); diff --git a/progs/redbook/image.c b/progs/redbook/image.c index dc1a7246eba..fa3b46f5ed4 100644 --- a/progs/redbook/image.c +++ b/progs/redbook/image.c @@ -58,7 +58,7 @@ GLubyte checkImage[checkImageHeight][checkImageWidth][3]; static GLdouble zoomFactor = 1.0; static GLint height; -void makeCheckImage(void) +static void makeCheckImage(void) { int i, j, c; @@ -72,7 +72,7 @@ void makeCheckImage(void) } } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -80,7 +80,7 @@ void init(void) glPixelStorei(GL_UNPACK_ALIGNMENT, 1); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glRasterPos2i(0, 0); @@ -89,7 +89,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); height = (GLint) h; @@ -100,7 +100,7 @@ void reshape(int w, int h) glLoadIdentity(); } -void motion(int x, int y) +static void motion(int x, int y) { static GLint screeny; @@ -113,7 +113,7 @@ void motion(int x, int y) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'r': diff --git a/progs/redbook/light.c b/progs/redbook/light.c index 0eed85e10c2..9431dce508e 100644 --- a/progs/redbook/light.c +++ b/progs/redbook/light.c @@ -47,7 +47,7 @@ /* Initialize material property, light source, lighting model, * and depth buffer. */ -void init(void) +static void init(void) { GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_shininess[] = { 50.0 }; @@ -65,14 +65,14 @@ void init(void) glEnable(GL_DEPTH_TEST); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glutSolidSphere (1.0, 20, 16); glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -88,7 +88,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/lines.c b/progs/redbook/lines.c index b34d4c418c6..9f12da9acfe 100644 --- a/progs/redbook/lines.c +++ b/progs/redbook/lines.c @@ -46,13 +46,13 @@ #define drawOneLine(x1,y1,x2,y2) glBegin(GL_LINES); \ glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); glEnd(); -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { int i; @@ -104,7 +104,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -113,7 +113,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/list.c b/progs/redbook/list.c index 3b4f44bd6da..5dea26fcad1 100644 --- a/progs/redbook/list.c +++ b/progs/redbook/list.c @@ -69,7 +69,7 @@ static void drawLine (void) glEnd (); } -void display(void) +static void display(void) { GLuint i; @@ -82,7 +82,7 @@ void display(void) glFlush (); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); @@ -97,7 +97,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/material.c b/progs/redbook/material.c index f9a4fc59288..5edddd9ef84 100644 --- a/progs/redbook/material.c +++ b/progs/redbook/material.c @@ -49,7 +49,7 @@ /* Initialize z-buffer, projection matrix, light source, * and lighting model. Do not specify a material property here. */ -void myinit(void) +static void myinit(void) { GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -87,7 +87,7 @@ void myinit(void) * glTranslatef() is used to move spheres to their appropriate locations. */ -void display(void) +static void display(void) { GLfloat no_mat[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat mat_ambient[] = { 0.7, 0.7, 0.7, 1.0 }; @@ -260,7 +260,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/mipmap.c b/progs/redbook/mipmap.c index d32dd725f4b..dadde055bef 100644 --- a/progs/redbook/mipmap.c +++ b/progs/redbook/mipmap.c @@ -54,7 +54,7 @@ GLubyte mipmapImage4[4][4][3]; GLubyte mipmapImage2[2][2][3]; GLubyte mipmapImage1[1][1][3]; -void makeImages(void) +static void makeImages(void) { int i, j; @@ -98,7 +98,7 @@ void makeImages(void) mipmapImage1[0][0][2] = 255; } -void myinit(void) +static void myinit(void) { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); @@ -128,7 +128,7 @@ void myinit(void) glEnable(GL_TEXTURE_2D); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_QUADS); @@ -140,7 +140,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/model.c b/progs/redbook/model.c index 8411ef355f1..f7c92f4f87c 100644 --- a/progs/redbook/model.c +++ b/progs/redbook/model.c @@ -42,13 +42,13 @@ #include #include -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void draw_triangle(void) +static void draw_triangle(void) { glBegin (GL_LINE_LOOP); glVertex2f(0.0, 25.0); @@ -57,7 +57,7 @@ void draw_triangle(void) glEnd(); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -86,7 +86,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -101,7 +101,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/movelight.c b/progs/redbook/movelight.c index a108cad439a..93758a222a4 100644 --- a/progs/redbook/movelight.c +++ b/progs/redbook/movelight.c @@ -58,7 +58,7 @@ static int spin = 0; /* Initialize material property, light source, lighting model, * and depth buffer. */ -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); @@ -72,7 +72,7 @@ void init(void) * light at a new position in world coordinates. The cube * represents the position of the light. */ -void display(void) +static void display(void) { GLfloat position[] = { 0.0, 0.0, 1.5, 1.0 }; @@ -96,7 +96,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -107,7 +107,7 @@ void reshape (int w, int h) } /* ARGSUSED2 */ -void mouse(int button, int state, int x, int y) +static void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: @@ -122,7 +122,7 @@ void mouse(int button, int state, int x, int y) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/nurbs.c b/progs/redbook/nurbs.c index a7c6f0c696e..fe03ce667ed 100644 --- a/progs/redbook/nurbs.c +++ b/progs/redbook/nurbs.c @@ -89,7 +89,7 @@ GLUnurbsObj *theNurb; /* Initialize material property, light source, lighting model, * and depth buffer. */ -void myinit(void) +static void myinit(void) { GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_diffuse[] = { 1.0, 0.2, 1.0, 1.0 }; @@ -122,7 +122,7 @@ void myinit(void) gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -147,7 +147,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/pickdepth.c b/progs/redbook/pickdepth.c index ad5bdc81994..91d44a38c0a 100644 --- a/progs/redbook/pickdepth.c +++ b/progs/redbook/pickdepth.c @@ -51,7 +51,7 @@ #include #include -void +static void myinit(void) { glClearColor(0.0, 0.0, 0.0, 0.0); @@ -65,7 +65,7 @@ myinit(void) * each rectangle is given the same name. Note that * each rectangle is drawn with a different z value. */ -void +static void drawRects(GLenum mode) { if (mode == GL_SELECT) @@ -100,7 +100,7 @@ drawRects(GLenum mode) /* processHits() prints out the contents of the * selection array. */ -void +static void processHits(GLint hits, GLuint buffer[]) { GLint i; @@ -131,7 +131,7 @@ processHits(GLint hits, GLuint buffer[]) */ #define BUFSIZE 512 -void +static void pickRects(int button, int state, int x, int y) { GLuint selectBuf[BUFSIZE]; @@ -164,7 +164,7 @@ pickRects(int button, int state, int x, int y) processHits(hits, selectBuf); } -void +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -172,7 +172,7 @@ display(void) glutSwapBuffers(); } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/picksquare.c b/progs/redbook/picksquare.c index 636edc97b4b..cc092dbf538 100644 --- a/progs/redbook/picksquare.c +++ b/progs/redbook/picksquare.c @@ -49,7 +49,7 @@ int board[3][3]; /* amount of color for each square */ /* Clear color value for every square on the board */ -void init(void) +static void init(void) { int i, j; for (i = 0; i < 3; i++) @@ -64,7 +64,7 @@ void init(void) * square is determined by its position on the grid, and * the value in the board[][] array. */ -void drawSquares(GLenum mode) +static void drawSquares(GLenum mode) { GLuint i, j; for (i = 0; i < 3; i++) { @@ -85,7 +85,7 @@ void drawSquares(GLenum mode) /* processHits prints out the contents of the * selection array. */ -void processHits (GLint hits, GLuint buffer[]) +static void processHits (GLint hits, GLuint buffer[]) { GLint i; GLuint j, ii = 0, jj = 0, names, *ptr; @@ -117,7 +117,7 @@ void processHits (GLint hits, GLuint buffer[]) */ #define BUFSIZE 512 -void pickSquares(int button, int state, int x, int y) +static void pickSquares(int button, int state, int x, int y) { GLuint selectBuf[BUFSIZE]; GLint hits; @@ -152,14 +152,14 @@ void pickSquares(int button, int state, int x, int y) glutPostRedisplay(); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); drawSquares (GL_RENDER); glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); @@ -170,7 +170,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/plane.c b/progs/redbook/plane.c index dc17f7b2386..2c2e2d24d93 100644 --- a/progs/redbook/plane.c +++ b/progs/redbook/plane.c @@ -47,7 +47,7 @@ /* Initialize material property, light source, and lighting model. */ -void myinit(void) +static void myinit(void) { GLfloat mat_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; /* mat_specular and mat_shininess are NOT default values */ @@ -75,7 +75,7 @@ void myinit(void) glEnable(GL_DEPTH_TEST); } -void drawPlane(void) +static void drawPlane(void) { glBegin (GL_QUADS); glNormal3f (0.0, 0.0, 1.0); @@ -104,7 +104,7 @@ void drawPlane(void) glEnd(); } -void display (void) +static void display (void) { GLfloat infinite_light[] = { 1.0, 1.0, 1.0, 0.0 }; GLfloat local_light[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -125,7 +125,7 @@ void display (void) glFlush (); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport (0, 0, w, h); glMatrixMode (GL_PROJECTION); diff --git a/progs/redbook/planet.c b/progs/redbook/planet.c index e13672d3f63..cc428b4e427 100644 --- a/progs/redbook/planet.c +++ b/progs/redbook/planet.c @@ -47,13 +47,13 @@ static int year = 0, day = 0; -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -68,7 +68,7 @@ void display(void) glutSwapBuffers(); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -80,7 +80,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 'd': diff --git a/progs/redbook/polyoff.c b/progs/redbook/polyoff.c index de34b2e7675..0e0ce86ec91 100644 --- a/progs/redbook/polyoff.c +++ b/progs/redbook/polyoff.c @@ -60,7 +60,7 @@ GLboolean doubleBuffer; /* display() draws two spheres, one with a gray, diffuse material, * the other sphere with a magenta material with a specular highlight. */ -void display (void) +static void display (void) { GLfloat gray[] = { 0.8, 0.8, 0.8, 1.0 }; GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 }; @@ -108,7 +108,7 @@ void display (void) * create display list with sphere * initialize lighting and depth buffer */ -void gfxinit (void) +static void gfxinit (void) { GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -134,7 +134,7 @@ void gfxinit (void) } /* call when window is resized */ -void reshape(int width, int height) +static void reshape(int width, int height) { glViewport (0, 0, width, height); glMatrixMode (GL_PROJECTION); @@ -176,7 +176,7 @@ static void Benchmark( float xdiff, float ydiff ) /* call when mouse button is pressed */ /* ARGSUSED2 */ -void mouse(int button, int state, int x, int y) { +static void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: switch (state) { @@ -213,7 +213,7 @@ void mouse(int button, int state, int x, int y) { } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 't': @@ -268,20 +268,7 @@ void keyboard (unsigned char key, int x, int y) fflush(stdout); } -static void -key(unsigned char k, int x, int y) -{ - switch (k) { - case 27: /* Escape */ - exit(0); - break; - default: - return; - } - glutPostRedisplay(); -} - -GLenum Args(int argc, char **argv) +static GLenum Args(int argc, char **argv) { GLint i; diff --git a/progs/redbook/polys.c b/progs/redbook/polys.c index 409abd17531..eeffe2301ce 100644 --- a/progs/redbook/polys.c +++ b/progs/redbook/polys.c @@ -44,7 +44,7 @@ #include #include -void display(void) +static void display(void) { GLubyte fly[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, @@ -89,7 +89,7 @@ void display(void) glFlush (); } -void myinit (void) +static void myinit (void) { /* clear background to black */ glClearColor (0.0, 0.0, 0.0, 0.0); diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c index 7e99098304a..1cbd395e47b 100644 --- a/progs/redbook/quadric.c +++ b/progs/redbook/quadric.c @@ -54,7 +54,7 @@ GLuint startList; -void CALLBACK errorCallback(GLenum errorCode) +static void CALLBACK errorCallback(GLenum errorCode) { const GLubyte *estring; @@ -63,7 +63,7 @@ void CALLBACK errorCallback(GLenum errorCode) exit(0); } -void init(void) +static void init(void) { GLUquadricObj *qobj; GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; @@ -120,7 +120,7 @@ void init(void) gluDeleteQuadric(qobj); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); @@ -150,7 +150,7 @@ void display(void) glFlush(); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -166,7 +166,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/robot.c b/progs/redbook/robot.c index 94e20ac71eb..c90b72ab3ea 100644 --- a/progs/redbook/robot.c +++ b/progs/redbook/robot.c @@ -47,13 +47,13 @@ static int shoulder = 0, elbow = 0; -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); glPushMatrix(); @@ -77,7 +77,7 @@ void display(void) glutSwapBuffers(); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -89,7 +89,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 's': diff --git a/progs/redbook/sccolorlight.c b/progs/redbook/sccolorlight.c index 0ea750e5846..d9e0a254e90 100644 --- a/progs/redbook/sccolorlight.c +++ b/progs/redbook/sccolorlight.c @@ -49,7 +49,7 @@ /* Initialize material property and light source. */ -void myinit(void) +static void myinit(void) { GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 0.0, 1.0, 1.0 }; @@ -68,7 +68,7 @@ void myinit(void) glEnable(GL_DEPTH_TEST); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); @@ -95,7 +95,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/scene.c b/progs/redbook/scene.c index c3abc727b78..6f336a8db46 100644 --- a/progs/redbook/scene.c +++ b/progs/redbook/scene.c @@ -48,7 +48,7 @@ /* Initialize material property and light source. */ -void myinit (void) +static void myinit (void) { GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -67,7 +67,7 @@ void myinit (void) glEnable(GL_DEPTH_TEST); } -void display (void) +static void display (void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -95,7 +95,7 @@ void display (void) glFlush (); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport (0, 0, w, h); glMatrixMode (GL_PROJECTION); diff --git a/progs/redbook/scenebamb.c b/progs/redbook/scenebamb.c index e7264d2003f..ea605f8c737 100644 --- a/progs/redbook/scenebamb.c +++ b/progs/redbook/scenebamb.c @@ -47,7 +47,7 @@ /* Initialize light source and lighting. */ -void myinit(void) +static void myinit(void) { GLfloat light_ambient[] = { 0.0, 0.0, 1.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -66,7 +66,7 @@ void myinit(void) glEnable(GL_DEPTH_TEST); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -94,7 +94,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/sceneflat.c b/progs/redbook/sceneflat.c index 10891fb9977..1b277334f5c 100644 --- a/progs/redbook/sceneflat.c +++ b/progs/redbook/sceneflat.c @@ -46,7 +46,7 @@ /* Initialize light source and shading model (GL_FLAT). */ -void myinit(void) +static void myinit(void) { GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -66,7 +66,7 @@ void myinit(void) glShadeModel (GL_FLAT); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -94,7 +94,7 @@ void display(void) glFlush(); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/select.c b/progs/redbook/select.c index 928373b8796..537d5194d46 100644 --- a/progs/redbook/select.c +++ b/progs/redbook/select.c @@ -57,7 +57,7 @@ /* draw a triangle with vertices at (x1, y1), (x2, y2) * and (x3, y3) at z units away from the origin. */ -void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2, +static void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3, GLfloat z) { glBegin (GL_TRIANGLES); @@ -68,8 +68,8 @@ void drawTriangle (GLfloat x1, GLfloat y1, GLfloat x2, } /* draw a rectangular box with these outer x, y, and z values */ -void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1, - GLfloat y2, GLfloat z1, GLfloat z2) +static void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1, + GLfloat y2, GLfloat z1, GLfloat z2) { glColor3f (1.0, 1.0, 1.0); glBegin (GL_LINE_LOOP); @@ -101,7 +101,7 @@ void drawViewVolume (GLfloat x1, GLfloat x2, GLfloat y1, /* drawScene draws 4 triangles and a wire frame * which represents the viewing volume. */ -void drawScene (void) +static void drawScene (void) { glMatrixMode (GL_PROJECTION); glLoadIdentity (); @@ -122,7 +122,7 @@ void drawScene (void) /* processHits prints out the contents of the selection array */ -void processHits (GLint hits, GLuint buffer[]) +static void processHits (GLint hits, GLuint buffer[]) { GLint i; GLuint j, names, *ptr; @@ -150,7 +150,7 @@ void processHits (GLint hits, GLuint buffer[]) */ #define BUFSIZE 512 -void selectObjects(void) +static void selectObjects(void) { GLuint selectBuf[BUFSIZE]; GLint hits; @@ -181,13 +181,13 @@ void selectObjects(void) processHits (hits, selectBuf); } -void init (void) +static void init (void) { glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); } -void display(void) +static void display(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -197,7 +197,7 @@ void display(void) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/smooth.c b/progs/redbook/smooth.c index 9d22fc90251..874033d5adf 100644 --- a/progs/redbook/smooth.c +++ b/progs/redbook/smooth.c @@ -43,13 +43,13 @@ #include #include -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); } -void triangle(void) +static void triangle(void) { glBegin (GL_TRIANGLES); glColor3f (1.0, 0.0, 0.0); @@ -61,14 +61,14 @@ void triangle(void) glEnd(); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); triangle (); glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -81,7 +81,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/stencil.c b/progs/redbook/stencil.c index b33e40a0307..5325abf8b77 100644 --- a/progs/redbook/stencil.c +++ b/progs/redbook/stencil.c @@ -64,7 +64,7 @@ #define YELLOWMAT 1 #define BLUEMAT 2 -void myinit (void) +static void myinit (void) { GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -101,7 +101,7 @@ void myinit (void) /* Draw a sphere in a diamond-shaped section in the * middle of a window with 2 tori. */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -132,7 +132,7 @@ void display(void) /* Whenever the window is reshaped, redefine the * coordinate system and redraw the stencil area. */ -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/stroke.c b/progs/redbook/stroke.c index 19b0391cbae..68b639abf4f 100644 --- a/progs/redbook/stroke.c +++ b/progs/redbook/stroke.c @@ -87,7 +87,7 @@ CP Sdata[] = { /* drawLetter() interprets the instructions from the array * for that letter and renders the letter with line segments. */ -void drawLetter(CP *l) +static void drawLetter(CP *l) { glBegin(GL_LINE_STRIP); for (;;) { @@ -111,7 +111,7 @@ void drawLetter(CP *l) } /* Create a display list for each of 6 characters */ -void myinit (void) +static void myinit (void) { GLuint base; @@ -130,13 +130,13 @@ void myinit (void) char *test1 = "A SPARE SERAPE APPEARS AS"; char *test2 = "APES PREPARE RARE PEPPERS"; -void printStrokedString(char *s) +static void printStrokedString(char *s) { GLsizei len = (GLsizei) strlen(s); glCallLists(len, GL_BYTE, (GLbyte *)s); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); diff --git a/progs/redbook/surface.c b/progs/redbook/surface.c index e33ce14f4fc..f0c5ab0b47c 100644 --- a/progs/redbook/surface.c +++ b/progs/redbook/surface.c @@ -53,7 +53,7 @@ GLUnurbsObj *theNurb; * Initializes the control points of the surface to a small hill. * The control points range from -3 to +3 in x, y, and z */ -void init_surface(void) +static void init_surface(void) { int u, v; for (u = 0; u < 4; u++) { @@ -71,7 +71,7 @@ void init_surface(void) /* Initialize material property and depth buffer. */ -void myinit(void) +static void myinit(void) { GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 }; GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -100,7 +100,7 @@ void myinit(void) glTranslatef (0.0, 0.0, -5.0); } -void display(void) +static void display(void) { GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}; int i, j; @@ -140,7 +140,7 @@ void display(void) glutSwapBuffers(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); @@ -150,7 +150,7 @@ void reshape(int w, int h) glMatrixMode(GL_MODELVIEW); } -void +static void menu(int value) { switch (value) { @@ -171,7 +171,7 @@ menu(int value) int down = 0, lastx; /* ARGSUSED1 */ -void +static void motion(int x, int y) { if (down) { @@ -182,7 +182,7 @@ motion(int x, int y) } /* ARGSUSED3 */ -void +static void mouse(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON) { diff --git a/progs/redbook/teaambient.c b/progs/redbook/teaambient.c index 53b5111752f..20ff1a4a33b 100644 --- a/progs/redbook/teaambient.c +++ b/progs/redbook/teaambient.c @@ -47,7 +47,7 @@ /* Initialize light source and lighting model. */ -void +static void myinit(void) { GLfloat light_ambient[] = @@ -78,7 +78,7 @@ myinit(void) glEnable(GL_DEPTH_TEST); } -void +static void display(void) { GLfloat low_ambient[] = @@ -114,7 +114,7 @@ display(void) glFlush(); } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/teapots.c b/progs/redbook/teapots.c index fb7aed380eb..102c18a3e33 100644 --- a/progs/redbook/teapots.c +++ b/progs/redbook/teapots.c @@ -49,7 +49,7 @@ * Initialize depth buffer, projection matrix, light source, and lighting * model. Do not specify a material property here. */ -void +static void myinit(void) { GLfloat ambient[] = @@ -83,7 +83,7 @@ myinit(void) * Move object into position. Use 3rd through 12th parameters to specify the * material property. Draw a teapot. */ -void +static void renderTeapot(GLfloat x, GLfloat y, GLfloat ambr, GLfloat ambg, GLfloat ambb, GLfloat difr, GLfloat difg, GLfloat difb, @@ -117,7 +117,7 @@ renderTeapot(GLfloat x, GLfloat y, * 3rd column: black, cyan, green, red, white, yellow plastic * 4th column: black, cyan, green, red, white, yellow rubber */ -void +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -173,7 +173,7 @@ display(void) glFlush(); } -void +static void myReshape(int w, int h) { glViewport(0, 0, w, h); diff --git a/progs/redbook/tess.c b/progs/redbook/tess.c index 238a469aff2..0bf8a8eb986 100644 --- a/progs/redbook/tess.c +++ b/progs/redbook/tess.c @@ -61,7 +61,7 @@ GLuint startList; -void display (void) { +static void display (void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(startList); @@ -69,12 +69,12 @@ void display (void) { glFlush(); } -void CALLBACK beginCallback(GLenum which) +static void CALLBACK beginCallback(GLenum which) { glBegin(which); } -void CALLBACK errorCallback(GLenum errorCode) +static void CALLBACK errorCallback(GLenum errorCode) { const GLubyte *estring; @@ -83,12 +83,12 @@ void CALLBACK errorCallback(GLenum errorCode) exit(0); } -void CALLBACK endCallback(void) +static void CALLBACK endCallback(void) { glEnd(); } -void CALLBACK vertexCallback(GLvoid *vertex) +static void CALLBACK vertexCallback(GLvoid *vertex) { const GLdouble *pointer; @@ -102,7 +102,7 @@ void CALLBACK vertexCallback(GLvoid *vertex) * but weight[4] may be used to average color, normal, or texture * coordinate data. In this program, color is weighted. */ -void CALLBACK combineCallback(GLdouble coords[3], +static void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut ) { @@ -122,7 +122,7 @@ void CALLBACK combineCallback(GLdouble coords[3], *dataOut = vertex; } -void init (void) +static void init (void) { GLUtesselator *tobj; GLdouble rect[4][3] = {{50.0, 50.0, 0.0}, @@ -199,7 +199,7 @@ void init (void) gluDeleteTess(tobj); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -208,7 +208,7 @@ void reshape (int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/tesswind.c b/progs/redbook/tesswind.c index 7d00c9f907d..4729880a57e 100644 --- a/progs/redbook/tesswind.c +++ b/progs/redbook/tesswind.c @@ -61,7 +61,7 @@ GLuint list; /* Make four display lists, * each with a different tessellated object. */ -void makeNewLists (void) { +static void makeNewLists (void) { int i; static GLdouble rects[12][3] = {{ 50.0, 50.0, 0.0}, {300.0, 50.0, 0.0}, @@ -153,7 +153,7 @@ void makeNewLists (void) { glEndList(); } -void display (void) { +static void display (void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glPushMatrix(); @@ -168,12 +168,12 @@ void display (void) { glFlush(); } -void CALLBACK beginCallback(GLenum which) +static void CALLBACK beginCallback(GLenum which) { glBegin(which); } -void CALLBACK errorCallback(GLenum errorCode) +static void CALLBACK errorCallback(GLenum errorCode) { const GLubyte *estring; @@ -182,7 +182,7 @@ void CALLBACK errorCallback(GLenum errorCode) exit(0); } -void CALLBACK endCallback(void) +static void CALLBACK endCallback(void) { glEnd(); } @@ -193,7 +193,7 @@ void CALLBACK endCallback(void) * coordinate data. */ /* ARGSUSED */ -void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4], +static void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4], GLfloat weight[4], GLdouble **dataOut ) { GLdouble *vertex; @@ -205,7 +205,7 @@ void CALLBACK combineCallback(GLdouble coords[3], GLdouble *data[4], *dataOut = vertex; } -void init(void) +static void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -226,7 +226,7 @@ void init(void) makeNewLists(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -240,7 +240,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'w': diff --git a/progs/redbook/texbind.c b/progs/redbook/texbind.c index 6a828ab2bdf..b6404b32d8c 100644 --- a/progs/redbook/texbind.c +++ b/progs/redbook/texbind.c @@ -52,7 +52,7 @@ static GLubyte otherImage[checkImageHeight][checkImageWidth][4]; static GLuint texName[2]; -void makeCheckImages(void) +static void makeCheckImages(void) { int i, j, c; @@ -72,7 +72,7 @@ void makeCheckImages(void) } } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -105,7 +105,7 @@ void init(void) glEnable(GL_TEXTURE_2D); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, texName[0]); @@ -125,7 +125,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -137,7 +137,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/texgen.c b/progs/redbook/texgen.c index 7c1802a3be9..5cb97e5a43d 100644 --- a/progs/redbook/texgen.c +++ b/progs/redbook/texgen.c @@ -60,7 +60,7 @@ GLubyte stripeImage[4*stripeImageWidth]; static GLuint texName; #endif -void makeStripeImage(void) +static void makeStripeImage(void) { int j; @@ -79,7 +79,7 @@ static GLfloat *currentCoeff; static GLenum currentPlane; static GLint currentGenMode; -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); @@ -122,7 +122,7 @@ void init(void) glMaterialf (GL_FRONT, GL_SHININESS, 64.0); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -136,7 +136,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -152,7 +152,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 'e': diff --git a/progs/redbook/texprox.c b/progs/redbook/texprox.c index 6f1e853facd..c2d699a71b2 100644 --- a/progs/redbook/texprox.c +++ b/progs/redbook/texprox.c @@ -53,7 +53,7 @@ #define GL_TEXTURE_INTERNAL_FORMAT GL_TEXTURE_COMPONENTS #endif -void init(void) +static void init(void) { GLint proxyComponents; @@ -84,12 +84,12 @@ void init(void) putchar('\n'); } -void display(void) +static void display(void) { exit(0); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); diff --git a/progs/redbook/texsub.c b/progs/redbook/texsub.c index 4e829675aba..7827d5a45f3 100644 --- a/progs/redbook/texsub.c +++ b/progs/redbook/texsub.c @@ -58,7 +58,7 @@ static GLubyte subImage[subImageHeight][subImageWidth][4]; static GLuint texName; -void makeCheckImages(void) +static void makeCheckImages(void) { int i, j, c; @@ -82,7 +82,7 @@ void makeCheckImages(void) } } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -102,7 +102,7 @@ void init(void) 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage); } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); @@ -123,7 +123,7 @@ void display(void) glDisable(GL_TEXTURE_2D); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -135,7 +135,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 's': diff --git a/progs/redbook/texturesurf.c b/progs/redbook/texturesurf.c index 0170070eaa5..2023072dba8 100644 --- a/progs/redbook/texturesurf.c +++ b/progs/redbook/texturesurf.c @@ -60,7 +60,7 @@ GLfloat ctrlpoints[4][4][3] = { GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}}, {{1.0, 0.0}, {1.0, 1.0}}}; -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); @@ -72,7 +72,7 @@ void display(void) #define imageHeight 64 GLubyte image[3*imageWidth*imageHeight]; -void makeImage(void) +static void makeImage(void) { int i, j; float ti, tj; @@ -89,7 +89,7 @@ void makeImage(void) } } -void myinit(void) +static void myinit(void) { glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlpoints[0][0][0]); @@ -112,7 +112,7 @@ void myinit(void) glShadeModel (GL_FLAT); } -void myReshape(int w, int h) +static void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); diff --git a/progs/redbook/torus.c b/progs/redbook/torus.c index 7ae4d41e263..a67d48e0f59 100644 --- a/progs/redbook/torus.c +++ b/progs/redbook/torus.c @@ -89,7 +89,7 @@ static void init(void) } /* Clear window and draw torus */ -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); @@ -98,7 +98,7 @@ void display(void) } /* Handle window resize */ -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -112,7 +112,7 @@ void reshape(int w, int h) /* Rotate about x-axis when "x" typed; rotate about y-axis when "y" typed; "i" returns torus to original view */ /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 'x': diff --git a/progs/redbook/trim.c b/progs/redbook/trim.c index f17674f6840..216f62a7c2f 100644 --- a/progs/redbook/trim.c +++ b/progs/redbook/trim.c @@ -59,7 +59,7 @@ GLUnurbsObj *theNurb; * Initializes the control points of the surface to a small hill. * The control points range from -3 to +3 in x, y, and z */ -void init_surface(void) +static void init_surface(void) { int u, v; for (u = 0; u < 4; u++) { @@ -75,7 +75,7 @@ void init_surface(void) } } -void nurbsError(GLenum errorCode) +static void nurbsError(GLenum errorCode) { const GLubyte *estring; @@ -86,7 +86,7 @@ void nurbsError(GLenum errorCode) /* Initialize material property and depth buffer. */ -void init(void) +static void init(void) { GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 }; GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -112,7 +112,7 @@ void init(void) (GLvoid (CALLBACK*) ()) nurbsError); } -void display(void) +static void display(void) { GLfloat knots[8] = {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0}; GLfloat edgePt[5][2] = /* counter clockwise */ @@ -147,7 +147,7 @@ void display(void) glFlush(); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -160,7 +160,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/unproject.c b/progs/redbook/unproject.c index 134c361bac5..6d1c7dbeded 100644 --- a/progs/redbook/unproject.c +++ b/progs/redbook/unproject.c @@ -45,14 +45,14 @@ #include #include -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT); glFlush(); } /* Change these values for a different transformation */ -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -62,7 +62,7 @@ void reshape(int w, int h) glLoadIdentity(); } -void mouse(int button, int state, int x, int y) +static void mouse(int button, int state, int x, int y) { GLint viewport[4]; GLdouble mvmatrix[16], projmatrix[16]; @@ -98,7 +98,7 @@ void mouse(int button, int state, int x, int y) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/varray.c b/progs/redbook/varray.c index b22e723e0ec..8ce39d77633 100644 --- a/progs/redbook/varray.c +++ b/progs/redbook/varray.c @@ -54,7 +54,7 @@ int setupMethod = POINTER; int derefMethod = DRAWARRAY; -void setupPointers(void) +static void setupPointers(void) { static GLint vertices[] = {25, 25, 100, 325, @@ -76,7 +76,7 @@ void setupPointers(void) glColorPointer (3, GL_FLOAT, 0, colors); } -void setupInterleave(void) +static void setupInterleave(void) { static GLfloat intertwined[] = {1.0, 0.2, 1.0, 100.0, 100.0, 0.0, @@ -89,14 +89,14 @@ void setupInterleave(void) glInterleavedArrays (GL_C3F_V3F, 0, intertwined); } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); setupPointers (); } -void display(void) +static void display(void) { glClear (GL_COLOR_BUFFER_BIT); @@ -117,7 +117,7 @@ void display(void) glFlush (); } -void reshape (int w, int h) +static void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); @@ -126,7 +126,7 @@ void reshape (int w, int h) } /* ARGSUSED2 */ -void mouse (int button, int state, int x, int y) +static void mouse (int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: @@ -160,7 +160,7 @@ void mouse (int button, int state, int x, int y) } /* ARGSUSED1 */ -void keyboard(unsigned char key, int x, int y) +static void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: diff --git a/progs/redbook/wrap.c b/progs/redbook/wrap.c index f9a1f162ab6..67749716e83 100644 --- a/progs/redbook/wrap.c +++ b/progs/redbook/wrap.c @@ -59,7 +59,7 @@ static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; static GLuint texName; #endif -void makeCheckImage(void) +static void makeCheckImage(void) { int i, j, c; @@ -74,7 +74,7 @@ void makeCheckImage(void) } } -void init(void) +static void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); @@ -101,7 +101,7 @@ void init(void) #endif } -void display(void) +static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); @@ -125,7 +125,7 @@ void display(void) glDisable(GL_TEXTURE_2D); } -void reshape(int w, int h) +static void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -137,7 +137,7 @@ void reshape(int w, int h) } /* ARGSUSED1 */ -void keyboard (unsigned char key, int x, int y) +static void keyboard (unsigned char key, int x, int y) { switch (key) { case 's': -- cgit v1.2.3 From 982acbddab536ab16b340243d2034abfb30dfe59 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 10 Oct 2009 10:45:16 -0600 Subject: progs/perf: Fix MSVC build. (cherry picked from commit cbf46ed670ef5a5c8a641730234dd7ae964c3170) --- progs/tests/texcomp_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/texcomp_image.h b/progs/tests/texcomp_image.h index e63a56774f3..a3884d4d0df 100644 --- a/progs/tests/texcomp_image.h +++ b/progs/tests/texcomp_image.h @@ -1,4 +1,4 @@ -static int ImgSize = 131072; +#define ImgSize 131072 static unsigned char ImgData[131072] = { 0x4d, 0xbc, 0x0b, 0xb4, 0xda, 0x0a, 0x78, 0xa8, 0x8d, 0xbc, 0x0c, 0xac, 0x8b, 0x7f, 0xeb, 0xf7, 0x8d, 0xbc, 0xeb, 0xab, 0xba, 0xb7, 0x82, 0xa2, 0x8d, 0xbc, 0x2b, 0xb4, 0xa2, 0xfd, 0xee, 0x2f, -- cgit v1.2.3 From 1bf2d78b11ac9ac71f4be285963db1af9f09fe73 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 22 Dec 2009 00:54:34 -0800 Subject: progs/tests: Fix build. --- progs/tests/packedpixels.c | 1 - 1 file changed, 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index 1e70a31151a..34df95549a6 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -273,7 +273,6 @@ Draw(void) glTranslatef(2, (i + 1) * (h + 2), 0); glRasterPos2i(8, 6); sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)", - IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); IntFormats[CurFormat].name, CurFormat + 1, (unsigned long) NUM_INT_FORMATS); PrintString(s); glPopMatrix(); -- cgit v1.2.3 From 0f6cbc55b7d05dbe4cd93a55238230b420e39e00 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 22 Dec 2009 00:54:34 -0800 Subject: progs/tests: Fix build. (cherry picked from commit 1bf2d78b11ac9ac71f4be285963db1af9f09fe73) --- progs/tests/packedpixels.c | 1 - 1 file changed, 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index 1e70a31151a..34df95549a6 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -273,7 +273,6 @@ Draw(void) glTranslatef(2, (i + 1) * (h + 2), 0); glRasterPos2i(8, 6); sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)", - IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); IntFormats[CurFormat].name, CurFormat + 1, (unsigned long) NUM_INT_FORMATS); PrintString(s); glPopMatrix(); -- cgit v1.2.3 From faae0e5da3c955ef98d87d127fda671de4bdb4a4 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 23 Dec 2009 16:55:16 +0100 Subject: rbug: rename pf_is_compressed to util_format_is_compressed --- progs/rbug/bin_to_bmp.c | 3 ++- progs/rbug/tex_dump.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/rbug/bin_to_bmp.c b/progs/rbug/bin_to_bmp.c index 03ff622fee7..49a5416787a 100644 --- a/progs/rbug/bin_to_bmp.c +++ b/progs/rbug/bin_to_bmp.c @@ -28,6 +28,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_debug.h" +#include "util/u_format.h" #include "util/u_network.h" #include "util/u_tile.h" @@ -73,7 +74,7 @@ static void dump(unsigned width, unsigned height, util_snprintf(filename, 512, "%s.bmp", pf_name(src_format)); - if (pf_is_compressed(src_format)) { + if (util_format_is_compressed(src_format)) { debug_printf("skipping: %s\n", filename); return; } diff --git a/progs/rbug/tex_dump.c b/progs/rbug/tex_dump.c index f9e06ee994a..963f8eeedea 100644 --- a/progs/rbug/tex_dump.c +++ b/progs/rbug/tex_dump.c @@ -27,6 +27,7 @@ #include "pipe/p_state.h" #include "util/u_memory.h" #include "util/u_debug.h" +#include "util/u_format.h" #include "util/u_network.h" #include "util/u_tile.h" #include "rbug/rbug.h" @@ -49,7 +50,7 @@ static void dump(rbug_texture_t tex, util_snprintf(filename, 512, "%llu_%s_%u.bmp", (unsigned long long)tex, pf_name(info->format), mip); - if (pf_is_compressed(info->format)) { + if (util_format_is_compressed(info->format)) { debug_printf("skipping: %s\n", filename); return; } -- cgit v1.2.3 From cdc69e34694a16e9f762aba45d7eba05e9dc8514 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 25 Dec 2009 23:13:50 -0800 Subject: progs/util: Silence warn_unused_result warnings. --- progs/util/readtex.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'progs') diff --git a/progs/util/readtex.c b/progs/util/readtex.c index d1c50a494aa..f6f511481ca 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -89,6 +90,7 @@ static rawImageRec *RawImageOpen(const char *fileName) rawImageRec *raw; GLenum swapFlag; int x; + size_t result; endianTest.testWord = 1; if (endianTest.testByte[0] == 1) { @@ -114,7 +116,8 @@ static rawImageRec *RawImageOpen(const char *fileName) } } - fread(raw, 1, 12, raw->file); + result = fread(raw, 1, 12, raw->file); + assert(result == 12); if (swapFlag) { ConvertShort(&raw->imagic, 1); @@ -162,8 +165,10 @@ static rawImageRec *RawImageOpen(const char *fileName) } raw->rleEnd = 512 + (2 * x); fseek(raw->file, 512, SEEK_SET); - fread(raw->rowStart, 1, x, raw->file); - fread(raw->rowSize, 1, x, raw->file); + result = fread(raw->rowStart, 1, x, raw->file); + assert(result == x); + result = fread(raw->rowSize, 1, x, raw->file); + assert(result == x); if (swapFlag) { ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); @@ -193,11 +198,13 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) { unsigned char *iPtr, *oPtr, pixel; int count, done = 0; + size_t result; if ((raw->type & 0xFF00) == 0x0100) { fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); - fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], - raw->file); + result = fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + assert(result == (unsigned int)raw->rowSize[y+z*raw->sizeY]); iPtr = raw->tmp; oPtr = buf; @@ -222,7 +229,8 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) } else { fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), SEEK_SET); - fread(buf, 1, raw->sizeX, raw->file); + result = fread(buf, 1, raw->sizeX, raw->file); + assert(result == raw->sizeX); } } -- cgit v1.2.3 From e81fe088f447b959b354fadf0d73fcc7ac7c468d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 26 Dec 2009 01:08:26 -0800 Subject: progs/demos: Silence warn_unused_result warnings. --- progs/demos/geartrain.c | 21 ++++++++++++++++----- progs/demos/isosurf.c | 8 +++++--- progs/demos/terrain.c | 5 ++++- 3 files changed, 25 insertions(+), 9 deletions(-) (limited to 'progs') diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c index 8fe405e8076..e6567dd6470 100644 --- a/progs/demos/geartrain.c +++ b/progs/demos/geartrain.c @@ -25,6 +25,7 @@ */ +#include #include #include #include @@ -129,8 +130,10 @@ Clear_Buffers () static void LoadTriplet (TDA A) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + result = fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + assert(result != EOF); A[0] = atof (Buf2); A[1] = atof (Buf3); A[2] = atof (Buf4); @@ -140,8 +143,10 @@ LoadTriplet (TDA A) static void LoadReal (float *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atof (Buf2); } @@ -149,8 +154,10 @@ LoadReal (float *a) static void LoadInteger (int *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atoi (Buf2); } @@ -158,8 +165,10 @@ LoadInteger (int *a) static void LoadText (char *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); strcpy (a, Buf2); } @@ -177,8 +186,10 @@ getdata (char filename[]) do { + int result; Clear_Buffers (); - fscanf (mainfile, "%s", Buf1); + result = fscanf (mainfile, "%s", Buf1); + (void) result; if (ferror (mainfile)) { printf ("\nError opening file !\n"); diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 2e9dff17261..dd5696507bb 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -132,9 +132,11 @@ static void read_surface( char *filename ) numverts = 0; while (!feof(f) && numverts #include #include #include @@ -559,12 +560,14 @@ loadpic(void) FILE *FilePic; int i, tmp; GLenum gluerr; + size_t result; if ((FilePic = fopen("terrain.dat", "r")) == NULL) { fprintf(stderr, "Error loading terrain.dat\n"); exit(-1); } - fread(bufferter, 256 * 256, 1, FilePic); + result = fread(bufferter, 256 * 256, 1, FilePic); + assert(result == 1); fclose(FilePic); for (i = 0; i < (256 * 256); i++) { -- cgit v1.2.3 From 0ab29d2b35bff913818f34d1979295a98cbe2b71 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 29 Dec 2009 21:11:37 -0800 Subject: progs/glsl: Silence compiler warnings. --- progs/glsl/shtest.c | 4 +++- progs/glsl/vert-tex.c | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'progs') diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 88315d74614..3c795437f42 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -493,7 +493,9 @@ ReadConfigFile(const char *filename, struct config_file *conf) /* ugly but functional parser */ while (!feof(f)) { - fgets(line, sizeof(line), f); + char *result; + result = fgets(line, sizeof(line), f); + (void) result; if (!feof(f) && line[0]) { if (strncmp(line, "vs ", 3) == 0) { VertShaderFile = strdup(line + 3); diff --git a/progs/glsl/vert-tex.c b/progs/glsl/vert-tex.c index 4c8bfa587aa..2b93c788889 100644 --- a/progs/glsl/vert-tex.c +++ b/progs/glsl/vert-tex.c @@ -40,15 +40,6 @@ static GLboolean Anim = GL_TRUE; static GLboolean WireFrame = GL_TRUE; static GLfloat xRot = -70.0f, yRot = 0.0f, zRot = 0.0f; - -/* value[0] = tex unit */ -static struct uniform_info Uniforms[] = { - { "tex1", 1, GL_SAMPLER_2D, { 0, 0, 0, 0 }, -1 }, - END_OF_UNIFORMS -}; - - - static void Idle(void) { -- cgit v1.2.3 From 5b2713c92a89fc6c47c3546d36eeb549e126ebc0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 30 Dec 2009 12:38:21 -0800 Subject: progs/glsl: Provide a better fix for fgets warning. --- progs/glsl/shtest.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 3c795437f42..e9800c307f3 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -492,11 +492,8 @@ ReadConfigFile(const char *filename, struct config_file *conf) conf->num_uniforms = 0; /* ugly but functional parser */ - while (!feof(f)) { - char *result; - result = fgets(line, sizeof(line), f); - (void) result; - if (!feof(f) && line[0]) { + while (fgets(line, sizeof(line), f) != NULL) { + if (line[0]) { if (strncmp(line, "vs ", 3) == 0) { VertShaderFile = strdup(line + 3); VertShaderFile[strlen(VertShaderFile) - 1] = 0; -- cgit v1.2.3 From 08d145e1d7479aab125013d6852968fa09ad6fb3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Dec 2009 21:41:37 -0700 Subject: progs/tests: added conditional rendering test program --- progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/condrender.c | 242 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+) create mode 100644 progs/tests/condrender.c (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 3e2541186b1..6f5df2e81ed 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -37,6 +37,7 @@ SOURCES = \ bug_3195.c \ bug_texstore_i8.c \ calibrate_rast.c \ + condrender.c \ copypixrate.c \ crossbar.c \ cva.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 3a0da62717c..38c28a9fe6e 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -59,6 +59,7 @@ progs = [ 'bug_3195', 'bug_texstore_i8', 'calibrate_rast', + 'condrender', 'copypixrate', 'crossbar', 'cva', diff --git a/progs/tests/condrender.c b/progs/tests/condrender.c new file mode 100644 index 00000000000..1db8a7c15af --- /dev/null +++ b/progs/tests/condrender.c @@ -0,0 +1,242 @@ +/* + * Test GL_NV_conditional_render + * + * Brian Paul + * 30 Dec 2009 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define TEST_DISPLAY_LISTS 0 + +static GLboolean Anim = GL_TRUE; +static GLfloat Xpos = 0; +static GLuint OccQuery; +static GLint Win = 0; + + +static void Idle(void) +{ + static int lastTime = 0; + static int sign = +1; + int time = glutGet(GLUT_ELAPSED_TIME); + float step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 20) /* 50Hz update */ + return; + + step = (time - lastTime) / 1000.0 * sign; + lastTime = time; + + Xpos += step; + + if (Xpos > 2.5) { + Xpos = 2.5; + sign = -1; + } + else if (Xpos < -2.5) { + Xpos = -2.5; + sign = +1; + } + glutPostRedisplay(); +} + + +static void Display( void ) +{ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glEnable(GL_DEPTH_TEST); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -15.0 ); + + /* draw the occluding polygons */ + glColor3f(0, 0.6, 0.8); + glBegin(GL_QUADS); + glVertex2f(-1.6, -1.5); + glVertex2f(-0.4, -1.5); + glVertex2f(-0.4, 1.5); + glVertex2f(-1.6, 1.5); + + glVertex2f( 0.4, -1.5); + glVertex2f( 1.6, -1.5); + glVertex2f( 1.6, 1.5); + glVertex2f( 0.4, 1.5); + glEnd(); + + /* draw the test polygon with occlusion testing */ + glPushMatrix(); + glTranslatef(Xpos, 0, -0.5); + glScalef(0.3, 0.3, 1.0); + glRotatef(-90.0 * Xpos, 0, 0, 1); + +#if TEST_DISPLAY_LISTS + glNewList(10, GL_COMPILE); + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery); + glEndList(); + glCallList(10); +#else + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery); +#endif + + glColorMask(0, 0, 0, 0); + glDepthMask(GL_FALSE); + + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + +#if TEST_DISPLAY_LISTS + glNewList(11, GL_COMPILE); + glEndQueryARB(GL_SAMPLES_PASSED_ARB); + glEndList(); + glCallList(11); +#else + glEndQueryARB(GL_SAMPLES_PASSED_ARB); +#endif + + glColorMask(1, 1, 1, 1); + glDepthMask(GL_TRUE); + + /* Note: disable depth test here so that we'll always see the orange + * box, except when it's totally culled. + */ + glDisable(GL_DEPTH_TEST); + + glBeginConditionalRenderNV(OccQuery, GL_QUERY_WAIT_NV); + /* draw the orange rect, so we can see what's going on */ + glColor3f(0.8, 0.5, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + glEndConditionalRenderNV(); + + /* always draw white outline around orange box */ + glColor3f(1.0, 1.0, 1.0); + glBegin(GL_LINE_LOOP); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glDeleteQueriesARB(1, &OccQuery); + glutDestroyWindow(Win); + exit(0); + break; + case ' ': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + const GLfloat step = 0.1; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_LEFT: + Xpos -= step; + break; + case GLUT_KEY_RIGHT: + Xpos += step; + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ + if (!glutExtensionSupported("GL_ARB_occlusion_query") || + !glutExtensionSupported("GL_NV_conditional_render")) { + printf("Sorry, this demo requires the extensions:\n"); + printf(" GL_ARB_occlusion_query\n"); + printf(" GL_NV_conditional_render\n"); + exit(-1); + } + + glGenQueriesARB(1, &OccQuery); + assert(OccQuery > 0); +} + + +int main( int argc, char *argv[] ) +{ + glutInitWindowSize( 400, 400 ); + glutInit( &argc, argv ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutIdleFunc( Idle ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 34075d0219edc2cedb5122eb0f82ee0b105b3abd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 31 Dec 2009 08:46:36 -0700 Subject: progs/tests: added test for GL_EXT_draw_buffers2 Render into two color buffers (render targets). Display half of each buffer in the window. Use different color masks for each render target. Only enable blending for the second render target. --- progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/drawbuffers2.c | 364 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 366 insertions(+) create mode 100644 progs/tests/drawbuffers2.c (limited to 'progs') diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 6f5df2e81ed..836396b2499 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -42,6 +42,7 @@ SOURCES = \ crossbar.c \ cva.c \ drawbuffers.c \ + drawbuffers2.c \ exactrast.c \ ext422square.c \ floattex.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 38c28a9fe6e..ae6488b3e6f 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -64,6 +64,7 @@ progs = [ 'crossbar', 'cva', 'drawbuffers', + 'drawbuffers2', 'exactrast', 'ext422square', 'fbotest1', diff --git a/progs/tests/drawbuffers2.c b/progs/tests/drawbuffers2.c new file mode 100644 index 00000000000..7b8cc5ca6a3 --- /dev/null +++ b/progs/tests/drawbuffers2.c @@ -0,0 +1,364 @@ +/* + * Test GL_ARB_draw_buffers2, GL_ARB_draw_buffers, GL_EXT_framebuffer_object + * and GLSL's gl_FragData[]. + * + * We draw to two color buffers and show the left half of the first + * color buffer on the left side of the window, and show the right + * half of the second color buffer on the right side of the window. + * + * Different color masks are used for the two color buffers. + * Blending is enabled for the second buffer only. + * + * Brian Paul + * 31 Dec 2009 + */ + + +#include +#include +#include +#include +#include +#include +#include "extfuncs.h" + +static int Win; +static int Width = 400, Height = 400; +static GLuint FBobject, RBobjects[3]; +static GLfloat Xrot = 0.0, Yrot = 0.0; +static GLuint Program; +static GLboolean Anim = GL_TRUE; + + +static void +CheckError(int line) +{ + GLenum err = glGetError(); + if (err) { + printf("GL Error 0x%x at line %d\n", (int) err, line); + } +} + + +static void +Display(void) +{ + GLubyte *buffer = malloc(Width * Height * 4); + static const GLenum buffers[2] = { + GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT + }; + + glUseProgram_func(Program); + + glEnable(GL_DEPTH_TEST); + + /* draw to user framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); + + /* Clear color buffer 0 (blue) */ + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glClear(GL_COLOR_BUFFER_BIT); + + /* Clear color buffer 1 (1 - blue) */ + glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); + glClear(GL_COLOR_BUFFER_BIT); + + glClear(GL_DEPTH_BUFFER_BIT); + + /* draw to two buffers w/ fragment shader */ + glDrawBuffersARB(2, buffers); + + /* different color masks for each buffer */ + if (1) { + glColorMaskIndexedEXT(0, GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); + glColorMaskIndexedEXT(1, GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); + } + + glPushMatrix(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + glPushMatrix(); + glTranslatef(1, 0, 0); + glutSolidTorus(1.0, 2.0, 10, 20); + glPopMatrix(); + glPushMatrix(); + glTranslatef(-1, 0, 0); + glRotatef(90, 1, 0, 0); + glutSolidTorus(1.0, 2.0, 10, 20); + glPopMatrix(); + glPopMatrix(); + + /* restore default color masks */ + glColorMaskIndexedEXT(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glColorMaskIndexedEXT(1, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + + /* read from user framebuffer */ + /* left half = colorbuffer 0 */ + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glPixelStorei(GL_PACK_ROW_LENGTH, Width); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, + buffer); + + /* right half = colorbuffer 1 */ + glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2); + glReadPixels(Width / 2, 0, Width - Width / 2, Height, + GL_RGBA, GL_UNSIGNED_BYTE, + buffer); + + /* draw to window */ + glUseProgram_func(0); + glDisable(GL_DEPTH_TEST); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glWindowPos2iARB(0, 0); + glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + free(buffer); + glutSwapBuffers(); + CheckError(__LINE__); +} + + +static void +Idle(void) +{ + Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.05; + glutPostRedisplay(); +} + + +static void +Reshape(int width, int height) +{ + float ar = (float) width / (float) height; + + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-ar, ar, -1.0, 1.0, 5.0, 35.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -20.0); + + Width = width; + Height = height; + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[0]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[1]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[2]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, + Width, Height); +} + + +static void +CleanUp(void) +{ + glDeleteFramebuffersEXT(1, &FBobject); + glDeleteRenderbuffersEXT(3, RBobjects); + glutDestroyWindow(Win); + exit(0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case ' ': + Anim = !Anim; + glutIdleFunc(Anim ? Idle : NULL); + break; + case 'x': + Xrot += 5.0; + break; + case 'X': + Xrot -= 5.0; + break; + case 'y': + Yrot += 5.0; + break; + case 'Y': + Yrot -= 5.0; + break; + case 27: + CleanUp(); + break; + } + glutPostRedisplay(); +} + + +static void +CheckExtensions(void) +{ + const char *req[] = { + "GL_EXT_framebuffer_object", + "GL_ARB_draw_buffers", + "GL_EXT_draw_buffers2" + }; + + const char *version = (const char *) glGetString(GL_VERSION); + GLint numBuf; + GLint i; + + for (i = 0; i < 3; i++) { + if (!glutExtensionSupported(req[i])) { + printf("Sorry, %s extension is required!\n", req[i]); + exit(1); + } + } + if (version[0] != '2') { + printf("Sorry, OpenGL 2.0 is required!\n"); + exit(1); + } + + glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &numBuf); + printf("GL_MAX_DRAW_BUFFERS_ARB = %d\n", numBuf); + if (numBuf < 2) { + printf("Sorry, GL_MAX_DRAW_BUFFERS_ARB needs to be >= 2\n"); + exit(1); + } + + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); +} + + +static void +SetupRenderbuffers(void) +{ + glGenFramebuffersEXT(1, &FBobject); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); + + glGenRenderbuffersEXT(3, RBobjects); + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[0]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[1]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBobjects[2]); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, + Width, Height); + + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_RENDERBUFFER_EXT, RBobjects[0]); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, + GL_RENDERBUFFER_EXT, RBobjects[1]); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, RBobjects[2]); + + CheckError(__LINE__); +} + + +static GLuint +LoadAndCompileShader(GLenum target, const char *text) +{ + GLint stat; + GLuint shader = glCreateShader_func(target); + glShaderSource_func(shader, 1, (const GLchar **) &text, NULL); + glCompileShader_func(shader); + glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetShaderInfoLog_func(shader, 1000, &len, log); + fprintf(stderr, "drawbuffers: problem compiling shader:\n%s\n", log); + exit(1); + } + return shader; +} + + +static void +CheckLink(GLuint prog) +{ + GLint stat; + glGetProgramiv_func(prog, GL_LINK_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog_func(prog, 1000, &len, log); + fprintf(stderr, "drawbuffers: shader link error:\n%s\n", log); + } +} + + +static void +SetupShaders(void) +{ + /* emit same color to both draw buffers */ + static const char *fragShaderText = + "void main() {\n" + " gl_FragData[0] = gl_Color; \n" + " gl_FragData[1] = gl_Color; \n" + "}\n"; + + GLuint fragShader; + + fragShader = LoadAndCompileShader(GL_FRAGMENT_SHADER, fragShaderText); + Program = glCreateProgram_func(); + + glAttachShader_func(Program, fragShader); + glLinkProgram_func(Program); + CheckLink(Program); + glUseProgram_func(Program); +} + + +static void +SetupLighting(void) +{ + static const GLfloat ambient[4] = { 0.0, 0.0, 0.0, 0.0 }; + static const GLfloat diffuse[4] = { 1.0, 1.0, 1.0, 0.75 }; + + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); + + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); +} + + +static void +Init(void) +{ + CheckExtensions(); + GetExtensionFuncs(); + SetupRenderbuffers(); + SetupShaders(); + SetupLighting(); + glEnable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnableIndexedEXT(GL_BLEND, 1); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(Width, Height); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutIdleFunc(Anim ? Idle : NULL); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 58b401315b1db3c2c483e1d1df372be76ca1001a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 31 Dec 2009 20:55:33 +0000 Subject: progs: Ignore derived files. --- progs/objviewer/.gitignore | 8 ++++++++ progs/samples/.gitignore | 1 + 2 files changed, 9 insertions(+) create mode 100644 progs/objviewer/.gitignore (limited to 'progs') diff --git a/progs/objviewer/.gitignore b/progs/objviewer/.gitignore new file mode 100644 index 00000000000..ff094f833e4 --- /dev/null +++ b/progs/objviewer/.gitignore @@ -0,0 +1,8 @@ +extfuncs.h +objview +readtex.c +readtex.h +shaderutil.c +shaderutil.h +trackball.c +trackball.h diff --git a/progs/samples/.gitignore b/progs/samples/.gitignore index f60d6e94eac..c15b886b884 100644 --- a/progs/samples/.gitignore +++ b/progs/samples/.gitignore @@ -36,6 +36,7 @@ prim quad readtex.c readtex.h +rgbtoppm select shape sphere -- cgit v1.2.3 From 7bbf7f94ea786e41ff1364cedaf7dd5c0bbf605a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 31 Dec 2009 21:10:25 +0000 Subject: scons: Build progs together with everything else. This is a substantial reorganization, This particular commit enables: - building the progs for unices platforms - glew is now built as a shared library (it is the default, and it is inconvenient and pointless to shift away from that default) - all progs get built by default --- SConstruct | 8 ++- docs/install.html | 9 ---- progs/SConscript | 38 +++++++++++++++ progs/SConstruct | 65 ------------------------- progs/demos/SConscript | 124 ++++++++++++++++++++--------------------------- progs/fp/SConscript | 15 +----- progs/glsl/SConscript | 20 +------- progs/perf/SConscript | 11 +---- progs/redbook/SConscript | 20 +------- progs/samples/SConscript | 20 +------- progs/tests/SConscript | 20 +------- progs/trivial/SConscript | 11 +---- progs/vp/SConscript | 11 +---- progs/vpglsl/SConscript | 11 +---- progs/wgl/SConscript | 14 ++---- src/glew/SConscript | 31 ++++++++---- src/glut/glx/SConscript | 66 ++++++++++++++++--------- 17 files changed, 180 insertions(+), 314 deletions(-) delete mode 100644 progs/SConstruct (limited to 'progs') diff --git a/SConstruct b/SConstruct index 0a545d5c922..ed92518eec8 100644 --- a/SConstruct +++ b/SConstruct @@ -177,7 +177,7 @@ if env['platform'] != common.default_platform: SConscript( 'src/glsl/SConscript', - variant_dir = env['build'] + '/host', + variant_dir = os.path.join(env['build'], 'host'), duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html exports={'env':host_env}, ) @@ -187,3 +187,9 @@ SConscript( variant_dir = env['build'], duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html ) + +SConscript( + 'progs/SConscript', + variant_dir = os.path.join('progs', env['build']), + duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html +) diff --git a/docs/install.html b/docs/install.html index 8c24cee7a3e..5aea92e0b51 100644 --- a/docs/install.html +++ b/docs/install.html @@ -351,20 +351,11 @@ example linux or windows, machine is x86 or x86_64, optionally followed by -debug for debug builds.

-

-The sample programs are built seperately. To build them do -

-    scons -C progs
-
-And the build output will be placed in progs/build/... -

-

To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do

     scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
-    scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
 

This will create: diff --git a/progs/SConscript b/progs/SConscript index 66eaf9e5410..3b180d00bc2 100644 --- a/progs/SConscript +++ b/progs/SConscript @@ -1,5 +1,43 @@ SConscript([ 'util/SConscript', +]) + +Import('*') + +progs_env = env.Clone() + +if progs_env['platform'] == 'windows': + progs_env.Append(CPPDEFINES = ['NOMINMAX']) + progs_env.Prepend(LIBS = [ + 'winmm', + 'kernel32', + 'user32', + 'gdi32', + ]) + +# OpenGL +if progs_env['platform'] == 'windows': + progs_env.Prepend(LIBS = ['glu32', 'opengl32']) +else: + progs_env.Prepend(LIBS = ['GLU', 'GL']) + +# Glut +progs_env.Prepend(LIBS = [glut]) + +# GLEW +progs_env.Prepend(LIBS = [glew]) + +progs_env.Prepend(CPPPATH = [ + '#progs/util', +]) + +progs_env.Prepend(LIBS = [ + util, +]) + +Export('progs_env') + +SConscript([ 'demos/SConscript', 'glsl/SConscript', 'redbook/SConscript', diff --git a/progs/SConstruct b/progs/SConstruct deleted file mode 100644 index 4d268cc6d7b..00000000000 --- a/progs/SConstruct +++ /dev/null @@ -1,65 +0,0 @@ -import os -import os.path -import sys - -env = Environment( - tools = ['generic'], - toolpath = ['../scons'], - ENV = os.environ, -) - - -# Use Mesa's headers and libs -if 1: - build_topdir = 'build' - build_subdir = env['platform'] - if env['machine'] != 'generic': - build_subdir += '-' + env['machine'] - if env['debug']: - build_subdir += "-debug" - if env['profile']: - build_subdir += "-profile" - build_dir = os.path.join(build_topdir, build_subdir) - - env.Append(CPPDEFINES = ['GLEW_STATIC']) - env.Append(CPPPATH = ['#../include']) - env.Append(LIBPATH = [ - '#../' + build_dir + '/glew/', - '#../' + build_dir + '/glut/glx', - ]) - - -conf = Configure(env) - -# OpenGL -if env['platform'] == 'windows': - env.Prepend(LIBS = ['glu32', 'opengl32']) -else: - env.Prepend(LIBS = ['GLU', 'GL']) - -# Glut -env['GLUT'] = False -if conf.CheckCHeader('GL/glut.h'): - if env['platform'] == 'windows': - env['GLUT_LIB'] = 'glut32' - else: - env['GLUT_LIB'] = 'glut' - env['GLUT'] = True - -# GLEW -env['GLEW'] = False -if conf.CheckCHeader('GL/glew.h'): - env['GLEW_LIB'] = 'glew' - env['GLEW'] = True - env.Prepend(LIBS = ['glew']) - -conf.Finish() - - -Export('env') - -SConscript( - 'SConscript', - build_dir = env['build'], - duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html -) diff --git a/progs/demos/SConscript b/progs/demos/SConscript index f851870bcf3..742dd66f36f 100644 --- a/progs/demos/SConscript +++ b/progs/demos/SConscript @@ -1,84 +1,66 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ - 'arbfplight', - 'arbfslight', - 'arbocclude', - 'bounce', - 'clearspd', - 'copypix', - 'cubemap', - 'drawpix', - 'engine', - 'fbo_firecube', - 'fire', - 'fogcoord', - 'fplight', - 'fslight', - 'gamma', - 'gearbox', - 'gears', - 'geartrain', - 'glinfo', - 'gloss', - 'gltestperf', - 'ipers', - 'isosurf', - 'lodbias', - 'morph3d', - 'multiarb', - 'paltex', - 'pointblast', - 'ray', - 'readpix', - 'reflect', - 'renormal', - 'shadowtex', - 'singlebuffer', - 'spectex', - 'spriteblast', - 'stex3d', - 'teapot', - 'terrain', - 'tessdemo', - 'texcyl', - 'texenv', - 'textures', - 'trispd', - 'tunnel', - 'tunnel2', - 'vao_demo', - 'winpos', - 'dinoshade', - 'fbotexture', - 'projtex', + 'arbfplight', + 'arbfslight', + 'arbocclude', + 'bounce', + 'clearspd', + 'copypix', + 'cubemap', + 'drawpix', + 'engine', + 'fbo_firecube', + 'fire', + 'fogcoord', + 'fplight', + 'fslight', + 'gamma', + 'gearbox', + 'gears', + 'geartrain', + 'glinfo', + 'gloss', + 'gltestperf', + 'ipers', + 'isosurf', + 'lodbias', + 'morph3d', + 'multiarb', + 'paltex', + 'pointblast', + 'ray', + 'readpix', + 'reflect', + 'renormal', + 'shadowtex', + 'singlebuffer', + 'spectex', + 'spriteblast', + 'stex3d', + 'teapot', + 'terrain', + 'tessdemo', + 'texcyl', + 'texenv', + 'textures', + 'trispd', + 'tunnel', + 'tunnel2', + 'vao_demo', + 'winpos', + 'dinoshade', + 'fbotexture', + 'projtex', ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) -env.Program( +progs_env.Program( target = 'rain', source = [ 'rain.cxx', diff --git a/progs/fp/SConscript b/progs/fp/SConscript index a78318542c1..113e11ab54e 100644 --- a/progs/fp/SConscript +++ b/progs/fp/SConscript @@ -1,15 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'fp-tri', @@ -24,7 +13,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = [prog + '.c'], ) diff --git a/progs/glsl/SConscript b/progs/glsl/SConscript index 7a4549cd705..8f2ebcf69c4 100644 --- a/progs/glsl/SConscript +++ b/progs/glsl/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'array', 'bitmap', @@ -48,7 +30,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/perf/SConscript b/progs/perf/SConscript index a5ec9a7c2a0..691478ab64d 100644 --- a/progs/perf/SConscript +++ b/progs/perf/SConscript @@ -1,11 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'copytex', @@ -21,7 +14,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = [ prog + '.c', diff --git a/progs/redbook/SConscript b/progs/redbook/SConscript index 242cb6647fc..24d7cff1b67 100644 --- a/progs/redbook/SConscript +++ b/progs/redbook/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'aaindex', 'aapoly', @@ -85,7 +67,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/samples/SConscript b/progs/samples/SConscript index 7a8a0d62d81..134dfa99807 100644 --- a/progs/samples/SConscript +++ b/progs/samples/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'accum', 'bitmap1', @@ -52,7 +34,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/tests/SConscript b/progs/tests/SConscript index ae6488b3e6f..e2c65382887 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - linux_progs = [ 'api_speed', ] @@ -140,7 +122,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 9a1f3575bdc..613383c77b1 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -1,11 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'clear-fbo-tex', @@ -154,7 +147,7 @@ progs = [ ] for prog in progs: - prog = env.Program( + prog = progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/vp/SConscript b/progs/vp/SConscript index 640c5dd8470..787cb793af2 100644 --- a/progs/vp/SConscript +++ b/progs/vp/SConscript @@ -1,13 +1,6 @@ -Import('env') +Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) - -env.Program( +progs_env.Program( target = 'vp-tris', source = ['vp-tris.c'], ) diff --git a/progs/vpglsl/SConscript b/progs/vpglsl/SConscript index 640c5dd8470..787cb793af2 100644 --- a/progs/vpglsl/SConscript +++ b/progs/vpglsl/SConscript @@ -1,13 +1,6 @@ -Import('env') +Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) - -env.Program( +progs_env.Program( target = 'vp-tris', source = ['vp-tris.c'], ) diff --git a/progs/wgl/SConscript b/progs/wgl/SConscript index 31f61676dec..248cc53a8d7 100644 --- a/progs/wgl/SConscript +++ b/progs/wgl/SConscript @@ -1,25 +1,17 @@ Import('*') -if env['platform'] != 'windows': +if progs_env['platform'] != 'windows': Return() -env = env.Clone() - -env.Append(LIBS = [ - 'kernel32', - 'user32', - 'gdi32', -]) - progs = [ 'sharedtex_mt', 'wglthreads', ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '/' + prog + '.c', ) -env.Program('wglinfo', ['wglinfo.c']) +progs_env.Program('wglinfo', ['wglinfo.c']) diff --git a/src/glew/SConscript b/src/glew/SConscript index 1161be6e633..b4541a7c26c 100644 --- a/src/glew/SConscript +++ b/src/glew/SConscript @@ -7,7 +7,7 @@ env = env.Clone() env.Append(CPPDEFINES = [ 'GLEW_BUILD', - 'GLEW_STATIC', + #'GLEW_STATIC', #'GLEW_MX', # Multiple Rendering Contexts support ]) @@ -15,15 +15,6 @@ env.PrependUnique(CPPPATH = [ '#/include', ]) -glew = env.StaticLibrary( - target = 'glew', - source = [ - 'glew.c', - ], -) - -env = env.Clone() - if env['platform'] == 'windows': env.PrependUnique(LIBS = [ 'glu32', @@ -37,6 +28,24 @@ else: 'GL', 'X11', ]) + +if env['platform'] == 'windows': + target = 'glew' +else: + target = 'GLEW' + +glew = env.SharedLibrary( + target = target, + source = [ + 'glew.c', + ], +) + +if env['platform'] == 'windows': + glew = env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') + +env = env.Clone() + env.Prepend(LIBS = [glew]) env.Program( @@ -48,3 +57,5 @@ env.Program( target = 'visualinfo', source = ['visualinfo.c'], ) + +Export('glew') diff --git a/src/glut/glx/SConscript b/src/glut/glx/SConscript index 938fec03df2..5234e6d58ac 100644 --- a/src/glut/glx/SConscript +++ b/src/glut/glx/SConscript @@ -2,11 +2,6 @@ Import('*') env = env.Clone() -if env['platform'] != 'windows': - Return() - -target = 'glut32' - env.Replace(CPPDEFINES = [ 'BUILD_GLUT32', 'GLUT_BUILDING_LIB', @@ -18,14 +13,6 @@ env.AppendUnique(CPPPATH = [ '#/include', ]) -env.PrependUnique(LIBS = [ - 'winmm', - 'gdi32', - 'user32', - 'opengl32', - 'glu32', -]) - sources = [ 'glut_bitmap.c', 'glut_bwidth.c', @@ -61,12 +48,6 @@ sources = [ 'glut_warp.c', 'glut_win.c', 'glut_winmisc.c', - - 'win32_glx.c', - 'win32_menu.c', - 'win32_util.c', - 'win32_winproc.c', - 'win32_x11.c', 'glut_8x13.c', 'glut_9x15.c', @@ -77,11 +58,52 @@ sources = [ 'glut_roman.c', 'glut_tr10.c', 'glut_tr24.c', - - 'glut.def', ] -env.SharedLibrary( +if env['platform'] == 'windows': + env.PrependUnique(LIBS = [ + 'winmm', + 'gdi32', + 'user32', + 'opengl32', + 'glu32', + ]) + target = 'glut32' + sources += [ + 'win32_glx.c', + 'win32_menu.c', + 'win32_util.c', + 'win32_winproc.c', + 'win32_x11.c', + 'glut.def', + ] +else: + env.PrependUnique(LIBS = [ + 'GLU', + 'GL', + 'X11', + 'Xext', + 'Xmu', + 'Xi', + ]) + target = 'glut' + sources += [ + 'glut_fcb.c', + 'glut_menu.c', + 'glut_menu2.c', + 'glut_glxext.c', + 'layerutil.c', + ] + + +glut = env.SharedLibrary( target = target, source = sources, ) + +env.InstallSharedLibrary(glut, version=(3, 7, 1)) + +if env['platform'] == 'windows': + glut = env.FindIxes(glut, 'LIBPREFIX', 'LIBSUFFIX') + +Export('glut') -- cgit v1.2.3 From ad9defdd9c5c7a18c833cdacebe012604190f167 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Jan 2010 16:25:37 -0800 Subject: progs/rbug: s/wait/rbug_wait/ wait conflicts with wait in /usr/include/sys/wait.h. --- progs/rbug/simple_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/rbug/simple_server.c b/progs/rbug/simple_server.c index 04380c33109..3a842c06c4e 100644 --- a/progs/rbug/simple_server.c +++ b/progs/rbug/simple_server.c @@ -29,7 +29,7 @@ #include "rbug/rbug.h" -static void wait() +static void rbug_wait() { int s = u_socket_listen_on_port(13370); int c = u_socket_accept(s); @@ -57,6 +57,6 @@ static void wait() int main(int argc, char** argv) { - wait(); + rbug_wait(); return 0; } -- cgit v1.2.3 From 646c8ce03217dbda87fd1f5aedddd3f75a477754 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Jan 2010 17:54:11 -0800 Subject: progs/samples: 'Silence no previous prototype' warnings. --- progs/samples/olympic.c | 20 ++++++++++---------- progs/samples/overlay.c | 18 +++++++++--------- progs/samples/rgbtoppm.c | 6 +++--- progs/samples/sphere.c | 30 +++++++++++++++--------------- progs/samples/star.c | 20 ++++++++++---------- progs/samples/stretch.c | 20 ++++++++++---------- progs/samples/wave.c | 2 +- 7 files changed, 58 insertions(+), 58 deletions(-) (limited to 'progs') diff --git a/progs/samples/olympic.c b/progs/samples/olympic.c index 5385e487026..209a8c141b2 100644 --- a/progs/samples/olympic.c +++ b/progs/samples/olympic.c @@ -74,7 +74,7 @@ int iters[RINGS]; GLuint theTorus; -void FillTorus(float rc, int numc, float rt, int numt) +static void FillTorus(float rc, int numc, float rt, int numt) { int i, j, k; double s, t; @@ -106,7 +106,7 @@ void FillTorus(float rc, int numc, float rt, int numt) } } -float Clamp(int iters_left, float t) +static float Clamp(int iters_left, float t) { if (iters_left < 3) { return 0.0; @@ -114,7 +114,7 @@ float Clamp(int iters_left, float t) return (iters_left-2)*t/iters_left; } -void DrawScene(void) +static void DrawScene(void) { int i, j; GLboolean goIdle; @@ -172,7 +172,7 @@ void DrawScene(void) } } -float MyRand(void) +static float MyRand(void) { return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 ); } @@ -181,12 +181,12 @@ float MyRand(void) #define GLUTCALLBACK #endif -void GLUTCALLBACK glut_post_redisplay_p(void) +static void GLUTCALLBACK glut_post_redisplay_p(void) { glutPostRedisplay(); } -void ReInit(void) +static void ReInit(void) { int i; float deviation; @@ -206,7 +206,7 @@ void ReInit(void) glutIdleFunc(glut_post_redisplay_p); } -void Init(void) +static void Init(void) { float base, height; float aspect, x, y; @@ -312,13 +312,13 @@ void Init(void) glMatrixMode(GL_MODELVIEW); } -void Reshape(int width, int height) +static void Reshape(int width, int height) { glViewport(0, 0, width, height); } -void Key(unsigned char key, int x, int y) +static void Key(unsigned char key, int x, int y) { switch (key) { @@ -330,7 +330,7 @@ void Key(unsigned char key, int x, int y) } } -GLenum Args(int argc, char **argv) +static GLenum Args(int argc, char **argv) { GLint i; diff --git a/progs/samples/overlay.c b/progs/samples/overlay.c index 23b5a4793ba..6087cef2815 100644 --- a/progs/samples/overlay.c +++ b/progs/samples/overlay.c @@ -69,19 +69,19 @@ starRec stars[MAXSTARS]; float sinTable[MAXANGLES]; -float Sin(float angle) +static float Sin(float angle) { return (sinTable[(GLint)angle]); } -float Cos(float angle) +static float Cos(float angle) { return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]); } -void NewStar(GLint n, GLint d) +static void NewStar(GLint n, GLint d) { if (rand()%4 == 0) { @@ -103,7 +103,7 @@ void NewStar(GLint n, GLint d) } } -void RotatePoint(float *x, float *y, float rotation) +static void RotatePoint(float *x, float *y, float rotation) { float tmpX, tmpY; @@ -113,7 +113,7 @@ void RotatePoint(float *x, float *y, float rotation) *y = tmpY; } -void MoveStars(void) +static void MoveStars(void) { float offset; GLint n; @@ -134,7 +134,7 @@ void MoveStars(void) } } -GLenum StarPoint(GLint n) +static GLenum StarPoint(GLint n) { float x0, y0, x1, y1, width; GLint i; @@ -182,7 +182,7 @@ GLenum StarPoint(GLint n) } } -void ShowStars(void) +static void ShowStars(void) { GLint n; @@ -221,7 +221,7 @@ static void Init(void) glDisable(GL_DITHER); } -void Reshape(int width, int height) +static void Reshape(int width, int height) { windW = (GLint)width; @@ -262,7 +262,7 @@ static void Key(unsigned char key, int x, int y) } } -void Idle(void) +static void Idle(void) { if (overlayInit == GL_FALSE) { diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index dcb74228dff..adc91469e56 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -25,7 +25,7 @@ typedef struct _ImageRec { int *rowSize; } ImageRec; -void +static void rgbtorgb(unsigned char *r,unsigned char *g,unsigned char *b,unsigned char *l,int n) { while(n--) { l[0] = r[0]; @@ -170,7 +170,7 @@ ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z) { } } -GLubyte * +static GLubyte * read_alpha_texture(char *name, int *width, int *height) { unsigned char *base, *lptr; @@ -200,7 +200,7 @@ read_alpha_texture(char *name, int *width, int *height) return (unsigned char *) base; } -GLubyte * +static GLubyte * read_rgb_texture(char *name, int *width, int *height) { unsigned char *base, *ptr; diff --git a/progs/samples/sphere.c b/progs/samples/sphere.c index 7d0508dee9f..23d4fe32c02 100644 --- a/progs/samples/sphere.c +++ b/progs/samples/sphere.c @@ -445,7 +445,7 @@ GLfloat identity[16] = { }; -void BuildCylinder(int numEdges) +static void BuildCylinder(int numEdges) { int i, top = 1.0, bottom = -1.0; float x[100], y[100], angle; @@ -481,7 +481,7 @@ void BuildCylinder(int numEdges) glEndList(); } -void BuildTorus(float rc, int numc, float rt, int numt) +static void BuildTorus(float rc, int numc, float rt, int numt) { int i, j, k; double s, t; @@ -515,7 +515,7 @@ void BuildTorus(float rc, int numc, float rt, int numt) glEndList(); } -void BuildCage(void) +static void BuildCage(void) { int i; float inc; @@ -609,7 +609,7 @@ void BuildCage(void) glEndList(); } -void BuildCube(void) +static void BuildCube(void) { int i, j; @@ -628,7 +628,7 @@ void BuildCube(void) glEndList(); } -void BuildLists(void) +static void BuildLists(void) { cube = glGenLists(1); @@ -646,7 +646,7 @@ void BuildLists(void) genericObject = torus; } -void SetDefaultSettings(void) +static void SetDefaultSettings(void) { magFilter = nnearest; @@ -657,7 +657,7 @@ void SetDefaultSettings(void) autoRotate = GL_TRUE; } -unsigned char *AlphaPadImage(int bufSize, unsigned char *inData, int alpha) +static unsigned char *AlphaPadImage(int bufSize, unsigned char *inData, int alpha) { unsigned char *outData, *out_ptr, *in_ptr; int i; @@ -677,7 +677,7 @@ unsigned char *AlphaPadImage(int bufSize, unsigned char *inData, int alpha) return outData; } -void Init(void) +static void Init(void) { float ambient[] = {0.0, 0.0, 0.0, 1.0}; float diffuse[] = {1.0, 1.0, 1.0, 1.0}; @@ -753,7 +753,7 @@ void Init(void) BuildLists(); } -void ReInit(void) +static void ReInit(void) { if (genericObject == torus) { glEnable(GL_DEPTH_TEST); @@ -773,7 +773,7 @@ void ReInit(void) glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textureEnvironment); } -void Draw(void) +static void Draw(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); @@ -806,7 +806,7 @@ void Draw(void) glutSwapBuffers(); } -void Reshape(int width, int height) +static void Reshape(int width, int height) { W = width; H = height; @@ -818,7 +818,7 @@ void Reshape(int width, int height) glMatrixMode(GL_MODELVIEW); } -void Idle(void) +static void Idle(void) { static double t0 = -1.; double t, dt; @@ -833,7 +833,7 @@ void Idle(void) glutPostRedisplay(); } -void Key2(int key, int x, int y) +static void Key2(int key, int x, int y) { switch (key) { @@ -863,7 +863,7 @@ void Key2(int key, int x, int y) glutPostRedisplay(); } -void Key(unsigned char key, int x, int y) +static void Key(unsigned char key, int x, int y) { switch (key) { @@ -950,7 +950,7 @@ void Key(unsigned char key, int x, int y) glutPostRedisplay(); } -GLenum Args(int argc, char **argv) +static GLenum Args(int argc, char **argv) { GLint i; diff --git a/progs/samples/star.c b/progs/samples/star.c index 2cf470e2a2f..2c44ebfd49e 100644 --- a/progs/samples/star.c +++ b/progs/samples/star.c @@ -67,19 +67,19 @@ starRec stars[MAXSTARS]; float sinTable[MAXANGLES]; -float Sin(float angle) +static float Sin(float angle) { return (sinTable[(GLint)angle]); } -float Cos(float angle) +static float Cos(float angle) { return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]); } -void NewStar(GLint n, GLint d) +static void NewStar(GLint n, GLint d) { if (rand()%4 == 0) { @@ -101,7 +101,7 @@ void NewStar(GLint n, GLint d) } } -void RotatePoint(float *x, float *y, float rotation) +static void RotatePoint(float *x, float *y, float rotation) { float tmpX, tmpY; @@ -111,7 +111,7 @@ void RotatePoint(float *x, float *y, float rotation) *y = tmpY; } -void MoveStars(void) +static void MoveStars(void) { float offset; GLint n; @@ -142,7 +142,7 @@ void MoveStars(void) } } -GLenum StarPoint(GLint n) +static GLenum StarPoint(GLint n) { float x0, y0, x1, y1, width; GLint i; @@ -190,7 +190,7 @@ GLenum StarPoint(GLint n) } } -void ShowStars(void) +static void ShowStars(void) { GLint n; @@ -229,7 +229,7 @@ static void Init(void) glDisable(GL_DITHER); } -void Reshape(int width, int height) +static void Reshape(int width, int height) { windW = (GLint)width; @@ -260,7 +260,7 @@ static void Key(unsigned char key, int x, int y) } } -void Draw(void) +static void Draw(void) { MoveStars(); @@ -307,7 +307,7 @@ static GLenum Args(int argc, char **argv) #define GLUTCALLBACK #endif -void GLUTCALLBACK glut_post_redisplay_p(void) +static void GLUTCALLBACK glut_post_redisplay_p(void) { glutPostRedisplay(); } diff --git a/progs/samples/stretch.c b/progs/samples/stretch.c index 1fd015d794a..11201dca230 100644 --- a/progs/samples/stretch.c +++ b/progs/samples/stretch.c @@ -67,7 +67,7 @@ int cCount, cIndex[2], cStep; GLenum op = OP_NOOP; -void DrawImage(void) +static void DrawImage(void) { glRasterPos2i(0, 0); @@ -84,7 +84,7 @@ void DrawImage(void) image->data); } -void DrawPoint(void) +static void DrawPoint(void) { int i; @@ -102,7 +102,7 @@ void DrawPoint(void) } } -void InitVList(void) +static void InitVList(void) { vList[0].x = 0.0; @@ -141,7 +141,7 @@ void InitVList(void) vList[4].tY = cList[0].y / (float)imageSizeY; } -void ScaleImage(int sizeX, int sizeY) +static void ScaleImage(int sizeX, int sizeY) { GLubyte *buf; @@ -154,7 +154,7 @@ void ScaleImage(int sizeX, int sizeY) image->sizeY = sizeY; } -void SetPoint(int x, int y) +static void SetPoint(int x, int y) { cList[cCount].x = (float)x; @@ -162,7 +162,7 @@ void SetPoint(int x, int y) cCount++; } -void Stretch(void) +static void Stretch(void) { glBegin(GL_TRIANGLES); @@ -221,7 +221,7 @@ void Stretch(void) } } -void Key(unsigned char key, int x, int y) +static void Key(unsigned char key, int x, int y) { switch (key) { @@ -245,7 +245,7 @@ void Key(unsigned char key, int x, int y) glutPostRedisplay(); } -void Mouse(int button, int state, int mouseX, int mouseY) +static void Mouse(int button, int state, int mouseX, int mouseY) { if (state != GLUT_DOWN) @@ -263,7 +263,7 @@ void Mouse(int button, int state, int mouseX, int mouseY) glutPostRedisplay(); } -void Animate(void) +static void Animate(void) { static double t0 = -1.; double t, dt; @@ -322,7 +322,7 @@ static GLenum Args(int argc, char **argv) #define GLUTCALLBACK #endif -void GLUTCALLBACK glut_post_redisplay_p(void) +static void GLUTCALLBACK glut_post_redisplay_p(void) { glutPostRedisplay(); } diff --git a/progs/samples/wave.c b/progs/samples/wave.c index d3c4687459e..396a6943e33 100644 --- a/progs/samples/wave.c +++ b/progs/samples/wave.c @@ -92,7 +92,7 @@ GLubyte contourTexture2[] = { #endif -void GLUTCALLBACK glut_post_redisplay_p(void) +static void GLUTCALLBACK glut_post_redisplay_p(void) { static double t0 = -1.; double t, dt; -- cgit v1.2.3 From 32d18924dff424eb2e06454193c6c2024f1b2795 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 2 Jan 2010 21:52:51 -0800 Subject: progs/tests: Silence warn_unused_result warning. --- progs/tests/vparray.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'progs') diff --git a/progs/tests/vparray.c b/progs/tests/vparray.c index af9b62d33e6..fe168c6cd56 100644 --- a/progs/tests/vparray.c +++ b/progs/tests/vparray.c @@ -37,13 +37,16 @@ static void read_surface( char *filename ) } numverts = 0; - while (!feof(f) && numverts < MAXVERTS) { - fscanf( f, "%f %f %f %f %f %f", - &data[numverts][0], &data[numverts][1], &data[numverts][2], - &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + while (numverts < MAXVERTS) { + int result; + result = fscanf( f, "%f %f %f %f %f %f", + &data[numverts][0], &data[numverts][1], &data[numverts][2], + &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + if (result == EOF) { + break; + } numverts++; } - numverts--; printf("%d vertices, %d triangles\n", numverts, numverts-2); printf("data = %p\n", (void *) data); -- cgit v1.2.3 From c9c6e9a39e3d38cfc05772667c759b82df8f0fff Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 2 Jan 2010 21:58:40 -0800 Subject: progs/tests: Silence uninitialized variable warning. --- progs/tests/getprocaddress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index b905eeaf81b..e699baf44bc 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -1188,7 +1188,7 @@ exercise_buffer_objects(enum Map_Buffer_Usage usage) GLuint bufferID; GLint bufferMapped; static GLubyte data[BUFFER_DATA_SIZE] = {0}; - float *dataPtr; + float *dataPtr = NULL; /* Get the function pointers we need. These are from * GL_ARB_vertex_buffer_object and are required in all -- cgit v1.2.3 From 1da47ac20e676e05c1b0b66c2c07265836f4c7eb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 3 Jan 2010 02:38:22 -0800 Subject: progs/vp: Ensure null-terminated byte string. --- progs/vp/vp-tris.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index 29cd027b00c..09236c296f7 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -96,7 +96,8 @@ static void Init( void ) exit(1); } - sz = (GLuint) fread(buf, 1, sizeof(buf), f); + sz = (GLuint) fread(buf, 1, sizeof(buf) - 1, f); + buf[sizeof(buf) - 1] = '\0'; if (!feof(f)) { fprintf(stderr, "file too long\n"); fclose(f); -- cgit v1.2.3 From 3ea5a95078bddaed66e3c9412b4b0c4685bc9ec7 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 3 Jan 2010 21:29:33 -0800 Subject: progs/samples: Silence compiler warnings. --- progs/samples/rgbtoppm.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'progs') diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index adc91469e56..403578ef423 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -3,6 +3,7 @@ /* texload is a simplistic routine for reading an SGI .rgb image file. */ +#include #include #include #include @@ -72,6 +73,7 @@ static ImageRec *ImageOpen(char *fileName) ImageRec *image; int swapFlag; int x; + int result; endianTest.testWord = 1; if (endianTest.testByte[0] == 1) { @@ -90,7 +92,8 @@ static ImageRec *ImageOpen(char *fileName) return NULL; } - fread(image, 1, 12, image->file); + result = fread(image, 1, 12, image->file); + assert(result == 12); if (swapFlag) { ConvertShort(&image->imagic, 1); @@ -117,8 +120,10 @@ static ImageRec *ImageOpen(char *fileName) } image->rleEnd = 512 + (2 * x); fseek(image->file, 512, SEEK_SET); - fread(image->rowStart, 1, x, image->file); - fread(image->rowSize, 1, x, image->file); + result = fread(image->rowStart, 1, x, image->file); + assert(result == x); + result = fread(image->rowSize, 1, x, image->file); + assert(result == x); if (swapFlag) { ConvertUint(image->rowStart, x/(int) sizeof(unsigned)); ConvertUint((unsigned *)image->rowSize, x/(int) sizeof(int)); @@ -138,11 +143,13 @@ static void ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z) { unsigned char *iPtr, *oPtr, pixel; int count; + int result; if ((image->type & 0xFF00) == 0x0100) { fseek(image->file, (long) image->rowStart[y+z*image->ysize], SEEK_SET); - fread(image->tmp, 1, (unsigned int)image->rowSize[y+z*image->ysize], - image->file); + result = fread(image->tmp, 1, (unsigned int)image->rowSize[y+z*image->ysize], + image->file); + assert(result == (unsigned int)image->rowSize[y+z*image->ysize]); iPtr = image->tmp; oPtr = buf; @@ -166,10 +173,12 @@ ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z) { } else { fseek(image->file, 512+(y*image->xsize)+(z*image->xsize*image->ysize), SEEK_SET); - fread(buf, 1, image->xsize, image->file); + result = fread(buf, 1, image->xsize, image->file); + assert(result == image->xsize); } } +#if 0 static GLubyte * read_alpha_texture(char *name, int *width, int *height) { @@ -199,6 +208,7 @@ read_alpha_texture(char *name, int *width, int *height) return (unsigned char *) base; } +#endif static GLubyte * read_rgb_texture(char *name, int *width, int *height) @@ -261,7 +271,8 @@ read_rgb_texture(char *name, int *width, int *height) int main(int argc, char **argv) { - int width, height; + int width = 0; + int height = 0; GLubyte *data; char buff[32]; int n; -- cgit v1.2.3 From 8a29e3f8e8e1f05e54959063928a93d7a5eef0f0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 3 Jan 2010 21:39:20 -0800 Subject: progs/egl: Silence uninitialized variable warnings. --- progs/egl/eglgears.c | 3 ++- progs/egl/eglscreen.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c index 052d0f9e25d..2d9b8cac7f7 100644 --- a/progs/egl/eglgears.c +++ b/progs/egl/eglgears.c @@ -374,7 +374,8 @@ main(int argc, char *argv[]) EGLint screenAttribs[10]; EGLModeMESA mode[MAX_MODES]; EGLScreenMESA screen; - EGLint count, chosenMode; + EGLint count; + EGLint chosenMode = 0; GLboolean printInfo = GL_FALSE; EGLint width = 0, height = 0; diff --git a/progs/egl/eglscreen.c b/progs/egl/eglscreen.c index 47b3ce3366f..520f76ea036 100644 --- a/progs/egl/eglscreen.c +++ b/progs/egl/eglscreen.c @@ -52,7 +52,8 @@ main(int argc, char *argv[]) EGLint screenAttribs[10]; EGLModeMESA mode[MAX_MODES]; EGLScreenMESA screen; - EGLint count, chosenMode; + EGLint count; + EGLint chosenMode = 0; EGLint width = 0, height = 0; d = eglGetDisplay(EGL_DEFAULT_DISPLAY); -- cgit v1.2.3 From 7c55fe9bfd6f5db8759610bbbf1fa220f02b8164 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Jan 2010 09:10:53 -0700 Subject: progs/fp: increase buffer size to read larger shaders --- progs/fp/fp-tri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'progs') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index ed29a2d683d..70676d4c400 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -73,7 +73,7 @@ static void Init( void ) GLuint Texture; GLint errno; GLuint prognum; - char buf[4096]; + char buf[50000]; GLuint sz; FILE *f; -- cgit v1.2.3