protonscr

Ni No Kuni II: Cannot create VK_FORMAT_BC1/3/7 textures

dxvkclosed bug
doitsujin/dxvk#273 · opened 2018-04-12 by tonix64 · updated 2018-04-14 · 19 comments · github
Ttonix64 2018-04-12 github

I get lots of: "D3D11: Cannot create texture: VK_FORMAT_BC1/3/7_XXX" errors.

The errors seem to result in some missing textures, generally 2d graphics like small icons, gamepad hints, game hud, some menu parts, but also some 3d details. Tried different settings but nothing seems to change.

Other than the missing graphics the game runs fine (most 3d graphics look fine and fps is good).

Software information

Ni No Kuni II: Revenant Kingdom

System information

Apitrace file(s)

Log files

Ddoitsujin maintainer 2018-04-12 github

Thanks for the report. The number of mipmap levels looks incorrect; while this is probably a game bug, I need to add a workaround.

Ddoitsujin maintainer 2018-04-12 github

@tonix64 Please test if 8508994a63222955e8196b3751dc6ae7c6a8a911 fixes the issue.

Ttonix64 2018-04-12 github

Still seem to have the same errors

Ddoitsujin maintainer 2018-04-12 github

In that case I need an apitrace to debug the issue.

Ttonix64 2018-04-12 github
Ddoitsujin maintainer 2018-04-13 github

I cannot reproduce the issue with the apitrace you provided, and the Vulkan validation layers are not complaining either (which they do if the mip level count of a texture is too big).

Ttonix64 2018-04-13 github

I have uploaded a slightly longer one in case I cut the first one too soon, on this one I can already see some missing graphics by the time the logo gets displayed: https://ufile.io/35yng

If this still doesn't allow to reproduce the issue, could it be because of a driver or vulkan support issue on my gfx card? I see I'm missing maintenance2 extension, and otherwise I guess it can be because the apitrace is running without dxvk and handling of certain d3d11 commands can result in different execution paths. Also, is there any way I can reproduce the apitrace with dxvk? I tried but I just get a segfault. Otherwise let me know if there is anything else I can do to test, I can compile dxvk on my side for testing so I could try patches without need to commit them into git.

Anyways thank you for looking into this and for all your great work!

Ddoitsujin maintainer 2018-04-13 github

Alright, I see what I can do.

I see I'm missing maintenance2 extension

That's because wine currently lacks support for it. Not a big deal since most drivers probably behave the same anyway even if the extension is not enabled, and should be resolved once wine gains support for newer Vulkan revisions.

Also, is there any way I can reproduce the apitrace with dxvk?

d3dretrace.exe nino2.4.trace should work if you have DXVK installed, yes. When using the UI, it sometimes crashes for some reason.

Ddoitsujin maintainer 2018-04-14 github

So first of all, sorry for the confusion, it's not the mip level count that causes problems here. The main issue is that, for some reason, the game tries to create those textures with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, which doesn't work. Note that this does not happen when replaying the apitrace, so my guess is that the game makes some decisions based on format support queries, and that one of those queries returns an incorrect result in DXVK.

Please apply the attached patch and post a new log. If you find the time, and if it works, it might also be worth posting an apitrace recorded with DXVK to catch any incorrect results returned by format support queries etc.

bc7.patch.txt

Ttonix64 2018-04-14 github

Logs with the patch applied:

Ddoitsujin maintainer 2018-04-14 github

Did you obtain that trace from d3dretrace.exe or the game itself? I'm asking because the the debug info from CheckFormatSupport is missing, but the game definitely makes calls to that function.

If you tested by replaying the trace, please run the actual game.

Ttonix64 2018-04-14 github

It's the log from the game itself, as I can tell by the original names of the log files (Nino2-d3d11.log). Maybe it's because I'm using default log level?

Ttonix64 2018-04-14 github

Ok I got an apitrace using dxvk: https://ufile.io/h7cc8

Ttonix64 2018-04-14 github

I added a debug line just below the call to CheckFormatSupport to make it clear when it's getting called, not sure if it's of any help, but doing anything I can to help :)

Ttonix64 2018-04-14 github

And here goes one with debug level logs:

Ttonix64 2018-04-14 github

I know it's not the right way to do it but the following patch avoids the errors and makes the game run beautifully:

Ddoitsujin maintainer 2018-04-14 github

Figured that out as well based on the DXVK apitrace, f07f610b6ab624798ddff3b6a0f74d4765c97389 should fix the issue. Thanks for the help!

Ttonix64 2018-04-14 github

Indeed it does \o/.

Although I do spot one regression in the game compared with my quickfix above: now the sound is a bit garbled. It might be a wine issue since I'm also needing to apply the PULSE_LATENCY_MSEC=60 workaround to avoid garbled audio in any case, but it's curious with the quickfix from above sound still works ok.

Anyways thank you very much and don't hesitate to ask for any additional logs if you want to debug this further.

Ttonix64 2018-04-14 github

Actually, scratch that, seems like audio comes garbled on some game boots independent of which version of the fix I'm using.

Nothing extracted yet.