You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 175301f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: dm/gfx/gl/hle_gl.m
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@
19
19
// Environment: DM_GL_LOG=1 logs object creation; DM_GL_CAPTURE=<dir> writes every shader source the game compiles (<key>.vert / <key>.frag, read by gl_shaders.py).
20
20
#include"../../host/hle.h"
21
21
#include"../nvn/nvn_mtl.h"
22
+
#include"../nvn/nvn_tex.h"
23
+
#include<nvn.h>
22
24
#include"../nvn/host_msl.h"
23
25
#import<Metal/Metal.h>
24
26
#include<CommonCrypto/CommonDigest.h>
@@ -601,6 +603,20 @@ static int tex_make(tex_t *t, int rt) {
// Write one level's (or a part's) bytes into a made texture, in command order: a CPU write when no command buffer that may still read it is pending,
605
621
// else a blit from transient memory (in this frame's command buffer, after ending its render pass, when this frame used it; in a command buffer of its own otherwise).
606
622
// face: the cube face or array layer; z: the slice of a 3D texture
if (!atomic_exchange(&warned, 1)) LOG("[RED] NVN cannot import GL texture %u (not a defined RGBA8 2D texture)", s->gl_name);
508
+
return0;
509
+
}
510
+
}
498
511
// Re-initializing a texture object that is still live (without a Finalize first): release the host texture of the old serial first. SMBW re-initializes its transient render targets on the same object every frame and never Finalizes them;
499
512
// previously every init created a new private MTLTexture and the old one stayed in the serial table forever, so GPU memory grew about 13 MB per frame (killed by the memory watchdog at 24 GB)
500
513
if (o->magic==MAGIC('T', 'E', 'X', 0) &&o->serial) { staticuint64_tn; if (!n++) LOG("[nvn] TextureInitialize on a texture object that is still live (no Finalize): releasing the old host texture (first case ser=%llu)", (unsigned long long)o->serial); mtl_tex_release(o); }
Copy file name to clipboardExpand all lines: dm/gfx/nvn/nvn_mtl.h
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,5 +50,6 @@ void mtl_xv_window_tex(uint64_t serial); // Register a window (swapchain) text
50
50
void*mtl_device(void);
51
51
void*mtl_device_classic(void); // the same for a layer that draws only on classic queues: a device without Metal 4 (a virtual Mac) starts too, and its presents are dropped
52
52
uint64_tmtl_ext_tex(void*tex);
53
+
voidmtl_tex_import_shared(uint64_tserial, void*tex); // Retain a GL texture for the lifetime of an NVN serial
53
54
uint64_tmtl_present_ext(uint64_tserial, doubleperiod, void*ev, uint64_tev_val, constintcrop[4]); // crop: x, y, w, h of the texture to show (NULL = all of it)
54
55
voidmtl_present_wait(uint64_tticket); // as in nvn_obj.h: wait until that present has been handed to the GPU
void *mtl_device_classic(void) { g_classic_ok = 1; return mtl_device(); } // the GL and Vulkan layers: a device without Metal 4 is taken too, with presents dropped (mtl_init)
12333
12333
// An external producer's texture (the Vulkan layer's swapchain images): a serial the present path resolves (serial_put), resident for the Metal 4 queue, never collected by the cross-submit ledger
const void *pkg_data; // TextureBuilderSetPackagedTextureData: copied into the storage at TextureInitialize (13 Sentinels)
32
+
uint32_t gl_name;
32
33
uint8_t set_swz : 1, stencil : 1; uint16_t swz; // TextureBuilderSetSwizzle: r | g << 3 | b << 6 | a << 9 (NVN and Metal channel enums have the same values: 0 zero 1 one 2 R 3 G 4 B 5 A);
33
34
// stencil: TextureBuilderSetDepthStencilMode STENCIL (the texture reads the stencil of its depth-stencil storage, as a stencil-mode view does)
0 commit comments