https://bugs.winehq.org/show_bug.cgi?id=48072
Bug ID: 48072 Summary: Textures not working correctly after commit a838e144dcaa55e227d7e99566a59f7a31d97227 Product: Wine Version: 4.17 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: tramtrist@tramtrist.com Distribution: ---
Created attachment 65622 --> https://bugs.winehq.org/attachment.cgi?id=65622 texture bug from 4.17
See attached: Floor and sky textures in everquest trilogy for Everquest Classic not working from >= 4.17 4.16 worked fine. Guessing commit a838e144dcaa55e227d7e99566a59f7a31d97227 is breaking the textures in sky/ground
https://bugs.winehq.org/show_bug.cgi?id=48072
Steve tramtrist@tramtrist.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tramtrist@tramtrist.com
https://bugs.winehq.org/show_bug.cgi?id=48072
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Regression SHA1| |a838e144dcaa55e227d7e99566a | |59f7a31d97227 Summary|Textures not working |Everquest Classic: Textures |correctly after commit |not working correctly |a838e144dcaa55e227d7e99566a | |59f7a31d97227 | Keywords| |regression CC| |matteo.mystral@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #1 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to Steve from comment #0)
Guessing commit a838e144dcaa55e227d7e99566a59f7a31d97227
Could you do a regression test to find out for sure? See: https://wiki.winehq.org/Regression_Testing
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #2 from Steve tramtrist@tramtrist.com --- Working on it.. though it's a bit out of my league :/
https://bugs.winehq.org/show_bug.cgi?id=48072
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Ever confirmed|0 |1
--- Comment #3 from Ken Sharp imwellcushtymelike@gmail.com --- 1. Checkout commit a838e144dcaa55e227d7e99566a59f7a31d97227 2. Compile and test 3. Revert commit a838e144dcaa55e227d7e99566a59f7a31d97227 4. Compile and test
Easy.
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #4 from Steve tramtrist@tramtrist.com --- I have run the bisect until I found the commit which cause the issue. 96547e622b04f403bc0c78d649275d1f844ed40e seems to have done it. I can revert that commit and cause the issue
https://bugs.winehq.org/show_bug.cgi?id=48072
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW CC| |z.figura12@gmail.com Regression SHA1|a838e144dcaa55e227d7e99566a |96547e622b04f403bc0c78d6492 |59f7a31d97227 |75d1f844ed40e
--- Comment #5 from Zebediah Figura z.figura12@gmail.com --- Here's hoping this one isn't too far over my head. Can you please attach a log with WINEDEBUG=+ddraw,+d3d8,+d3d9,+d3d?
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #6 from Steve tramtrist@tramtrist.com --- Created attachment 65666 --> https://bugs.winehq.org/attachment.cgi?id=65666 Log for commit 96547e622b04f403bc0c78d6492
https://bugs.winehq.org/show_bug.cgi?id=48072
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #65666|text/plain |application/gzip mime type| |
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #7 from Zebediah Figura z.figura12@gmail.com --- Created attachment 65668 --> https://bugs.winehq.org/attachment.cgi?id=65668 patch
Can you please try the attached patch?
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #8 from Steve tramtrist@tramtrist.com --- Apply it to which version? Latest?
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #9 from Zebediah Figura z.figura12@gmail.com --- (In reply to Steve from comment #8)
Apply it to which version? Latest?
Yes, or at any rate a version after the offending commit.
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #10 from Steve tramtrist@tramtrist.com --- Yep that fixed it... attaching new log.
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #11 from Steve tramtrist@tramtrist.com --- Created attachment 65671 --> https://bugs.winehq.org/attachment.cgi?id=65671 log after patch
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #12 from Steve tramtrist@tramtrist.com --- I applied the patch right after the commit which broke it.
I'll rebase the source and apply it to 4.19 latest tonight.
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #13 from tram tramtrist@tramtrist.com --- Ya this worked in 4.19 with the patch applied. Good to go I'd say. Can the developer explain how the patch worked/what caused the issue just for my education? Thanks :)
https://bugs.winehq.org/show_bug.cgi?id=48072
--- Comment #14 from Zebediah Figura z.figura12@gmail.com --- (In reply to tram from comment #13)
Ya this worked in 4.19 with the patch applied. Good to go I'd say. Can the developer explain how the patch worked/what caused the issue just for my education? Thanks :)
Sure. wined3d has an internal "command stream" thread, which serves the dual purpose of serializing commands sent by multiple client d3d threads, and improving performance by allowing those threads to execute asynchronously. Because of its asynchronicity, the command stream thread has its own state. That state doesn't carry a reference to resources which have a reference count attached (e.g. textures), I think because destruction of resources also has to go through the command stream.
When IDirectDraw7::SetCooperativeLevel() is called, we (among other things) tear down and recreate the wined3d device. Commit 96547e622 fixed an error where the CS might try to use a resource after it had been freed, since state_cleanup() releases all resources bound to the current state in the wined3d_device, but previously no corresponding call was made for the CS.
However, it in turn did not get rid of the discrepancy between device state cleanup and CS state cleanup—since wined3d_cs_reset_state() resets *all* state, but state_cleanup() only resets allocated resources. Now the CS is holding the default state, whereas the device is holding stale sampler state. In practice, this wouldn't matter—another part of SetCooperativeLevel() is restoring the state from before it was called—except that the functions that set state skip doing anything (including signaling the CS) if the device already has that state.
So, in summary, before 96547e622, both bugs cancelled each other out: wined3d_device_set_sampler_state() didn't update the CS state, but the CS state was stale and so was correct anyway. 96547e622 fixed the second bug; the attached patch essentially fixes the first, by making sure that the device state is completely reset to the default state.
That may have been a bit long-winded, but I tried to include all the context necessary for a newcomer to understand the problem.
https://bugs.winehq.org/show_bug.cgi?id=48072
tram tramtrist@tramtrist.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #15 from tram tramtrist@tramtrist.com --- See comments below.. Attached patch has fixed the issue. Please apply in next release.
https://bugs.winehq.org/show_bug.cgi?id=48072
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|FIXED |--- Ever confirmed|1 |0 Keywords| |patch
--- Comment #16 from Zebediah Figura z.figura12@gmail.com --- We don't mark bugs FIXED until a patch has been applied.
https://bugs.winehq.org/show_bug.cgi?id=48072
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |7b1581a7841a94bb4f4aa27bfa6 | |125d749afa433 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #17 from Zebediah Figura z.figura12@gmail.com --- Fixed by https://source.winehq.org/git/wine.git/commitdiff/7b1581a7841a94bb4f4aa27bfa6125d749afa433.
https://bugs.winehq.org/show_bug.cgi?id=48072
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #18 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.21.