mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-28 20:08:51 -04:00
Triforce v0.8.5
A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
@@ -102,6 +102,7 @@
|
||||
#include "gpu_write_history.h" // ((Triforce) RX_VK_GPU_WRITE_HISTORY=1: gpu_wrote_hist)
|
||||
#include "wrote_regions.h" // ((Triforce, 11-21, TEX-02) the regions a GPU write ever reached: "not written" without the lock)
|
||||
#include "drawn_page_map.h" // ((Triforce, 11-21, TEX-21) a drawn texture's page map recorded at its first draw
|
||||
#include "bakescan.h" // ((Triforce, 11-26, C36) the bake write-back's scan: the list of the textures it can take
|
||||
#include "dead_count.h" // ((Triforce, 11-21, THREAD-21's first step) what destroying the dead images costs a present: counted
|
||||
#include "finalized_obsolete.h" // ((Triforce, 11-21, TEX-43) a finalized target whose storage the CPU has rewritten goes)
|
||||
#include "slot_retire.h" // ((Triforce, 11-21, TEX-76) a depth target another size replaced at its start: let go after 16 presents)
|
||||
@@ -3218,6 +3219,25 @@ bool upload_inner(Texture& tex, const Ranges* dirty) {
|
||||
widen_rows(out, blocks, (size_t)g.tw * th * g.td, src_bpb, out_bpb, widen_alpha(src_vf));
|
||||
}
|
||||
st_bytes += (int64_t)out_bytes;
|
||||
// ((11-28) lab: RX_VK_TEX_SAVE=<w>x<h>[,<w>x<h>...]: those sizes' uploads into RX_VK_TEX_SAVE_DIR as uploaded:
|
||||
// ASTC decoded (RGBA8), others in their blocks. For the Jabu-Jabu bars' textures)
|
||||
if (static const char* save = getenv("RX_VK_TEX_SAVE"); save && level == 0) {
|
||||
char want[32];
|
||||
snprintf(want, sizeof want, "%ux%u", tex.width, tex.height);
|
||||
const char* dir = getenv("RX_VK_TEX_SAVE_DIR");
|
||||
if (dir && strstr(save, want)) {
|
||||
static std::atomic<int> saved{0};
|
||||
char name[512];
|
||||
snprintf(name, sizeof name, "%s\\tex_%s_vf%d_%llx_y%u_%d.bin", dir, want, (int)tex.format,
|
||||
(unsigned long long)tex.gpu, y0, saved++);
|
||||
if (FILE* f = fopen(name, "wb")) {
|
||||
fwrite(tex.astc ? out : blocks, 1, tex.astc ? out_bytes : block_bytes, f);
|
||||
fclose(f);
|
||||
logf("vk: texture saved: %s (%llu bytes, %ux%u, rows from block %u)", name,
|
||||
(unsigned long long)(tex.astc ? out_bytes : block_bytes), g.w, px_h, y0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// (a sparse image: only its blocks this holds texels other than zero get memory; the others read
|
||||
// zero unbound, and what the copy writes into them is dropped)
|
||||
if (tex.sparse) {
|
||||
@@ -3487,9 +3507,11 @@ bool bc1_retype(Texture& x, const char* why) {
|
||||
}
|
||||
|
||||
void vw_forget(const Texture& t); // (below: a destroyed texture leaves the list of GPU-written ones)
|
||||
void bake_forget(Texture* tex); // ((Triforce, 11-26, C36) and the bake write-back's list: bakescan.h)
|
||||
void forget_gpu(Texture* tex) {
|
||||
if (tex->freed_listed) reuse_drop(*tex); // ((Triforce, 11-21, TEX-14) gone: no image to take)
|
||||
vw_forget(*tex);
|
||||
bake_forget(tex);
|
||||
if (gpu_write_history_on()) { // ((Triforce) RX_VK_GPU_WRITE_HISTORY: watched no more)
|
||||
std::lock_guard lk(gpu_wrote_mu);
|
||||
gpu_wrote_hist.forget(tex->id, tex->gpu, tex->gpu + tex->guest_size);
|
||||
@@ -4670,6 +4692,18 @@ uint32_t texture_epoch() {
|
||||
// game that reads it on the CPU gets them too. Not marked: a texture that had the CPU's texels before the GPU's (mixed
|
||||
// content), virtual pools, storage over 64 MB.
|
||||
void bake_note_written(Texture* t); // (below: what the GPU baked, into the game's memory)
|
||||
// ((Triforce, 11-26, C36) bakescan.h: the textures bake_writeback_step can take (drawn by the GPU in one frame, their texels
|
||||
// not in the game's memory yet), listed where they become so: texture_written and the step's two lost copies; a destroyed
|
||||
// one leaves it in forget_gpu. The step walks this, not the whole cache. RX_VK_BAKE_SCAN=all: the whole cache and no list,
|
||||
// as before)
|
||||
bool bake_list_kept(); // (below: not with RX_VK_BAKE_WRITEBACK=0 or RX_VK_BAKE_SCAN=all, where nothing reads the list)
|
||||
namespace { // (the same unnamed namespace forget_gpu's declaration of bake_forget is in, above)
|
||||
bakescan::List<Texture> bake_list;
|
||||
void bake_forget(Texture* tex) { bake_list.forget(tex); }
|
||||
// (every place that tells the list calls this: listed where the list is kept. A call and not a branch at the call, so that
|
||||
// texture_written's control flow, and with it its entry in the renderer's play profile (RX_VK_PGO), stays v0.8.4's)
|
||||
void bake_list_note(Texture* tex) { if (bake_list_kept()) bake_list.note(tex); }
|
||||
} // namespace
|
||||
constexpr uint32_t kAuditMark = 0x6f555047; // ("GPUo")
|
||||
bool audit_on() {
|
||||
static const bool on = getenv("RX_VK_AUDIT_GPU_ONLY") && atoi(getenv("RX_VK_AUDIT_GPU_ONLY")) != 0;
|
||||
@@ -5516,6 +5550,10 @@ VkImageView twin3d_view(Texture* tex, VkFormat f, uint32_t level0, uint32_t nlev
|
||||
|
||||
namespace texpack {
|
||||
constexpr uint64_t kPackBudget = 3ull << 30;
|
||||
// ((Triforce, 11-27) the pack's share of the card (texpack_pressure): a fifth of what the driver allows, kPackBudget at most;
|
||||
// and whether the use is past the line where the pack's images go before any of the game's textures (no new one meanwhile)
|
||||
uint64_t cap = kPackBudget;
|
||||
bool pressed = false;
|
||||
/// A pack file's picture as RGBA8 (false: not a picture this reads)
|
||||
bool decode_png(const std::string& bytes, std::vector<unsigned char>& rgba, int* w, int* h) {
|
||||
#ifdef _WIN32
|
||||
@@ -5777,12 +5815,12 @@ VkImageView pack_view(Texture* tex, VkFormat f, uint32_t level0, uint32_t nlevel
|
||||
}
|
||||
// ((Triforce, 11-25) 4: its image did not fit kPackBudget, its file let go: asked again once there is room)
|
||||
const uint64_t want_need = (uint64_t)fw * tex_pack::kScale * fh * tex_pack::kScale * 4 * 4 / 3;
|
||||
if (tex->pack_state == 4 && texpack::frame_no.load(std::memory_order_relaxed) >= tex->pack_retry_at &&
|
||||
texpack::bytes + want_need <= texpack::kPackBudget)
|
||||
if (tex->pack_state == 4 && texpack::frame_no.load(std::memory_order_relaxed) >= tex->pack_retry_at && !texpack::pressed &&
|
||||
texpack::bytes + want_need <= texpack::cap)
|
||||
texpack::want(tex);
|
||||
if (tex->pack_state != 3) return VK_NULL_HANDLE;
|
||||
if (!tex->hd) {
|
||||
if (texpack::bytes + want_need > texpack::kPackBudget) {
|
||||
if (texpack::bytes + want_need > texpack::cap || texpack::pressed) { // ((Triforce, 11-27) its share, and not under pressure)
|
||||
static std::atomic<int> told{0};
|
||||
if (told.fetch_add(1) < 4) logf("vk: texture pack: its %llu MB of video memory are used: the game's own textures from here",
|
||||
(unsigned long long)(texpack::bytes >> 20));
|
||||
@@ -5903,6 +5941,48 @@ void texpack_gone(Texture& tex) {
|
||||
texpack::bytes -= std::min(texpack::bytes, (uint64_t)tex.hd_bytes);
|
||||
tex.hd = VK_NULL_HANDLE, tex.hd_alloc = nullptr, tex.hd_views.clear();
|
||||
}
|
||||
/// ((Triforce, 11-27) texture_frame's, each look with the driver's count: the pack's share and its yielding. A player's RX 6800
|
||||
/// XT (16 GB, ~13.5 GB allowed) ran Castle Town at ~30 fps with "textures 3489 MB (budget 1208 MB)": the pack's images (up to
|
||||
/// 3 GB) were not textures to the budget, so the live line squeezed the game's own instead, which were made again at every
|
||||
/// turn (texture lookups 20 ms a frame), each taking its pack image with it to be decoded again; an RTX 3060 Ti (8 GB, 1440p)
|
||||
/// lost its device at "textures 1041 MB (budget 181 MB)". Now the pack's share is a fifth of what the driver allows (3 GB at
|
||||
/// most), and past 75% of it (under the textures' own lines: the live one's ~80%, the 90% rule) the pack's images go first, the least recently used, down to 2% under that line, before any of
|
||||
/// the game's textures: those textures are drawn from the game's own image (pack_state 4, asked again after kRetryFrames once
|
||||
/// the use is back under the line). No pack image is made while the use is past it
|
||||
void texpack_pressure(bool known, uint64_t pressure, uint64_t allowed) {
|
||||
if (!texpack::on() || !known || !allowed) return;
|
||||
texpack::cap = std::min<uint64_t>(texpack::kPackBudget, allowed / 5);
|
||||
// (RX_VK_TEX_PACK_LINE=<pct>, 20 to 95: another line, the lab's way to see the yielding on a card with room)
|
||||
static const uint64_t pct = getenv("RX_VK_TEX_PACK_LINE") ? (uint64_t)std::clamp(atoi(getenv("RX_VK_TEX_PACK_LINE")), 20, 95) : 75;
|
||||
const uint64_t line = allowed / 100 * pct;
|
||||
texpack::pressed = pressure > line;
|
||||
if (!texpack::pressed || !texpack::bytes) return;
|
||||
const uint64_t want = pressure - line + allowed / 50;
|
||||
std::vector<Texture*> held;
|
||||
for (auto& kv : textures)
|
||||
if (kv.second && kv.second->hd) held.push_back(&*kv.second);
|
||||
std::sort(held.begin(), held.end(), [](const Texture* a, const Texture* b) { return a->last_frame < b->last_frame; });
|
||||
uint64_t freed = 0;
|
||||
int n = 0;
|
||||
const uint64_t now = texpack::frame_no.load(std::memory_order_relaxed);
|
||||
for (Texture* t : held) {
|
||||
if (freed >= want) break;
|
||||
freed += t->hd_bytes;
|
||||
views_gone.went(t->id);
|
||||
texpack_gone(*t);
|
||||
texpack::let_go(t->pack_key); // (its decoded file not held in RAM meanwhile)
|
||||
t->pack_state = 4, t->pack_retry_at = now + texpack::kRetryFrames;
|
||||
n++;
|
||||
}
|
||||
if (!n) return;
|
||||
destroy_gen++;
|
||||
static std::atomic<int> told{0};
|
||||
if (told.fetch_add(1, std::memory_order_relaxed) < 8)
|
||||
logf("vk: texture pack: VRAM past %llu%% of what the driver allows (%llu of %llu MB): %d of its images let go first, %llu MB "
|
||||
"(the least recently used; %llu MB of them now, its share %llu MB)", (unsigned long long)pct, (unsigned long long)(pressure >> 20),
|
||||
(unsigned long long)(allowed >> 20), n, (unsigned long long)(freed >> 20), (unsigned long long)(texpack::bytes >> 20),
|
||||
(unsigned long long)(texpack::cap >> 20));
|
||||
}
|
||||
/// (texture_frame) decoded files' textures, and Evil HD turned (F2, the row): the views that had the game's or the pack's
|
||||
/// image go stale, so the next look takes the other
|
||||
void texpack_tick() {
|
||||
@@ -6020,6 +6100,10 @@ VkImageView texture_view(Texture* tex, const nvn_tex* t, const nvn_view* v, VkIm
|
||||
unsigned sw[4] = {d.swizzle_r, d.swizzle_g, d.swizzle_b, d.swizzle_a};
|
||||
if (v && v->set_swizzle)
|
||||
for (int i = 0; i < 4; i++) sw[i] = v->swz[i];
|
||||
// ((11-28) lab: RX_VK_BC4_SWZ=abcd, NVN swizzle digits (0 zero, 1 one, 2-5 RGBA) for every BC4 view)
|
||||
if (static const char* o = getenv("RX_VK_BC4_SWZ"); o && strlen(o) >= 4 &&
|
||||
(nf == NVN_FORMAT_RGTC1_UNORM || nf == NVN_FORMAT_RGTC1_SNORM))
|
||||
for (int i = 0; i < 4; i++) sw[i] = (unsigned)(o[i] - '0');
|
||||
// (X formats read alpha as one)
|
||||
switch (nf) {
|
||||
case NVN_FORMAT_RGBX8: case NVN_FORMAT_RGBX8SN: case NVN_FORMAT_RGBX8UI: case NVN_FORMAT_RGBX8I:
|
||||
@@ -6036,7 +6120,7 @@ VkImageView texture_view(Texture* tex, const nvn_tex* t, const nvn_view* v, VkIm
|
||||
cm = {component(sw[0]), component(sw[1]), component(sw[2]), component(sw[3])};
|
||||
static const bool log_swizzle = getenv("RX_VK_LOG_SWIZZLE") != nullptr; // (hookshot: RGB9E5 and R11G11B10 views)
|
||||
static int swizzle_logged;
|
||||
if (log_swizzle && nf == NVN_FORMAT_RGB9E5F && swizzle_logged++ < 12)
|
||||
if (log_swizzle && (nf == NVN_FORMAT_RGB9E5F || nf == NVN_FORMAT_RGTC1_UNORM || nf == NVN_FORMAT_RGTC1_SNORM) && swizzle_logged++ < 40)
|
||||
logf("vk: sampled view of #%u NVN %#x as vk %d: swizzle %u %u %u %u (descriptor %u %u %u %u, view %d)", tex->id,
|
||||
nf, (int)f, sw[0], sw[1], sw[2], sw[3], d.swizzle_r, d.swizzle_g, d.swizzle_b, d.swizzle_a,
|
||||
v && v->set_swizzle ? 1 : 0);
|
||||
@@ -6677,6 +6761,7 @@ void texture_written(Texture* tex, const char* why) {
|
||||
tex->uploaded = true;
|
||||
if (tex->owed.from) upload_owed::paid(tex->owed); // (Triforce: the image is the content now, not what an upload still owed it)
|
||||
bake_note_written(tex); // (Triforce: early in such a run, its texels go into its memory at this recording's end)
|
||||
bake_list_note(tex); // ((Triforce, 11-26, C36) and, should that not take it, the step's list has it: bakescan.h)
|
||||
}
|
||||
|
||||
|
||||
@@ -7368,12 +7453,35 @@ struct BakeBatch {
|
||||
std::deque<BakeBatch> bake_batches;
|
||||
uint64_t st_bake_wb, st_bake_wb_bytes, st_bake_wb_lost, st_bake_wb_logged;
|
||||
uint64_t st_bake_gpu, st_bake_gpu_bytes, swizzle_map_bytes, swizzle_map_n; // (texture_end_recording's, below)
|
||||
// ((Triforce, 11-26, C36) the step's scan: steps by the list and by the whole cache, the listed textures looked at and
|
||||
// the cache's that the walk would have looked at, and RX_VK_BAKE_SCAN=check's armed textures the list did not have)
|
||||
std::atomic<uint64_t> st_scan_list{0}, st_scan_all{0}, st_scan_looked{0}, st_scan_cache{0}, st_scan_missed{0};
|
||||
struct BakeKind { uint32_t w, h, levels; int format; uint64_t n, bytes; };
|
||||
std::unordered_map<uint64_t, BakeKind> bake_kinds; // (what it wrote back, by size and format: the log's largest)
|
||||
bool bake_writeback_on() {
|
||||
static const bool on = !getenv("RX_VK_BAKE_WRITEBACK") || atoi(getenv("RX_VK_BAKE_WRITEBACK")) != 0;
|
||||
return on;
|
||||
}
|
||||
// ((Triforce, 11-26, C36) RX_VK_BAKE_SCAN, read once, and logged when not the default and the write-back is on: bakescan.h)
|
||||
bakescan::Mode bake_scan_mode() {
|
||||
static const bakescan::Mode scan = [] {
|
||||
const bakescan::Mode m = bakescan::mode_of(getenv("RX_VK_BAKE_SCAN"));
|
||||
if (m != bakescan::kList && bake_writeback_on())
|
||||
logf("vk: RX_VK_BAKE_SCAN=%s: the bake write-back's scan walks the whole texture cache every fourth present, as "
|
||||
"before%s", getenv("RX_VK_BAKE_SCAN"),
|
||||
m == bakescan::kCheck ? ", and counts the armed textures its list does not hold (must be 0)"
|
||||
: ", and keeps no list");
|
||||
return m;
|
||||
}();
|
||||
return scan;
|
||||
}
|
||||
// ((Triforce, 11-26, C36) whether bake_list is kept: not where nothing reads it (RX_VK_BAKE_WRITEBACK=0: no step at all;
|
||||
// RX_VK_BAKE_SCAN=all: the walk of the whole cache, as before). =check, which asks it, and the lab knob nobakescan keep it:
|
||||
// bakescan::kept)
|
||||
bool bake_list_kept() {
|
||||
static const bool kept = bakescan::kept(bake_writeback_on(), bake_scan_mode());
|
||||
return kept;
|
||||
}
|
||||
void bake_writeback_step(uint64_t completed) {
|
||||
if (!bake_writeback_on()) return;
|
||||
while (!bake_batches.empty() && bake_batches.front().value <= completed) { // (the CPU half of what the GPU is past)
|
||||
@@ -7389,10 +7497,16 @@ void bake_writeback_step(uint64_t completed) {
|
||||
watch_tex(t, "baked: its texels written into its memory");
|
||||
} else {
|
||||
t->wb_written = 0, st_bake_wb_lost++;
|
||||
bake_list_note(t); // ((C36) listed again: bakescan.h)
|
||||
}
|
||||
} else { // (gone, finalized or drawn again since: its memory is left as it is; drawn again, it is listed again)
|
||||
} else { // (gone, finalized or drawn again since: its memory is left as it is)
|
||||
if (it.f.buf) destroy_buffer(it.f.buf, it.f.alloc);
|
||||
if (t && t->wb_written == it.written) t->wb_written = 0;
|
||||
// ((C36) and the list told: a finalized one is listed again, never ripe while released; one drawn anew
|
||||
// was listed by texture_written)
|
||||
if (t && t->wb_written == it.written) {
|
||||
t->wb_written = 0;
|
||||
bake_list_note(t);
|
||||
}
|
||||
st_bake_wb_lost++;
|
||||
}
|
||||
}
|
||||
@@ -7419,28 +7533,80 @@ void bake_writeback_step(uint64_t completed) {
|
||||
// (drawn in one frame, four presents or more ago; still the game's, and sampled in the last four presents: the game's own
|
||||
// draws say its storage is still this texture's. The small ones the eviction calls baked; the guest window's, which the
|
||||
// game's code can read)
|
||||
// ((Triforce, 11-26, the GPU audit's C36) Not by a walk of the whole cache (1.1% of the Presentation Thread at Lake
|
||||
// Hylia, for nothing where the recordings write them back): bake_list holds every texture that passes the tests time
|
||||
// does not change (bakescan::armed: told wherever a texture can become armed), and the rest (bakescan::ripe, the image,
|
||||
// its format) is asked of the listed ones here, as it was of all. The caps as before (bakescan::room); the oldest listed
|
||||
// go first, and one no step can take does not stop the newer ones. RX_VK_BAKE_SCAN=all: the whole cache and no list, as
|
||||
// before; =check: the whole cache, and what the list would have missed counted, each once (armed and not listed: must
|
||||
// be 0). The lab knob nobakescan: the whole cache in its phases)
|
||||
const bakescan::Mode scan = bake_scan_mode();
|
||||
const bool whole = scan != bakescan::kList || lab_ab::on("nobakescan");
|
||||
static std::vector<Texture*> listed;
|
||||
bake_list.settle(listed); // (in every mode: those armed no more leave it; with RX_VK_BAKE_SCAN=all it is empty)
|
||||
if (scan == bakescan::kCheck)
|
||||
for (auto& kv : textures) {
|
||||
Texture* t = kv.second.get();
|
||||
if (!bakescan::armed(t->gpu_written, t->first_written, t->last_written, t->wb_written) || t->wb_listed) continue;
|
||||
if (const uint64_t n = st_scan_missed.fetch_add(1, std::memory_order_relaxed); n < 20)
|
||||
logf_at(log_warn, "vk: RX_VK_BAKE_SCAN=check: #%u %#llx %ux%u NVN %#x is armed for the bake write-back and not "
|
||||
"listed (drawn at frame %llu, written back for %llu, now %llu): the list would have missed it",
|
||||
t->id, (unsigned long long)t->gpu, t->width, t->height, t->nvn_format, (unsigned long long)t->last_written,
|
||||
(unsigned long long)t->wb_written, (unsigned long long)frame_no);
|
||||
bake_list_note(t); // (listed now: counted once, not again at each step)
|
||||
}
|
||||
BakeBatch nb;
|
||||
uint64_t bytes = 0;
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
for (auto& kv : textures) {
|
||||
Texture* t = kv.second.get();
|
||||
if (!t->gpu_written || t->released || t->only_cleared || !t->first_written || t->first_written != t->last_written ||
|
||||
t->wb_written == t->last_written || frame_no < t->last_written + 4 || frame_no - t->last_frame > 4 ||
|
||||
t->bytes > (4ull << 20) || t->gpu >= (1ull << 39) || !t->image || !flushable(*t))
|
||||
continue;
|
||||
if (nb.items.size() >= 24 || bytes + t->guest_size > (8ull << 20)) break; // (the rest four presents on)
|
||||
const auto take = [&](Texture* t) { // (false: the step is full)
|
||||
if (!bakescan::armed(t->gpu_written, t->first_written, t->last_written, t->wb_written) ||
|
||||
!bakescan::ripe(t->released, t->only_cleared, t->last_written, t->last_frame, t->bytes, t->gpu, frame_no) ||
|
||||
!t->image || !flushable(*t))
|
||||
return true;
|
||||
// ((C36) one no step can take (more than a step's 8 MB of storage) does not stop the newer ones in the list; the walk
|
||||
// of the whole cache stops at it, as before)
|
||||
if (!whole && !bakescan::room(0, 0, t->guest_size)) return true;
|
||||
if (!bakescan::room(nb.items.size(), bytes, t->guest_size)) return false; // (the rest four presents on)
|
||||
if (!cmd) {
|
||||
cmd = upload_cmd();
|
||||
full_barrier(cmd, "bake write-back: before the copies");
|
||||
}
|
||||
BakeItem it{Flush{t, t->gpu, t->gpu + t->guest_size}, t->id, t->gpu, t->last_written};
|
||||
it.f.ignore_cpu = audit_on();
|
||||
if (!flush_record(it.f, cmd)) continue; // (no staging buffer: tried again four presents on)
|
||||
if (!flush_record(it.f, cmd)) return true; // (no staging buffer: tried again four presents on)
|
||||
t->wb_written = t->last_written, t->wb_done_frame = 0;
|
||||
t->last_value = std::max(t->last_value, rec_value); // (its end, if it goes now, waits for the copy)
|
||||
bytes += t->guest_size;
|
||||
nb.items.push_back(std::move(it));
|
||||
return true;
|
||||
};
|
||||
if (whole) {
|
||||
st_scan_all.fetch_add(1, std::memory_order_relaxed);
|
||||
for (auto& kv : textures)
|
||||
if (!take(kv.second.get())) break;
|
||||
} else {
|
||||
st_scan_list.fetch_add(1, std::memory_order_relaxed);
|
||||
st_scan_cache.fetch_add(textures.size(), std::memory_order_relaxed);
|
||||
size_t looked = 0; // (up to where the caps stopped it)
|
||||
for (Texture* t : listed) {
|
||||
looked++;
|
||||
if (!take(t)) break;
|
||||
}
|
||||
st_scan_looked.fetch_add(looked, std::memory_order_relaxed);
|
||||
}
|
||||
// ((Triforce, 11-26, C36) bakescan.h: a line of its own every 600 presents (a multiple of 4: after this step's settle),
|
||||
// so that a run with nothing written back, and both arms of the knob's A/B, say it. Listed at this step: what that
|
||||
// settle kept (listed, the step's copy), all of it armed then, those the step took included)
|
||||
if (frame_no % 600 == 0)
|
||||
logf("vk: the bake write-back's scan: by the list at %llu steps (%llu listed textures looked at; the cache held %llu at "
|
||||
"those steps), by the whole cache at %llu steps; %zu listed at this step, %llu listed in all; armed and not "
|
||||
"listed (counted with RX_VK_BAKE_SCAN=check, each once, must be 0): %llu (RX_VK_BAKE_SCAN=all: the whole cache "
|
||||
"and no list, as before)", (unsigned long long)st_scan_list.load(std::memory_order_relaxed),
|
||||
(unsigned long long)st_scan_looked.load(std::memory_order_relaxed),
|
||||
(unsigned long long)st_scan_cache.load(std::memory_order_relaxed),
|
||||
(unsigned long long)st_scan_all.load(std::memory_order_relaxed), listed.size(),
|
||||
(unsigned long long)bake_list.added.load(std::memory_order_relaxed),
|
||||
(unsigned long long)st_scan_missed.load(std::memory_order_relaxed));
|
||||
if (nb.items.empty()) return;
|
||||
VkMemoryBarrier2 b{VK_STRUCTURE_TYPE_MEMORY_BARRIER_2}; // (the copies' writes, for the host)
|
||||
b.srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
|
||||
@@ -8176,6 +8342,7 @@ void texture_frame(uint64_t completed) {
|
||||
if (textures_pool_usage(&pool_blocks, &pool_free)) reclaim = vram_compact::reclaimable(block_free, pool_free);
|
||||
}
|
||||
const uint64_t pressure = by_blocks ? used : used - std::min(used, reclaim);
|
||||
texpack_pressure(known, pressure, allowed); // ((Triforce, 11-27) Evil HD's pack yields first: texpack_pressure)
|
||||
pool_pressed = known && pressure > allowed / 10 * 9; // (the target pool given back meanwhile)
|
||||
pool_tier = target_pool::tier(known, pressure, allowed); // ((Triforce, 11-21, TEX-29) halved above 90%, none above 97%)
|
||||
compact.pressed = known && vram_compact::pressed(used, allowed); // (hookshot, RX_VK_COMPACT: by the driver's own count)
|
||||
|
||||
Reference in New Issue
Block a user