chg: centralise --capture to tests_captureframes()
parent
f9dec24eb5
commit
8637f7ede3
|
@ -392320,6 +392320,14 @@ void record_frame() {
|
|||
#line 0
|
||||
|
||||
#line 1 "v4k_window.c"
|
||||
//-----------------------------------------------------------------------------
|
||||
// capture tests
|
||||
static
|
||||
uint64_t tests_captureframes() {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
return capture_target;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fps locking
|
||||
|
||||
|
@ -392387,8 +392395,7 @@ int fps_wait() {
|
|||
}
|
||||
static
|
||||
void window_vsync(float hz) {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( capture_target ) return;
|
||||
if( tests_captureframes() ) return;
|
||||
if( hz <= 0 ) return;
|
||||
do_once fps_locker(1);
|
||||
framerate = hz;
|
||||
|
@ -392610,7 +392617,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
|
|||
int winWidth = window_canvas().w * scale;
|
||||
int winHeight = window_canvas().h * scale;
|
||||
|
||||
if (optioni("--capture", 0)) {
|
||||
if (tests_captureframes()) {
|
||||
winWidth = 1280;
|
||||
winHeight = 720;
|
||||
}
|
||||
|
@ -392989,8 +392996,7 @@ int window_swap() {
|
|||
}
|
||||
|
||||
static uint64_t capture_frame = 0;
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( cook_done && ++capture_frame == capture_target ) {
|
||||
if( cook_done && ++capture_frame == tests_captureframes() ) {
|
||||
mkdir( "tests/out", 0777 );
|
||||
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||
|
||||
|
@ -395721,7 +395727,7 @@ static void v4k_post_init(float refresh_rate) {
|
|||
glfwShowWindow(window);
|
||||
glfwGetFramebufferSize(window, &w, &h); //glfwGetWindowSize(window, &w, &h);
|
||||
|
||||
randset(time_ns() * !optioni("--capture",0));
|
||||
randset(time_ns() * !tests_captureframes());
|
||||
boot_time = -time_ss(); // measure boot time, this is continued in window_stats()
|
||||
|
||||
// clean any errno setup by cooking stage
|
||||
|
|
|
@ -40,7 +40,7 @@ static void v4k_post_init(float refresh_rate) {
|
|||
glfwShowWindow(window);
|
||||
glfwGetFramebufferSize(window, &w, &h); //glfwGetWindowSize(window, &w, &h);
|
||||
|
||||
randset(time_ns() * !optioni("--capture",0));
|
||||
randset(time_ns() * !tests_captureframes());
|
||||
boot_time = -time_ss(); // measure boot time, this is continued in window_stats()
|
||||
|
||||
// clean any errno setup by cooking stage
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// capture tests
|
||||
static
|
||||
uint64_t tests_captureframes() {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
return capture_target;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fps locking
|
||||
|
||||
|
@ -65,8 +73,7 @@ int fps_wait() {
|
|||
}
|
||||
static
|
||||
void window_vsync(float hz) {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( capture_target ) return;
|
||||
if( tests_captureframes() ) return;
|
||||
if( hz <= 0 ) return;
|
||||
do_once fps_locker(1);
|
||||
framerate = hz;
|
||||
|
@ -288,7 +295,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
|
|||
int winWidth = window_canvas().w * scale;
|
||||
int winHeight = window_canvas().h * scale;
|
||||
|
||||
if (optioni("--capture", 0)) {
|
||||
if (tests_captureframes()) {
|
||||
winWidth = 1280;
|
||||
winHeight = 720;
|
||||
}
|
||||
|
@ -667,8 +674,7 @@ int window_swap() {
|
|||
}
|
||||
|
||||
static uint64_t capture_frame = 0;
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( cook_done && ++capture_frame == capture_target ) {
|
||||
if( cook_done && ++capture_frame == tests_captureframes() ) {
|
||||
mkdir( "tests/out", 0777 );
|
||||
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||
|
||||
|
|
18
engine/v4k.c
18
engine/v4k.c
|
@ -26860,6 +26860,14 @@ void record_frame() {
|
|||
#line 0
|
||||
|
||||
#line 1 "v4k_window.c"
|
||||
//-----------------------------------------------------------------------------
|
||||
// capture tests
|
||||
static
|
||||
uint64_t tests_captureframes() {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
return capture_target;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fps locking
|
||||
|
||||
|
@ -26927,8 +26935,7 @@ int fps_wait() {
|
|||
}
|
||||
static
|
||||
void window_vsync(float hz) {
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( capture_target ) return;
|
||||
if( tests_captureframes() ) return;
|
||||
if( hz <= 0 ) return;
|
||||
do_once fps_locker(1);
|
||||
framerate = hz;
|
||||
|
@ -27150,7 +27157,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
|
|||
int winWidth = window_canvas().w * scale;
|
||||
int winHeight = window_canvas().h * scale;
|
||||
|
||||
if (optioni("--capture", 0)) {
|
||||
if (tests_captureframes()) {
|
||||
winWidth = 1280;
|
||||
winHeight = 720;
|
||||
}
|
||||
|
@ -27529,8 +27536,7 @@ int window_swap() {
|
|||
}
|
||||
|
||||
static uint64_t capture_frame = 0;
|
||||
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||
if( cook_done && ++capture_frame == capture_target ) {
|
||||
if( cook_done && ++capture_frame == tests_captureframes() ) {
|
||||
mkdir( "tests/out", 0777 );
|
||||
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||
|
||||
|
@ -30261,7 +30267,7 @@ static void v4k_post_init(float refresh_rate) {
|
|||
glfwShowWindow(window);
|
||||
glfwGetFramebufferSize(window, &w, &h); //glfwGetWindowSize(window, &w, &h);
|
||||
|
||||
randset(time_ns() * !optioni("--capture",0));
|
||||
randset(time_ns() * !tests_captureframes());
|
||||
boot_time = -time_ss(); // measure boot time, this is continued in window_stats()
|
||||
|
||||
// clean any errno setup by cooking stage
|
||||
|
|
Loading…
Reference in New Issue