Fix more prototypes;

This commit is contained in:
bjorn 2023-04-25 21:45:30 -07:00
parent ad4978f692
commit cb44549205
14 changed files with 56 additions and 56 deletions

View File

@ -2667,7 +2667,7 @@ static void condemn(void* handle, VkObjectType type) {
morgue->data[morgue->head++ & MORGUE_MASK] = (gpu_victim) { handle, type, state.tick[CPU] };
}
static void expunge() {
static void expunge(void) {
gpu_morgue* morgue = &state.morgue;
while (morgue->tail != morgue->head && state.tick[GPU] >= morgue->data[morgue->tail & MORGUE_MASK].tick) {
gpu_victim* victim = &morgue->data[morgue->tail++ & MORGUE_MASK];

View File

@ -165,11 +165,11 @@ void android_main(struct android_app* app) {
(*app->activity->vm)->DetachCurrentThread(app->activity->vm);
}
bool os_init() {
bool os_init(void) {
return true;
}
void os_destroy() {
void os_destroy(void) {
// There are two ways a quit can happen, which need to be handled slightly differently:
// - If the system tells us to quit, we get an event with APP_CMD_DESTROY. In response we push a
// QUIT event to lovr.event and main will eventually exit cleanly. No other teardown necessary.
@ -189,11 +189,11 @@ void os_destroy() {
memset(&state, 0, sizeof(state));
}
const char* os_get_name() {
const char* os_get_name(void) {
return "Android";
}
uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
return sysconf(_SC_NPROCESSORS_ONLN);
}
@ -220,14 +220,14 @@ static void* log_main(void* data) {
return 0;
}
void os_open_console() {
void os_open_console(void) {
pthread_create(&log.thread, NULL, log_main, log.handles);
pthread_detach(log.thread);
}
#define NS_PER_SEC 1000000000ULL
double os_get_time() {
double os_get_time(void) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC);
@ -287,7 +287,7 @@ bool os_vm_release(void* p, size_t size) {
// - Block if the app is paused or no window is present
// - If the app was active and becomes inactive after an event, break instead of waiting for
// another event. This gives the main loop a chance to respond (e.g. exit VR mode).
void os_poll_events() {
void os_poll_events(void) {
while (!state.app->destroyRequested) {
int events;
struct android_poll_source* source;
@ -342,7 +342,7 @@ bool os_window_open(const os_window_config* config) {
return true;
}
bool os_window_is_open() {
bool os_window_is_open(void) {
return false;
}
@ -426,11 +426,11 @@ bool os_is_key_down(os_key key) {
// Private, must be declared manually to use
void* os_get_java_vm() {
void* os_get_java_vm(void) {
return state.app->activity->vm;
}
void* os_get_jni_context() {
void* os_get_jni_context(void) {
return state.app->activity->clazz;
}

View File

@ -1,10 +1,10 @@
#ifndef LOVR_USE_GLFW
void os_destroy() {
void os_destroy(void) {
//
}
void os_poll_events() {
void os_poll_events(void) {
//
}
@ -12,7 +12,7 @@ bool os_window_open(const os_window_config* config) {
return false;
}
bool os_window_is_open() {
bool os_window_is_open(void) {
return false;
}
@ -276,11 +276,11 @@ static int convertKey(os_key key) {
}
}
void os_destroy() {
void os_destroy(void) {
glfwTerminate();
}
void os_poll_events() {
void os_poll_events(void) {
if (glfwState.window) {
glfwPollEvents();
}
@ -341,7 +341,7 @@ bool os_window_open(const os_window_config* config) {
return true;
}
bool os_window_is_open() {
bool os_window_is_open(void) {
return glfwState.window;
}
@ -420,7 +420,7 @@ bool os_is_key_down(os_key key) {
}
#ifdef _WIN32
HANDLE os_get_win32_window() {
HANDLE os_get_win32_window(void) {
return (HANDLE) glfwGetWin32Window(glfwState.window);
}
#endif

View File

@ -10,23 +10,23 @@
#define NS_PER_SEC 1000000000ULL
bool os_init() {
bool os_init(void) {
return true;
}
const char* os_get_name() {
const char* os_get_name(void) {
return "Linux";
}
uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
return sysconf(_SC_NPROCESSORS_ONLN);
}
void os_open_console() {
void os_open_console(void) {
//
}
double os_get_time() {
double os_get_time(void) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC);

View File

@ -19,29 +19,29 @@ static struct {
fn_permission* onPermissionEvent;
} state;
bool os_init() {
bool os_init(void) {
mach_timebase_info_data_t info;
mach_timebase_info(&info);
state.frequency = (info.denom * 1e9) / info.numer;
return true;
}
const char* os_get_name() {
const char* os_get_name(void) {
return "macOS";
}
uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
uint32_t count;
size_t size = sizeof(count);
sysctlbyname("hw.logicalcpu", &count, &size, NULL, 0);
return count;
}
void os_open_console() {
void os_open_console(void) {
//
}
double os_get_time() {
double os_get_time(void) {
return mach_absolute_time() / (double) state.frequency;
}

View File

@ -55,24 +55,24 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR args, int show) {
#endif
bool os_init() {
bool os_init(void) {
LARGE_INTEGER f;
QueryPerformanceFrequency(&f);
frequency = f.QuadPart;
return true;
}
const char* os_get_name() {
const char* os_get_name(void) {
return "Windows";
}
uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
SYSTEM_INFO info;
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
}
void os_open_console() {
void os_open_console(void) {
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
if (GetLastError() != ERROR_ACCESS_DENIED) {
if (!AllocConsole()) {
@ -86,7 +86,7 @@ void os_open_console() {
freopen("CONOUT$", "w", stderr);
}
double os_get_time() {
double os_get_time(void) {
LARGE_INTEGER t;
QueryPerformanceCounter(&t);
return t.QuadPart / (double) frequency;

View File

@ -224,7 +224,7 @@ bool lovrAudioInit(const char* spatializer, uint32_t sampleRate) {
return state.initialized = true;
}
void lovrAudioDestroy() {
void lovrAudioDestroy(void) {
if (!state.initialized) return;
for (size_t i = 0; i < 2; i++) {
ma_device_uninit(&state.devices[i]);
@ -362,11 +362,11 @@ bool lovrAudioSetGeometry(float* vertices, uint32_t* indices, uint32_t vertexCou
return success;
}
const char* lovrAudioGetSpatializer() {
const char* lovrAudioGetSpatializer(void) {
return state.spatializer->name;
}
uint32_t lovrAudioGetSampleRate() {
uint32_t lovrAudioGetSampleRate(void) {
return state.sampleRate;
}

View File

@ -166,7 +166,7 @@ bool phonon_init(void) {
return true;
}
void phonon_destroy() {
void phonon_destroy(void) {
if (state.scratchpad) free(state.scratchpad);
for (size_t i = 0; i < MAX_SOURCES; i++) {
if (state.binauralEffect[i]) phonon_iplDestroyBinauralEffect(&state.binauralEffect[i]);

View File

@ -20,13 +20,13 @@ void lovrVariantDestroy(Variant* variant) {
}
}
bool lovrEventInit() {
bool lovrEventInit(void) {
if (state.initialized) return false;
arr_init(&state.events, arr_alloc);
return state.initialized = true;
}
void lovrEventDestroy() {
void lovrEventDestroy(void) {
if (!state.initialized) return;
for (size_t i = state.head; i < state.events.length; i++) {
Event* event = &state.events.data[i];
@ -46,7 +46,7 @@ void lovrEventDestroy() {
memset(&state, 0, sizeof(state));
}
void lovrEventPump() {
void lovrEventPump(void) {
os_poll_events();
}
@ -76,7 +76,7 @@ bool lovrEventPoll(Event* event) {
return true;
}
void lovrEventClear() {
void lovrEventClear(void) {
arr_clear(&state.events);
state.head = 0;
}

View File

@ -689,7 +689,7 @@ bool lovrGraphicsInit(GraphicsConfig* config) {
return true;
}
void lovrGraphicsDestroy() {
void lovrGraphicsDestroy(void) {
if (!state.initialized) return;
#ifndef LOVR_DISABLE_HEADSET
// If there's an active headset session it needs to be stopped so it can clean up its Pass and
@ -770,7 +770,7 @@ void lovrGraphicsDestroy() {
memset(&state, 0, sizeof(state));
}
bool lovrGraphicsIsInitialized() {
bool lovrGraphicsIsInitialized(void) {
return state.initialized;
}
@ -1100,7 +1100,7 @@ void lovrGraphicsSubmit(Pass** passes, uint32_t count) {
releasePassResources();
}
void lovrGraphicsPresent() {
void lovrGraphicsPresent(void) {
if (state.presentable) {
state.window->gpu = NULL;
state.window->renderView = NULL;
@ -1109,7 +1109,7 @@ void lovrGraphicsPresent() {
}
}
void lovrGraphicsWait() {
void lovrGraphicsWait(void) {
gpu_wait_idle();
}
@ -1305,7 +1305,7 @@ void lovrBufferClear(Buffer* buffer, uint32_t offset, uint32_t size) {
// Texture
Texture* lovrGraphicsGetWindowTexture() {
Texture* lovrGraphicsGetWindowTexture(void) {
if (!state.window->gpu) {
beginFrame();
@ -2326,7 +2326,7 @@ const MaterialInfo* lovrMaterialGetInfo(Material* material) {
// Font
Font* lovrGraphicsGetDefaultFont() {
Font* lovrGraphicsGetDefaultFont(void) {
if (!state.defaultFont) {
Rasterizer* rasterizer = lovrRasterizerCreate(NULL, 32);
state.defaultFont = lovrFontCreate(&(FontInfo) {
@ -3667,7 +3667,7 @@ static void lovrPassCheckValid(Pass* pass) {
lovrCheck(pass->tick == state.tick, "Passes can only be used for a single frame (unable to use this Pass again because lovr.graphics.submit has been called since it was created)");
}
Pass* lovrGraphicsGetWindowPass() {
Pass* lovrGraphicsGetWindowPass(void) {
if (!state.windowPass && state.window) {
Texture* window = lovrGraphicsGetWindowTexture();

View File

@ -33,7 +33,7 @@ extern double webxr_update(void);
static bool webxrAttached = false;
static HeadsetInterface* previousHeadsetDriver;
void webxr_attach() {
void webxr_attach(void) {
if (webxrAttached || lovrHeadsetInterface == &lovrHeadsetWebXRDriver) {
return;
}
@ -43,7 +43,7 @@ void webxr_attach() {
webxrAttached = true;
}
void webxr_detach() {
void webxr_detach(void) {
if (!webxrAttached) {
return;
}

View File

@ -35,7 +35,7 @@ static struct {
RandomGenerator* generator;
} state;
bool lovrMathInit() {
bool lovrMathInit(void) {
if (state.initialized) return false;
state.generator = lovrRandomGeneratorCreate();
Seed seed = { .b64 = (uint64_t) time(0) };
@ -43,7 +43,7 @@ bool lovrMathInit() {
return state.initialized = true;
}
void lovrMathDestroy() {
void lovrMathDestroy(void) {
if (!state.initialized) return;
lovrRelease(state.generator, lovrRandomGeneratorDestroy);
memset(&state, 0, sizeof(state));
@ -81,7 +81,7 @@ double lovrMathNoise4(double x, double y, double z, double w) {
return snoise4(x, y, z, w) * .5 + .5;
}
RandomGenerator* lovrMathGetRandomGenerator() {
RandomGenerator* lovrMathGetRandomGenerator(void) {
return state.generator;
}
@ -225,7 +225,7 @@ static const size_t vectorComponents[] = {
[V_MAT4] = 16
};
Pool* lovrPoolCreate() {
Pool* lovrPoolCreate(void) {
Pool* pool = calloc(1, sizeof(Pool));
lovrAssert(pool, "Out of memory");
pool->ref = 1;

View File

@ -81,7 +81,7 @@ bool lovrSystemInit(void) {
return true;
}
void lovrSystemDestroy() {
void lovrSystemDestroy(void) {
if (!state.initialized) return;
os_on_key(NULL);
os_on_text(NULL);

View File

@ -235,7 +235,7 @@ static uint32_t mantissa[2048];
static uint32_t exponent[64];
static uint16_t offset[64];
void float16Init() {
void float16Init(void) {
for (uint32_t i = 0; i < 256; i++) {
int e = i - 127;
if (e < -24) {