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
[d3d9] Fix a bunch of Wine test failures #3895
base: master
Are you sure you want to change the base?
Conversation
hi which apps are affected with this? |
I don't know if any apps are affected. I want to make DXVK play nice with the Wine tests. |
cd2b68b
to
90eb194
Compare
229 failures left in the visual category. |
We now pass all state block tests. |
8fc6d83
to
ae512ba
Compare
I think I'll try to land this first batch before looking into more of the tests. |
rs[D3DRS_POINTSPRITEENABLE] = FALSE; | ||
rs[D3DRS_POINTSCALEENABLE] = FALSE; | ||
rs[D3DRS_POINTSCALE_A] = bit::cast<DWORD>(1.0f); | ||
rs[D3DRS_POINTSCALE_B] = bit::cast<DWORD>(0.0f); | ||
rs[D3DRS_POINTSCALE_C] = bit::cast<DWORD>(0.0f); | ||
rs[D3DRS_POINTSIZE] = bit::cast<DWORD>(1.0f); | ||
rs[D3DRS_POINTSIZE_MIN] = bit::cast<DWORD>(1.0f); | ||
rs[D3DRS_POINTSIZE_MAX] = bit::cast<DWORD>(64.0f); | ||
rs[D3DRS_POINTSIZE_MAX] = bit::cast<DWORD>(limits.pointSizeRange[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The default render state value has to match what we report in the device caps."
And does that match what any DX9 implementation exposes? We should check that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MaxPointSize is 8192 in the D3D8 dump that Winter did. (With a NVIDIA GeForce4 Ti 4800 SE).
The Vulkan max point size range is generally much lower unless you're using an AMD GPU.
https://vulkan.gpuinfo.org/displaydevicelimit.php?name=pointSizeRange[1]&platform=linux
So considering that setting the max to 64.0 hasn't caused any issue so far, this should be fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth that still is the case for Nvidia, namely MaxPointSize is 8192 even with modern drivers/cards. AMD sets it somewhat lower, e.g. 256 on @Blisto91's 7900 XTX.
vbo.stride); | ||
} else { | ||
// For whatever reason, D3D9 doesn't capture the stream offset | ||
dst->SetStreamSourceWithoutOffset( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does the offset we apply to the context come from if it is never captured?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did another round of testing the behavior of native D3D9 and it's pretty weird:
It only ignores the offset when calling IDirect3DStateBlock9::Capture
.
That means, that both the initial capture when creating a state block using IDirect3DDevice9::CreateStateBlock
as well as capturing the stream source by calling IDirect3DDevice9::SetStreamSource
in between IDirect3DDevice9::BeginStateBlock
and IDirect3DDevice9::EndStateBlock
will capture the offset as one would normally expect.
IDirect3DStateBlock9::Apply
only touches the stream sources if the state block has been created using IDirect3DDevice9::CreateStateBlock(D3DSBT_VERTEXSTATE)
or by calling IDirect3DDevice9::SetStreamSource
in between IDirect3DDevice9::BeginStateBlock
and IDirect3DDevice9::EndStateBlock
. Both of those capture the offset just fine.
So the only thing that does not work is updating the offset of a stream source that is capturing in a state block by calling Capture
. So to answer your question: it's not strictly correct that the offset is "never captured" and the offset we apply comes from capturing it earlier. That's also the way this PR implements it.
I hope that was somewhat understandable. 😅
Also fixes a Wine test.
Fixes the diffuse alpha and the direction.
Fixes the Wine test "test_specular_lighting".
Fixes a Wine test and matches further testing on Windows.
The default render state value has to match what we report in the device caps. Fixes a Wine stateblock test.
Fixes the following Wine test failures:
StretchRect, lighting, specular_lighting
Actually matches the documentation here: https://learn.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3ddevice9-stretchrect