1000FPS CHALLENGE
Posted: Wed Jun 01, 2016 2:30 am
I have an i5-6500U CPU @ 3.2GHz (3.6GHz peak). It has an HD 530 GPU built into it. I am using Mesa 11.3.0-git i965 drivers. Despite Wikipedia and MesaMatrix saying I have GL 4.3 support, due to a lack of GLSL 4.30 support, I have OpenGL Core 4.2 EDIT: OpenGL 4.3 support is now in Mesa Git. I am now on 12.1.0-git.
The challenge is to render a 512x64x512 VXL file at >1000FPS on the target hardware. You will need to produce source code that I can compile.
There are no limits as to how you go about completely ruining the quality, but if you simply raytrace 1 pixel then while it will technically pass the challenge, it won't be a very impressive "entry".
In case it wasn't glaringly obvious, I run Linux. C or C++ is fine, just make sure the damn thing compiles in GCC. You probably don't want to use any other languages here, speed is what matters.
Intel GPUs don't really reach 1000FPS at high resolutions. Sure, you *can* reach that speed if you minimise the program window, but that's about as good as it gets.
The full fillrate is about 850FPS at 1280x720. If we minimise glxgears, we get about 1900FPS. So we'll do this on a different resolution. We only care about the "real" FPSes here, not the no-blit ones.
- 1280x720: 850FPS real, 1900FPS no-blit EDIT: Actually, a simple test which draws one triangle and uses usleep(100) yields ~1500FPS real. This category is now somewhat plausible.
- 800x600: 2200FPS real, 4600FPS no-blit
- 640x480: 3350FPS real, 6450FPS no-blit
- 640x360: 4100FPS real, 8100FPS no-blit
Any resolution in that list that isn't 1280x720 will do.
Here's a template that may or may not work:
WARNING: The NVidia shader compiler is extremely lax and lets you get away with stuff that is blatantly invalid GLSL. The Mesa shader compiler, on the other hand, actually requires you to do stuff properly. For instance, if you don't provide a #version directive, it will assume you want GLSL 1.10, which is how the actual specification works. Another example, "float k = texture(tex, tc0);" will not work. Use "float k = texture(tex, tc0).r;" instead. Make sure you print the shader logs to the console, so I can send them straight back at you when your shaders inevitably fail.
The challenge is to render a 512x64x512 VXL file at >1000FPS on the target hardware. You will need to produce source code that I can compile.
There are no limits as to how you go about completely ruining the quality, but if you simply raytrace 1 pixel then while it will technically pass the challenge, it won't be a very impressive "entry".
In case it wasn't glaringly obvious, I run Linux. C or C++ is fine, just make sure the damn thing compiles in GCC. You probably don't want to use any other languages here, speed is what matters.
Intel GPUs don't really reach 1000FPS at high resolutions. Sure, you *can* reach that speed if you minimise the program window, but that's about as good as it gets.
The full fillrate is about 850FPS at 1280x720. If we minimise glxgears, we get about 1900FPS. So we'll do this on a different resolution. We only care about the "real" FPSes here, not the no-blit ones.
- 1280x720: 850FPS real, 1900FPS no-blit EDIT: Actually, a simple test which draws one triangle and uses usleep(100) yields ~1500FPS real. This category is now somewhat plausible.
- 800x600: 2200FPS real, 4600FPS no-blit
- 640x480: 3350FPS real, 6450FPS no-blit
- 640x360: 4100FPS real, 8100FPS no-blit
Any resolution in that list that isn't 1280x720 will do.
Here's a template that may or may not work:
Code: Select all
Note that the forums appear to change hard tabs to 3-wide soft tabs so you may want to fix that.// requirements: SDL2, libepoxy
// suggested libs: datenwolf's linmath.h
// compiling on OSes that don't hate developers (i.e. anything that isn't Windows):
// cc -O1 -g -o challenge main.c `sdl2-config --cflags --libs` -lepoxy
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <epoxy/gl.h>
#include <SDL.h>
#define INIT_WIDTH 800
#define INIT_HEIGHT 600
SDL_Window *window;
SDL_GLContext context;
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
window = SDL_CreateWindow("1000FPS Challenge",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
INIT_WIDTH, INIT_HEIGHT,
SDL_WINDOW_OPENGL);
SDL_assert_release(window != NULL);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
// highest compat version: 3.0
// lowest core version: 3.1
// highest core version: currently 4.2
// if you want a core context, set the version to 3.1 or higher
// if you want a compat context, set the version to 3.0 or lower
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
context = SDL_GL_CreateContext(window);
SDL_assert_release(context);
SDL_GL_SetSwapInterval(0); // disable vsync
// set shit up here
int nextframe_time = SDL_GetTicks() + 1000;
int frame_counter = 0;
int running = 1;
while(running) {
// draw shit here
SDL_GL_SwapWindow(window);
usleep(1000);
//sched_yield();
int curframe_time = SDL_GetTicks();
frame_counter++;
if(curframe_time >= nextframe_time) {
printf("%4d FPS\n", frame_counter);
frame_counter = 0;
nextframe_time += 1000;
}
SDL_Event ev;
while(SDL_PollEvent(&ev)) {
switch(ev.type) {
case SDL_QUIT:
running = 0;
break;
}
}
}
return 0;
}
WARNING: The NVidia shader compiler is extremely lax and lets you get away with stuff that is blatantly invalid GLSL. The Mesa shader compiler, on the other hand, actually requires you to do stuff properly. For instance, if you don't provide a #version directive, it will assume you want GLSL 1.10, which is how the actual specification works. Another example, "float k = texture(tex, tc0);" will not work. Use "float k = texture(tex, tc0).r;" instead. Make sure you print the shader logs to the console, so I can send them straight back at you when your shaders inevitably fail.

