Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videos in Serious Sam 2 aren't rendered correctly #39

Closed
aufkrawall opened this issue May 27, 2019 · 15 comments
Closed

Videos in Serious Sam 2 aren't rendered correctly #39

aufkrawall opened this issue May 27, 2019 · 15 comments
Assignees

Comments

@aufkrawall
Copy link

There is this corruption (doubled and wrong colors):
Screenshot_20190527_133941
They look correct with wined3d.

@axeldavy
Copy link
Collaborator

Would it be possible to get a short trace of the issue with
https://github.com/iXit/wine-nine-standalone/wiki/apitrace
?
Thanks

@aufkrawall
Copy link
Author

Here it is:
Sam2.trace.zip
I ran the game with Gallium Nine and not wined3d, hope that's not an issue.

@axeldavy
Copy link
Collaborator

Thanks, I'll investigate

@axeldavy
Copy link
Collaborator

Given the same issue happens with wined3d in the trace, I guess it is something with texture pitch or similar. Having the same trace with wine would be helpful.

@dungeon007
Copy link

There is a demo of this:
https://www.moddb.com/downloads/serious-sam-2-demo
Seems about format conversion, from YUY2 to RGB888::
d3d:wined3d_check_device_format_conversion wined3d 0x1306a8, adapter_idx 0, device_type WINED3D_DEVICE_TYPE_HAL, src_format WINED3DFMT_YUY2, dst_format WINED3DFMT_B8G8R8X8_UNORM stub!
https://en.wikipedia.org/wiki/YUV
AFAIR YUY2 format was removed from hardware since ATi/AMD HD cards, so conversion is needed there on more recent ones.

@dungeon007
Copy link

I guess this just works if somebody tries to play this on pre HD AMD card... i mean on r300 gallium driver, as there such conversion is not needed... well, i am not sure if nine even works on r300 in the first place. 🤣
But that is what i think this bug is about, it must be converted... otherwise wont play correctly on a HW without such format support.

@dungeon007
Copy link

DXVK also play this correctly, likely do conversion there too... 🤣
https://github.com/doitsujin/dxvk/tree/master/src/d3d9/shaders

@dungeon007
Copy link

"Given the same issue happens with wined3d in the trace, I guess it is something with texture pitch or similar. Having the same trace with wine would be helpful."
Well, wined3d trace when replaying on nine just exits with 🤣
44 @0 IDirect3D9::CreateDevice(this = 0x135170, Adapter = D3DADAPTER_DEFAULT, DeviceType = D3DDEVTYPE_HAL, hFocusWindow = 0x1005a, BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING, pPresentationParameters = &{BackBufferWidth = 1024, BackBufferHeight = 768, BackBufferFormat = D3DFMT_X8R8G8B8, BackBufferCount = 1, MultiSampleType = D3DMULTISAMPLE_NONE, MultiSampleQuality = 0, SwapEffect = D3DSWAPEFFECT_DISCARD, hDeviceWindow = 0x1005a, Windowed = FALSE, EnableAutoDepthStencil = TRUE, AutoDepthStencilFormat = D3DFMT_D32, Flags = 0x0, FullScreen_RefreshRateInHz = 0, PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE}, ppReturnedDeviceInterface = &0x134e90) = D3D_OK
44: warning: failed with 0x8876086c (D3DERR_INVALIDCALL): Invalid call
I guess you want some from Windows? 🤣

@dungeon007
Copy link

He, he, seems Windows trace no one could replay as it picks D3DFMT_YUY2. 🤣
WINED3D and DXVK, when replaying just exits with: X Error of failed request: BadWindow (invalid Window parameter)
NINE seems do something else, but still crashy... anyway, if interested to see crashes for yourself, both wined3d and windows traces here:

https://drive.google.com/file/d/1jcoTlhZDzAcBS0hWjZCXYRSXbIgdS3vY/view?usp=sharing

@axeldavy
Copy link
Collaborator

The formats can be emulated so I should be able to replay both traces.

@axeldavy
Copy link
Collaborator

If I emulate YUV2 I can run both traces fine.

Unfortunately it is a bit more complicated than that. On both windows and wined3d they advertise suppose for the format as surface but not texture. Probably for a good reason. Nine makes no difference between the two in terms of advertised format. I'll have to take a look.

@dungeon007
Copy link

He, he, i hexed GfxD3D.dll and replaced all occurrences of YUY2 with RGBG or GRGB. 🤣
WINED3D looks the same as NINE if on RGBG or GRGB, doubled and wrong colors. Meanwhile, NINE is not doubled on these, just on YUY2. DXVK is never doubled.
Colors are off with these on any WINED3D, NINE, DXVK of course, but at least could be a proof that scaling seems actually different on all these.
Dont know why i mention this, but who knows it might help. 🤣

@dungeon007
Copy link

I mean that was an brute force attack, just to show a difference 🤣 NINE seems opposite of WIND3D there, just a guess.... should formats ever turn into doubles, probably no?

@dungeon007
Copy link

"Meanwhile, NINE is not doubled on these, just on YUY2."
Not just, it is on YUY2 but also on UYVY, meanwhile on WINED3D these YUVs are scaled, but else arent - quite the opposite of NINE. 🤣
On DXVK, none is doubled UYVY, RGBG, YUY2, GRGB, DXT1, DXT2, DXT3, DXT4 and DXT5... anything that game supports is scaled correctly.
On WINED3D, correct are only UYVY and YUY2, else doubled.
On NINE, everything else scale correctly, besides UYVY and YUY2. 🤣

@dungeon007
Copy link

On Windows, it scales and renders correctly there no matter what i hexed there on formats, unlike on Linux where seems NONE do that.
So maybe, just return the same emulated thing for UYVY, RGBG, YUY2 and GRGB. 🤣

axeldavy added a commit to iXit/Mesa-3D that referenced this issue Apr 11, 2021
Adds alternative format to store YUV textures/surfaces.

These will be converted on upload to the alternative format.
Fixes: iXit/wine-nine-standalone#39

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants