I'm not sure this is 100% safe (maybe limiting those blits to sysmem textures would be better like stated in the original change?)
-- v6: wined3d: Don't reject blits coming from older command stream.
From: Aida Jonikienė aidas957@gmail.com
This is a partial revert of commit db6f95880c2631b64e48adc547d365e878ae45a6.
GTA 2 is missing non-text textures after exiting from the game to the menu screen when cross-CS thread blits are completely rejected. --- dlls/wined3d/texture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 2efdaf91438..154f4a13733 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3902,9 +3902,10 @@ HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context, return WINED3DERR_INVALIDCALL; }
- if (dst_texture->resource.device != src_texture->resource.device) + if (src_texture->resource.device->cs->thread_id > dst_texture->resource.device->cs->thread_id + || src_texture->resource.device->cs > dst_texture->resource.device->cs) { - FIXME("Rejecting cross-device blit.\n"); + FIXME("Rejecting blit from newer command stream.\n"); return E_NOTIMPL; }
On Wed Sep 11 10:11:56 2024 +0000, Aida Jonikienė wrote:
Why does GTA 2 use an older CS thread inside src_texture in my real-world test case? Is there some parent context/device thing I'm not aware of? The ddraw tests have the opposite behavior (and obviously trigger the CS thread assert) so I'm checking for it and rejecting blits there (which does allow ddraw tests to work well enough)
That's not how thread IDs work.
Each device has an associated command stream. Each texture belongs to exactly one device. If you try to use a texture with a device it wasn't created with, things will break. wined3d isn't set up to deal with that situation right now, for multiple reasons.
One such reason is that synchronizing across multiple command streams is not trivial. Another is that the backing GPU resources can't be used across different devices. There may be others I'm not thinking of.
A first step to solving this bug would be to write a test that replicates what the application is doing, and show that the cross-device blit in question is supposed to succeed. We have tests that show that they fail in general, so either there must be something different about this one, or the actual bug is something else.
Either way, I'd request to stop pushing guesses to a draft merge request; that wastes CI resources and attention.