Joshua Ashton
3e65c2bb87
[d3d9] Reduce copying around of shader metadata at Create time
2020-09-11 21:49:14 +01:00
Robin Kertels
89d36e1d7f
[d3d9] Handle edge cases around implicit discard
2020-08-15 05:45:01 +01:00
Robin Kertels
b28a7353bb
[d3d9] Do implicit discard when locking system memory resources
2020-08-10 00:09:29 +01:00
Joshua Ashton
ad6b91d84a
[d3d9] Flush and synchronize to cs before format conversion
...
Fixes a race when DISCARD is used
2020-08-07 10:56:26 +01:00
Joshua Ashton
f1aa80dab9
[d3d9] Don't private reference additional swapchains
2020-08-07 10:56:26 +01:00
Robin Kertels
2714cb952d
[d3d9] Extend dirty tracking to render targets
...
Ensures we copy a dynamic default pool texture to its
mapping buffer after the device renders to it.
2020-07-20 18:36:20 +01:00
Robin Kertels
291f7e05bc
[d3d9] Fix uninitialized BufferHandle when discarding mapped buffer
...
Co-authored-by: Christopher Egert <cme3000@gmail.com>
2020-06-15 03:26:47 +01:00
Joshua Ashton
9525f53d00
[d3d9] Only enable FETCH4 when POINT sampling
...
Closes #1660
2020-06-14 00:38:36 +01:00
Joshua Ashton
67f01631fa
[d3d9] Clear dirty range when discarding buffers
2020-06-11 05:58:17 +01:00
Robin Kertels
7389da29be
[d3d9] Discard mapped buffer if it's currently in use
2020-06-11 05:53:33 +01:00
Robin Kertels
5d5ec2aa77
[d3d9] Remove IsUploading from CommonTexture
...
This was always true on subsequent Lock calls.
The first lock was handled by the 'freshly allocated fast path' anyway.
2020-06-11 05:53:33 +01:00
Joshua Ashton
e6ed8dab63
[d3d9] Perform tracking for preloaded managed resources
2020-06-11 05:53:33 +01:00
Joshua Ashton
7e72010302
[d3d9] Upload managed resource if needed before mip gen
2020-06-11 05:53:33 +01:00
Joshua Ashton
b1bd3597a4
[d3d9] Implement PreLoad for buffers + textures
2020-06-11 05:53:33 +01:00
Joshua Ashton
68ae3f4376
[d3d9] Return D3D_OK when unlocking not locked textures
...
Matches D3D9 behaviour
2020-06-05 23:46:33 +01:00
Joshua Ashton
124023bac5
[d3d9] Add read-only check to uploading managed textures on Lock
2020-06-05 23:33:00 +01:00
Joshua Ashton
ed5cbb99b6
[d3d9] Mark managed for upload in Lock rather than Unlock
...
Fixes Nekopara properly.
Also refactor some locking checks
2020-06-05 23:29:23 +01:00
Joshua Ashton
86e8315416
[d3d9] Revert Nekopara hacks
2020-06-05 23:15:10 +01:00
Joshua Ashton
d39cf31189
[d3d9] Implement uploadAllManagedSubresources option
...
Nekopara locks mip 1, then unlocks mip 0 and expects it to upload all the mips.
2020-06-05 02:34:44 +01:00
Joshua Ashton
5558460853
[d3d9] Don't mark lock on DONOTWAIT path
...
Fixes some issues in some games using this feature.
2020-06-01 15:52:25 +01:00
Joshua Ashton
c03eaf2de7
[d3d9] Hook up auto gen mip filter
2020-05-27 10:12:43 +02:00
Joshua Ashton
7cd46e72e9
[dxvk] Add filter type to generateMipmaps
2020-05-27 10:12:43 +02:00
Joshua Ashton
561254b51d
[d3d9] Support RENDERTARGET and AUTOGENMIPMAP together
...
Fixes funky water in Trackmania
Closes #1642
2020-05-27 09:03:58 +01:00
Joshua Ashton
d8381dab8d
[d3d9] Fix a typo when unmarking autogen mips
2020-05-26 18:57:28 +01:00
Joshua Ashton
1a920f44ea
[d3d9] Rename GenerateMips to EmitGenerateMips
2020-05-26 18:50:34 +01:00
Joshua Ashton
fabe7b5d59
[d3d9] Check if needs mip gen in GenerateTextureMips
...
There could be duplicate indices!
2020-05-26 18:49:17 +01:00
Joshua Ashton
6c030afc95
[d3d9] Update device tracking when manually autogenning mips
...
Avoids some needless generations potentially.
2020-05-26 18:48:42 +01:00
Joshua Ashton
e57aea5749
[d3d9] Track and defer mipmap generations
...
Turns out we need to track this crap and generate at draw time and handle a bunch of other wacky cases for it...
Bah.
Fixes #1642
(The funky water.)
2020-05-26 18:42:53 +01:00
Christopher Egert
67b1ee4f9b
[d3d9] Only allow ColorFill on surfaces in D3DPOOL_DEFAULT
...
Both nine and native nvidia d3d9 seems to do this,
this fixes a crash in spacemail by xplsv.
2020-05-25 13:33:12 +01:00
Joshua Ashton
4e1ee5bf39
[d3d9] Normalize projection spec constant further
...
Only include those used in the pixel shader and are bound.
2020-05-25 06:13:21 +01:00
Joshua Ashton
8fdf9e67d3
[d3d9, dxso] Implement FETCH4
2020-05-25 06:13:21 +01:00
Joshua Ashton
8e7df31878
[d3d9] Correct resolve offset regions for intermediate StretchRect resolves
...
We don't want to use the dst info for these, given the blit will do that.
Partially fixes #1637
2020-05-22 11:13:07 +02:00
Joshua Ashton
e2ad3b1b20
[d3d9] Improve sampler anisotropy normalization
2020-05-21 08:58:39 +01:00
Robin Kertels
724d0fc0b2
[d3d9] Set scissor to the viewport if that's smaller
...
Fixes #1608
2020-05-13 18:53:11 +01:00
Joshua Ashton
774f74cd36
[d3d9] Only dirty ff pixel shader if set texture is in PS binding range
2020-05-07 16:14:11 +01:00
Joshua Ashton
27b9736626
[d3d9] Dirty fixed function pixel shader on texture type change
...
Fixes #1603
2020-05-07 16:09:58 +01:00
Joshua Ashton
b2f6885e55
[d3d9] Make texture stage state args mask easier to read
2020-05-07 15:37:05 +01:00
Joshua Ashton
a6771daf49
[d3d9] Unbind depth image views on device reset
2020-05-07 15:35:48 +01:00
Joshua Ashton
42deab0d60
[d3d9] Cleanup SetStateTextureStageState dirty flags
2020-05-07 14:50:26 +01:00
Joshua Ashton
f88f424da4
[d3d9] Convert border color to float in CS thread
...
It's cheaper to look up sampler keys this way
2020-05-07 13:11:59 +01:00
Philip Rebohle
5fd361757b
[d3d9] Disable old border color hack if custom border colors are supported
2020-05-04 20:18:44 +02:00
Philip Rebohle
263865cf28
[d3d9] Enable custom border color features if available
2020-05-04 19:46:57 +02:00
Joshua Ashton
4699d4162a
[d3d9] Implement swapchain containers for surfaces
...
Fixes a crash in L.A. Noire.
Closes #1564
2020-04-13 01:42:30 +01:00
Joshua Ashton
6e5e50c359
[d3d9] Optimize hazard tracking in the SetTexture case
...
We don't need to perform DS/RT hazard tracking updates if the texture we replaced and ourselves do not have those usages.
2020-04-09 15:29:41 +01:00
Joshua Ashton
9b4cd8aa87
[d3d9] Remove texMask from UpdateActiveHazardsRT
...
This is an invalid optimization and leads to render hazards being dropped
Our hazard tracking for render targets is done in render target indices as opposed to texture indices for depth stencil tracking so `texMask` doesn't work for that reason, and the fact that even if it did, there is no relationship to an individual texture and a render target index that has a hazard.
2020-04-09 15:29:41 +01:00
Joshua Ashton
83e03ac9d8
[d3d9] Make COPM render state unlikely
...
This is only ever called once per game and we don't support it anyway
2020-04-05 06:27:14 +01:00
Joshua Ashton
92031a7bac
[d3d9] Fix dumb typo in ATOC handling
2020-04-03 21:13:15 +01:00
Joshua Ashton
457c0c3021
[d3d9] Fix state sometimes not being set in SetRenderState
...
Previously this prevented us disabling AlphaToCoverage once the application enabled it.
2020-04-03 07:52:35 +01:00
Joshua Ashton
bb2e88ee06
[d3d9] Fix crash when calling ColorFill with NULL format
...
Impacts #1528
2020-03-25 07:23:17 +00:00
Joshua Ashton
a9339ae832
[d3d9] Fix depth hazard case for write + read
...
Closes #1519
2020-03-20 14:23:29 +01:00
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
Joshua Ashton
764cb5634f
[d3d9] Unmark resources as dirty if they get discarded
2020-01-24 15:54:15 +00:00
Joshua Ashton
6fa28bf937
[d3d9] Don't block on GetRenderTargetData
...
Fixes perf in #1363
2020-01-24 15:54:15 +00:00
Joshua Ashton
7d0ddc4b3b
[d3d9] Remap texture stage state types onto our own enum
...
Fits us nicely into a dword for captures while not exclusing D3DTSS_CONSTANT
2020-01-23 02:05:09 +00:00
Philip Rebohle
296aacb23e
[d3d9] Return specific image view from GetSampleView
...
Lets us have pick the sRGB-ness of the view in one place. Needed
for the next patch.
2020-01-17 17:47:08 +01:00
Philip Rebohle
905d69e77b
[d3d9] Don't pass format mapping to D3D9CommonTexture
...
Instead, infer it from the format. This is basically being done
already, however the mapping we pass in is not correct if the
image format is Unknown.
2020-01-17 17:47:08 +01:00
Joshua Ashton
e5df573292
[d3d9] Add AreFormatsSimilar helper
2020-01-17 05:55:47 +00:00
Joshua Ashton
9e5e4c1cfc
[d3d9] Don't mark for hazards if we aren't rendering to mip 0
2020-01-16 03:04:58 +00:00
Joshua Ashton
7c53a997ef
[d3d9] Keep subresource views in subresources, defer creation until needed
...
Avoid creating a bunch of views that we probably don't need whenever a texture is created
2020-01-16 03:00:31 +00:00
Joshua Ashton
9647e449d2
[d3d9] Remove redundant logging from SetDialogBoxMode
...
This path doesn't error anyway...
2020-01-10 04:30:02 +00:00
Philip Rebohle
79fcaa9fba
[d3d9] Remove unused variable from D3D9DeviceEx::Clear
...
Fixes a compiler warning.
2020-01-09 18:06:58 +00:00
Joshua Ashton
47555f1dda
[d3d9] Add GetSurfaceExtent helper
2020-01-09 03:29:58 +00:00
Joshua Ashton
cd58b147a1
[d3d9] Respect mip != 0 for Clear fastpath
2020-01-09 03:24:50 +00:00
Joshua Ashton
ebcab68822
[d3d9] Respect specific mip size for implicit viewport in SetRenderTarget
...
Closes #1295
2020-01-09 03:19:37 +00:00
Joshua Ashton
b738c4220b
[d3d9] Scale depth bias value based on current format's r
value
2020-01-08 19:38:18 +00:00
Joshua Ashton
2d7f4b1a2c
[d3d9] Set depth bias values separately, optimize redundant rasterizer state changes
2020-01-08 19:38:18 +00:00
Joshua Ashton
c024b89171
[dxso] Implement d3d9.forceSamplerTypeSpecConstants
...
This option makes us always use a spec constant to determine sampler type (instead of just in PS 1.x)
which works around a game bug in Halo CE where it gives cube textures to 2d/volume samplers
2020-01-01 20:56:05 +00:00
Joshua Ashton
b4f2094c02
[d3d9] Enable bounds testing for D3DPOOL_SYSTEMMEM buffers
...
Improves performance in Halo CE.
2019-12-22 19:05:22 +00:00
Joshua Ashton
5cc0fd5c25
[d3d9] Simplify SetViewport
...
pViewport == nullptr is illegal
2019-12-18 23:18:01 +00:00
Joshua Ashton
bab56433cb
[d3d9] Avoid rebinding scissor rects if the same one is re-set
2019-12-18 23:18:01 +00:00
Joshua Ashton
288a9dd547
[d3d9] Avoid rebinding viewports if the same one is re-set
2019-12-18 23:18:01 +00:00
Joshua Ashton
9ec0541b93
[d3d9] Still rebind viewport/scissor when setting the same RT
...
Closes #1290
2019-12-18 23:18:01 +00:00
Joshua Ashton
784abe5cf4
[d3d9] Move auto depth stencil creation to after swapchain creation
...
If the app specifies w == 0 and/or h == 0 then this will be filled in by then in the presentation params.
Impacts #1278
2019-12-18 00:09:55 +00:00
Joshua Ashton
009e772fe8
[d3d9] Remove initial device reset outside of constructor
...
Allows us to funnel hresults from that to the response of CreateDevice
2019-12-17 23:59:37 +00:00
Joshua Ashton
3b119c0be6
[d3d9] Log unavailable backbuffer format if encountered when resetting swapchain
2019-12-17 22:36:27 +00:00
Joshua Ashton
3abd30bb96
[d3d9] Fix return value for invalid backbuffer formats
...
This got changed when I saw that the auto depth stencil when set to an unavailable returns D3DERR_NOTAVAILABLE.
Turns out if the backbuffer is unavailable it returns D3DERR_INVALIDCALL...
Consistent...
Closes #1278
2019-12-17 22:36:27 +00:00
Joshie
54ed8f0bb0
[d3d9] Implement Direct3D9 Frontend ( #1275 )
...
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Co-authored-by: Robin Kertels <robin.kertels@gmail.com>
Co-authored-by: pchome <pchome@users.noreply.github.com>
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Derek Lesho <dereklesho52@Gmail.com>
Co-authored-by: Luis Cáceres <lacaceres97@gmail.com>
Co-authored-by: Nelson Chen <crazysim@gmail.com>
Co-authored-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Co-authored-by: Riesi <riesi@opentrash.com>
Co-authored-by: gbMichelle <gbmichelle.dev@gmail.com>
2019-12-16 04:28:01 +01:00