Minimal CPU shader multithreaded renderer written in pure C - raw Win32, no libraries, no abstraction layers. Pixels, threads, and math from scratch.
I just felt like doing something with C.
The math library isn't done yet, I just added the functions that I needed for the demo.
gcc src/*.c src/shaders/*.c -o build/bin.exe -lgdi32Simply init the window and choose the render function with the number of threads you want to use from your CPU. The last parameter is to enable temporal accumulation for ray tracing shaders.
#include "defines.h"
#include "win.h"
#include "shaders/sphere_tracing.h"
#include "shaders/glass_disks.h"
vec4_t main_image(vec2_t fragCoord, vec2_t resolution, float time, uint frame)
{
return glass_disks_main(fragCoord, resolution, time, frame);
}
int main(void)
{
//Init Window
window_create("Renderer", 700, 450);
//Render Loop with 10 threads and temporal accumulation enabled
window_run(main_image, 10, true);
return 0;
}