chg: set fixed rnd seed for captures
2
MAKE.bat
|
@ -685,7 +685,7 @@ if "%1"=="addons[" (
|
||||||
if "%1"=="hello" set "hello=yes" && goto loop
|
if "%1"=="hello" set "hello=yes" && goto loop
|
||||||
if "%1"=="editor" set "editor=yes" && set "v4k=yes" && set "hello=no"&& goto loop
|
if "%1"=="editor" set "editor=yes" && set "v4k=yes" && set "hello=no"&& goto loop
|
||||||
if "%1"=="run" set "run=yes" && goto loop
|
if "%1"=="run" set "run=yes" && goto loop
|
||||||
if "%1"=="all" set "v4k=yes" && set "demos=yes" && set "lab=yes" && set "editor=yes" && set "hello=yes" && goto loop
|
if "%1"=="all" set "v4k=yes" && set "demos=yes" && set "lab=yes" && set "hello=yes" && goto loop
|
||||||
|
|
||||||
if "%1"=="tcc" set "cc=%1" && goto loop
|
if "%1"=="tcc" set "cc=%1" && goto loop
|
||||||
if "%1"=="cl" set "cc=%1" && goto loop
|
if "%1"=="cl" set "cc=%1" && goto loop
|
||||||
|
|
26
TEST.bat
|
@ -1,12 +1,13 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set WORKDIR=%~dp0
|
cd /d "%~dp0\."
|
||||||
|
|
||||||
call make cook
|
call make cook
|
||||||
|
|
||||||
mkdir %WORKDIR%\tests > nul 2> nul
|
mkdir tests > nul 2> nul
|
||||||
mkdir %WORKDIR%\tests\out > nul 2> nul
|
mkdir tests\out > nul 2> nul
|
||||||
mkdir %WORKDIR%\tests\ref > nul 2> nul
|
mkdir tests\ref > nul 2> nul
|
||||||
mkdir %WORKDIR%\tests\diff > nul 2> nul
|
mkdir tests\diff > nul 2> nul
|
||||||
|
|
||||||
where gm > nul 2> nul
|
where gm > nul 2> nul
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
|
@ -16,16 +17,19 @@ if errorlevel 1 (
|
||||||
)
|
)
|
||||||
|
|
||||||
for %%x in (*.exe) do (
|
for %%x in (*.exe) do (
|
||||||
echo Running %%x...
|
@REM echo Running %%x...
|
||||||
start /wait "" "%%x" --nocook --capture=50
|
start /wait "" "%%x" --nocook --capture=50
|
||||||
|
|
||||||
if not exist %WORKDIR%\tests\ref\%%~nx.exe.png (
|
if not exist "tests\ref\%%~nx.png" (
|
||||||
echo Reference image not found. Copying %%~nx.exe.png ...
|
echo [pass] reference image not found. Copying %%~nx.png ...
|
||||||
copy %WORKDIR%\tests\out\%%~nx.exe.png %WORKDIR%\tests\ref\%%~nx.exe.png
|
copy "tests\out\%%~nx.png" "tests\ref\%%~nx.png"
|
||||||
) else (
|
) else (
|
||||||
call gm compare -metric MSE -maximum-error 0.02 %WORKDIR%\tests\ref\%%~nx.exe.png %WORKDIR%\tests\out\%%~nx.exe.png -file %WORKDIR%\tests\diff\%%~nx.exe.png > nul 2> nul
|
call gm compare -metric MSE -maximum-error 0.005 "tests\ref\%%~nx.png" "tests\out\%%~nx.png" -file "tests\diff\%%~nx.png"
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo Images differ too much. Check %WORKDIR%\tests\diff\%%~nx.exe.png
|
echo [fail] %%~nx.exe! Check "tests\diff\%%~nx.png"
|
||||||
|
) else (
|
||||||
|
echo [pass] %%~nx.exe
|
||||||
|
del "tests\diff\%%~nx.png"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,8 +38,8 @@ int main() {
|
||||||
// load model
|
// load model
|
||||||
model_t m1 = model("suzanne.obj", MODEL_NO_ANIMATIONS);
|
model_t m1 = model("suzanne.obj", MODEL_NO_ANIMATIONS);
|
||||||
model_t m2 = model("suzanne.obj", MODEL_NO_ANIMATIONS|MODEL_MATCAPS);
|
model_t m2 = model("suzanne.obj", MODEL_NO_ANIMATIONS|MODEL_MATCAPS);
|
||||||
// model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
||||||
model_t m3 = model("Scutum_low.fbx", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
// model_t m3 = model("Scutum_low.fbx", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
||||||
model_t m4 = model("cube.obj", MODEL_NO_ANIMATIONS);
|
model_t m4 = model("cube.obj", MODEL_NO_ANIMATIONS);
|
||||||
// model_t m4 = model("avp/scene.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
// model_t m4 = model("avp/scene.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
||||||
// model_t m3 = model("Cerberus_LP.FBX", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
// model_t m3 = model("Cerberus_LP.FBX", MODEL_NO_ANIMATIONS|MODEL_PBR);
|
||||||
|
@ -83,9 +83,10 @@ int main() {
|
||||||
object_model(obj4, m3);
|
object_model(obj4, m3);
|
||||||
object_scale(obj4, vec3(3,3,3));
|
object_scale(obj4, vec3(3,3,3));
|
||||||
object_move(obj4, vec3(-10+6*3,0,-10));
|
object_move(obj4, vec3(-10+6*3,0,-10));
|
||||||
object_pivot(obj4, vec3(0,0,90));
|
// object_pivot(obj4, vec3(0,0,90));
|
||||||
|
object_pivot(obj4, vec3(0,90,0));
|
||||||
|
|
||||||
// spawn object5 (pbr)
|
// spawn object5 (shadertoy)
|
||||||
object_t* obj5 = scene_spawn();
|
object_t* obj5 = scene_spawn();
|
||||||
object_model(obj5, m4);
|
object_model(obj5, m4);
|
||||||
object_diffuse(obj5, sh.tx);
|
object_diffuse(obj5, sh.tx);
|
||||||
|
|
|
@ -392983,10 +392983,15 @@ int window_swap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t capture_frame = 0;
|
static uint64_t capture_frame = 0;
|
||||||
if (cook_done && optioni("--capture", 0) && capture_frame++ == optioni("--capture", 0)) {
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
void *rgb = screenshot(3);
|
if( cook_done && ++capture_frame == capture_target ) {
|
||||||
|
mkdir( "tests/out", 0777 );
|
||||||
|
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||||
|
|
||||||
|
int n = 3;
|
||||||
|
void *rgb = screenshot(n);
|
||||||
stbi_flip_vertically_on_write(true);
|
stbi_flip_vertically_on_write(true);
|
||||||
if(!stbi_write_png(va("tests/out/%s.png", argv(0)), w, h, 3, rgb, 3 * w) ) {
|
if(!stbi_write_png(screenshot_file, w, h, n, rgb, n * w) ) {
|
||||||
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -395721,6 +395726,11 @@ static void v4k_post_init(float refresh_rate) {
|
||||||
|
|
||||||
// preload brdf LUT early
|
// preload brdf LUT early
|
||||||
(void)brdf_lut();
|
(void)brdf_lut();
|
||||||
|
|
||||||
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
|
if (capture_target) {
|
||||||
|
randset(capture_target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -51,6 +51,11 @@ static void v4k_post_init(float refresh_rate) {
|
||||||
|
|
||||||
// preload brdf LUT early
|
// preload brdf LUT early
|
||||||
(void)brdf_lut();
|
(void)brdf_lut();
|
||||||
|
|
||||||
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
|
if (capture_target) {
|
||||||
|
randset(capture_target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -660,10 +660,15 @@ int window_swap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t capture_frame = 0;
|
static uint64_t capture_frame = 0;
|
||||||
if (cook_done && optioni("--capture", 0) && capture_frame++ == optioni("--capture", 0)) {
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
void *rgb = screenshot(3);
|
if( cook_done && ++capture_frame == capture_target ) {
|
||||||
|
mkdir( "tests/out", 0777 );
|
||||||
|
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||||
|
|
||||||
|
int n = 3;
|
||||||
|
void *rgb = screenshot(n);
|
||||||
stbi_flip_vertically_on_write(true);
|
stbi_flip_vertically_on_write(true);
|
||||||
if(!stbi_write_png(va("tests/out/%s.png", argv(0)), w, h, 3, rgb, 3 * w) ) {
|
if(!stbi_write_png(screenshot_file, w, h, n, rgb, n * w) ) {
|
||||||
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
16
engine/v4k.c
|
@ -27523,10 +27523,15 @@ int window_swap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t capture_frame = 0;
|
static uint64_t capture_frame = 0;
|
||||||
if (cook_done && optioni("--capture", 0) && capture_frame++ == optioni("--capture", 0)) {
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
void *rgb = screenshot(3);
|
if( cook_done && ++capture_frame == capture_target ) {
|
||||||
|
mkdir( "tests/out", 0777 );
|
||||||
|
const char *screenshot_file = va("tests/out/%s.png", app_name());
|
||||||
|
|
||||||
|
int n = 3;
|
||||||
|
void *rgb = screenshot(n);
|
||||||
stbi_flip_vertically_on_write(true);
|
stbi_flip_vertically_on_write(true);
|
||||||
if(!stbi_write_png(va("tests/out/%s.png", argv(0)), w, h, 3, rgb, 3 * w) ) {
|
if(!stbi_write_png(screenshot_file, w, h, n, rgb, n * w) ) {
|
||||||
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
PANIC("!could not write screenshot file `%s`\n", screenshot_file);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -30261,6 +30266,11 @@ static void v4k_post_init(float refresh_rate) {
|
||||||
|
|
||||||
// preload brdf LUT early
|
// preload brdf LUT early
|
||||||
(void)brdf_lut();
|
(void)brdf_lut();
|
||||||
|
|
||||||
|
static uint64_t capture_target; do_once capture_target = optioni("--capture", 0);
|
||||||
|
if (capture_target) {
|
||||||
|
randset(capture_target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 228 KiB |
Before Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 326 KiB After Width: | Height: | Size: 326 KiB |
Before Width: | Height: | Size: 840 KiB |
After Width: | Height: | Size: 840 KiB |
Before Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 422 KiB |
After Width: | Height: | Size: 422 KiB |
Before Width: | Height: | Size: 969 KiB |
After Width: | Height: | Size: 970 KiB |
Before Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 1017 KiB After Width: | Height: | Size: 1017 KiB |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 139 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 320 KiB |
Before Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 420 KiB |
After Width: | Height: | Size: 420 KiB |
Before Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 4.4 MiB |
After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 263 KiB |
After Width: | Height: | Size: 263 KiB |
Before Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 181 KiB |
Before Width: | Height: | Size: 941 KiB |
After Width: | Height: | Size: 941 KiB |