From f3ce186887af6d58baf057328ad4e8337be5cbdc Mon Sep 17 00:00:00 2001 From: Chris Koos Date: Sat, 31 Oct 2026 11:46:13 -0700 Subject: [PATCH] Mark texture storage as written in nvnTextureFlushTexels nvnTextureFlushTexels was a no-op stub. Call nvn_guest_written on CPU-visible texture storage so mirrored textures whose texels were flushed by the guest are stamped in the write-generation table for re-upload, matching nvnBufferFlushMappedRange. --- runtime/nvn_api_obj.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/nvn_api_obj.c b/runtime/nvn_api_obj.c index f9d50e59..4569ddde 100644 --- a/runtime/nvn_api_obj.c +++ b/runtime/nvn_api_obj.c @@ -323,8 +323,11 @@ NVN_API(nvnTextureReadTexelsStrided) { read_texels(c, 1); } NVN_API(nvnTextureWriteTexels) { write_texels(c, 0); } NVN_API(nvnTextureWriteTexelsStrided) { write_texels(c, 1); } // void nvnTexture{Flush,Invalidate}Texels(const NVNtexture *t, const NVNtextureView *v, const NVNcopyRegion *r): texel -// access is coherent -NVN_API(nvnTextureFlushTexels) { (void)c; } +// access is coherent; flush marks the storage as written for re-upload +NVN_API(nvnTextureFlushTexels) { + const tex_t *t = arg_p(c, 0); + if (t && t->mem && !nvn_gpu_only((uintptr_t)t->mem)) nvn_guest_written((uintptr_t)t->mem, t->L.size); +} NVN_API(nvnTextureInvalidateTexels) { (void)c; } // ---------- Samplers