acomminos / wine-pba

Patches to add a persistent buffer allocator for faster dynamic geometry in Direct3D games.
GNU Lesser General Public License v2.1
138 stars 6 forks source link

Final Fantasy XIV Fails to load after character select: 006a:err:d3d:resource_init Failed to allocate system memory. #36

Open GloriousEggroll opened 6 years ago

GloriousEggroll commented 6 years ago

FFXIV dx9 mode game opens, runs, logs in and gets to character select, then when you get to the loading screen it pops an error. (various other games run fantastic though, great work and progress!)

game runs without issues in staging-3.3 (non pba)

it should be noted this game requires a full DXSETUP install to run. winetricks d3d9, directx9, d3dx9_36 or any combination of the 3 is not enough. not sure if that has any effect on anything

log attached. log.txt ffxiv

GloriousEggroll commented 6 years ago

I checked winetricks after a fresh install to see what DXSETUP installed: xact xinput vcrun2013 quartz devenum made a new install with just those and no dx overrides at all, game launched, then instead of giving me an error it just crashed out. same problem regarding failed to allocate system memory. spams this in log:

00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory. 00ab:err:d3d:resource_init Failed to allocate system memory.

ghost commented 6 years ago

I think I have seen problem myself, I changed the geo_heap_size to vram * 0.75, in WoW initially it looked ok, but noticed tooltips were blank, then fell over with oom errors

anyway, a sed for 0001-wined3d-Initial-implementation-of-a-persistent-mappe.patch

sed 's/GLsizeiptr geo_heap_size = 512 \* 1024 \* 1024/GLsizeiptr geo_heap_size = device->adapter->vram_bytes \* 0.5/' instead of 512mb, it will be 1/2 video ram, assuming a 1gb card, it is the same as stock pba how much vram do you have? try lowering the 0.5 ( maybe start with 0.25 and work up ) and see if that improves things

I might look into how wine does tunables and hack one in so no need for recompiles

GloriousEggroll commented 6 years ago

I've got a vega 64 with 8gb vram, ill give your change a shot and see how it plays

-edit- still crashes

i believe this may also be related to https://github.com/acomminos/wine-pba/issues/35

as ffxiv in dx9 mode is 32 bit

-edit 2- dx11 mode does not crash, but is unuseable due to black/missing character textures. this is a problem in wine-mainline also, not pba related. also sits around 15-20 fps on dx11 ffxivdx11

ghost commented 6 years ago

yeah, my patch would make geo_heap_size a silly amount I was assuming you had low mem card, ok, so 32bit so addressable mem is 4gb max ( I really need to refresh on 32bit mem restrictions ) hmm, what happens if you limit the video ram size with winetricks? 512mb along with my hacky *0.5 geo_heap_size

or , stock pba and 1024mb vid ram

edit while looking game requirment specs I notice demo on steam is available http://store.steampowered.com/app/312060/FINAL_FANTASY_XIV_Online_Free_Trial/ so I 'll take a look at that but I only have an E6600 @ 3.33 and a don't laugh nvidia gt620

GloriousEggroll commented 6 years ago

limiting the VideoMemorySize to 4096 did no good ;/

acomminos commented 6 years ago

This isn't a video memory issue, the 32 bit address space is likely being exhausted. Try reducing cb_heap_size drastically (as constant buffers are not used on D3D9), and making geo_heap_size a smaller constant (my guess is 256MB might be more reasonable). Keep an eye on the debug output for complaints from the persistent buffer allocator about running out of space.

mrdeathjr28 commented 6 years ago

@acomminos

Yeah this problem stay reported in vanilla too and dont have relation with video memory

https://bugs.winehq.org/show_bug.cgi?id=44375

Specially notorious in certain apps when allocate more than 4gb, some apps with higher settings can detonate this situation case grid with higher settings and others

GloriousEggroll commented 6 years ago

@mrdeathjr28 i dont have any problems running or loading the game in dx9 mode in vanilla at all

mrdeathjr28 commented 6 years ago

@GloriousEggroll

Is only in certain apps with determinated conditions case grid and others but appears some rare cases as samurai warriors 4 II when app allocate 4gb but game dont crash at least in my test around 2 hour of gaming

Curiously dont up than 4.0gb in this time but another apps are more sensible case assasins creed 1 + mods, mass effect 1 + mods + test drive unlimited 2 + mods and others

But as your said before cited apps runs in vanilla but with pba crash because this apps allocate more memory than vanilla

GloriousEggroll commented 6 years ago

ffxiv-pba @acomminos that worked!

sed -i 's/GLsizeiptr geo_heap_size = 512 \* 1024 \* 1024/GLsizeiptr geo_heap_size = 256 \* 1024 \* 1024/' ../wine-pba/patches/0001-wined3d-Initial-implementation-of-a-persistent-mappe.patch

sed -i 's/GLsizeiptr cb_heap_size = 128 \* 1024 \* 1024/GLsizeiptr cb_heap_size = 64 \* 1024 \* 1024/' ../wine-pba/patches/0001-wined3d-Initial-implementation-of-a-persistent-mappe.patch

getting between 50-60 fps on maxed out settings

ghost commented 6 years ago

@GloriousEggroll added a rough tunable option https://gist.github.com/Firerat/2b90b59ecf78bbaa1a420b66ca9088ef

with you can overide the default geo_heap and/or cb_heap e.g. in user.reg [Software\Wine\Direct3D] "cb_heap"="16"

GloriousEggroll commented 6 years ago

@Firerat forgot to post, this works great. Here's a patch for pba that works with current pba. Apply this patch to the pba patches before applying the pba patches to wine:

https://github.com/GloriousEggroll/ge-wine/blob/master/ffxiv-pba.patch

ghost commented 6 years ago

@GloriousEggroll yw, I had forgoten about that one since @acomminos did the disable PBA via env_var I thought it would be better ( and easier ) to set the custom heap sizes in the same way, i.e. launch wine with __PBA_GEO_HEAP=512 __PBA_CB_HEAP=1 wine <some dx9 game> and just have shell scripts for your game specific sweetspots

ghost commented 6 years ago

I should probaly fork already, but anyway 0001-wined3d-GEO-and-CB-heap-size-override-envvars.patch.gz

no messing with regedit,