aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-30 13:48:40 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-30 13:48:40 -0700
commit29a025962b9dc92534c2dcec5f068a9983b9f80b (patch)
tree8b67c660b1828923a1d8ad24e5f94943cafd3fe1 /tests
parent5a4828f4ae133fcd6d2abaf2822d6184b07eb513 (diff)
parenteefa5818573b8494549dfc30e8fd1faa4975f2af (diff)
Merge branch 'texenv' of github.com:jdashg/emscripten into incoming
Diffstat (limited to 'tests')
-rw-r--r--tests/aniso.c16
-rw-r--r--tests/gl_ps.c40
-rw-r--r--tests/gl_ps_workaround.c230
-rw-r--r--tests/gl_ps_workaround2.c230
-rw-r--r--tests/glbegin_points.c44
-rwxr-xr-xtests/runner.py168
-rw-r--r--tests/s3tc.c16
-rw-r--r--tests/s3tc_crunch.c16
-rw-r--r--tests/sdl_fog_density.c48
-rw-r--r--tests/sdl_fog_exp2.c48
-rw-r--r--tests/sdl_fog_linear.c48
-rw-r--r--tests/sdl_fog_negative.c48
-rw-r--r--tests/sdl_fog_simple.c51
-rw-r--r--tests/sdl_ogl.c48
-rw-r--r--tests/sdl_ogl_defaultMatrixMode.c46
-rw-r--r--tests/sdl_ogl_p.c44
16 files changed, 319 insertions, 822 deletions
diff --git a/tests/aniso.c b/tests/aniso.c
index e02c20ac..1126265e 100644
--- a/tests/aniso.c
+++ b/tests/aniso.c
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
const char *exts = (const char *)glGetString(GL_EXTENSIONS);
assert(hasext(exts, "GL_EXT_texture_filter_anisotropic"));
-
+
GLint aniso;
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso);
printf("Max anisotropy: %d (using that)\n", aniso);
@@ -73,10 +73,8 @@ int main(int argc, char *argv[])
// Set the OpenGL state after creating the context with SDL_SetVideoMode
glClearColor( 0, 0, 0, 0 );
-
-#if !EMSCRIPTEN
- glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
-#endif
+
+ glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
glViewport( 0, 0, 600, 600 );
@@ -155,7 +153,7 @@ int main(int argc, char *argv[])
// Clear the screen before drawing
glClear( GL_COLOR_BUFFER_BIT );
-
+
// Bind the texture to which subsequent calls refer to
int w = 10;
int n = 15;
@@ -200,7 +198,7 @@ int main(int argc, char *argv[])
}
*/
SDL_GL_SwapBuffers();
-
+
#if !EMSCRIPTEN
// Wait for 3 seconds to give us a chance to see the image
SDL_Delay(2000);
@@ -208,8 +206,8 @@ int main(int argc, char *argv[])
// Now we can delete the OpenGL texture and close down SDL
glDeleteTextures( 1, &texture );
-
+
SDL_Quit();
-
+
return 0;
}
diff --git a/tests/gl_ps.c b/tests/gl_ps.c
index 6ea0e3db..4fa79922 100644
--- a/tests/gl_ps.c
+++ b/tests/gl_ps.c
@@ -115,11 +115,11 @@ int main(int argc, char *argv[])
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
-
+
// Set the OpenGL state after creating the context with SDL_SetVideoMode
glClearColor( 0, 0, 0, 0 );
-
+
#if !EMSCRIPTEN
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
#endif
@@ -135,30 +135,30 @@ int main(int argc, char *argv[])
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
-
+
// Load the OpenGL texture
GLuint texture; // Texture object handle
SDL_Surface *surface; // Gives us the information to make the texture
-
- if ( (surface = IMG_Load("screenshot.png")) ) {
-
+
+ if ( (surface = IMG_Load("screenshot.png")) ) {
+
// Check that the image's width is a power of 2
if ( (surface->w & (surface->w - 1)) != 0 ) {
printf("warning: image.bmp's width is not a power of 2\n");
}
-
+
// Also check if the height is a power of 2
if ( (surface->h & (surface->h - 1)) != 0 ) {
printf("warning: image.bmp's height is not a power of 2\n");
}
-
+
// Have OpenGL generate a texture object handle for us
glGenTextures( 1, &texture );
-
+
// Bind the texture object
glBindTexture( GL_TEXTURE_2D, texture );
-
+
// Set the texture's stretching properties
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
@@ -169,25 +169,25 @@ int main(int argc, char *argv[])
memset(surface->pixels, 0x66, surface->w*surface->h);
// Edit the texture object's image data using the information SDL_Surface gives us
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
//SDL_UnlockSurface(surface);
- }
+ }
else {
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
SDL_Quit();
return 1;
- }
-
+ }
+
// Free the SDL_Surface only if it was successfully created
- if ( surface ) {
+ if ( surface ) {
SDL_FreeSurface( surface );
}
-
+
// Clear the screen before drawing
glClear( GL_COLOR_BUFFER_BIT );
-
+
shaders();
// Bind the texture to which subsequent calls refer to
@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
glDisableClientState(GL_VERTEX_ARRAY);
SDL_GL_SwapBuffers();
-
+
#if !EMSCRIPTEN
// Wait for 3 seconds to give us a chance to see the image
SDL_Delay(3000);
@@ -226,8 +226,8 @@ int main(int argc, char *argv[])
// Now we can delete the OpenGL texture and close down SDL
glDeleteTextures( 1, &texture );
-
+
SDL_Quit();
-
+
return 0;
}
diff --git a/tests/gl_ps_workaround.c b/tests/gl_ps_workaround.c
deleted file mode 100644
index 1e2a5c41..00000000
--- a/tests/gl_ps_workaround.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************
- * *
- * Using SDL With OpenGL *
- * *
- * Tutorial by Kyle Foley (sdw) *
- * *
- * http://gpwiki.org/index.php/SDL:Tutorials:Using_SDL_with_OpenGL *
- * *
- *******************************************************************/
-
-/*
-THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION
-AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN.
-
-THE ORIGINAL AUTHOR IS KYLE FOLEY.
-
-THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY
-OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF
-MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE,
-ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE
-RESULTING FROM THE USE, MODIFICATION, OR
-REDISTRIBUTION OF THIS SOFTWARE.
-*/
-
-#if !EMSCRIPTEN
-#define USE_GLEW 1
-#endif
-
-#if USE_GLEW
-#include "GL/glew.h"
-#endif
-
-#include "SDL/SDL.h"
-#include "SDL/SDL_image.h"
-#if !USE_GLEW
-#include "SDL/SDL_opengl.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-void shaders() {
-#if USE_GLEW
- glewInit();
-#endif
-
- GLint ok;
-
- const char *vertexShader = "void main(void) \n"
- "{ \n"
- " gl_Position = ftransform(); \n"
- " gl_TexCoord[0] = gl_MultiTexCoord0; \n"
- " gl_FrontColor = gl_Color; \n"
- "} \n";
- const char *fragmentShader = "uniform sampler2D tex0; \n"
- "void main(void) \n"
- "{ \n"
- " gl_FragColor = gl_Color * texture2D(tex0, gl_TexCoord[0].xy); \n"
- "} \n";
-
- GLuint vs = glCreateShader(GL_VERTEX_SHADER);
- glShaderSource(vs, 1, &vertexShader, NULL);
- glCompileShader(vs);
- glGetShaderiv(vs, GL_COMPILE_STATUS, &ok);
- assert(ok);
-
- GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(fs, 1, &fragmentShader, NULL);
- glCompileShader(fs);
- glGetShaderiv(fs, GL_COMPILE_STATUS, &ok);
- assert(ok);
-
- GLuint program = glCreateProgram();
-
- glAttachShader(program, vs);
- glAttachShader(program, fs);
- glLinkProgram(program);
- glGetProgramiv(program, GL_LINK_STATUS, &ok);
- assert(ok);
-
- glUseProgram(program);
-}
-
-int main(int argc, char *argv[])
-{
- SDL_Surface *screen;
-
- // Slightly different SDL initialization
- if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) {
- printf("Unable to initialize SDL: %s\n", SDL_GetError());
- return 1;
- }
-
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // *new*
-
- screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ); // *changed*
- if ( !screen ) {
- printf("Unable to set video mode: %s\n", SDL_GetError());
- return 1;
- }
-
- // Set the OpenGL state after creating the context with SDL_SetVideoMode
-
- glClearColor( 0, 0, 0, 0 );
-
-#if !EMSCRIPTEN
- glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
-#endif
-
- glViewport( 0, 0, 640, 480 );
-
- glMatrixMode( GL_PROJECTION );
- GLfloat matrixData[] = { 2.0/640, 0, 0, 0,
- 0, -2.0/480, 0, 0,
- 0, 0, -1, 0,
- -1, 1, 0, 1 };
- glLoadMatrixf(matrixData); // test loadmatrix
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- // Load the OpenGL texture
-
- GLuint texture; // Texture object handle
- SDL_Surface *surface; // Gives us the information to make the texture
-
- if ( (surface = IMG_Load("screenshot.png")) ) {
-
- // Check that the image's width is a power of 2
- if ( (surface->w & (surface->w - 1)) != 0 ) {
- printf("warning: image.bmp's width is not a power of 2\n");
- }
-
- // Also check if the height is a power of 2
- if ( (surface->h & (surface->h - 1)) != 0 ) {
- printf("warning: image.bmp's height is not a power of 2\n");
- }
-
- // Have OpenGL generate a texture object handle for us
- glGenTextures( 1, &texture );
-
- // Bind the texture object
- glBindTexture( GL_TEXTURE_2D, texture );
-
- // Set the texture's stretching properties
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-
- //SDL_LockSurface(surface);
-
- // Add some greyness
- memset(surface->pixels, 0x66, surface->w*surface->h);
-
- // Edit the texture object's image data using the information SDL_Surface gives us
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
-
- //SDL_UnlockSurface(surface);
- }
- else {
- printf("SDL could not load image.bmp: %s\n", SDL_GetError());
- SDL_Quit();
- return 1;
- }
-
- // Free the SDL_Surface only if it was successfully created
- if ( surface ) {
- SDL_FreeSurface( surface );
- }
-
- // Clear the screen before drawing
- glClear( GL_COLOR_BUFFER_BIT );
-
- shaders();
-
- // Bind the texture to which subsequent calls refer to
- glBindTexture( GL_TEXTURE_2D, texture );
-
- // Use clientside vertex pointers to render two items. In this test we have each
- // attribute in a separate buffer, packed (i.e. stride == 0)
- GLfloat vertexData[] = { 10, 10,
- 300, 10,
- 300, 128,
- 10, 128,
- 410, 10,
- 600, 10,
- 630, 200,
- 310, 250,
- 100, 300,
- 300, 300,
- 300, 400,
- 100, 400 };
- GLfloat textureData[] = { 0, 0,
- 1, 0,
- 1, 1,
- 0, 1,
- 0, 0.5,
- 1, 0.5,
- 1, 1,
- 0.5, 1,
- 0, 0,
- 1, 0,
- 1, 1,
- 0, 1, };
-
- glEnableClientState(GL_TEXTURE_2D); // XXX should be GL_TEXTURE_COORD_ARRAY); // XXX
- glTexCoordPointer(2, GL_FLOAT, 0, textureData);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vertexData);
-
- glDrawArrays(GL_QUADS, 0, 12);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
-
- SDL_GL_SwapBuffers();
-
-#if !EMSCRIPTEN
- // Wait for 3 seconds to give us a chance to see the image
- SDL_Delay(3000);
-#endif
-
- // Now we can delete the OpenGL texture and close down SDL
- glDeleteTextures( 1, &texture );
-
- SDL_Quit();
-
- return 0;
-}
diff --git a/tests/gl_ps_workaround2.c b/tests/gl_ps_workaround2.c
deleted file mode 100644
index e5bd2fd1..00000000
--- a/tests/gl_ps_workaround2.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************
- * *
- * Using SDL With OpenGL *
- * *
- * Tutorial by Kyle Foley (sdw) *
- * *
- * http://gpwiki.org/index.php/SDL:Tutorials:Using_SDL_with_OpenGL *
- * *
- *******************************************************************/
-
-/*
-THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION
-AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN.
-
-THE ORIGINAL AUTHOR IS KYLE FOLEY.
-
-THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY
-OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF
-MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE,
-ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE
-RESULTING FROM THE USE, MODIFICATION, OR
-REDISTRIBUTION OF THIS SOFTWARE.
-*/
-
-#if !EMSCRIPTEN
-#define USE_GLEW 1
-#endif
-
-#if USE_GLEW
-#include "GL/glew.h"
-#endif
-
-#include "SDL/SDL.h"
-#include "SDL/SDL_image.h"
-#if !USE_GLEW
-#include "SDL/SDL_opengl.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-void shaders() {
-#if USE_GLEW
- glewInit();
-#endif
-
- GLint ok;
-
- const char *vertexShader = "void main(void) \n"
- "{ \n"
- " gl_Position = ftransform(); \n"
- " gl_TexCoord[0] = gl_MultiTexCoord0; \n"
- " gl_FrontColor = gl_Color; \n"
- "} \n";
- const char *fragmentShader = "uniform sampler2D tex0; \n"
- "void main(void) \n"
- "{ \n"
- " gl_FragColor = gl_Color * texture2D(tex0, gl_TexCoord[0].xy); \n"
- "} \n";
-
- GLuint vs = glCreateShader(GL_VERTEX_SHADER);
- glShaderSource(vs, 1, &vertexShader, NULL);
- glCompileShader(vs);
- glGetShaderiv(vs, GL_COMPILE_STATUS, &ok);
- assert(ok);
-
- GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(fs, 1, &fragmentShader, NULL);
- glCompileShader(fs);
- glGetShaderiv(fs, GL_COMPILE_STATUS, &ok);
- assert(ok);
-
- GLuint program = glCreateProgram();
-
- glAttachShader(program, vs);
- glAttachShader(program, fs);
- glLinkProgram(program);
- glGetProgramiv(program, GL_LINK_STATUS, &ok);
- assert(ok);
-
- glUseProgram(program);
-}
-
-int main(int argc, char *argv[])
-{
- SDL_Surface *screen;
-
- // Slightly different SDL initialization
- if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) {
- printf("Unable to initialize SDL: %s\n", SDL_GetError());
- return 1;
- }
-
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // *new*
-
- screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ); // *changed*
- if ( !screen ) {
- printf("Unable to set video mode: %s\n", SDL_GetError());
- return 1;
- }
-
- // Set the OpenGL state after creating the context with SDL_SetVideoMode
-
- glClearColor( 0, 0, 0, 0 );
-
-#if !EMSCRIPTEN
- glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
-#endif
-
- glViewport( 0, 0, 640, 480 );
-
- glMatrixMode( GL_PROJECTION );
- GLfloat matrixData[] = { 2.0/640, 0, 0, 0,
- 0, -2.0/480, 0, 0,
- 0, 0, -1, 0,
- -1, 1, 0, 1 };
- glLoadMatrixf(matrixData); // test loadmatrix
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- // Load the OpenGL texture
-
- GLuint texture; // Texture object handle
- SDL_Surface *surface; // Gives us the information to make the texture
-
- if ( (surface = IMG_Load("screenshot.png")) ) {
-
- // Check that the image's width is a power of 2
- if ( (surface->w & (surface->w - 1)) != 0 ) {
- printf("warning: image.bmp's width is not a power of 2\n");
- }
-
- // Also check if the height is a power of 2
- if ( (surface->h & (surface->h - 1)) != 0 ) {
- printf("warning: image.bmp's height is not a power of 2\n");
- }
-
- // Have OpenGL generate a texture object handle for us
- glGenTextures( 1, &texture );
-
- // Bind the texture object
- glBindTexture( GL_TEXTURE_2D, texture );
-
- // Set the texture's stretching properties
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-
- //SDL_LockSurface(surface);
-
- // Add some greyness
- memset(surface->pixels, 0x66, surface->w*surface->h);
-
- // Edit the texture object's image data using the information SDL_Surface gives us
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
-
- //SDL_UnlockSurface(surface);
- }
- else {
- printf("SDL could not load image.bmp: %s\n", SDL_GetError());
- SDL_Quit();
- return 1;
- }
-
- // Free the SDL_Surface only if it was successfully created
- if ( surface ) {
- SDL_FreeSurface( surface );
- }
-
- // Clear the screen before drawing
- glClear( GL_COLOR_BUFFER_BIT );
-
- shaders();
-
- // Bind the texture to which subsequent calls refer to
- glBindTexture( GL_TEXTURE_2D, texture );
-
- // Use clientside vertex pointers to render two items. In this test we have each
- // attribute in a separate buffer, packed (i.e. stride == 0)
- GLfloat vertexData[] = { 10, 10,
- 300, 10,
- 300, 128,
- 10, 128,
- 410, 10,
- 600, 10,
- 630, 200,
- 310, 250,
- 100, 300,
- 300, 300,
- 300, 400,
- 100, 400 };
- GLfloat textureData[] = { 0, 0,
- 1, 0,
- 1, 1,
- 0, 1,
- 0, 0.5,
- 1, 0.5,
- 1, 1,
- 0.5, 1,
- 0, 0,
- 1, 0,
- 1, 1,
- 0, 1, };
-
- glEnable(GL_TEXTURE_2D); // XXX should be GL_TEXTURE_COORD_ARRAY); and also glEnableClientState! XXX two workarounds here
- glTexCoordPointer(2, GL_FLOAT, 0, textureData);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, vertexData);
-
- glDrawArrays(GL_QUADS, 0, 12);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
-
- SDL_GL_SwapBuffers();
-
-#if !EMSCRIPTEN
- // Wait for 3 seconds to give us a chance to see the image
- SDL_Delay(3000);
-#endif
-
- // Now we can delete the OpenGL texture and close down SDL
- glDeleteTextures( 1, &texture );
-
- SDL_Quit();
-
- return 0;
-}
diff --git a/tests/glbegin_points.c b/tests/glbegin_points.c
index b28cca4e..9128a4f5 100644
--- a/tests/glbegin_points.c
+++ b/tests/glbegin_points.c
@@ -46,14 +46,12 @@ int main(int argc, char *argv[])
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
-
+
// Set the OpenGL state after creating the context with SDL_SetVideoMode
glClearColor( 0, 0, 0, 0 );
-
-#if !EMSCRIPTEN
- glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
-#endif
+
+ glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
glViewport( 0, 0, 640, 480 );
@@ -66,30 +64,30 @@ int main(int argc, char *argv[])
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
-
+
// Load the OpenGL texture
GLuint texture; // Texture object handle
SDL_Surface *surface; // Gives us the information to make the texture
-
- if ( (surface = IMG_Load("screenshot.png")) ) {
-
+
+ if ( (surface = IMG_Load("screenshot.png")) ) {
+
// Check that the image's width is a power of 2
if ( (surface->w & (surface->w - 1)) != 0 ) {
printf("warning: image.bmp's width is not a power of 2\n");
}
-
+
// Also check if the height is a power of 2
if ( (surface->h & (surface->h - 1)) != 0 ) {
printf("warning: image.bmp's height is not a power of 2\n");
}
-
+
// Have OpenGL generate a texture object handle for us
glGenTextures( 1, &texture );
-
+
// Bind the texture object
glBindTexture( GL_TEXTURE_2D, texture );
-
+
// Set the texture's stretching properties
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
@@ -100,25 +98,25 @@ int main(int argc, char *argv[])
memset(surface->pixels, 0x66, surface->w*surface->h);
// Edit the texture object's image data using the information SDL_Surface gives us
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
//SDL_UnlockSurface(surface);
- }
+ }
else {
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
SDL_Quit();
return 1;
- }
-
+ }
+
// Free the SDL_Surface only if it was successfully created
- if ( surface ) {
+ if ( surface ) {
SDL_FreeSurface( surface );
}
-
+
// Clear the screen before drawing
glClear( GL_COLOR_BUFFER_BIT );
-
+
// Bind the texture to which subsequent calls refer to
glBindTexture( GL_TEXTURE_2D, texture );
@@ -151,7 +149,7 @@ int main(int argc, char *argv[])
glEnd();
SDL_GL_SwapBuffers();
-
+
#if !EMSCRIPTEN
// Wait for 3 seconds to give us a chance to see the image
SDL_Delay(3000);
@@ -159,8 +157,8 @@ int main(int argc, char *argv[])
// Now we can delete the OpenGL texture and close down SDL
glDeleteTextures( 1, &texture );
-
+
SDL_Quit();
-
+
return 0;
}
diff --git a/tests/runner.py b/tests/runner.py
index 720f434e..6e259f45 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -904,26 +904,26 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows
void interface_clock_changed()
{
- UINT8 m_divshift;
- INT32 m_divisor;
+ UINT8 m_divshift;
+ INT32 m_divisor;
- //INT64 attos = m_attoseconds_per_cycle;
- INT64 attos = 279365114840;
- m_divshift = 0;
- while (attos >= (1UL << 31))
- {
- m_divshift++;
- printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31);
- attos >>= 1;
- }
- m_divisor = attos;
+ //INT64 attos = m_attoseconds_per_cycle;
+ INT64 attos = 279365114840;
+ m_divshift = 0;
+ while (attos >= (1UL << 31))
+ {
+ m_divshift++;
+ printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31);
+ attos >>= 1;
+ }
+ m_divisor = attos;
- printf("m_divisor is %i\n",m_divisor);
+ printf("m_divisor is %i\n",m_divisor);
}
int main() {
- interface_clock_changed();
- return 0;
+ interface_clock_changed();
+ return 0;
}
'''
self.do_run(src, '''m_divshift is 1, on 279365114840 >?= 2147483648
@@ -997,8 +997,8 @@ m_divisor is 1091269979
volatile UINT64 testu64a = 14746250828952703000U;
while ((UINT64)testu32a * (UINT64)bigu32 < testu64a) {
- printf("testu64a is %llu\n", testu64a);
- testu64a /= 2;
+ printf("testu64a is %llu\n", testu64a);
+ testu64a /= 2;
}
return 0;
@@ -1456,28 +1456,28 @@ c5,de,15,8a
quint64 v = strtoull("4433ffeeddccbb00", NULL, 16);
printf("%lld\n", v);
- const string string64bitInt = "4433ffeeddccbb00";
- stringstream s(string64bitInt);
- quint64 int64bitInt = 0;
+ const string string64bitInt = "4433ffeeddccbb00";
+ stringstream s(string64bitInt);
+ quint64 int64bitInt = 0;
printf("1\n");
- s >> hex >> int64bitInt;
+ s >> hex >> int64bitInt;
printf("2\n");
- stringstream out;
- out << hex << qbswap(int64bitInt);
+ stringstream out;
+ out << hex << qbswap(int64bitInt);
- cout << out.str() << endl;
- cout << hex << int64bitInt << endl;
- cout << string64bitInt << endl;
+ cout << out.str() << endl;
+ cout << hex << int64bitInt << endl;
+ cout << string64bitInt << endl;
- if (out.str() != "bbccddeeff3344")
- {
- cout << "Failed!" << endl;
- }
- else
- {
- cout << "Succeeded!" << endl;
- }
+ if (out.str() != "bbccddeeff3344")
+ {
+ cout << "Failed!" << endl;
+ }
+ else
+ {
+ cout << "Succeeded!" << endl;
+ }
return 0;
}
@@ -3613,36 +3613,36 @@ Exiting setjmp function, level: 0, prev_jmp: -1
src = open(path_from_root('tests', 'life.c'), 'r').read()
self.do_run(src, '''--------------------------------
[] [] [][][]
- [] [] [] [][] [] [] []
-[] [][] [][] [][][] []
+ [] [] [] [][] [] [] []
+[] [][] [][] [][][] []
[] [] [] [] [][] [] []
[] [][] [] [] [] [] [][][][]
- [][] [][] [] [][][] [] []
- [] [][] [][] [][] [][][]
+ [][] [][] [] [][][] [] []
+ [] [][] [][] [][] [][][]
[][] [][][] [] []
[][] [][] []
[][][]
- []
-
-
-
-
- [][][]
- [] [][] [][]
- [][] [] [][] [][]
- [][] [][]
- []
- [][]
+ []
+
+
+
+
+ [][][]
+ [] [][] [][]
+ [][] [] [][] [][]
+ [][] [][]
+ []
+ [][]
[][] []
[] [][] []
[][][] []
- [] [][]
+ [] [][]
[] [] []
- []
+ []
[] [] []
- [][][]
-
- []
+ [][][]
+
+ []
[][][] []
--------------------------------
''', ['2'], force_c=True)
@@ -4030,15 +4030,15 @@ def process(filename):
// see related things in openjpeg
typedef struct opj_mqc_state {
- unsigned int qeval;
- int mps;
- struct opj_mqc_state *nmps;
- struct opj_mqc_state *nlps;
+ unsigned int qeval;
+ int mps;
+ struct opj_mqc_state *nmps;
+ struct opj_mqc_state *nlps;
} opj_mqc_state_t;
static opj_mqc_state_t mqc_states[2] = {
- {0x5600, 0, &mqc_states[2], &mqc_states[3]},
- {0x5602, 1, &mqc_states[3], &mqc_states[2]},
+ {0x5600, 0, &mqc_states[2], &mqc_states[3]},
+ {0x5602, 1, &