Commit Graph

76 Commits

Author SHA1 Message Date
Joshua Ashton 021c593ad8 [d3d9] Use all heaps when determining initial texture memory
Matches behaviour on Windows 10

Merges #1436
2020-03-18 19:40:01 +00:00
Joshua Ashton a9040c5cce [d3d9] Allow multisampled depth stencil resolves in StretchRect
Fixes a crash in some Source 2 titles
2020-03-18 04:59:27 +00:00
Philip Rebohle ba213c1fa0 [dxvk] Factor out waiting for resource to become idle
And use the new generic spin function to reduce syscall spam.
2020-03-15 03:43:04 +01:00
Joshua Ashton e33627cfdc [d3d9] Optimize unnecessary loops in hazard tracking
We only want to update specific indices of bitfields at a time, so pass through that information and mask it off.
2020-03-09 01:03:18 +00:00
Joshua Ashton 812a113a85 [d3d9] Avoid multiple tzcnts per loop in hazard tracking 2020-03-09 00:53:50 +00:00
Joshua Ashton f6b26b302d [d3d9] Handle depth stencil hazards
Track depth stencil textures being used and whether we have any active hazards.

Rebind the framebuffer with VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL if we encounter a depth stencil hazard.

Fixes black squares in Mass Effect and validation errors in some titles.

Closes #1484
2020-03-09 00:53:19 +00:00
Joshua Ashton a432befa8d [d3d9] Add RT suffix to current hazard tracking
We can have DS hazards...
2020-03-09 00:23:22 +00:00
Joshua Ashton 077f48b4ef [d3d9] Flush format converter in device after init
Otherwise we can be overwritten if its a new resource we just created by the initializer.
2020-03-02 04:37:20 +00:00
Joshua Ashton 36d3e8e83d [d3d9] Don't InitReturnPtr in CreateQuery
Matches native behaviour

Fixes a Wine test
2020-02-28 21:51:34 +00:00
Joshua Ashton 5548493fad [d3d9] Don't update device state for offset/stride if the buffer is nullptr
May also avoid some redundant rebinds here too...

Fixes a Wine test
2020-02-28 21:40:19 +00:00
Joshua Ashton 722520a9f7 [d3d9] Don't rebind user's vertex buffer/indices in DrawPrimitive[Indexed]UP
D3D9 doesn't do this, it instead sets them to NULL so we can simplify this logic a fair bit.

Found via a Wine test.
2020-02-28 21:37:00 +00:00
Joshua Ashton 3587bcdb9f [d3d9] Disallow creating additional swapchains if we are fullscreen
From Wine tests...
2020-02-28 01:43:07 +00:00
Joshua Ashton 632812b88f [d3d9] Disallow additional fullscreen swapchains
From Wine tests...
2020-02-28 01:39:52 +00:00
Joshua Ashton 0757097fa0 [d3d9] Initialize return ptr in device's GetBackBuffer
The swapchain's function does not do this, but this one does.
2020-02-28 01:37:23 +00:00
Joshua Ashton 528cacca5f [d3d9] Only have a single implicit swapchain
I am naive to think that this API is in any way sane, and that iSwapChains actually does what you would expect.

Swapchains created by CreateAdditionalSwapchain[Ex] are not tracked in that figure... There can only ever be one.

Great API. Very cool.

This also adds and consolidates some missing thread synchronization on the swapchain functions (that should have already had it).

(note: m_implicitSwapchain always exists, so we don't need to lock if that's all we call.)
2020-02-28 01:29:38 +00:00
Joshua Ashton c07f8c941c [d3d9] Delegate VCACHE check to QuerySupported
Fixes a failing Wine test
2020-02-28 00:59:44 +00:00
Joshua Ashton fbf76e8420 [d3d9] Don't mark unuploaded textures as uploaded 2020-02-25 04:37:01 +00:00
Joshua Ashton d1dc217d31 [d3d9] Fix readback for evictManagedOnUnlock 2020-02-23 16:59:33 +00:00
Joshua Ashton 2408b881a2 [dxso] Use SSBOs for vertex constant buffers if we'd be outside of uniform range
Impacts #1375
2020-02-20 08:14:58 +01:00
Joshua Ashton d11a07082c [d3d9] Remove unnecessary dirty flag change in CreateConstantBuffers 2020-02-20 08:14:58 +01:00
Joshua Ashton 512393e469 [d3d9] Refactor constant buffer creation 2020-02-20 08:14:58 +01:00
Joshua Ashton 8fabc25a38 [d3d9] Implement d3d9.allowDiscard 2020-02-18 16:53:51 +00:00
Joshua Ashton 6b85e6d3f1 Revert "[d3d9] Ignore D3DLOCK_DISCARD when partially locking buffers"
This reverts commit 50cf3a465b.
2020-02-18 16:50:39 +00:00
Joshua Ashton 378bdbdfb0 [d3d9] Remove repeated wrap state setting in Reset 2020-02-17 18:05:45 +00:00
Joshua Ashton 50cf3a465b [d3d9] Ignore D3DLOCK_DISCARD when partially locking buffers
Fixes #1444
2020-02-15 03:10:00 +00:00
Joshua Ashton 7d3ec74b40 [d3d9] Don't perform clipping in FF if disabled
Avoids unnecessary matrix multiplications in the shader, given this isn't as cheap as it is for programmable.
2020-02-14 19:19:22 +00:00
Joshua Ashton 0c16cc7749 [d3d9] Perform FF vertex clipping in world space
Previously we were doing this in object space which is incorrect.

Closes #1446
2020-02-14 19:09:02 +00:00
Joshua Ashton cad3b69e82 [d3d9] Fix likeliness in GetStreamSource 2020-02-14 17:21:52 +00:00
Joshua Ashton 2096a95262 [d3d9] Fix ColorFill using sampler views for partial extents
Closes #1434
2020-02-14 06:49:15 +01:00
Joshua Ashton ae68e3a5bc [d3d9] Defer managed texture uploads until PrepareDraw and when needed
This also caches shader masks used for hazard tracking.
2020-02-14 00:51:58 +00:00
Joshua Ashton 6e9725a124 [d3d9] Use bitsets for bool subresource arrays
Also remove lockflag tracking and consolidate that to a bitset
2020-02-14 00:51:58 +00:00
Joshua Ashton 51903d8348 [d3d9] Genericise video format conversion 2020-02-10 18:27:35 +00:00
Philip Rebohle 7567486668 [d3d9] Handle invalid alpha ref correctly 2020-02-10 15:20:13 +00:00
Joshua Ashton c42d44a4c3 [d3d9] Mark vertex blend dirty in MultiplyTransform if needed 2020-02-10 06:17:05 +00:00
Joshua Ashton 14203761d9 [d3d9] Reverse multiplication order in MultiplyTransform
Closes https://github.com/Joshua-Ashton/d9vk/issues/295
2020-02-10 06:16:12 +00:00
Joshua Ashton 4291bc9dfb [d3d9] Reupload fixed func ps data if stage constant changes
Closes #1420
2020-02-08 16:33:47 +00:00
Joshua Ashton b9474cf787 [d3d9] Return D3D_OK in CreateTexture even if AUTOGENMIPMAP flag is stripped
D3DOK_NOAUTOGEN is only returned when querying format support, the flag is stripped away silently in CreateTexture if it has to be.

Fixes #1409
2020-02-06 23:48:01 +00:00
Philip Rebohle 88147e19d2 [d3d9] Simplify dirty check for shader constants 2020-02-06 17:58:15 +01:00
Philip Rebohle aa70369671 [d3d9] Store copy of shader metadata in constant set
Reduces pointer chasing when updating shader constants.
2020-02-06 17:58:15 +01:00
Philip Rebohle 06809587e8 [d3d9] Don't arbitrarily set fog scale to 0
The Witcher 1 sets FOGSTART == FOGEND together with LINEAR fog mode, in
which case we previously set fog_scale to 0 and therefore incorrectly
override the pixel color with the fog color.

Fixes #1401.
2020-02-06 17:50:04 +01:00
Joshua Ashton 87dd8f0122 [d3d9] Validate blit regions are in range
Closes #1392
2020-02-04 23:45:32 +00:00
Joshua Ashton 92ee9c7ef1 [d3d9] Error on StretchRect when not D3DPOOL_DEFAULT 2020-02-04 22:37:44 +00:00
Joshua Ashton 3196fbc759 [d3d9] Unbind fragment shader for ProcessVertices
Fixes validation errors and potential UB on some drivers
2020-01-29 21:43:12 +00:00
Joshua Ashton b1edf227f8 [d3d9] Enable depth bounds feature, if supported
Only expose it in format checks if the adapter supports the feature also
2020-01-28 01:51:04 +00:00
Joshua Ashton 720cdf383e [d3d9] Use spec constants for bool constants 2020-01-27 14:21:21 +01:00
Joshua Ashton a43223256e [d3d9] Fix GetTextureStageState using unmapped types
Closes #1378
2020-01-27 01:07:11 +00:00
Joshua Ashton 9b486515fa [d3d9] Allow StretchRect BC -> BC format without stretch 2020-01-25 00:31:45 +00:00
Philip Rebohle 5d2215e898 [d3d9] Don't try to blit to compressed images
Fixes Vulkan validation errors and potential driver crashes in
Dragon Age Origins.
2020-01-24 22:59:26 +00:00
Joshua Ashton 13792df4c5 [d3d9] Don't mark D3DUSAGE_AUTOGENMIPMAP as renderable
We can't access those mips via locking in D3D9 so it's a-okay! :)
2020-01-24 15:54:15 +00:00
Joshua Ashton f804c6364d [d3d9] Implement d3d9.allowDoNotWait 2020-01-24 15:54:15 +00:00