mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-20 04:35:57 +00:00
TOTK_WB_MERGE=0 also turns off the shadow storage's word merge, so the two can be compared
This commit is contained in:
1 parent
cabbfc5c86
commit
77a52e4577
2 files changed
+15
-9
No files matched your search
+1
-1
@@ -153,7 +153,7 @@ Many rows below are developer tools that only act together with another setting
|
||||
| `vram_headroom` (default `1`) | `0` turns off the spare half-block of video memory that a background thread keeps per memory type. | Texture allocations on the render thread can wait for a new block again. | Caution |
|
||||
| `vs_outs` | `all` declares all 32 vertex shader output locations; otherwise only the union of the paired fragment inputs. | Larger vertex shaders and new pipelines; unwritten outputs read the same as before. | Caution |
|
||||
| `wb_exact` (default `1`) | `0` decides write-back of GPU-written textures by page only. | A target that shares a page with data the CPU writes can go unwritten, so a name label next to the reticle can blink. | Caution |
|
||||
| `wb_merge` (default `1`) | `0` copies GPU-written ranges back as plain copies instead of writing word by word the words that changed. | In mirror memory mode the GPU's copy can overwrite words the CPU wrote, which breaks effects such as falling rain and waterfall splashes. | Caution |
|
||||
| `wb_merge` (default `1`) | `0` copies GPU-written ranges back as plain copies instead of writing word by word the words that changed; with `shadow = 1` it also leaves ranges the GPU has yet to write back out of the copy into the shadow. | In mirror memory mode, and with `shadow = 1`, the GPU's copy can overwrite words the CPU wrote, which breaks effects such as falling rain and waterfall splashes. | Caution |
|
||||
|
||||
## Motion vectors and DLSS
|
||||
|
||||
|
||||
+14
-8
@@ -996,7 +996,8 @@ static int query_stamp(uint64_t lo, uint64_t hi, uint32_t g) {
|
||||
// spawns, and a CPU copy that skipped pending ranges never let them reach the GPU: falling rain showed only its
|
||||
// splashes. Each pending range keeps a base, the words guest memory and the shadow last agreed on (the shadow's bytes
|
||||
// when the range became pending). The CPU copy takes the words where guest memory differs from the base; the fence
|
||||
// copy back takes the words where the shadow differs from it. A word both changed takes the GPU's.
|
||||
// copy back takes the words where the shadow differs from it. A word both changed takes the GPU's. TOTK_WB_MERGE=0
|
||||
// skips the pending ranges in the CPU copy and copies them back whole, as before.
|
||||
// TOTK_SHADOW=1/0 (shadow in totk.ini) forces the mode on or off; the default is on for Linux and Wine.
|
||||
typedef struct { uint64_t lo, hi; uint8_t *base; int refs; } SRange;
|
||||
static PlatMutex shadow_lock = PLAT_MUTEX_INIT; // after pool_lock; before gen_lock
|
||||
@@ -1068,6 +1069,16 @@ static void shadow_forget(PoolRec *r) {
|
||||
plat_mutex_unlock(&shadow_lock);
|
||||
}
|
||||
|
||||
// TOTK_WB_MERGE: the write-back merge of mirrors (wb_merge_record) and the word merge of the shadow's pending ranges.
|
||||
static int merge_on = -1;
|
||||
static int merge_wanted(void) {
|
||||
if (merge_on < 0) {
|
||||
merge_on = cfg_bool("TOTK_WB_MERGE");
|
||||
rt_log("mem: write-back merge %s (TOTK_WB_MERGE)", merge_on ? "on" : "off");
|
||||
}
|
||||
return merge_on;
|
||||
}
|
||||
|
||||
// A run of differing words from *at on, as byte offsets [*at, *end) of x and y (n bytes, the last word may be shorter);
|
||||
// 0 when none is left.
|
||||
static int diff_run(const uint8_t *x, const uint8_t *y, uint64_t n, uint64_t *at, uint64_t *end) {
|
||||
@@ -1311,7 +1322,7 @@ void vk_mem_gpu_pending(uint64_t addr, uint64_t size) {
|
||||
spend[i].refs++;
|
||||
} else {
|
||||
uint8_t *base = NULL;
|
||||
if (r && r->smap && lo >= r->import_lo && hi <= r->import_hi && (base = malloc(size))) {
|
||||
if (r && r->smap && lo >= r->import_lo && hi <= r->import_hi && merge_wanted() && (base = malloc(size))) {
|
||||
memcpy(base, r->smap + (lo - r->import_lo), size);
|
||||
for (int k = 0; k < nspend; k++) {
|
||||
const SRange *p = &spend[k];
|
||||
@@ -1893,7 +1904,6 @@ static PlatMutex snap_pool_lock = PLAT_MUTEX_INIT;
|
||||
static SnapChunk snap_pool[SNAP_POOL_N];
|
||||
static int nsnap_pool;
|
||||
static uint64_t snap_pool_bytes;
|
||||
static int merge_on = -1;
|
||||
static struct {
|
||||
int tried, ok;
|
||||
PFN_vkCmdPushDescriptorSetKHR push;
|
||||
@@ -1936,11 +1946,7 @@ fail:
|
||||
}
|
||||
|
||||
static int merging(void) {
|
||||
if (merge_on < 0) {
|
||||
merge_on = cfg_bool("TOTK_WB_MERGE");
|
||||
rt_log("mem: write-back merge %s (TOTK_WB_MERGE)", merge_on ? "on" : "off");
|
||||
}
|
||||
if (!merge_on) return 0;
|
||||
if (!merge_wanted()) return 0;
|
||||
if (!WM.tried) merge_init(vk_ctx());
|
||||
return WM.ok;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user