Closed SveSop closed 5 years ago
Edit : actually i just caused the problem myself, it's the prefix upgrade from 5.9 to 5.10 who caused the problem. I cleaned up the prefix, now it work fine on 5.10 staging with dxvk.
Does it also uses SetDepthBoundsTest from nvapi (whichever implementation)?
Edit : actually i just caused the problem myself, it's the prefix upgrade from 5.9 to 5.10 who caused the problem. I cleaned up the prefix, now it work fine on 5.10 staging with dxvk.
Does it also uses SetDepthBoundsTest from nvapi (whichever implementation)?
I don't know, it's the first time i saw this message on wine output. But with the clean profile the message appear too, it's just different without your nvapi, so i assume it use it. Well the profile was almost pretty "clean", cause i use one per game, and this one require no override or any specific trick, it simply not survived the wine prefix upgrade.
@SveSop Thanks for all the additional info, so for future case i know how to deal with this. Will just continue without nvapi cause the game have no problem so far.
I don't know, it's the first time i saw this message on wine output. But with the clean profile the message appear too, it's just different without your nvapi, so i assume it use it. Well the profile was almost pretty "clean", cause i use one per game, and this one require no override or any specific trick, it simply not survived the wine prefix upgrade.
If this method is used by this game similar like UE4 does, you should see a confirmation once on the console f(rom https://github.com/jp7677/dxvk-nvapi/blob/master/src/nvapi.cpp#L34)
If it used correctly, you should see a confirmation once on the console f(rom https://github.com/jp7677/dxvk-nvapi/blob/master/src/nvapi.cpp#L34)
Without nvapi override : 0178:err:nvapi:NvAPI_D3D11_SetDepthBoundsTest Failed to get wined3d device handle! 0178:fixme:nvapi:unimplemented_stub function 0x6c2d048c is unimplemented!
With : NvAPI_GetErrorMessage -1: OK warn: D3D11DeviceContext::QueryInterface: Unknown interface query
So no confirmation
With "nvapi_lite" and running "Monster Hunter World Benchmark" it reads:
0160:trace:nvapi:nvapi_QueryInterface (7aaf7a04)
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 0, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 1, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 0, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 0, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 1, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 1, 0.999954, 0.999958): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 0, 0.000000, 1.000000): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 1, 0.999571, 0.999594): dxvk
0160:trace:nvapi:NvAPI_D3D11_SetDepthBoundsTest (0x1a885b0, 0, 0.000000, 1.000000): dxvk
(And loads more throughout running)
And from what i gather "working correctly"... although it is hard to quantify the difference, as you cant really disable nvapi when using nVidia hardware in Windows to test the "real" difference. I think i ended up with around 1-2% increase when running with this under wine/dxvk.
If it used correctly, you should see a confirmation once on the console f(rom https://github.com/jp7677/dxvk-nvapi/blob/master/src/nvapi.cpp#L34)
Without nvapi override : 0178:err:nvapi:NvAPI_D3D11_SetDepthBoundsTest Failed to get wined3d device handle! 0178:fixme:nvapi:unimplemented_stub function 0x6c2d048c is unimplemented!
With : NvAPI_GetErrorMessage -1: OK warn: D3D11DeviceContext::QueryInterface: Unknown interface query
So no confirmation
Out of curiosity, could you post all console output from nvapi? Afaik the DXVK warning should also contain a GUID, could you also post the full warning? That said, I guess the game uses more of nvapi than just the very basic stuff that UE4 needs, so you are probably better off with spoofing AMD and disabling nvapi all together (which is for good reason the default/recommendation for DXVK).
The only output i have from nvapi is this at start : NvAPI_QueryInterface 0xad298d3f: Called with unknown offset NvAPI_Initialize DXVK-NVAPI-v0.1.2: OK
Then i got spammed with during all the play : NvAPI_GetErrorMessage -1: OK warn: D3D11DeviceContext::QueryInterface: Unknown interface query warn: db6f6ddb-ac77-4e88-8253-819df9bbf140
Thanks. Yeah, I guess the game wants to use far more than just simple setdepthboundstest
from nvapi. I can only find a reference to that offset (0xad298d3f) within the Renderdoc source code and there it is passed on to nvapi. So no idea and I would again suggest to just spoof AMD, thus set nvapihack to the default, and disable nvapi like described here https://github.com/doitsujin/dxvk/wiki/Common-issues#nvapi
Since i don't have an nvidia card, that's what i do, disabling nvapi. Ive first started by providing nvapi assuming it will get ride of any nvapi message, but that's not the good way to follow.
And after reading the common issue, i see game make use of nvapi when detecting NVIDIA card, so in the end is this the game that don't use good code to detect gpu, or a wine bug ?
Well, according to your logs you seem to use either native or built-in nvapi. Could you try with export WINEDLLOVERRIDES="nvapi,nvapi64=d"
to actually prevent wine to load any nvapi/nvapi64 library?
It's just because the log are from before ive set the dll override to disabled.
I'm not entirely sure I understood what you mean. But yeah, if disabling nvapi got you rid of these nvapi log spam, then you can assume that the game just looks for an nvapi.dll or nvapi64.dll to be present and uses it right away when having found it.
Since i don't have an nvidia card, that's what i do, disabling nvapi.
Heh... Yeah, i wonder why nvapi did not work without a nVidia card... I must have missed that crucial bit of information some place i guess.
That supposed to be a good news? :smiley:
That supposed to be a good news? smiley
Not really anything revolutionary new there i tho. They still have not made all the "call addresses" public, and most of that someone already have posted random places anyway, but picking it from IDA and whatnot.
Some of the "guessed functions" implemented for the few functions i have looked at has been mostly correct anyway.
But in all fairness, getting stuff confirmed might absolutely help those interested :) So its a step in the right direction for sure!
Example from running GPUCapsViewer:
0009:trace:0009:trace:nvapi:get_thunk_function (329d77cd)
0009:fixme:nvapi:unimplemented_stub function 0x329d77cd is unimplemented!
The function address 329d77cd is not to be found in the SDK, so that does not help... However, on one of the "various places", i have found what function it calls. (which is not present in the SDK either).
So yeah, a step in the right direction, but not "soon you will have a fully working nvapi for linux".
I must admit i have not tested that many things the last few months, cos i am not sure the benefit of actually having a function made outweighs the dxgi.nvapiHack = True
in DXVK. Maybe if was needed for HDR or some other stuff it could be nice?
I am willing to fiddle more with it, and if ppl had good examples where a game either does not work, or is severely bugged/slowed by using dxgi.nvapiHack = False
along with the wine-staging implementation of nvapi, that would be valuable. The only example i know i have done some testing with is the SetDepthBoundsTest
and using MonsterHunter World demo I found it maybe to be like a 1% increase (probably within a random margin of error..) vs. using nvapiHack and fake AMD card.
Maybe for GSync? Anyone know of a game not working with GSync because of missing nvapi implementation for wine?
So yeah, a step in the right direction, but not "soon you will have a fully working nvapi for linux".
Eeeh...Yeah i can imagine it's far from seeing fully working PhysX in Batman Arkham Knight
So yeah, a step in the right direction, but not "soon you will have a fully working nvapi for linux".
Eeeh...Yeah i can imagine it's far from seeing fully working PhysX in Batman Arkham Knight
Well, i do know that atleast for some apps, nvapi calls give the app things like
NvAPI_GPU_CudaEnumComputeCapableGpus
NvAPI_GetPhysicalGPUFromGPUID
and depending on said app/game it would either use GPU to do physx rendering, or cpu. So if AK calls nvapi, get none/wrong reply, CPU will be used for physx rendering. The wine-staging nvapi gives the correct reply on a nVidia gpu afaik, but i would think if you use the default dxvk.conf setting of dxgi.nvapiHack = True
(or not configured), it would use CPU rendering.
Last time i've checked this particular game when enabling nvapi parts of PhysX (in-game Settings not available and looks like disabled, i mean like interactive fog) if you try to force them through config file - game will crash.
However rest of PhysX options works fine.
(of course CUDA packages was properly set and wine-staging used, earlier games with usual implementation of non-nvapi PhysX work just fine with GPU acceleration as well)
I've added forwarding to the other DXVK D3D11 extensions and some basic system information stuff to https://github.com/jp7677/dxvk-nvapi I've added new binaries for easy usage. Please let me know if you see something that uses BeginUAVOverlap/EndUAVOverlap or MultiDrawInstancedIndirect/MultiDrawIndexedInstancedIndirect through NVAPI. I would love to test if it makes a difference. Until now I have only seen SetDepthBoundsTest through NVAPI.
@jp7677 Thx for your efforts! :+1:
Tested with Batman Arkham Knight above, in-game settings for interactive fog still not available though, rest of PhysX seems to work as before, pretty much.
When i exited game there were some fatal error, not sure how to test it further, but i definitely haven't seen that one before so it must be caused by dxvk-nvapi, please tell me how i can provide more info on that.
Please let me know if you see something that uses BeginUAVOverlap/EndUAVOverlap or MultiDrawInstancedIndirect/MultiDrawIndexedInstancedIndirect through NVAPI.
How can i test it?
PhysX has nothing to do with this project.
How can i test it?
Ideally games that use it should be slightly faster. There shouldnt be any visual difference.
As far as i understand those options in this particular Batman game are only available if game can see that:
I'm sure that first 2 i meet, tested it with multiple other games under wine-staging
Ideally games that use it should be slightly faster.
Very hard to say, as for me game worked pretty damn good before and after dxvk-nvapi
@keybreak Thanks a lot for giving it a try.
Regarding Batman AK, basically what @K0bin says. The game wants to use NVAPI for NVIDIA shader extension (NV_EXTN_OP_VOTE_BALLOT and NV_EXTN_OP_FP16_ATOMIC). DXVK does not know about these extensions, thus dxvk-nvapi returns that these are not supported, thus nothing should be different. (Interesting note, when I return that these extension are supported and return Ok for NvAPI_D3D11_SetNvShaderExtnSlot, I can see some visual artifacts in the benchmark. I would have expected a crash in that case. The DXVK logs contains no hint of anything unsupported. Though reading https://developer.nvidia.com/unlocking-gpu-intrinsics-hlsl there seem to be some magic behind the scenes.
Batman AK does not use NVAPI for any of the methods that are currently forwarded to DXVK. You should at least see a statement printed on the console like NvAPI_D3D11_SetDepthBoundsTest: OK
when a program uses it.
The last two gameworks features (interactive fog, etc) would also need an nvcuda
implementation afaik.
So there is no viable way to use / force Interactive fog / Paper debris for this game on Linux? :disappointed:
Batman AK does not use NVAPI for any of the methods that are currently forwarded to DXVK. You should at least see a statement printed on the console like NvAPI_D3D11_SetDepthBoundsTest: OK when a program uses it.
Yep, i don't see it in log... :thinking:
The last two gameworks features (interactive fog, etc) would also need an nvcuda implementation afaik.
That's interesting, i thought nvcuda already working, if you do all that https://forum.endeavouros.com/t/linux-gaming/7339/2#heading--linux-gaming-advanced-physx
Though reading https://developer.nvidia.com/unlocking-gpu-intrinsics-hlsl there seem to be some magic behind the scenes.
As always...Nvidia with it's voodoo magic :rofl:
Here's my test on:
Also i've tried to enable manually set those options and restrict file to read only to force it: drive_c/users/x133/My Documents/WB Games/Batman Arkham Knight/GFXSettings.BatmanArkhamKnight.xml
<OPTION Name="Interactive_Smoke" Registered="True" Type="Bool" Value="true" />
<OPTION Name="Interactive_Paper_Debris" Registered="True" Type="Bool" Value="true" />
That lead to:
lutris-wrapper: Batman Arkham knight
Running /home/x133/.PlayOnLinux/wine/linux-amd64/5.11-staging/bin/wine /home/x133/.PlayOnLinux/wineprefix/Batman_Arkham_knight/drive_c/Games/Batman Arkham knight/Binaries/Win64/BatmanAK.exe -nologo
Initial process has started with pid 348322
Game is considered started.
info: Game: BatmanAK.exe
info: DXVK: v1.7.1-2-g743f309
info: Found config file: dxvk.conf
info: Effective configuration:
info: dxgi.nvapiHack = False
info: Built-in extension providers:
info: Win32 WSI
info: OpenVR
warn: OpenVR: Failed to locate module
info: Enabled instance extensions:
info: VK_KHR_get_surface_capabilities2
info: VK_KHR_surface
info: VK_KHR_win32_surface
info: GeForce GTX TITAN X:
info: Driver: 450.66.0
info: Vulkan: 1.2.133
info: Memory Heap[0]:
info: Size: 12288 MiB
info: Flags: 0x1
info: Memory Type[7]: Property Flags = 0x1
info: Memory Heap[1]:
info: Size: 24048 MiB
info: Flags: 0x0
info: Memory Type[0]: Property Flags = 0x0
info: Memory Type[1]: Property Flags = 0x0
info: Memory Type[2]: Property Flags = 0x0
info: Memory Type[3]: Property Flags = 0x0
info: Memory Type[4]: Property Flags = 0x0
info: Memory Type[5]: Property Flags = 0x0
info: Memory Type[6]: Property Flags = 0x0
info: Memory Type[8]: Property Flags = 0x6
info: Memory Type[9]: Property Flags = 0xe
info: Memory Heap[2]:
info: Size: 246 MiB
info: Flags: 0x1
info: Memory Type[10]: Property Flags = 0x7
wine: Unhandled page fault on read access to 0000000000000000 at address 00000001408B4BAA (thread 00bc), starting debugger...
Game is considered exited.
All monitored processes have exited.
Never found the initial process' return code. Weird?
Exit with returncode 0
So there is no viable way to use / force Interactive fog / Paper debris for this game on Linux?  That's interesting, i thought nvcuda already working, ...
I'm not that familiar with the details, but from my understanding, Cuda/Physx from wine-staging does not contain implementations for Cuda/D3D11 interop which AK would need. Though other methods, e.g. needed for tech-demos like Fluidmark are implemented. So no, currently there is no way to to use these Gameworks features on Linux. From my understanding it is not that simple to add the missing bits and pieces.
Regarding the logs, I'm using the Steam version with latest released Proton, there is much less usage of NVAPI. I wonder what happens with all that information that your version wants to query from your system ;). I don't see the crash on my Steam version on exit either. Anyway, I remember AK crashing when using detective mode i.c.w. nvapi-hack off. I'm not sure what the current state of that issue is, but I'm sure that dxvk-nvapi won't affect/solve that. I would recommend to stay with the defaults (spoofing AMD) for this game since it does not uses any of the DXVK extensions that are forwarded by dxvk-nvapi.
PS: Feel free to shorten the logs to not spam this issue tracker to much.
Regarding the logs, I'm using the Steam version with latest released Proton, there is much less usage of NVAPI. I wonder what happens with all that information that your version wants to query from your system ;).
Yep, i'd also like to know...I only know that EPIC version is most modern / updated version of that game for today, so they must have updated some in-game nvidia libs hence changes!
Anyway, I remember AK crashing when using detective mode i.c.w. nvapi-hack off. I'm not sure what the current state of that issue is, but I'm sure that dxvk-nvapi won't affect that.
Yep, confirmed it crashes
PS: Feel free to shorten the logs to not spam this issue tracker to much.
Sorry, i though that GitHub should auto-truncate them when using code tag
My N's nvapi re-implementation is built into DXVK, it contains only minimum to function and only DXVK d3d11 interfaces are in use (for e.g. SetDepthBoundsTest). If @doitsujin will consider to include such thing in DXVK, I could polish and PR changes. It could be alternative to current nvapi hack.
Well, the real minimum is to implement just nvapi_QueryInterface rejecting every request, but no reason to include such stub into DXVK, the point is to have some benefit from what DXVK interfaces can offer.
@pchome
Well, the real minimum is to implement just nvapi_QueryInterface rejecting every request, but no reason to include such stub into DXVK, the point is to have some benefit from what DXVK interfaces can offer.
The "problem" here could be that once it is there, it will be used, and if used, the information provided should be useful. There seems to be a lot of different implementations of the usage from various games/apps, so it kinda leaves the whole ordeal somewhat of a can-o-worms in that regard. I mean - it is highly probable that if a game uses nvapi.dll once you have a nVidia card, it could "break" in unknown ways if the information provided by it is bogus...
Two other things i would venture to implement in the basic minimal approach is:
Having this as a opt-in kind of thing in the install script could be useful where it would provide some benefit. setup_dxvk.sh install --with-nvapi
or something?
@SveSop
The "problem" here could be that once it is there, it will be used, and if used, the information provided should be useful. ...
No information provided. It is literally functions group and NvAPI_D3D11_SetDepthBoundsTest.
NvAPI docs are clear in part which say "you should call nvapi_QueryInterface before using any NvAPI functions". So if we don't report any mem-info and version functions, then app should use different method to obtain such information. Sure there are apps/games which will check only nvapi.dll presence, and then trying to use random functions w/o even check return value of nvapi_QueryInterface. Anyway nvapi-hack works (except maybe for plain Wine w/o DXVK dxgi.dll), enabled by default.
Having this as a opt-in kind of thing in the install script could be useful where it would provide some benefit. setup_dxvk.sh install --with-nvapi or something?
Yes, disabled by default.
@pchome There are a lot of weird/faulty implementations of this usage i think. Games "should" have a good way of doing it correctly - with a fallback incase correct info is not provided, but that does not mean they actually do... Then again, worst case scenario is just to use the DXVK nvapihack anyway :) Wine dxgi does not have a easy to use "fake hardware id", so it would probably mean a recompile in that case. (Who play "recent" games with wined3d these days?) EDIT: Other than d3d12 games using vkd3d tho... I can see games utilizing NvAPI to get certain raytracing functions perhaps?
It would probably be somewhat similar to the AMDAgs (dxvk-ags) thing? Slightly differently implemented by games i think, in that it is games that ship amd_ags_x64.dll, and not AMD drivers? Haven't really looked into it tbh..
@SveSop
PS. To make sure the game/app does what it can to use nvapi, you should put this in the dxvk.conf file:
Do you know where this config should be for DXk on Windows?
@SveSop
PS. To make sure the game/app does what it can to use nvapi, you should put this in the dxvk.conf file:
Do you know where this config should be for DXk on Windows?
Put the dxvk.conf file in the same folder you put the dxvk d3d11.dll file(s) (and where the .exe file is) when using windows.
Yeah, I've already figured it out.
Since @pchome made that standalone meson compile version of nvapi, i have been experimenting a wee bit with various stuff there. The question could be if there is something to be done to "fix" nvapi so it more or less gets useful for those weird nvapi cases.
I do not own a game that have any serious issues with this, and searching here kinda ended up in a non-conclusive 100% way to recreate problems (for me), cos i dont want to buy 4-5-6 games just to test. I would lub some feedback on what game "is the worst" if you are not faking AMD card, and setting dll-overrides for nvapi to "disabled".
What i have experienced so far, is as ppl have described, and that is even if you fake AMD card, and the nvapi.dll exist, it will end up being used anyway.
I have added a few fake things to the nvapi source, and i know it wont actually DO any hardware setting changes, but maybe faking calls and returning "sane" answers is enough for a few games? Worth a test in my book i guess.
https://github.com/SveSop/nvapi_standalone
Grab it, compile it and test it. (Script explanation in the README).
The absolutely awesome thing about this standalone source (big thanks pchome) is that when installed via dll-overrides, you just compile and replace the install folder to test a "new version", so its easy to fiddle with.
As of now, I have just faked as much of my GTX970 as possible (easily changed, and if interested i can explain how). I do not think it really matters much tho, but its a fun experiment. I have zero coding experience, so if obvious errors or ways to do things easier is spotted, tips are most welcome :+1:
What i would love tho, is for a comparison of
WINEDEBUG="-all,+nvapi"
logs between the regular staging nvapi and mine, especially for games that have huge issues with this. Probably best to post it as issues on my GIT. Eg. "wine-staging.log" "wine-nvapi-standalone.log", so i can try to pinpoint if there is anything obvious that COULD help.Not saying it actually will solve anything, but hey.. fun project nevertheless.
PS. To make sure the game/app does what it can to use nvapi, you should put this in the dxvk.conf file:
dxgi.nvapiHack = False
(Requires RECENT git - cf9de54 or newer) Or ofc you can override it with:in the dxvk.conf file.