#include #include #include #include #include #include #include #include #include #include "renderer.h" #include "wayland.h" #include struct timespec program_start; void init_timer() { clock_gettime(CLOCK_MONOTONIC, &program_start); } double time_since_start() { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); return (now.tv_sec - program_start.tv_sec) + (now.tv_nsec - program_start.tv_nsec) / 1e9; } int main(int argc, char *argv[]) { char *shader_path = NULL; int output_type = OUTPUT_WINDOW; if (argc >= 2) { shader_path = argv[1]; } else { printf("need to supply path to shader\n"); exit(1); } if (argc >= 3) { // xdg toplevel window (window) or wlr_layer_shell window (layer) if (strcmp(argv[2], "window")) { output_type = OUTPUT_WINDOW; } else if (strcmp(argv[2], "layer")) { output_type = OUTPUT_LAYER; } } struct client_state state; wayland_init(&state, output_type); Renderer renderer = new_renderer(); while (state.running) { double time = time_since_start(); render(&renderer, state.width, state.height, time, shader_path, 0); commit(&state); } return 0; }