mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 17:59:58 -04:00
Task and mesh stages get their own c0 bank.
c0_info keeps the last bank per stage and reuses it when the inputs (storage and uniform bindings, base instance) are equal, but task and mesh shared the compute entry and the inputs do not name the stage, while the storage table sits at 0x670 for the task stage and at 0x770 for the mesh stage. When a program's task and mesh stages bind the same storage buffers, the second stage got the first one's bank and read zero storage addresses. In a Kokiri Forest frame every draw with a task stage (moss foliage, Link's house door) launched mesh groups that made no vertices, while mesh draws without a task stage drew. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,11 +154,11 @@ typedef struct {
|
||||
VkBuffer sup_buf;
|
||||
VkDeviceSize sup_off;
|
||||
int sup_valid;
|
||||
uint8_t c0[3][VK_C0_BYTES]; // last c0 bank per stage (vertex, fragment, compute) and where it lives
|
||||
VkBuffer c0_buf[3];
|
||||
VkDeviceSize c0_off[3];
|
||||
int c0_valid[3];
|
||||
struct { p_bind_buf ssbo[16], ubo[16]; uint32_t dim[3], binst; uint8_t push[1024]; } c0_in[3]; // what vk_c0_fill read for c0[k]
|
||||
uint8_t c0[5][VK_C0_BYTES]; // last c0 bank per stage (vertex, fragment, compute, task, mesh) and where it lives
|
||||
VkBuffer c0_buf[5];
|
||||
VkDeviceSize c0_off[5];
|
||||
int c0_valid[5];
|
||||
struct { p_bind_buf ssbo[16], ubo[16]; uint32_t dim[3], binst; uint8_t push[1024]; } c0_in[5]; // what vk_c0_fill read for c0[k]
|
||||
VkPipelineLayout ds_layout; // graphics layout the sets below were last pushed or bound with
|
||||
VkDescriptorSet ds_bound[2]; // allocated set bound per set number (0: none or pushed since)
|
||||
VkDescriptorSet ds_last[2]; // last allocated and written set per set number, contents in DS
|
||||
@@ -1277,7 +1277,11 @@ static uint32_t nvn2_cs_tables_at(const uint8_t *ctl);
|
||||
|
||||
static VkDescriptorBufferInfo c0_info(VkExec *ex, int st) {
|
||||
DrawCtx *const cx = ex->dc;
|
||||
int k = st == NVN_STAGE_VS ? 0 : st == NVN_STAGE_FS ? 1 : 2;
|
||||
// One bank per stage: the inputs below do not say which stage they are for, and the stages lay the storage table out
|
||||
// at different offsets (c0_ssbo_base). Task and mesh shared the compute entry: the foliage's task and mesh stages
|
||||
// bind the same storage buffers, so the task stage was handed the mesh stage's bank (its table at 0x770), read
|
||||
// zero addresses at 0x670, culled every instance and launched no mesh workgroups.
|
||||
int k = st == NVN_STAGE_VS ? 0 : st == NVN_STAGE_FS ? 1 : st == NVN_STAGE_TASK ? 3 : st == NVN_STAGE_MESH ? 4 : 2;
|
||||
// vk_c0_fill reads the storage slots, and the uniform slots and dispatch size for compute or the base instance for
|
||||
// graphics: equal inputs give the same bank, so neither the fill nor the 2 KiB compare is needed.
|
||||
// A vertex or fragment bank depends on the storage slots and the base instance alone (the rest of its inputs record
|
||||
|
||||
Reference in New Issue
Block a user