Add shared pose motion vectors for Link and attached equipment

This commit is contained in:
automata.
2026-11-12 10:35:57 -05:00
committed by chrg6
parent 38afed16d5
commit b29cbbe6a6
11 changed files with 900 additions and 59 deletions

View File

@@ -580,7 +580,9 @@ static void twins_release(VkCtx *c);
static void mesh_ring_release(VkCtx *c);
static void pool_marks_release(VkCtx *c);
static void pose_shutdown(void);
void vk_exec_draw_shutdown(void) {
pose_shutdown();
vk_meshfb_shutdown();
if (vk_ctx()) mesh_ring_release(vk_ctx()), pool_marks_release(vk_ctx()); // made without the stand-ins below too
if (!Z.ready) return;
@@ -3743,7 +3745,7 @@ static void bind_pipeline(VkExec *ex, VkPipelineBindPoint bp, VkPipeline p) {
if (!k) cx->B.st_valid = 0;
}
static VkViewport draw_viewport(VkExec *ex) {
static VkViewport base_viewport(VkExec *ex) {
float x = 0, y = 0, w = (float)ex->pass_w, h = (float)ex->pass_h;
if (ex->has_vp) {
float k = ex->pass_scale > 1 ? (float)ex->pass_scale : 1.0f;
@@ -3752,6 +3754,11 @@ static VkViewport draw_viewport(VkExec *ex) {
if (w < 1) w = 1;
if (h < 1) h = 1;
VkViewport v = {x, y + h, w, -h, ex->depth_range[0], ex->depth_range[1]}; // the y flip: negative height
return v;
}
static VkViewport draw_viewport(VkExec *ex) {
VkViewport v = base_viewport(ex);
vk_dlaa_viewport(ex, &v); // the scene's draws move by the DLAA jitter
return v;
}
@@ -4531,10 +4538,13 @@ void vk_exec_ahead_op(VkExec *sx, uint32_t op, const void *payload) {
// building, or whose last-frame blocks are not in the snapshot, keeps the camera's motion. NX2NAVI_DLAA_OBJMV=0 turns it
// off (vk_mvprev.c).
#include "mvobj_fs_spv.h"
#include "link_motion_spv.h"
static const char MO_FS_RES[] = "{\"key\":\"mvobj\",\"stage\":\"ps\",\"notes\":[],\"cbufs\":[{\"binding\":1,\"slot\":3}],"
"\"sbufs\":[],\"textures\":[],\"images\":[]}";
static const char LINK_FS_RES[] = "{\"key\":\"link-motion\",\"stage\":\"ps\",\"cbufs\":[{\"binding\":1,\"slot\":3}],"
"\"textures\":[{\"binding\":2,\"type\":3}],\"sbufs\":[],\"images\":[]}";
static struct {
const GfxShader *fs[16]; // per input Location
const GfxShader *fs[16], *link_fs[16]; // per input Location
int failed;
uint64_t cand, still, draws, nodata, building, ran, dropped;
uint64_t ns_check, ns_rec, n_rec, ns_emit, ns_still;
@@ -4564,7 +4574,8 @@ typedef struct {
VkIndexType it;
uint32_t count, instances, base_instance;
int32_t base_vertex;
uint64_t cam; // the draw's camera block (c4), this frame's
uint64_t cam; // the draw's camera block, this frame's
int pose_index, pose_view;
} MoDraw;
typedef struct { VkBuffer b[17]; VkDeviceSize o[17], sz[17], str[17]; } MoVb;
static struct {
@@ -4580,7 +4591,7 @@ static struct {
uint64_t vgen;
float sup_in[3]; // the support buffer last filled for the list and its inputs
VkDescriptorBufferInfo sup;
float par_in[4]; // the fragment shader's parameters last written and their inputs
float par_in[8]; // the fragment shader's parameters last written and their inputs
VkDescriptorBufferInfo par;
VkDescriptorSetLayout aset_layout[2]; // the last allocated set per set number, with its descriptors
VkDescriptorSet aset[2];
@@ -4644,6 +4655,22 @@ static const GfxShader *mo_fs(int loc) {
return MO.fs[loc];
}
static const GfxShader *link_motion_fs(int loc) {
if (loc < 0 || loc >= 16) return NULL;
if (MO.link_fs[loc]) return MO.link_fs[loc];
uint32_t words[sizeof link_motion_spv / sizeof(uint32_t)];
memcpy(words, link_motion_spv, sizeof words);
for (size_t i = 5; i < sizeof words / sizeof *words; i += words[i] >> 16) {
// OpDecorate Location 15 uniquely identifies the previous clip position in link_motion.frag.
if (words[i] == ((4u << 16) | 71u) && words[i + 2] == 30 && words[i + 3] == 15) {
words[i + 3] = (uint32_t)loc;
MO.link_fs[loc] = gfx_shader_own(words, sizeof words / sizeof *words, LINK_FS_RES);
break;
}
}
return MO.link_fs[loc];
}
// The write of binding b from its packed descriptors.
static VkWriteDescriptorSet mo_write(const VkPipeBinding *b, const VkDescSlot *d) {
VkWriteDescriptorSet w = {.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = b->binding,
@@ -4661,7 +4688,7 @@ static VkWriteDescriptorSet mo_write(const VkPipeBinding *b, const VkDescSlot *d
// mo_ovr), the support buffer and sampled textures. An allocated set is written here (or the last one reused when it
// would hold the same); a pushed set is pushed by mo_emit. 0 for a pipeline with storage buffers, images or texel
// buffers (not drawn again).
static int mo_desc(VkExec *ex, const VkPipeInfo *info, MoDraw *q) {
static int mo_desc(VkExec *ex, const VkPipeInfo *info, MoDraw *q, const VkDescriptorImageInfo *pose_depth) {
if (info->n_bindings > MAX_BINDINGS || info->pool) return 0;
uint32_t total = 0;
for (uint32_t i = 0; i < info->n_bindings; i++) total += info->bindings[i].count ? info->bindings[i].count : 1;
@@ -4692,6 +4719,9 @@ static int mo_desc(VkExec *ex, const VkPipeInfo *info, MoDraw *q) {
for (uint32_t k = 0; k < cnt; k++) o[k].buffer = ubo_info(ex, st, r->slot + (int)k);
} else if (b->kind == GFX_RES_SSBO && !(r->flags & 1)) { // read only: instance data of foliage and such
for (uint32_t k = 0; k < cnt; k++) o[k].buffer = ssbo_info(ex, st, r, 0);
} else if (pose_depth && st == NVN_STAGE_FS && b->type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) {
if (cnt != 1) return 0;
o->image = *pose_depth;
} else if (b->kind == GFX_RES_TEX && b->type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) {
vk_texture_lock();
for (uint32_t k = 0; k < cnt; k++) {
@@ -4819,9 +4849,11 @@ static void mo_emit(VkCommandBuffer cb) {
}
}
static int mvobj_pick(VkExec *ex, const GfxShader **vs_out, uint32_t *banks_out, uint64_t t0);
#include "vk_fg_pose.inc"
static int mvobj_pick(VkExec *ex, const p_draw_idx *d, const GfxShader **vs_out, uint32_t *banks_out, MotionOwner *owner_out, uint64_t t0);
static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSize ib_off, uint64_t t0,
const GfxShader *vs, uint32_t banks);
const GfxShader *vs, uint32_t banks, const MotionOwner *owner);
// The chunks of a parallel group (vk_exec.c) add to the frame's list at once: whether a draw is listed at all is decided
// by its own draw context (mvobj_pick, its memo per context), and only the frame's list, its memos and statistics go
// under mo_lock there: under one lock for the whole check, the chunks' scene draws waited for each other. The order of
@@ -4830,16 +4862,20 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
static PlatMutex mo_lock = PLAT_MUTEX_INIT;
static void mvobj_draw(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSize ib_off) {
if (MO.failed || !vk_mvprev_on() || !ex->dc->B.st_valid) return;
if (MO.failed || !ex->dc->B.st_valid) return;
if (RT_V111) {
if (!vk_dlaa_available() || !pose_enabled()) return;
} else if (!vk_mvprev_on()) return;
static int timed = -1;
if (timed < 0) timed = rt_knob("MVOBJ_TIMES", "0"); // NX2NAVI_MVOBJ_TIMES=1: the summary's times (the clock reads cost)
uint64_t t0 = timed ? kern_now_ns() : 0;
const GfxShader *vs;
uint32_t banks;
int listed = mvobj_pick(ex, &vs, &banks, t0);
MotionOwner owner = {0};
int listed = mvobj_pick(ex, d, &vs, &banks, &owner, t0);
int lk = listed && vk_exec_shared();
if (lk) plat_mutex_lock(&mo_lock);
if (listed) mvobj_draw_(ex, d, ib, ib_off, t0, vs, banks);
if (listed) mvobj_draw_(ex, d, ib, ib_off, t0, vs, banks, &owner);
if (t0) __atomic_add_fetch(&MO.ns_check, kern_now_ns() - t0, __ATOMIC_RELAXED);
if (lk) plat_mutex_unlock(&mo_lock);
}
@@ -4966,9 +5002,47 @@ static int mo_prev_cached(int index, const p_bind_buf *u, VkDescriptorBufferInfo
return r;
}
static int mo_legacy_previous(VkExec *ex, uint64_t frame, uint32_t banks, uint64_t t0, uint64_t tp,
VkDescriptorBufferInfo prevb[17], uint32_t *have_out, uint32_t *changed_mask) {
static struct { uint64_t frame, key; int moving; VkDescriptorBufferInfo b[17]; uint32_t have; } memo[8192];
uint64_t key = banks;
for (int b = 3; b <= 16; b++)
if (banks >> b & 1 && b != 4) key = (key ^ ex->ubo[NVN_STAGE_VS][b - 3].addr) * 0x100000001b3ull;
uint32_t mi = (uint32_t)(key * 0xff51afd7ed558ccdull >> 51);
uint32_t have = 0;
if (memo[mi].frame == frame && memo[mi].key == key) {
if (!memo[mi].moving) {
if (t0) MO.ns_still += kern_now_ns() - tp;
MO.still++;
return 0;
}
memcpy(prevb, memo[mi].b, sizeof memo[mi].b), have = memo[mi].have;
} else {
MO.misses++;
int moving = 0;
for (int b = 3; b <= 16; b++) {
if (!(banks >> b & 1) || b == 4) continue;
const p_bind_buf *u = &ex->ubo[NVN_STAGE_VS][b - 3];
int changed;
if (u->addr && u->size && mo_prev_cached(b - 3, u, &prevb[b], &changed))
have |= 1u << b, moving |= changed << b; // the banks whose block changed
}
memo[mi].frame = frame, memo[mi].key = key, memo[mi].moving = moving;
memcpy(memo[mi].b, prevb, sizeof memo[mi].b), memo[mi].have = have;
if (!moving) {
if (t0) MO.ns_still += kern_now_ns() - tp;
MO.still++;
return 0;
}
}
*have_out = have;
*changed_mask = (uint32_t)memo[mi].moving;
return 1;
}
// Whether the draw goes on to the frame's list (mvobj_draw_), with its motion variant and the banks its position reads;
// this draw context alone decides (no lock in a chunk): the draw's state, and the variant memo per context.
static int mvobj_pick(VkExec *ex, const GfxShader **vs_out, uint32_t *banks_out, uint64_t t0) {
static int mvobj_pick(VkExec *ex, const p_draw_idx *d, const GfxShader **vs_out, uint32_t *banks_out, MotionOwner *owner_out, uint64_t t0) {
DrawCtx *const cx = ex->dc;
if (!vk_exec_in_chunk()) mvobj_banks(ex); // a test's log of every scene draw (its tables are not shared)
const VkExecTarget *z = &ex->depth;
@@ -4977,7 +5051,21 @@ static int mvobj_pick(VkExec *ex, const GfxShader **vs_out, uint32_t *banks_out,
return 0;
// solid geometry only, which tests and writes the scene depth: effects, particles and screen quads write none, and
// drawn again they would put their motion on the surfaces behind them (DLSS takes those from the surface)
if (!cx->B.st.ds.dt || !cx->B.st.ds.dw) return 0;
if (!cx->B.st.ds.dt) return 0;
if (!cx->B.st.ds.dw && !(RT_V111 && cx->B.st.ds.df == NVN_DEPTH_FUNC_EQUAL && ex->color[0].image &&
(vk_pipeline_target_wmask(&cx->B.st, 0) & 7))) return 0;
// An opaque colour pass can use EQUAL against a depth prepass. Its geometry is already in the scene depth.
if (RT_V111) {
VkViewport v = base_viewport(ex);
if (ex->ubo[0][0].size != 0x3500 || d->instances > 1 || d->base_instance || cx->B.st.color.blend_en || cx->B.st.ds.st ||
ex->pass_layers != 1 || z->level || z->base_layer || z->layers != 1 ||
v.x != 0.0f || v.y != (float)z->height ||
v.width != (float)z->width || v.height != -(float)z->height) return 0;
if (!pose_owner(ex, owner_out)) {
__atomic_add_fetch(&pose_unowned, 1, __ATOMIC_RELAXED);
return 0;
}
}
// a vertex shader that reads a user bank besides the camera's (c4) may move on its own
const GfxShaderRes *ur;
int nu = gfx_shader_resources(cx->B.st.vs, GFX_RES_UBO, &ur), reads = 0;
@@ -5008,7 +5096,7 @@ static int mvobj_pick(VkExec *ex, const GfxShader **vs_out, uint32_t *banks_out,
uint32_t extra = gfx_shader_outputs(v, io) & ~gfx_shader_outputs(cx->B.st.vs, io);
uint32_t banks = extra ? gfx_shader_mvprev_banks(v) & 0x1fff8u : 0;
vmemo[vi].of = cx->B.st.vs, vmemo[vi].vs = v, vmemo[vi].banks = banks;
vk_mvprev_want((banks & ~(1u << 4)) >> 3); // binding index = bank - 3
if (!RT_V111) vk_mvprev_want((banks & ~(1u << 4)) >> 3); // binding index = bank - 3
}
const GfxShader *vs = vmemo[vi].vs;
uint32_t banks = vmemo[vi].banks;
@@ -5055,7 +5143,7 @@ static int mvobj_pick(VkExec *ex, const GfxShader **vs_out, uint32_t *banks_out,
// A draw mvobj_pick took, onto the frame's list (in a chunk under mo_lock): the list begins at the first such draw of
// the frame's submission (mo_emit drops a list of another frame, submission or depth format).
static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSize ib_off, uint64_t t0,
const GfxShader *vs, uint32_t banks) {
const GfxShader *vs, uint32_t banks, const MotionOwner *owner) {
DrawCtx *const cx = ex->dc;
const VkExecTarget *z = &ex->depth;
uint64_t tp = t0 ? kern_now_ns() : 0;
@@ -5063,40 +5151,41 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
if (MQ.frame != frame || MQ.fence != ex->fence || MQ.depth_fmt != z->format) mo_begin(ex, frame);
mo_mask_note(banks, cx->B.st.vs);
// last frame's camera and blocks; held still when none of the position's blocks changed (most of the scenery)
VkDescriptorBufferInfo cam, prevb[17];
PoseRange *pose = RT_V111 ? pose_match(ex, d, owner) : NULL;
if (RT_V111 && !pose) return;
VkDescriptorBufferInfo cam = {0}, prevb[17] = {0};
uint32_t have = 0, changed = 0;
const ActorPose *previous_pose = NULL;
ActorPose *pose_view = NULL;
VkDescriptorImageInfo pose_depth = {0};
int pose_visibility_guard = 0;
float history[4] = {0};
float jit[2];
if (!vk_dlaa_prev_camera(&cam, jit)) {
MO.nodata++, MO.why[0]++;
return;
}
static struct { uint64_t frame, key; int moving; VkDescriptorBufferInfo b[17]; uint32_t have; } memo[8192];
uint64_t key = banks;
for (int b = 3; b <= 16; b++)
if (banks >> b & 1 && b != 4) key = (key ^ ex->ubo[NVN_STAGE_VS][b - 3].addr) * 0x100000001b3ull;
uint32_t mi = (uint32_t)(key * 0xff51afd7ed558ccdull >> 51);
uint32_t have = 0;
if (memo[mi].frame == frame && memo[mi].key == key) {
if (!memo[mi].moving) {
if (t0) MO.ns_still += kern_now_ns() - tp;
return (void)MO.still++;
if (pose) {
const uint32_t required = (1u << 3) | (1u << 4) | (1u << 6);
if ((banks & required) != required || (banks & ~0xf8u)) return;
const GfxShaderRes *resources;
if (gfx_shader_resources(vs, GFX_RES_SSBO, &resources) || gfx_shader_resources(vs, GFX_RES_TEX, &resources) ||
gfx_shader_resources(vs, GFX_RES_IMG, &resources)) return;
previous_pose = pose_previous(pose, ex, d, frame, banks, &pose_view);
if (!previous_pose) return;
pose_visibility_guard = pose_guard_needed(pose, pose_view, previous_pose);
if (pose_visibility_guard && !vk_dlaa_pose_depth(frame, z->width, z->height, &pose_depth, history)) {
// Missing visibility evidence is not evidence that this valid pose vector is wrong.
// Keep the raw vector, with the normal current-depth and history-validity checks.
pose_view->guard_missing_depth = 1;
pose_visibility_guard = 0;
}
memcpy(prevb, memo[mi].b, sizeof prevb), have = memo[mi].have;
pose_view->visibility_guard = pose_visibility_guard;
VkViewport v = draw_viewport(ex);
jit[0] = v.x;
jit[1] = v.y - (float)z->height;
} else {
MO.misses++;
int moving = 0;
for (int b = 3; b <= 16; b++) {
if (!(banks >> b & 1) || b == 4) continue;
const p_bind_buf *u = &ex->ubo[NVN_STAGE_VS][b - 3];
int changed;
if (u->addr && u->size && mo_prev_cached(b - 3, u, &prevb[b], &changed))
have |= 1u << b, moving |= changed << b; // the banks whose block changed
}
memo[mi].frame = frame, memo[mi].key = key, memo[mi].moving = moving;
memcpy(memo[mi].b, prevb, sizeof prevb), memo[mi].have = have;
if (!moving) {
if (t0) MO.ns_still += kern_now_ns() - tp;
return (void)MO.still++;
if (!vk_dlaa_prev_camera(&cam, jit)) {
MO.nodata++, MO.why[0]++;
return;
}
if (!mo_legacy_previous(ex, frame, banks, t0, tp, prevb, &have, &changed)) return;
}
if (t0) MO.ns_part[1] += kern_now_ns() - tp, MO.n_part[1]++, tp = kern_now_ns();
GfxShaderIo io[32];
@@ -5106,7 +5195,8 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
MO.storage++;
return;
}
const GfxShader *fs = mo_fs(31 - __builtin_clz(extra));
int loc = 31 - __builtin_clz(extra);
const GfxShader *fs = pose_visibility_guard ? link_motion_fs(loc) : mo_fs(loc);
if (!fs) {
MO.no_fs++;
return;
@@ -5124,7 +5214,7 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
static int eq = -1;
if (eq < 0) eq = rt_knob("MVOBJ_EQUAL", "0");
int df = cx->B.st.ds.df;
df = eq ? NVN_DEPTH_FUNC_EQUAL : df == NVN_DEPTH_FUNC_LESS ? NVN_DEPTH_FUNC_LEQUAL
df = (eq || pose) ? NVN_DEPTH_FUNC_EQUAL : df == NVN_DEPTH_FUNC_LESS ? NVN_DEPTH_FUNC_LEQUAL
: df == NVN_DEPTH_FUNC_GREATER ? NVN_DEPTH_FUNC_GEQUAL : df == NVN_DEPTH_FUNC_LEQUAL || df == NVN_DEPTH_FUNC_GEQUAL ? df
: NVN_DEPTH_FUNC_EQUAL;
ms.ds.dt = 1, ms.ds.dw = 0, ms.ds.df = (uint64_t)df, ms.ds.st = 0;
@@ -5165,20 +5255,31 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
// into the frame's list, past the primary's binding caches (mo_desc); mo_emit records it
MQ.d = mo_grow(MQ.d, &MQ.cap, MQ.n + 1, sizeof *MQ.d);
MoDraw *q = &MQ.d[MQ.n];
float par_in[4] = {(float)z->width, (float)z->height, jit[0], jit[1]};
float par_in[8] = {(float)z->width, (float)z->height, jit[0], jit[1], history[0], history[1], history[2], history[3]};
if (!MQ.par.buffer || memcmp(par_in, MQ.par_in, sizeof par_in)) {
VkBuffer pbuf;
VkDeviceSize poff;
memcpy(scratch(ex, 16, &pbuf, &poff), par_in, sizeof par_in);
MQ.par = (VkDescriptorBufferInfo){pbuf, poff, 16};
memcpy(scratch(ex, sizeof par_in, &pbuf, &poff), par_in, sizeof par_in);
MQ.par = (VkDescriptorBufferInfo){pbuf, poff, sizeof par_in};
memcpy(MQ.par_in, par_in, sizeof par_in);
}
memset(cx->mo_ovr, 0, sizeof cx->mo_ovr);
for (int bk = 3; bk <= 16; bk++) // last frame's block, or this frame's where none was found
cx->mo_ovr[NVN_STAGE_VS][bk + 15] = bk == 4 ? cam : have >> bk & 1 ? prevb[bk] : ubo_info(ex, NVN_STAGE_VS, bk);
if (previous_pose) {
const uint8_t *data = previous_pose->bytes;
for (int i = 0; i < POSE_BANKS; ++i) {
if (!previous_pose->size[i]) continue;
VkDescriptorBufferInfo *b = &cx->mo_ovr[NVN_STAGE_VS][18 + i];
b->range = previous_pose->size[i];
memcpy(scratch(ex, b->range, &b->buffer, &b->offset), data, b->range);
data += b->range;
}
} else {
for (int bk = 3; bk <= 16; bk++)
cx->mo_ovr[NVN_STAGE_VS][bk + 15] = bk == 4 ? cam : (have >> bk & 1) ? prevb[bk] : ubo_info(ex, NVN_STAGE_VS, bk);
}
cx->mo_ovr[NVN_STAGE_FS][3] = MQ.par;
cx->mo_ovr_on = 1;
int bound = mo_desc(ex, info, q);
int bound = mo_desc(ex, info, q, pose_visibility_guard ? &pose_depth : NULL);
cx->mo_ovr_on = 0;
if (!bound) {
MO.storage++;
@@ -5197,17 +5298,25 @@ static void mvobj_draw_(VkExec *ex, const p_draw_idx *d, VkBuffer ib, VkDeviceSi
q->it = d->itype == NVN_INDEX_TYPE_UNSIGNED_SHORT ? VK_INDEX_TYPE_UINT16 : VK_INDEX_TYPE_UINT32;
q->count = (uint32_t)d->count, q->instances = d->instances > 0 ? (uint32_t)d->instances : 1;
q->base_vertex = d->base_vertex, q->base_instance = (uint32_t)d->base_instance;
q->cam = ex->ubo[NVN_STAGE_VS][1].addr;
q->cam = ex->ubo[NVN_STAGE_VS][pose ? 0 : 1].addr;
q->pose_index = pose ? (int)(pose - pose_ranges) + 1 : 0;
q->pose_view = pose ? (int)(pose_view - pose->history[frame & 1].view) : 0;
MQ.n++;
MO.draws++;
for (int i = 0; i < 16; i++) // the frame's draws per position banks and changed banks (vk_mvobj_frame_masks)
if (!MF[i].n || (MF[i].mask == banks && MF[i].chg == (uint32_t)memo[mi].moving)) {
MF[i].mask = banks, MF[i].chg = (uint32_t)memo[mi].moving, MF[i].n++;
if (!MF[i].n || (MF[i].mask == banks && MF[i].chg == changed)) {
MF[i].mask = banks, MF[i].chg = changed, MF[i].n++;
break;
}
if (t0) MO.ns_rec += kern_now_ns() - t1, MO.n_rec++;
}
int vk_fg_pose_prepare(uint64_t cam, VkImage depth) {
if (!RT_V111 || !pose_enabled()) return 0;
pose_select(__atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED), cam, depth);
return MQ.n != 0;
}
int vk_mvobj_execute(VkExec *ex, uint64_t cam, VkImageView mv, VkImageView depth, VkFormat depth_fmt, uint32_t w,
uint32_t h) {
static uint64_t frames;
@@ -5278,7 +5387,11 @@ int vk_mvobj_execute(VkExec *ex, uint64_t cam, VkImageView mv, VkImageView depth
// a draw of another view would move by the difference between the two views
int kept = 0;
for (int i = 0; i < MQ.n; i++)
if (MQ.d[i].cam == cam) MQ.d[kept++] = MQ.d[i];
if (MQ.d[i].cam == cam && (!MQ.d[i].pose_index ||
pose_ranges[MQ.d[i].pose_index - 1].history[frame & 1].view[MQ.d[i].pose_view].selected)) {
if (MQ.d[i].pose_index) ++pose_written[pose_ranges[MQ.d[i].pose_index - 1].actor];
MQ.d[kept++] = MQ.d[i];
}
else MO.other_cam++;
MQ.n = kept;
if (!MQ.n) {