mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 04:15:57 +00:00
Merge pull request #501: Keep a texture's pool flags instead of reading its pool object later (lowlevel-larry)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
329acf81d2
4 files changed
+6
-3
No files matched your search
@@ -197,6 +197,7 @@ NVN_API(nvnTextureInitialize) {
|
||||
o->magic = NVN_TEX_MAGIC;
|
||||
o->d = s->d;
|
||||
o->pool = s->pool;
|
||||
o->pool_flags = s->pool ? (uint16_t)s->pool->flags : 0;
|
||||
o->off = s->off;
|
||||
o->has_layout = s->has_layout;
|
||||
memcpy(o->layout, s->layout, 8);
|
||||
|
||||
@@ -48,6 +48,9 @@ typedef struct {
|
||||
} tex_builder_t; FITS(tex_builder_t, NVNtextureBuilder);
|
||||
typedef struct {
|
||||
uint32_t magic; nvn_texdesc d; uint8_t has_layout, layout[8];
|
||||
uint16_t pool_flags; // the pool's flags at Initialize (in the padding): a game may finalize and free
|
||||
// the pool object while the back end still looks the texture up, and the
|
||||
// driver keeps no pointer to it either
|
||||
nvn_texlayout L; uint8_t *mem; pool_t *pool; int64_t off;
|
||||
uint64_t serial; // Initialization serial: the back end uses it to find its texture in the host table (the game may copy the object by value, so object pointers cannot be stored)
|
||||
} tex_t; FITS(tex_t, NVNtexture);
|
||||
|
||||
@@ -176,7 +176,7 @@ static void init_tex(tex_t *t, pool_t *pool, int64_t off, int format) {
|
||||
t->d.target = NVN_TEXTURE_TARGET_2D, t->d.format = format, t->d.width = TEX_W, t->d.height = TEX_H;
|
||||
t->d.depth = 1, t->d.levels = 1;
|
||||
nvn_tex_layout(&t->d, &t->L);
|
||||
t->pool = pool, t->off = off, t->mem = pool->mem + off, t->serial = 100 + (uint64_t)off;
|
||||
t->pool = pool, t->pool_flags = (uint16_t)pool->flags, t->off = off, t->mem = pool->mem + off, t->serial = 100 + (uint64_t)off;
|
||||
}
|
||||
|
||||
// Pixel of the RGBA8 target after the stream: the scissored second clear inside the rectangle, the first elsewhere.
|
||||
|
||||
@@ -166,8 +166,7 @@ static int same_but_swizzle(const TexKey *a, const TexKey *b) {
|
||||
static int tex_mirrored(const tex_t *t) {
|
||||
if (!t->mem || nvn_gpu_only((uintptr_t)t->mem)) return 0;
|
||||
if (t->has_layout) return 1;
|
||||
const pool_t *p = t->pool;
|
||||
if (!p || !(p->flags & (NVN_MEMORY_POOL_FLAGS_CPU_UNCACHED | NVN_MEMORY_POOL_FLAGS_CPU_CACHED))) return 0;
|
||||
if (!(t->pool_flags & (NVN_MEMORY_POOL_FLAGS_CPU_UNCACHED | NVN_MEMORY_POOL_FLAGS_CPU_CACHED))) return 0;
|
||||
if (t->d.flags & (NVN_TEXTURE_FLAGS_DISPLAY | NVN_TEXTURE_FLAGS_COMPRESSIBLE | NVN_TEXTURE_FLAGS_ADAPTIVE_ZCULL |
|
||||
NVN_TEXTURE_FLAGS_DEPTH16_PREFER_FAST_CLEAR | NVN_TEXTURE_FLAGS_ZCULL_SUPPORT_STENCIL))
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user