Repository navigation
Conversation
…e those slots 72% of the argument tables BotW writes follow only a uniform buffer rebind on that stage. A per-stage generation of every other argument change (g_args_ogen) lets such a table be copied from the shader's last one in the pass, with only its uniform buffer slots made again (not for shaders that read handles or pointers out of a uniform buffer, cb_only). The geometry and mesh paths that force a stage's table again move the generation too. DM_NVN_CB_CHECK=1 writes the full table as well and logs a difference; DM_NVN_CB_FAST=0 turns the path off. Measured on the Xipzer fork (BotW, Mac, encode thread on): 11,090 -> 10,670 instructions a draw (-4%).
…off the uniform-only path; geometry and mesh binds move g_args_ogen Found while porting the uniform-only path upstream (PR seedds#1472): NVN_RB_IMGU and NVN_RB_TBUFU read a handle out of a uniform buffer too, and nvn_geometry.inc changed stages 2-4's bindings with only g_args_dirty, so the fast path could copy a table with the previous geometry bindings. Discord: https://discord.com/channels/1491224015434678394/1524915513606803549
|
Note: I couldn't run |
|
Closing: superseded by adaff73 (PR #1611), which does the same thing on main: Not on main from here: the |
An argument table whose stage only had uniform buffers rebound since it was last written in the pass is copied from that table, and only its uniform buffer slots are made again.
Why. In Breath of the Wild, 72% of the argument tables
encode_args_writes follow only a uniform buffer rebind on that stage. The full path walks every binding again (textures, samplers, images, driver banks) underg_rmuto produce the same values.What.
g_args_ogen[6]: a per-stage generation that moves at every argument change other than a uniform buffer bind:args_dirty_all,OP_BIND_SSBO,OP_BIND_TEX,OP_BIND_SAMP,OP_BIND_IMG,OP_PUSH_CONST, and the geometry and mesh paths innvn_geometry.incthat force a stage's table again (g_geo_bindchanges there).ubd_dirtyandOP_BIND_UBOleave it alone.NvShaderkeepsab_ogen(the generation its table was written under),ab_cpu(the table's arena address, so the copy sends nocontentsmessage) andcb_only: set once,-1when a binding follows a uniform buffer's content (SAMPU,TEXU,SBUFU,UBOP,IMGU,TBUFU).encode_args_, after the full reuse check: when the table is from this pass, the generation is unchanged, and none of the full reuse's other refusals apply (pass dump, compute,drv_read[0]with another base instance, pool or handle table with another pool snapshot,g_res_check_on), the table is copied to a new arena block and eachNVN_RB_CBUFslot is made as the full path makes it (zero bank, deferred update shadow orubp_get).DM_NVN_CB_CHECK=1writes the full table as well and logs the first difference ([RED] uniform-only table differs ...) and a running count.DM_NVN_CB_FAST=0turns the path off. Both are indocs/env_switches.tsv.Compared with the fork commit, this leaves out the fork-only features (TAAU, object motion, MetalFX interpolation) and a profiling hunk, adds
IMGUandTBUFUto thecb_onlyexclusions, bumps the generation innvn_geometry.inc, and takeshtabinto the pool snapshot condition asmain's full reuse does.Measured on the Xipzer fork (Mac, Breath of the Wild, encode thread on, two alternated pairs): 11,090 -> 10,670 instructions a draw (-4%).
DM_NVN_CB_CHECK=1compared 21.6 M tables with the full path over a 360-degree camera turn there: no difference. Not measured again on this branch.Graphics tests pass, also with
DM_NVN_CB_CHECK=1, exceptt_nvn, which aborts with the BotW profile onmaintoo and passes withDM_PRESENT_SNAP=0.test_env_switchespasses.