http://bugs.winehq.org/show_bug.cgi?id=37073
Bug ID: 37073 Summary: Trees not rendered correctly in Far Cry 2 Product: Wine Version: 1.7.24 Hardware: x86 OS: Linux Status: NEW Severity: minor Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: gyebro69@gmail.com
Created attachment 49267 --> http://bugs.winehq.org/attachment.cgi?id=49267 terminal output
When anti-aliasing is enabled in the game options treetops look like flat, 2D objects. Changing the other game option <Real Tree> has no effect on the issue. With disabled anti-aliasing trees look good.
I can reproduce the problem with nouveau and the binary drivers too. Native d3dx9_36 was used to work around bug #22682
Disabling GLSL, orm=backbuffer doesn't make it better.
Fedora 20 Geforce 250 GTS / binary drivers 340.24
http://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #1 from Béla Gyebrószki gyebro69@gmail.com --- Created attachment 49268 --> http://bugs.winehq.org/attachment.cgi?id=49268 FC2 screenshot
If you look at the attached screenshot in bug #32596 you should see the similarity regarding trees in these games. This may be the same problem, i don't know. The difference is that disabling multisampling doesn't fix the issue in Skydrift.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #2 from Austin English austinenglish@gmail.com --- This is your friendly reminder that there has been no bug activity for over a year. Is this still an issue in current (1.7.51 or newer) wine?
https://bugs.winehq.org/show_bug.cgi?id=37073
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Trees not rendered |Trees not rendered |correctly in Far Cry 2 |correctly in Far Cry 2 when | |anti-aliasing enabled
--- Comment #3 from Béla Gyebrószki gyebro69@gmail.com --- Still in wine-1.7.51-48-ge28d6b2, Nvidia binary drivers 340.93.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #4 from Béla Gyebrószki gyebro69@gmail.com --- Still a bug in wine-1.9.15-240-ga65718a.
Far Cry 2 (GOG.com) Fedora 24 OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 730/PCIe/SSE2 OpenGL core profile version string: 4.5.0 NVIDIA 367.35 OpenGL core profile shading language version string: 4.50 NVIDIA
p.s: this slightly reminds me of bug #40512, where grass has those blocky textures.
https://bugs.winehq.org/show_bug.cgi?id=37073
Wanderer _Wanderer_@outlook.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |_Wanderer_@outlook.com
--- Comment #5 from Wanderer _Wanderer_@outlook.com --- Can be confirmed as well for Wine 2.2.
https://bugs.winehq.org/show_bug.cgi?id=37073
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #6 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.0-rc4?
https://bugs.winehq.org/show_bug.cgi?id=37073
minion minion.procyk@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |minion.procyk@gmail.com
--- Comment #7 from minion minion.procyk@gmail.com --- just checking protondb, users are reporting this tree issue as of 2 weeks ago. I'll give the game a download and see for myself and report with an update
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #8 from minion minion.procyk@gmail.com --- i can confirm the 2014 FC2 screenshot does it justice. Can be observed with proton 4.11 and latest wine as shown below.
$ wine --version wine-5.0-rc4
https://bugs.winehq.org/show_bug.cgi?id=37073
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
--- Comment #9 from Paul Gofman gofmanp@gmail.com --- Created attachment 66218 --> https://bugs.winehq.org/attachment.cgi?id=66218 Support Nvidia & AMD specific alpha to coverage settings
I've tested the game.
It is d3d9 game which wants to use "alpha to coverage" feature when antialiasing is enabled. Nvidia and AMD cards provide these features under d3dx9 each in its own hacky way.
1. Nvidia The support of alpha to coverage can be queried on Nvidia by checking 'ATOC' fourcc pseudo-format support. Alpha to coverage render state is set through D3DRS_ADAPTIVETESS_Y render state with 'ATOC' bytes turning state on and D3DFMT_UNKNWON turning state off.
2. AMD There is no documented way to detect the support for this feature I could find, but it said to be available since long ago on all ATI & AMD cards. Alpha to coverage render state is controlled through D3DRS_POINTSIZE set to either 'A2M1' (enable) or 'A2M0' (disable).
If the game detects video card as Nvidia it queries for 'ATOC' format and if it is found works Nvidia way. Otherwise (if the reported card is not Nvidia or ATOC format is not available) it works AMD way.
I am attaching the patchset (3 patches) which implements both AMD & Nvidia states which fixes the issue for me (I tested on Nvidia card also spoofing AMD through HCKU\Software\Wine\Direct3D\VideoPciVendorID and VideoPciDeviceID registry keys).
Actually just implementing AMD render state is enough for this game as it fallbacks to AMD mode if it doesn't find ATOC format on Nvidia.
https://bugs.winehq.org/show_bug.cgi?id=37073
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #10 from Béla Gyebrószki gyebro69@gmail.com --- The patch indeed fixes the problem in Far Cry 2, tested on Nvidia hardware. Also fixes bug #32596 for me, which seemingly is about the same thing.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #11 from minion minion.procyk@gmail.com --- thanks for the patch. I have an amd card so i'll give this a go and report back.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #12 from minion minion.procyk@gmail.com --- i didnt notice any change after the patch.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #13 from minion minion.procyk@gmail.com --- FWIW some more info:
$ ./wine --version wine-5.0-rc4-72-g4f0212c4fd
VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5700 / 5700 XT] (rev c1) Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Device 0b36 Kernel driver in use: amdgpu Kernel modules: amdgpu
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #14 from Paul Gofman gofmanp@gmail.com --- (In reply to minion from comment #12)
i didnt notice any change after the patch.
Can you please:
1. Make sure you are using clean Wine prefix and not using any Wine d3d settings in registry
2. Attach a log with WINEDEBUG=+d3d9,+d3d,+d3d_shader. The log may be big but if you have game save near the trees you only need to load game for a second, and the logs are compressed really well.
3. Try spoofing NVIDIA card by setting the following DWORD hex values in registry under HKCU\Software\Wine\Direct3D key:
VideoPciVendorID to 10de VideoPciDeviceID to 1be0
https://bugs.winehq.org/show_bug.cgi?id=37073
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |paulthetall@gmail.com
--- Comment #15 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- *** Bug 32596 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #16 from minion minion.procyk@gmail.com --- the uncompressed log is 11G, the compressed log is like 200MB. how can i submit this log to you?
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #17 from minion minion.procyk@gmail.com --- or i can try slicing the log and recompressing. i'll see what i can do to get it uploadable.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #18 from Paul Gofman gofmanp@gmail.com --- Can you upload that to google drive or similar and post a link?
If that is not possible for some reason, can you please extract the following from the full log and compress / upload resulting files:
1. grep '(fixme:|err:|warn:|set_render_state|d3d9:)' log_file > 1.txt 2. head -n 1000000 log_file > 2.txt
But it would be really easier if you could upload the whole compressed log somewhere.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #19 from Paul Gofman gofmanp@gmail.com --- Also, it is very interesting if spoofing video card helps (with my patches applied; and the logs are needed without spoofing). In addition to the values I suggested above, it would be interesting to try with AMD card values which I used when testing this:
VideoPciVendorID 1002 VideoPciDeviceID 67df
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #20 from Paul Gofman gofmanp@gmail.com --- I also could reproduce the glitch with Intel card and I have a suspicion that it might be the same on Windows. E. g., I found such report from Windows user: https://steamcommunity.com/app/19900/discussions/0/487870763311673180/
So there is a chance the game just works this way as it does not recognize video card. I am not sure how likely is that for AMD RX 5700, but is it known if it works correctly on Windows with that card?
Anyway, the test results with spoofing and logs might tell us more.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #21 from minion minion.procyk@gmail.com --- tried spoofing amd and achieved the same results. I uploaded the log to google drive here: https://drive.google.com/file/d/1xdjeBmuL8_4-GcG0Q-m3iq-cq8a55DGo/view?usp=s...
the log was created with your initial request of WINEDEBUG=+d3d9,+d3d,+d3d_shader
i will load this up on windows and see what the results are.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #22 from minion minion.procyk@gmail.com --- i verified the behavior is correct in windows, trees look like... trees.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #23 from Paul Gofman gofmanp@gmail.com --- Created attachment 66227 --> https://bugs.winehq.org/attachment.cgi?id=66227 sanity check
Your log was recorded during video card spoofing enabled in video, but it didn't matter because:
- it happens Nvidia device id I gave is not recognized by Wine for spoofing and that setting had no effect; - as I can see from your logs the game is seemingly trying control sample to coverage AMD way and that was supposed to work with my patches, so it is probably not about some card (info) misdetection by the game. That code which implements that worked for me on Nvidia and Intel video cards, not sure why AMD opengl can have any specifics here.
I suggest at this point we perform some sanity check to make sure we are not missing something obvious. Could you please apply the attached patch on top of my previous patches, and then run the game again (please remove any spoofing config keys from registry). Please make sure that the patch is applied without errors. And attach plain terminal output, without any debug flags. If it works as I can expect, it is going to spam a lot of err: messages but should not make the log insanely big.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #24 from minion minion.procyk@gmail.com --- Created attachment 66228 --> https://bugs.winehq.org/attachment.cgi?id=66228 plain term output
attached is the log on top of your other patches on a clean prefix. I dont see those error messages spitting out. does this suggest i'm patching incorrectly?
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #25 from Paul Gofman gofmanp@gmail.com --- Created attachment 66229 --> https://bugs.winehq.org/attachment.cgi?id=66229 sanity check 2
(In reply to minion from comment #24)
attached is the log on top of your other patches on a clean prefix. I dont see those error messages spitting out. does this suggest i'm patching incorrectly?
Either you are running unpatched code (you are not using those Wine binaries built with my patches), or I am missing something more or less obvious why the state does not get updated. I am attaching yet another patch (to be applied in addition to all the previous) to see this now hopefully for sure. Could you please apply all the patches (all 3), build 32 bit wined3d and again run and attach plain output. We are expecting to see some spammed err: messages if the patched code is working.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #26 from minion minion.procyk@gmail.com --- FWIW i'm only building 64bit wine. I will post the results with your patch.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #27 from Paul Gofman gofmanp@gmail.com --- (In reply to minion from comment #26)
FWIW i'm only building 64bit wine. I will post the results with your patch.
Please mind that the game is 32 bit, 64 binaries are simply not used with it. Please make sure that the binaries you built are loaded with the game. You can do that by running with WINEDEBUG=+loaddll and observing the path of builtin dll being loaded, or (my favourite way):
lsof -p <pid> | grep wined3d
where <pid> is the pid of running FarCry2.exe
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #28 from minion minion.procyk@gmail.com --- thank you for your patience. The wrong dll was being loaded. I see the trees looking pretty as can be. I will try to be more mindful in the future.
thanks for your work, Paul.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #29 from Paul Gofman gofmanp@gmail.com --- I am glad it works now, thank you for testing.
I should think of embedding some special logs into the testing patches, its not the first time something entirely different is being tested at start.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #30 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Paul Gofman from comment #9)
- AMD There is no documented way to detect the support for this feature I
could find, but it said to be available since long ago on all ATI & AMD cards.
FWIW the usual AMD "spec" on the d3d9 hacks (which I have around in the form of a "Advanced DX9 Capabilities for ATI Radeon Cards_v2.pdf" file) simply says that it's always supported on d3d9+ cards.
https://bugs.winehq.org/show_bug.cgi?id=37073
--- Comment #31 from Paul Gofman gofmanp@gmail.com --- Should be fixed by https://source.winehq.org/git/wine.git/commit/c736321633c6a247b406be50b1780c... and https://source.winehq.org/git/wine.git/commit/2a913ecb69d2ddfcab9e9b049e03f0....
https://bugs.winehq.org/show_bug.cgi?id=37073
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |2a913ecb69d2ddfcab9e9b049e0 | |3f0e8ad50a1e8 Resolution|--- |FIXED
--- Comment #32 from Béla Gyebrószki gyebro69@gmail.com --- Works for me (Nvidia 440.58.01), thank you Paul.
https://bugs.winehq.org/show_bug.cgi?id=37073
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #33 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.3.