Closed MattFiler closed 5 years ago
Please build and then run the sdkmeshdump.cpp tool on your sdkmesh
and post the results here so I can get a sense of the size of resources you need.
Here's what I got back for the model I'm having issues with.
Also, are you calling GraphicsMemory::Commit
each rendering frame? It's critical for the memory reclamation.
Yeah, I call it at the end of every render. I'm also utilising GraphicsMemory::GarbageCollect
in-between loading models to try and help, but it doesn't seem to make much difference.
I'm calling DeviceResources::WaitForGpu
before GraphicsMemory::GarbageCollect
as the function states the GPU must be idled before using for best effects - is this correct?
I think the question is what is your overall memory usage. The LinearAllocator used by GraphicsMemory grows the heap on-demand so it's not a fixed size. That said, it can't grow the heap larger than the amount of memory that your DirectX 12 driver supports for UPLOAD
type heaps.
Are you loading a lot of models? Are you using LoadStaticBuffers
to convert the UPLOAD
VB/IB to DEFAULT
? Are you using x64 native or 32-bit?
The issue occurs usually when switching between models - I use one large model for each of our environments. When changing environments I unload it, then load the next. They're all of a similar size to the dump I posted. The environments have a few other models loaded within them but they're all pretty small (~3K verts). When loading the models I do call LoadStaticBuffers
, I guess this is correct?
Did you close this because you were able to resolve the issue?
Utilising GraphicsMemory::GarbageCollect
after a call to DeviceResources::WaitForGpu
following a reset of model resources did the trick for my runtime model swapping issue. To solve the initial "out of memory" loading issue I simply split my model into two SDKMESH files to load-in which seems to work fine. Up to you if you keep the issue open - it might be worth exploring the problem further as it is repeatable with large individual SDKMESHes.
Thanks. I'll keep an eye out for future problems.
I did add some more debugging output in this commit.
BTW, are you using 32-bit or 64-bit native?
Appreciate the help! I'm using 64-bit.
I'm currently trying to load a large SDKMesh and getting an out of memory throw in LinearAllocator's
FindPageForAlloc
. Is there any defined maximum size an SDKMesh can be, or is that something which is system dependant?