Update log levels
This commit is contained in:
parent
5f5fe249f8
commit
6fe9d082b9
2 changed files with 12 additions and 6 deletions
10
src/main.c
10
src/main.c
|
@ -17,6 +17,8 @@ int main(int argc, char *argv[]) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_set_level(LOG_DEBUG);
|
||||||
|
|
||||||
struct renderer_state state = {0};
|
struct renderer_state state = {0};
|
||||||
|
|
||||||
/* Create inotify instance */
|
/* Create inotify instance */
|
||||||
|
@ -32,7 +34,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
state.screen_shader.filename = argv[1];
|
state.screen_shader.filename = argv[1];
|
||||||
log_debug("Screen shader file: %s", state.screen_shader.filename);
|
log_info("Screen shader file: %s", state.screen_shader.filename);
|
||||||
|
|
||||||
if (state.inotify_fd != -1) {
|
if (state.inotify_fd != -1) {
|
||||||
state.screen_shader.wd = inotify_add_watch(
|
state.screen_shader.wd = inotify_add_watch(
|
||||||
|
@ -47,7 +49,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
state.buffer_shader.filename = argv[2];
|
state.buffer_shader.filename = argv[2];
|
||||||
log_debug("Buffer shader file: %s", state.buffer_shader.filename);
|
log_info("Buffer shader file: %s", state.buffer_shader.filename);
|
||||||
|
|
||||||
if (state.inotify_fd != -1) {
|
if (state.inotify_fd != -1) {
|
||||||
state.buffer_shader.wd = inotify_add_watch(
|
state.buffer_shader.wd = inotify_add_watch(
|
||||||
|
@ -120,8 +122,8 @@ int main(int argc, char *argv[]) {
|
||||||
if (state.time - state.prev_time >= 1.0) {
|
if (state.time - state.prev_time >= 1.0) {
|
||||||
double fps = (state.frame_count - state.prev_frame_count) /
|
double fps = (state.frame_count - state.prev_frame_count) /
|
||||||
(state.time - state.prev_time);
|
(state.time - state.prev_time);
|
||||||
log_debug("frame = %zu, time = %.2f, fps = %.2f, viewport = (%d, %d)",
|
log_info("frame = %zu, time = %.2f, fps = %.2f, viewport = (%d, %d)",
|
||||||
state.frame_count, state.time, fps, viewport[2], viewport[3]);
|
state.frame_count, state.time, fps, viewport[2], viewport[3]);
|
||||||
state.prev_frame_count = state.frame_count;
|
state.prev_frame_count = state.frame_count;
|
||||||
state.prev_time = state.time;
|
state.prev_time = state.time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,16 +205,20 @@ void process_input(struct renderer_state *state) {
|
||||||
} else if (num_read <= 0) {
|
} else if (num_read <= 0) {
|
||||||
log_error("[inotify] Could not read inotify state");
|
log_error("[inotify] Could not read inotify state");
|
||||||
} else {
|
} else {
|
||||||
log_debug("[inotify] File changed on disk, reloading shaders");
|
|
||||||
should_reload = true;
|
should_reload = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glfwGetKey(state->window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
if (glfwGetKey(state->window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
||||||
log_debug("Quitting");
|
log_info("Quitting");
|
||||||
glfwSetWindowShouldClose(state->window, true);
|
glfwSetWindowShouldClose(state->window, true);
|
||||||
} else if (should_reload ||
|
} else if (should_reload ||
|
||||||
glfwGetKey(state->window, GLFW_KEY_R) == GLFW_PRESS) {
|
glfwGetKey(state->window, GLFW_KEY_R) == GLFW_PRESS) {
|
||||||
|
if (should_reload) {
|
||||||
|
log_info("File changed on disk, reloading shaders");
|
||||||
|
} else {
|
||||||
|
log_info("Reloading shaders");
|
||||||
|
}
|
||||||
// reinitialize time and frame count
|
// reinitialize time and frame count
|
||||||
state->frame_count = 0;
|
state->frame_count = 0;
|
||||||
state->prev_frame_count = 0;
|
state->prev_frame_count = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue