/*
+<<<<<<< HEAD
Copyright (r) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+=======
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+>>>>>>> upstream
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
#include "SDL_test_common.h"
#define WINDOW_WIDTH 720
#define WINDOW_HEIGHT 1280
-#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) || defined(__TIZEN__)
+#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \
+ || defined(__WINDOWS__) || defined(__LINUX__) || defined(__TIZEN__)
#define HAVE_OPENGLES2
#endif
-#define HAVE_OPENGLES2
#ifdef HAVE_OPENGLES2
do { \
data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
- return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
+ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
} \
} while ( 0 );
#endif /* __SDL_NOGETPROCADDR__ */
{ \
GLenum glError = ctx.glGetError(); \
if(glError != GL_NO_ERROR) { \
- SDLTest_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
+ SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
quit(1); \
} \
}
if(status != GL_TRUE) {
ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
- SDLTest_Log("Shader compilation failed: %s", buffer);fflush(stderr);
+ SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr);
quit(-1);
}
}
for (i = 0; i < state->num_windows; ++i) {
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) {
- SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+ SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
/* Continue for next window */
continue;
#endif
}
int
-SDL_main(int argc, char *argv[])
+main(int argc, char *argv[])
{
int fsaa, accel;
int value;
}
}
if (consumed < 0) {
- SDLTest_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
+ SDL_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
SDLTest_CommonUsage(state));
quit(1);
}
return 0;
}
- context = SDL_calloc(state->num_windows, sizeof(context));
+ context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
if (context == NULL) {
- SDLTest_Log("Out of memory!\n");
+ SDL_Log("Out of memory!\n");
quit(2);
}
for (i = 0; i < state->num_windows; i++) {
context[i] = SDL_GL_CreateContext(state->windows[i]);
if (!context[i]) {
- SDLTest_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
+ SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
quit(2);
}
}
/* Important: call this *after* creating the context */
if (LoadContext(&ctx) < 0) {
- SDLTest_Log("Could not load GLES2 functions\n");
+ SDL_Log("Could not load GLES2 functions\n");
quit(2);
return 0;
}
}
SDL_GetCurrentDisplayMode(0, &mode);
- SDLTest_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
- SDLTest_Log("\n");
- SDLTest_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR));
- SDLTest_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER));
- SDLTest_Log("Version : %s\n", ctx.glGetString(GL_VERSION));
- SDLTest_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
- SDLTest_Log("\n");
+ SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
+ SDL_Log("\n");
+ SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR));
+ SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER));
+ SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION));
+ SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
+ SDL_Log("\n");
status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
if (!status) {
- SDLTest_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
+ SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
+ SDL_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
SDL_GetError());
}
status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
if (!status) {
- SDLTest_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
+ SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
+ SDL_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
SDL_GetError());
}
status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
if (!status) {
- SDLTest_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
+ SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
+ SDL_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
SDL_GetError());
}
status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
if (!status) {
- SDLTest_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
+ SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
+ SDL_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
SDL_GetError());
}
if (fsaa) {
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
if (!status) {
- SDLTest_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
+ SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
+ SDL_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
SDL_GetError());
}
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
if (!status) {
- SDLTest_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
+ SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
+ SDL_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
SDL_GetError());
}
}
if (accel) {
status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
if (!status) {
- SDLTest_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
+ SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
} else {
- SDLTest_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
+ SDL_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
SDL_GetError());
}
}
- datas = SDL_calloc(state->num_windows, sizeof(shader_data));
+ datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data));
/* Set rendering settings for each context */
for (i = 0; i < state->num_windows; ++i) {
int w, h;
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) {
- SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+ SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
/* Continue for next window */
continue;
/* Print out some timing information */
now = SDL_GetTicks();
if (now > then) {
- SDLTest_Log("%2.2f frames per second\n",
+ SDL_Log("%2.2f frames per second\n",
((double) frames * 1000) / (now - then));
}
#if !defined(__ANDROID__) && !defined(__NACL__)
int
main(int argc, char *argv[])
{
- SDLTest_Log("No OpenGL ES support on this system\n");
+ SDL_Log("No OpenGL ES support on this system\n");
return 1;
}