mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 21:15:57 +00:00
Fill a window one pixel wider than the picture, and let the probes use the shader census of either game version.
gfx_fit_rect rounded the picture up to an even size, so at 1167x656 a 16:9 picture was 1166 wide and the last column stayed black, which failed --probe-vkexec; it now takes the window's parity, which keeps the bars equal at any size. The present check of --probe-vkexec expects the picture's rectangle and black bars, as --probe-window does, so it passes on a 16:10 screen too. --probe-shader, the draw part of --probe-vkexec and the pipeline self-test looked only for build/v121/shaders; probe_census_dir takes the running version's census first, then the other one's. The Linux notes say what the probes need over SSH.
This commit is contained in:
1 parent
08df794360
commit
7766716e16
6 files changed
+54
-57
No files matched your search
+13
-20
@@ -142,11 +142,16 @@ static int test_present(const GfxBackend *b, uint8_t *guest, int *w_out, int *h_
|
||||
if (fmt == VK_FORMAT_B8G8R8A8_UNORM) want[0] = to_byte(rgba[2]), want[1] = to_byte(rgba[1]), want[2] = to_byte(rgba[0]);
|
||||
else if (fmt == VK_FORMAT_R8G8B8A8_UNORM) want[0] = to_byte(rgba[0]), want[1] = to_byte(rgba[1]), want[2] = to_byte(rgba[2]);
|
||||
else CHECK(0, "swapchain format %d is not UNORM RGBA/BGRA", (int)fmt);
|
||||
uint32_t wv;
|
||||
uint32_t wv, black = 0xff000000u; // opaque black in both byte orders
|
||||
memcpy(&wv, want, 4);
|
||||
int r[4]; // the picture's rectangle; black bars around it when the window's shape differs (gfx_present.c)
|
||||
gfx_fit_rect(TEX_W, TEX_H, w, h, r);
|
||||
const uint32_t *p = (const uint32_t *)px;
|
||||
for (long k = 0, n = (long)w * h; k < n; k++)
|
||||
CHECK(p[k] == wv, "presented pixel %ld is %08x, expected %08x", k, p[k], wv);
|
||||
for (long k = 0, n = (long)w * h; k < n; k++) {
|
||||
int x = (int)(k % w), y = (int)(k / w);
|
||||
uint32_t e = x >= r[0] && x < r[0] + r[2] && y >= r[1] && y < r[1] + r[3] ? wv : black;
|
||||
CHECK(p[k] == e, "presented pixel %ld (%d, %d) is %08x, expected %08x", k, x, y, p[k], e);
|
||||
}
|
||||
vk_present_capture(0);
|
||||
b->texture_release(&t);
|
||||
b->pool_fini(&pool);
|
||||
@@ -240,7 +245,7 @@ static int test_clear(const GfxBackend *b, uint8_t *guest, int *n_inside) {
|
||||
}
|
||||
|
||||
// ---- draw part: the pipeline self-test, then a hand-built stream that clears an RGBA8 target, binds a census
|
||||
// vertex + fragment pair and draws one triangle; a census compute shader is dispatched. The census (build/v121/shaders,
|
||||
// vertex + fragment pair and draws one triangle; a census compute shader is dispatched. The census (probe_census_dir,
|
||||
// tools/shader_census.py) is read the way vk_pipeline_selftest reads it: a pair is a fragment shader and a vertex
|
||||
// shader of the same source file.
|
||||
|
||||
@@ -308,19 +313,6 @@ static char *dr_read(const char *path, long *size) {
|
||||
return b;
|
||||
}
|
||||
|
||||
static int dr_root(char *root, size_t n) {
|
||||
char exe[PLAT_PATH_MAX * 2];
|
||||
int len = plat_exe_path(exe, sizeof exe);
|
||||
if (!len || len >= sizeof exe) return 0;
|
||||
for (char *cut = plat_last_sep(exe); cut; cut = plat_last_sep(exe)) {
|
||||
*cut = 0;
|
||||
char p[PLAT_PATH_MAX * 2 + 40];
|
||||
snprintf(p, sizeof p, "%s/build/v121/shaders/jobs.json", exe);
|
||||
if (plat_file_exists(p)) return snprintf(root, n, "%s", exe) < (int)n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dr_hex(char c) { return c <= '9' ? c - '0' : (c | 32) - 'a' + 10; }
|
||||
|
||||
// A program of one census shader as the game hands it to NVN: control section, code with its 0x30-byte header.
|
||||
@@ -330,7 +322,7 @@ static prog_t *dr_prog(const char *root, const DrawEnt *e[], int n) {
|
||||
p->magic = NVN_PROG_MAGIC, p->serial = ++serial;
|
||||
for (int i = 0; i < n; i++) {
|
||||
char path[PLAT_PATH_MAX * 2 + 128];
|
||||
snprintf(path, sizeof path, "%s/build/v121/shaders/code/%.64s.code", root, e[i]->key);
|
||||
snprintf(path, sizeof path, "%s/code/%.64s.code", root, e[i]->key);
|
||||
long body;
|
||||
char *raw = dr_read(path, &body);
|
||||
if (!raw) return free(p), NULL;
|
||||
@@ -396,8 +388,9 @@ static uint8_t *draw_prefix(uint8_t *q, prog_t *prog, const pool_t *pool, tex_t
|
||||
|
||||
static int test_draw(const GfxBackend *b, uint8_t *guest, int *n_drawn, int *n_tries, int *n_cs) {
|
||||
char root[PLAT_PATH_MAX * 2], path[PLAT_PATH_MAX * 2 + 64];
|
||||
CHECK(dr_root(root, sizeof root), "build/v121/shaders/jobs.json not found");
|
||||
snprintf(path, sizeof path, "%s/build/v121/shaders/jobs.json", root);
|
||||
CHECK(probe_census_dir(root, sizeof root), "no build/v%d/shaders/jobs.json above the exe (run tools/shader_census.py)",
|
||||
rt_game_version);
|
||||
snprintf(path, sizeof path, "%s/jobs.json", root);
|
||||
long size;
|
||||
char *jobs = dr_read(path, &size);
|
||||
DrawEnt *e = malloc(sizeof *e * 20000);
|
||||
|
||||
Reference in new issue
Block a user