Joshua Ashton
072d3a039e
[d3d9] Track bound RTs
...
This also improves active RT hazard tracking by also accounting for NULL
2021-08-08 02:14:11 +00:00
Joshua Ashton
e0f9ebf695
[d3d9] Common buffer header cleanups and docs
2021-08-08 02:14:11 +00:00
Joshua Ashton
ee11e1af58
[d3d9] Minor buffer code-style cleanups
2021-08-08 02:14:11 +00:00
Joshua Ashton
b1b1524737
[d3d9] Adapter cleanups
2021-08-08 02:14:11 +00:00
Joshua Ashton
da411c8a48
[d3d9] Move m_lod after m_subresources
2021-08-08 02:14:11 +00:00
Joshua Ashton
4a569918c0
[d3d9] Track NULL state per-subresource
2021-08-08 02:14:11 +00:00
Joshua Ashton
d6bc355782
[d3d9] Fix code-style of D3D9Subresource and inline
2021-08-08 02:14:11 +00:00
Joshua Ashton
f4ce795fe7
[d3d9] Do a little packing of subresource members
2021-08-08 02:14:11 +00:00
Joshua Ashton
d922e261e8
[d3d9] Make D3D9_COMMON_TEXTURE_DESC smaller
2021-08-08 02:14:11 +00:00
Joshua Ashton
3592d7b48f
[d3d9] Return const buffer references in D3D9CommonBuffer
...
Avoids some needless refcounting
2021-08-08 02:14:11 +00:00
Joshua Ashton
fb7035f16a
[d3d9] Remove D3D9CommonBuffer::GetDesc
...
We already have ::Desc()
2021-08-08 02:14:11 +00:00
Joshua Ashton
750639d3b6
[d3d9] Return const view references in D3D9Subresource
2021-08-08 02:14:11 +00:00
Joshua Ashton
3cbac8923f
[d3d9] Return const refs for image/buffers + format mapping in CommonTexture
...
Avoids needless Rc ref counts and copies of that fairly large structure.
2021-08-08 02:14:11 +00:00
Georg Lehmann
23873cbb57
[d3d9] Disable primitive restart
2021-08-08 02:05:27 +00:00
Georg Lehmann
fdc2e2e78f
[d3d9] Fix NEVER alpha testing
2021-08-07 21:54:30 +00:00
Georg Lehmann
be3c248c8b
[d3d9] Don't mark mips as dirty when the texture doesn't have automatic mips
2021-08-07 21:53:34 +00:00
Georg Lehmann
973678e6bf
[d3d9] Only look at the last bit for D3DSAMP_SRGBTEXTURE
2021-08-07 13:09:13 +00:00
Georg Lehmann
a1fbcf35de
[d3d9] Ignore clear with Count == 0 and non-NULL rect
2021-08-06 18:54:17 +00:00
Robin Kertels
7873bebaf2
[d3d9] Only check range overlap if the buffer is not directly mapped
2021-07-28 16:57:02 +00:00
Joshua Ashton
b8a4b85c48
[d3d9] Fix clearing render targets on device reset
2021-07-26 14:35:48 +02:00
Robin Kertels
b4e6f81cb5
[d3d9] Respect aligned pitch when using initial data
2021-07-24 19:41:59 +00:00
Robin Kertels
6ba3d2f9d4
[d3d9] Set correct usage flags for large temporary staging buffers
2021-07-23 13:36:21 +00:00
Robin Kertels
fa279eb8ad
[d3d9] Ignore NO_DIRTY_UPDATE for POOL_DEFAULT resources
...
Respecting it breaks Senren Banka because we never upload the texture.
2021-07-23 13:36:21 +00:00
Robin Kertels
584e1515b1
[d3d9] Fix pitch when copying straight from mapping buffer
2021-07-23 13:36:21 +00:00
Robin Kertels
34101dcf26
[d3d9] Fix UpdateTexture extent
...
Same as 5f1629f2cb
2021-07-23 13:36:21 +00:00
Joshua Ashton
d3112c320b
[d3d9] Add dirty texture tracking
...
Reduces overhead from re-binding and unnecessary binding (srgb changes) in L4D2.
I go from about 750 -> 850-900 fps in c1m2_streets with this change.
2021-07-14 20:38:49 +00:00
Robin Kertels
8eeff90e0a
[d3d9] Only use staging buffers for uploads once we've stalled on the resource
2021-07-14 19:26:25 +00:00
Robin Kertels
b83261b759
[d3d9] Adjust waiting in LockBuffer to staging buffer upload
...
Now that we're uploading using a staging buffer,
we don't need to wait for non default buffers.
We should also respect READONLY for WRITEONLY buffers
(yes, it sounds dumb) because Nostale relies on that.
2021-07-14 19:26:25 +00:00
Robin Kertels
ed24c17d53
[d3d9] Validate srcRect and dstPoint in UpdateSurface
2021-07-14 18:33:38 +00:00
Georg Lehmann
b3b2f0921c
[d3d9] Never init pSharedHandle.
...
This parameter has three different meanings if it's non NULL:
- if Pool is D3DPOOL_SYSTEMMEM it's a host pointer for inital data
- if it points to a nullptr it's a output handle
- if it's a pointer to non NULL pointer it's an import handle
2021-07-14 15:29:46 +00:00
Robin Kertels
5f1629f2cb
[d3d9] Fix FlushImage extent for smaller mip maps
2021-07-10 16:23:56 +00:00
Robin Kertels
9f0775b1ac
[d3d9] Always use cached memory for texture mapping buffers
...
We read from that memory when uploading the texture.
Fixes performance in Oblivion.
2021-07-08 21:42:12 +00:00
Joshua Ashton
c7f8267f98
[d3d9] Fix NV12 conversion
...
Froggy is the right color now
2021-07-08 22:36:59 -07:00
Connor Abbott
9579132942
[d3d9] Remove extra spaces in def file
...
wrc is pickier about this than windres and refuses to accept it.
2021-07-03 14:28:28 +02:00
Connor Abbott
aae0e57a46
Don't add def file as an object
...
This is unnecessary even on mingw, and leads to duplicating the .def
file on the linking command line which winegcc complains about.
2021-07-03 14:28:28 +02:00
Robin Kertels
309284e7dc
[d3d9] Respect 4 byte pitch when reading back texture
2021-07-01 05:47:44 -07:00
Robin Kertels
c43618d19f
[d3d9] Fix texture dirty box clearing
...
- Fix interleaved locks with evictManagedOnUnlock
We need to make sure there are no other subresources of a texture locked
before clearing the dirty box. Otherwise the data for those other subresources
won't get copied into VRAM.
- Clear dirty box regardless of texture pool
Otherwise we keep repacking and copying the whole texture
for every single lock. This causes performance problems
in Star Wars: The Old Republic.
2021-07-01 05:47:44 -07:00
Philip Rebohle
2ff8b42fff
[d3d9] Enable robustBufferAccess2 feature if available
...
Tightens some out-of-bound rules around vertex attributes.
2021-06-29 18:35:47 -07:00
Philip Rebohle
96f5641a7e
[d3d9] Ensure that the bound UP vertex buffer region is large enough
...
If the buffer size is less than (vertexCount * stride), the last vertex
may be considered out-of-bounds, even if all attributes are included in
the vertex.
Fixes #2131 .
2021-06-29 18:35:47 -07:00
Philip Rebohle
cd8a2bcfcd
[dxvk] Use custom sync primitives
2021-06-29 00:51:20 +02:00
Philip Rebohle
a14884c652
[dxvk] Add destination offset/extent to copyDepthStencilImageToPackedBuffer
...
Needed to support partial copies between buffers and depth-stencil images.
2021-06-24 21:07:47 +02:00
Philip Rebohle
ba4938e201
[dxvk] Add slice alignment to copyImageToBuffer
2021-06-24 21:07:47 +02:00
Philip Rebohle
4840cdaf8c
[dxvk] Add slice alignment to copyBufferToImage
2021-06-24 21:07:45 +02:00
Robin Kertels
8a93bbd8fa
[d3d9] Make sure clear extent does not exceed rt size
2021-06-19 16:11:11 -07:00
Robin Kertels
d7c4afbeba
[d3d9] Pass correct element size to texture converter
2021-06-19 10:43:31 -07:00
Philip Rebohle
4f5f85925b
[d3d9] Add frame rate limiter and d3d9.maxFrameRate option
2021-06-12 13:50:08 +02:00
Robin Kertels
6f468ec5e0
[d3d9] Fix texture converter
2021-06-12 03:48:01 -07:00
Joshua Ashton
f1a9d72d38
[d3d9] Don't scale z to [0, 1] for POSITIONT
...
I originally thought the depth clipping region was always [0, 1] when I first implemented this nearly 2 years ago.
The depth clipping region is already in the viewport's depth range, so just don't do anything here if we are z-testing.
( We still need to keep the flattening around for when ztest is disabled though :( )
Fixes : #2056
2021-06-06 09:31:01 -07:00
Joshua Ashton
747834e9b0
[d3d9] Bump frame id before presentation
2021-06-01 18:31:29 +02:00
Joshua Ashton
fcb7639106
[d3d9] Synchronize frame latency on latency change
2021-06-01 18:16:35 +02:00
Joshua Ashton
787de33022
[d3d9] Sync frame latency after presentation
2021-06-01 18:16:35 +02:00
Philip Rebohle
0b88d0deab
[vulkan] Remove getSyncSemaphores from presenter
...
Instead, return the semaphores in acquireNextImage.
2021-06-01 04:32:50 +02:00
Philip Rebohle
253884a8c7
[vulkan] Remove fence from presenter
...
We don't use these anywhere.
2021-06-01 03:51:16 +02:00
Philip Rebohle
0af7229b8e
[util] Restore display modes of all monitors in RestoreMonitorDisplayMode
...
Fixes #2064 .
2021-06-01 01:48:12 +02:00
Philip Rebohle
6462174c13
[dxvk] Support multi-plane formats in copyImageToBuffer
2021-05-30 19:42:43 +02:00
Philip Rebohle
86542248df
[dxvk] Support multi-plane formats in copyBufferToImage
2021-05-30 19:42:43 +02:00
Joshua Ashton
0520ce9448
[d3d9] Treat largest element in Stream 0 as vertex decl size
...
Closes #2059
2021-05-13 01:32:56 +01:00
Joshua Ashton
f0c1e89443
[d3d9] Handle zero-sized draws
...
These return S_OK, because ofc they do.
2021-05-05 19:25:46 +01:00
Joshua Ashton
0f52c85d21
[d3d9] Account for vertex declaration size for UP draws
...
The stride may not give us the full picture here as the stride
may not encompass the vertex declaration entirely.
Consider a vertex declaration of size 20, and a stride of 12,
we may not have covered the whole range of space the draw wants with
VertexCount * Stride.
Some games such as FF13 Lightning Returns have two float3s in the vertex decl
and draw two triangles with the last float being out of bounds. This causes
the whole vertex element to be set to 0 on NVIDIA which breaks their fullscreen passes.
Instead, take (VertexCount - 1) * Stride + VertexDeclSize for the buffer size
and pad with 0s outside of the VertexCount * Stride range.
Closes : #2046
Closes : #1908
2021-05-05 19:25:46 +01:00
Joshua Ashton
4a4b96611d
[d3d9] Only log WaitForVBlank stub once
2021-04-30 19:33:24 +01:00
Robin Kertels
525fd53bbc
[d3d9] Fix FlushBuffer
...
Use stored mapped slice and use correct dst offset.
2021-04-23 18:06:29 +01:00
Robin Kertels
da23771df4
[d3d9] Remove unused variable
2021-04-23 18:06:29 +01:00
Robin Kertels
13f53531e5
[d3d9] Fix offset in UpdateSurface
2021-04-22 20:18:50 +01:00
Robin Kertels
0bc8b0b33a
[d3d9] Align pitch to 4
2021-04-22 17:44:58 +01:00
Robin Kertels
2ba433bbd8
[d3d9+util] Remove option to disable implicit discard
2021-04-22 17:44:58 +01:00
Robin Kertels
03f5893011
[d3d9] Remove implicit discard
2021-04-22 17:44:58 +01:00
Robin Kertels
b9512a4063
[d3d9] Only copy dirty parts of managed/sysmem resources
2021-04-22 17:44:58 +01:00
Robin Kertels
4261ff6ec1
[d3d9] Use staging buffer for managed copies
2021-04-22 17:44:58 +01:00
Robin Kertels
bb11d7dee8
[d3d9] Refactor AllocUpBuffer so it can be used for managed uploads
2021-04-22 17:44:58 +01:00
Robin Kertels
8cc0c9a0f1
[d3d9] Clamp dirty buffer range
...
And always maintain dirty range.
2021-04-22 17:44:58 +01:00
Georg Lehmann
77d80acf75
[d3d9] respect Vector4 alignment in UpdateStateConstants
2021-04-15 22:25:11 +01:00
Georg Lehmann
1ed6edf096
[d3d9] respect Vector4 alignment in GetShaderConstants
2021-04-15 22:25:11 +01:00
Georg Lehmann
5d3b130ec8
[d3d9] respect Matrix4 alignment in ConvertMatrix
2021-04-15 22:25:11 +01:00
Philip Rebohle
c3feea2bce
[dxvk] Make samplerAnisotropy feature optional
2021-04-04 20:01:30 +01:00
Philip Rebohle
0a787683b6
[dxvk] Don't require shaderStorageImageExtendedFormats
...
No real reason to, not sure why we did this in the first place.
2021-04-04 20:01:30 +01:00
Robin Kertels
9d0c46b9c6
[d3d9] FF: use correct vector type when dealing with tex coords
2021-04-04 16:31:39 +01:00
Robin Kertels
d17f62902d
[d3d9+util] Remove AllowLockFlagReadonly option
2021-03-22 17:43:07 +00:00
Robin Kertels
dba7525954
[d3d9] Mark non default resources as dirty by default
2021-03-22 17:43:07 +00:00
Robin Kertels
8159e87331
[d3d9] Fix some issues with dirty box handling
...
- The dst texture in UpdateSurface must be in D3DPOOL_DEFAULT
which doesn't do dirty tracking. So we don't need to
call AddDirtyBox there.
- Clear DirtyBox when we flush managed textures with EvictManagedOnUnlock.
- Do nothing in AddDirtyBox for D3DPOOL_DEFAULT textures
2021-03-22 17:43:07 +00:00
Robin Kertels
cb5f8aa392
[d3d9] Properly scale dirty box
2021-03-22 17:43:07 +00:00
Robin Kertels
3f57a3a8cc
[d3d9] Use buffer DirtyRange to track managed uploads
2021-03-22 17:43:07 +00:00
Robin Kertels
4f45e74d96
[d3d9] Improve naming of texture dirty flag and dirty boxes
2021-03-22 17:43:07 +00:00
Robin Kertels
6f139791d2
[d3d9] Improve naming of buffer flags and ranges
2021-03-22 17:43:07 +00:00
Philip Rebohle
e3b92bcfac
[dxvk] Add conservative rasterization mode to rasterizer state
2021-03-13 20:22:32 +01:00
Joshua Ashton
0367bf95c4
[build] MSVC check cleanup
2021-03-03 18:57:42 +01:00
Rémi Bernon
1589f516c9
[d3d9] Convert window position relative to its parent.
2021-03-03 15:49:52 +00:00
Joshua Ashton
31063252eb
[d3d9] Don't implicit discard if read locked
2021-02-28 15:06:23 +00:00
Joshua Ashton
741070785a
[d3d9] Allow implicit discard for all backed buffers
2021-02-28 13:01:00 +00:00
Joshua Ashton
6bb271b299
[d3d9] Cleanup options code
2021-02-27 20:35:37 +00:00
Joshua Ashton
8c2ec5d9c9
[d3d9] Clean up resource locking code
2021-02-27 20:15:39 +00:00
Joshua Ashton
e8fc7ea23a
[d3d9] Add d3d9.allowImplicitDiscard option
2021-02-27 20:08:57 +00:00
Joshua Ashton
50d223e614
[d3d9] Add option to use device local memory for constant buffers
...
Useful for testing performance.
2021-02-27 19:29:52 +00:00
Robin Kertels
eec4481ca0
[d3d9] Fix various issues in UpdateTexture
...
- Skip copies for empty or invalid rects
- align up the extent
- use util functions to slightly clean up the code
2021-02-27 17:31:15 +00:00
Philip Rebohle
12693b17f9
[d3d9] Use DxvkSwapchainBlitter for presentation
2021-02-27 14:54:14 +00:00
Philip Rebohle
dcf4599c98
[d3d9] Use ATTACHMENT_OPTIMAL layout for render targets
...
Significantly improves GPU-bound performance on RADV in a number of games.
2021-02-26 05:02:32 +00:00
Philip Rebohle
73a06aea72
[d3d9] Manually discard swap chain image view on present
2021-02-21 02:18:55 +01:00
Joshua Ashton
59816a71b9
Revert "[d3d9] Don't minimise in WM_ACTIVATEAPP"
...
Not needed as this was an FSHack bug.
This reverts commit d87200c4d9
.
2021-02-19 03:14:56 +00:00
Joshua Ashton
d87200c4d9
[d3d9] Don't minimise in WM_ACTIVATEAPP
...
Sometimes mode-setting jank can occur and technically we'd need to re-set the mode on the next present if the game gets actually minimised.
2021-02-15 17:29:45 +00:00
Robin Kertels
ec5c324643
[d3d9] Mark generated mip maps as dirty
2021-02-14 23:55:00 +00:00
Robin Kertels
021ffe7350
[d3d9] Regenerate auto mip gen textures in UpdateTexture
...
.. instead of copying them
2021-02-14 23:55:00 +00:00
Robin Kertels
338f6dfb0e
[d3d9] Track dirty regions for UpdateTexture
2021-02-14 23:55:00 +00:00
Philip Rebohle
4f184b3424
[d3d9] Mark images as shared if necessary
2021-02-14 04:00:02 +01:00
Joshua Ashton
fcaab6aa46
[d3d9] Expose adapter/backbuffer formats properly
...
Matches native behaviour in my testing.
2021-02-06 08:57:32 +00:00
Joshua Ashton
58d6f018bb
[d3d9] Allow A2R10G10B10 backbuffer format in Windowed
2021-02-06 08:43:37 +00:00
Philip Rebohle
01a511aa99
[dxvk,dxgi,d3d9] Fix shader spec constant IDs
...
These changed after changing the render target output swizzle stuff.
2021-01-29 16:46:01 +01:00
Joshua Ashton
0eec95843f
[d3d9] Fix warnings with query caching
2021-01-08 13:49:38 +00:00
Gabriel Ivăncescu
83f6400a07
d3d9: Send necessary messages for full-screen windows during WM_ACTIVATEAPP.
2021-01-08 13:40:34 +00:00
Robin Kertels
60a2aeb6ef
[d3d9] End query before the stall heuristic flush
2021-01-07 21:19:28 +00:00
Robin Kertels
0f933fee8b
[d3d9] Extend query stall tracking to other query types
2021-01-07 21:19:28 +00:00
Robin Kertels
6554ca8f9e
[d3d9] Cache query data
2021-01-07 21:19:28 +00:00
Robin Kertels
6a54d86f25
[d3d9] Implement apitraceMode option
2020-12-14 16:51:19 +00:00
Robin Kertels
4b6632764f
Revert "[d3d9] Only use DEVICE_LOCAL memory for small dynamic buffers"
...
This reverts commit f3a82a0bcc
.
Apparently this makes other games slower. We need a different solution for TR: Legend.
2020-12-14 16:51:19 +00:00
Joshua Ashton
65635b23c1
[d3d9] Always slightly bias viewport, regardless of size
...
Since we got TRUNC_COORD on RADV, we always need to bias this now.
Closes : #1854
2020-12-14 03:51:49 +00:00
Joshua Ashton
09043ddd16
[dxso] Implement option for alpha test wiggle room
2020-11-26 12:15:03 +00:00
Joshua Ashton
6a63f4af56
[d3d9] Enable null descriptors for D3D9
2020-11-24 16:17:36 +00:00
Joshua Ashton
c3fdc768cf
[d3d9] Only define the push constants we use
...
Fixes #1742
2020-09-26 06:39:52 +01:00
Joshua Ashton
753fcd5649
[d3d9] Only read point scale push constant in fixed function
...
Otherwise it doesn't exist and we're reading garbage/non-existant data.
Even though this gets spec-constanted away via an opSelect, some drivers don't like this
2020-09-26 06:39:52 +01:00
Joshua Ashton
e4bca7a42f
[d3d9] Handle specular fog factor for fixed function
...
Also handle POSITION_T shenanigans
Closes #1771
2020-09-26 06:06:06 +01:00
Joshua Ashton
dc392f7cfa
[d3d9] Fix typo declaring fixed func fog inputs
2020-09-26 04:03:11 +01:00
Joshua Ashton
3e65c2bb87
[d3d9] Reduce copying around of shader metadata at Create time
2020-09-11 21:49:14 +01:00
ishitatsuyuki
bb85a4caa8
Handle non-ASCII characters properly in paths
2020-09-10 15:56:38 +02:00
Joshua Ashton
743f309253
[d3d9] Implement YV12 video format
...
Needed for #1726 otherwise it will upload dump that upload garbage in a YUV2 texture.
2020-08-17 22:32:30 +01:00
Robin Kertels
89d36e1d7f
[d3d9] Handle edge cases around implicit discard
2020-08-15 05:45:01 +01:00
Joshua Ashton
d92660923a
[d3d9] Use VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT
2020-08-10 09:45:49 +02:00
Robin Kertels
b28a7353bb
[d3d9] Do implicit discard when locking system memory resources
2020-08-10 00:09:29 +01:00
Joshua Ashton
98c7da805b
[d3d9] Rename BT.703 to BT.709
...
Don't know how this typo got introduced.
Thanks to Ryao for finding the matrix and pointing this out.
2020-08-07 20:54:45 +01:00
Joshua Ashton
e2a26f2bc5
[d3d9] Optimize NV12 conversion to use a macropixel of [2, 1]
2020-08-07 10:56:26 +01:00
Joshua Ashton
9fe1b9d03f
[d3d9] Replace macropixel size with plane count
2020-08-07 10:56:26 +01:00
Joshua Ashton
2bf9f298af
[d3d9] Implement NV12 format conversion
2020-08-07 10:56:26 +01:00
Joshua Ashton
2cfd219024
[d3d9] Move some YUV helpers to common and cleanup YUY2 shader
2020-08-07 10:56:26 +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
Biswapriyo Nath
3b52cad243
fix clang errors
...
File changes:
* meson.build: add -Wno-unused-private-field and -Wno-microsoft-exception-spec
option to suppress clang compiler warnings
* d3d9/d3d9_swvp_emu.h: include unordered_map for std::unordered_map
2020-07-21 11:41:28 +02:00
Robin Kertels
f3a82a0bcc
[d3d9] Only use DEVICE_LOCAL memory for small dynamic buffers
...
Tomb Raider Legend writes to multiple 128KB dynamic buffers
and one 512KB one every frame.
2020-07-20 18:36:20 +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
04397e5a7b
[d3d9] Mark mips as dirty when the filter changes
2020-06-11 05:53:33 +01:00
Joshua Ashton
f537474fe4
[d3d9] Add missing locks to mipmap auto 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
fa988be4aa
[d3d9] Improve MarkAllForUpload implementation
...
Only mark the bits we are actually using.
2020-06-05 02:40:41 +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
3825d16a31
[d3d9] Move mip filter into common texture
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
Joshua Ashton
b958473cc9
[d3d9] Move pLockedBox/Rect checks to subresource
2020-05-26 13:14:58 +01:00
Joshua Ashton
4c1deabcd3
[d3d9] Don't expose surfaces for autogenned mips
2020-05-26 13:11:24 +01:00
Joshua Ashton
a35df1c3b1
[d3d9] Fix AUTOGENMIPMAP not working in some instances
...
Closes #1642
2020-05-26 12:46:55 +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
4d70d59ea4
[d3d9] Use base texture for subresource refs
...
Fixes a crash when running d3d9-triangle
2020-05-25 13:29:56 +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
Christopher Egert
79feed9d89
[d3d9] Allow D3DFMT_NULL as RenderTargetFormat in CheckDepthStencilMatch
...
This partially fixes shadows in Timeshift.
2020-05-19 04:12:36 +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
Joshua Ashton
fd75775197
[d3d9] Use unordered comparison opposed to isnan
...
Results in better codegen
2020-05-07 13:05:36 +01:00
Joshua Ashton
198ce13934
[d3d9] Replace clamp with min in sampler normalization
2020-05-07 13:01:14 +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
DadSchoorse
9b602ef850
[util] Rework tearFree as a Tristate
...
PR #1606 .
2020-05-02 10:18:13 +02:00
Philip Rebohle
f1e069568d
[build] Remove .spec files
...
No longer needed now that we don't support winelib builds anymore.
2020-05-01 00:52:33 +02:00
Joshua Ashton
9f4baf3f55
[d3d9] Fix swapchain surface refs once and for all
...
The refcounting for d3d9 swapchain surfaces is very funny.
They don't actually hold any form of reference to their parent, unlike the surface->texture relationship.
When a swapchain is destroyed, the surfaces become orphans (like offscreen rendertargets) if they are still reffed.
Calling GetContainer on them when orphaned will return E_NOINTERFACE and nullptr for __uuidof(IDirect3DSwapChain)
Fixes some potential lingering refs on the device.
2020-04-26 13:32:22 +01:00
Joshua Ashton
409eac9d20
[d3d9] Use if/else in GetCommonTexture and TextureRefPrivate
...
These are the only things it can be, and they all end up calling what the compiler will optimize to the same function so we can avoid a branch here.
2020-04-19 01:11:11 +01:00
Joshua Ashton
3f2b582d5f
[d3d9] Avoid prematurely deleting swapchain backbuffers if they are still reffed on reset
2020-04-19 00:59:02 +01:00
Joshua Ashton
837861ffdd
[d3d9] Cleanup private ref code for subresources
2020-04-18 21:06:38 +01:00
Joshua Ashton
42089d73c5
[d3d9] Fix ref-counting for swapchain surfaces
2020-04-18 21:06:38 +01:00
Philip Rebohle
ab8ab4052f
[d3d9] Fix compiler warnings
2020-04-13 22:05:27 +01: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
ecb3e05cb9
[d3d9] Ignore adapter type for CheckDepthStencilMatch and CheckDeviceType when windowed
2020-04-09 02:35:35 +01:00
Joshua Ashton
c3cff09c4f
[d3d9] Implement d3d9.longMad option
2020-04-08 23:20:57 +01:00
Joshua Ashton
93b4427a13
[d3d9] Add and use D3D9WindowMessageFilter helper
...
Stops us forgetting to reset the message filter
Previously when the device was intially created with fullscreen, filter would always be enabled
2020-04-08 20:20:01 +01:00
Joshua Ashton
3f4ffdfba8
[d3d9] Fix MinGW compilation
...
MSVC doesn't care about static.
2020-04-06 20:35:30 +01:00
Joshua Ashton
46329689ba
[d3d9] Handle WM_DESTROY event
2020-04-06 20:16:17 +01:00
Joshua Ashton
18b46e5c22
[d3d9] Move HookWindowProc out of swapchain class
2020-04-06 20:15:49 +01:00
Joshua Ashton
a340cd4dd3
[d3d9] Add CallCharsetFunction helper
2020-04-06 20:06:45 +01:00
Joshua Ashton
6cf052b3f2
[d3d9] Cleanup ResetWindowProc
2020-04-06 19:45:15 +01:00
Joshua Ashton
135d246610
[d3d9] Cleanup and formatting for window proc hook
2020-04-06 19:42:48 +01:00
Joshua Ashton
47ddd8466a
[d3d9] Re-look up wnd proc iterator
...
Avoids a potential issue where this could change address during this time.
2020-04-06 19:40:25 +01:00
Joshua Ashton
a80eea926a
[d3d9] Filter out window messages we cause
...
Closes #1517
2020-04-06 19:38:26 +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
904d3e6c90
[d3d9] Don't declspec dllexport on MinGW builds
...
Fixes ordinal exporting on MinGW, which was causing a crash in CSGO due to it querying a fixed ordinal for a D3D9On12 hack.
2020-04-02 02:00:42 +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
5ff7cad77d
[d3d9] Fix formatting in D3D9WindowProc
2020-03-25 07:14:35 +00:00
Joshua Ashton
a9339ae832
[d3d9] Fix depth hazard case for write + read
...
Closes #1519
2020-03-20 14:23:29 +01:00
Philip Rebohle
1150121606
[d3d9] Fix depth-stencil layouts
...
Otherwise we're always using GENERAL for depth buffers.
2020-03-20 04:04:53 +00: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
Florian Will
1a4b15a82d
[d3d9] Add option to disable the explicit frontbuffer
...
The Vulkan swapchain is unaffected by this, but we don't create an
"internal" frontbuffer in D3D9SwapChainEx if this option is set. This
breaks GetFrontBufferData (which returns backbuffer data if the option
is enabled), but it disables front/backbuffer flipping.
Most windows drivers apparently always use the same backbuffer for all
frames in windowed mode. At least one game (ZUSI 3) seems to rely on
this behavior, and only redraws dirty regions for each frame instead of
redrawing everything. With buffer flips, this leads to flickering. When
enabling this new noExplicitFrontBuffer option, the flickering
disappears.
2020-03-18 19:31:00 +00:00
Joshua Ashton
6a8933cf31
[d3d9] Allow arbitrary backbuffer/adapter formats
...
It seems these aren't linked in the way the docs made out, this fixes a crash when starting some titles.
Closes #1508
2020-03-18 06:00:28 +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
Philip Rebohle
da506f5932
[util] Add generic recursive spinlock
2020-03-15 03:43:04 +01:00
Rémi Bernon
14946c599f
[d3d9] Hook WM_NCCALCSIZE to get rid of fullscreen non-client areas.
2020-03-11 17:46:08 +00:00
Joshua Ashton
64e649ae18
[d3d9] Don't check IsNull for depth stencil views
...
We don't need to do this. Depth stencils can never be D3DFMT_NULL.
2020-03-09 01:13:54 +00: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
102d97db02
[d3d9] Add IsDepthStencil helper to D3D9CommonTexture
2020-03-09 00:24:56 +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
eaa599bf9a
[d3d9] Implement A2W10V10U10 format via conversion
2020-03-08 23:32:33 +00:00
Joshua Ashton
60ec7e8208
[d3d9] Implement X8L8V8U8 format via conversion
2020-03-08 23:22:52 +00:00
Joshua Ashton
afd4e6e457
[d3d9] Use a common header for cs conversion helpers
2020-03-08 22:29:41 +00:00
Joshua Ashton
45c8b09104
[d3d9] Don't update present region in Reset
...
Fixes a regression in A Hat in Time when changing resolutions
2020-03-06 18:23:08 +00:00
Philip Rebohle
245007daba
[d3d9] Don't use m_monitor in GetDisplayModeEx
...
Should fix #1495 .
2020-03-05 15:25:05 +00:00
Philip Rebohle
5e41e00456
[d3d9] Use new common monitor functions
2020-03-04 23:06:15 +00:00
Philip Rebohle
66503aeaa0
[util] Factor out common monitor-related functions
2020-03-04 23:06:15 +00:00
Joshua Ashton
8c68cf1551
[d3d9] Fix alignment of SubresourceData
...
This should match SubresourceType...
2020-03-02 16:11:07 +00:00
Joshua Ashton
27d7af65a1
[d3d9] Consolidate format helper code
2020-03-02 04:37:20 +00:00
Joshua Ashton
1b26fabc6e
[d3d9] Use uniform texel buffers for conversion
2020-03-02 04:37:20 +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
58316ebe4c
[d3d9] Add missing breaks to format helper switch
2020-03-02 04:37:20 +00:00
Joshua Ashton
7743276e1d
[d3d9] Implement L6V5U5 format via conversion
2020-03-02 04:37:20 +00:00
Joshua Ashton
b67f4974be
[d3d9] Fix view formats for conversion formats
2020-03-02 04:03:27 +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
e41640dcde
[d3d9] Make nullptr/oob checks in GetBackBuffer unlikely
2020-02-28 01:03:34 +00:00
Joshua Ashton
8cfca32c2a
[d3d9] Don't InitReturnPtr in GetBackBuffer
...
Matches native behaviour.
Found via a Wine test.
2020-02-28 01:02:56 +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
3332bb2844
[d3d9] Add some missing synchronization when completely remaking a presenter
2020-02-27 22:55:20 +00:00
Joshua Ashton
33f6add0ff
[d3d9] Fix sampler decision at Present time
2020-02-27 22:54:43 +00:00
Joshua Ashton
b6e1da916a
[d3d9] Fix scissor rect size when presenting
2020-02-27 22:53:14 +00:00
Joshua Ashton
1592e2770b
[d3d9] Remove unnecessary dirty checks in Reset
2020-02-26 22:34:17 +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
0e353895fd
[d3d9] Enumerate adapters by display
...
WPF expects us to return an adapter for every display attached otherwise
it decides to device reset every frame.
Closes #1459
2020-02-21 18:03:57 +00:00
Joshua Ashton
f095f6385e
[d3d9] Initialize all backbuffers in swapchain creation
...
Otherwise they are garbage and undefined layout.
Fixes some validation errors in Lumino City #1462
2020-02-21 06:45:02 +00:00
Joshua Ashton
38838f7428
[d3d9] Synchronize present and wait for idle when invalidating a swapchain
...
Lumino City calls CreateAdditionalSwapchain instead of the regular device reset functions.
We were missing some needed synchronization here to make this work properly for this game.
Impacts #1462
2020-02-21 01:38:58 +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
f688889b41
[d3d9] Avoid setting cursor position if we are already at that position
...
Avoids an infinite loop where we trigger the cursor move window message which calls SetCursorPos and so on and so forth...
Closes #1400
2020-02-20 01:44:50 +00:00
Joshua Ashton
17166a8aeb
[d3d9] Add equality operator overloads for POINT
2020-02-20 01:39:13 +00:00
Joshua Ashton
261a242486
[d3d9] Disallow GetFrontBufferData for anything but D3DPOOL_SYSTEMMEM
...
Fixes #1464
2020-02-19 18:05:50 +00: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
Philip Rebohle
4cf3ef538c
[d3d9] Fix A4R4G4B4 swizzle
2020-02-17 15:32:28 +00:00
Joshua Ashton
a6d554615e
[d3d9] Avoid needless swizzle for A4R4G4B4
...
Should fix this d3d9 format working on Intel ANV
Impacts #1455
2020-02-16 22:54:28 +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
02c79d892c
[d3d9] Try to create offscreen surfaces with render target usage
2020-02-14 06:49:15 +01:00
Joshua Ashton
1f5ddde411
[d3d9] Remove unused D3D9ViewSet structure
2020-02-14 06:49:15 +01:00
Joshua Ashton
c7d5ce1c50
[d3d9] Fix incorrect type for luminance scale and offset in D3DTOP_BUMPENVMAPLUMINANCE
2020-02-14 01:10:26 +00: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
cf6142e782
[d3d9] Don't expose formats with alpha as adapter formats
...
Impacts #1440
2020-02-14 00:46:14 +00:00
Joshua Ashton
acb3cda1dc
[d3d9] Hold a private reference to FVF-generated vertex decls
...
Otherwise the device will never be able to be destroyed as there will be a circular dependency.
Closes #1417
2020-02-13 18:42:49 +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
Philip Rebohle
bf03fd8732
[d3d9] Implment fixed-function clipping
2020-02-10 07:32:22 +01:00
Joshua Ashton
ba8dad3958
[d3d9] Fix multiplication order in D3D9StateBlock::MultiplyStateTransform
2020-02-10 06:22:58 +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
afeb4814c7
[d3d9] Remove SRGB variant from Q8W8V8U8
2020-02-10 04:57:45 +00:00
Joshua Ashton
310ab6da64
[d3d9] Implement D3DTOP_BUMPENVMAPLUMINANCE
2020-02-08 23:08:48 +00:00
Joshua Ashton
302aed256b
[d3d9] Implement D3DTOP_BUMPENVMAP
2020-02-08 23:00:57 +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
2f8fbf9114
[d3d9] Use linear sampler for upscaling if extents don't match on Present
2020-02-07 18:53: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
Joshua Ashton
1f67602b98
[d3d9] Check correct sampler bitfield when applying/capturing sampler state
2020-02-06 22:37:50 +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
2288dd924e
[d3d9] Fix GCC warnings for unsigned->signed comparisons
2020-02-06 17:50:28 +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
Philip Rebohle
1e6ad0b372
[d3d9] Re-introduce client API HUD item
2020-01-28 16:32:58 +00:00
Philip Rebohle
38ad868214
[hud] Add parameter to allow placing HUD items
2020-01-28 16:32:58 +00:00
Philip Rebohle
588beb5b2f
[hud] Don't initialize client API HUD item by default
...
Removes the client API property from the DXVK device as well.
Instead, client APIs should create the HUD item manually.
2020-01-28 16:32:58 +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
Philip Rebohle
38a0d2c552
[d3d9] Don't check for sRGB formats when retrieving back buffer view
...
Turns out this is always false anyway.
2020-01-24 01:47:52 +01:00
Philip Rebohle
582b06a706
[d3d9] Rotate swap chain back buffers
...
Restores functionality removed in 81c3daa3d0
.
2020-01-24 00:27:09 +00:00
Philip Rebohle
6a6af16195
[d3d9] Retrieve back buffer view from the D3D9Surface
2020-01-24 00:27:09 +00:00
Philip Rebohle
81c3daa3d0
[dxvk] Remove image renaming
...
Broken by design, has to be implemented by client APIs instead.
2020-01-23 22:21:45 +01:00
Florian Will
0b3f9718c9
[d3d9] Fix some off-by-one TSS types enum values
...
They are 0-based instead of 1-based, and therefore supposed to be
off-by-one compared to D3DTEXTURESTAGESTATETYPE, but three values in the
enum are actually off-by-two.
For me, this fixes some odd rail rendering in ZUSI 3.
Fixes: 7d0ddc4b
2020-01-23 17:26:51 +00:00
Joshua Ashton
792c74e1d9
[d3d9] Fix texture stage index in stateblocks
...
Fixes minimap transparency in FHX https://github.com/Joshua-Ashton/d9vk/issues/306
2020-01-23 02:19:43 +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
Joshua Ashton
a1cad25a51
[d3d9] Remove unnecessary loops for some stateblocks applications
2020-01-23 02:05:09 +00:00
Joshua Ashton
ff2c6a076f
[d3d9] Fix opSelect condition vector size
...
Fixes invalid fixed function shaders
2020-01-22 22:54:27 +00:00
Joshua Ashton
35a9934cde
[d3d9] Make unbound textures return (0, 0, 0, 1) (fixed func)
...
Fixes sky in Ferentus Herrcot Xiones
https://github.com/Joshua-Ashton/d9vk/issues/306
2020-01-18 03:10:47 +00:00
Philip Rebohle
caae5d18ed
[d3d9] Remove unused variable
...
Fixes a compiler warning.
2020-01-17 18:04:09 +01:00
Philip Rebohle
609856db35
[d3d9] Create front buffer
2020-01-17 18:04:09 +01:00
Philip Rebohle
f20a3c07fb
[d3d9] Don't create sRGB views for non-sRGB compatible textures
...
Otherwise we end up creating views with VK_IMAGE_FORMAT_UNDEFINED.
2020-01-17 17:47:08 +01: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
Philip Rebohle
7e35a0687b
[d3d9] Don't enable DrawParameters capability
...
Not used in D3D9 shaders.
2020-01-17 17:46:59 +01:00
Joshua Ashton
b954ab886f
[d3d9] Implement GetFrontBufferData (currently with first backbuffer)
...
Fixes screenshots in ATi ToyShop demo
2020-01-17 06:01:48 +00:00
Joshua Ashton
e5df573292
[d3d9] Add AreFormatsSimilar helper
2020-01-17 05:55:47 +00:00
Joshua Ashton
9fce945b62
[d3d9] Don't create views if we are a null resource
2020-01-17 04:20:05 +00:00
Philip Rebohle
eb37dfa8d2
[d3d9] Create multiple back buffers for GetBackBuffer API
...
Needed by Atelier Sophie.
2020-01-16 18:50:23 +01:00
Philip Rebohle
c911784bb8
[d3d9] Synchronize with presentation in D3D9SwapChainEx::Reset
...
Otherwise, the subsequent patches would break if Reset is called
while there's still a frame in flight.
2020-01-16 18:50:23 +01: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
64ece36349
[d3d9] Implement d3d9.forceSwapchainMSAA
...
Works good enough for some titles like Vampire The Masquerade: Bloodlines.
2020-01-11 02:34:37 +00:00
Joshua Ashton
3ebd4b28a3
[d3d9] Defer dialog mode swapchain recreation decision to Present
...
Avoids unnecessary swapchain recreations if the game calls SetDialogBoxMode multiple times per frame
2020-01-10 04:30:55 +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
9541aef0b8
[d3d9] Ensure D3DDISPLAYMODEEX we use to call the Ex funcs has its size set correctly
2020-01-06 04:14:02 +00:00
Joshua Ashton
61b6f8f297
[d3d9] Hook up GetAdapterDisplayMode to resp. adapter func
...
Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
2020-01-06 04:07:02 +00:00
Joshua Ashton
91574993df
[d3d9] Return current display mode in GetAdapterDisplayModeEx rather than last mode
...
Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
2020-01-06 04:06:45 +00:00
Joshua Ashton
845ab2b5af
[d3d9] Don't re-set dialogbox mode on swapchain Reset
...
There's no reason to do this now that we have no error path in SetDialogBoxMode...
2020-01-04 21:12:53 +00:00
Joshua Ashton
d53b3adaea
[d3d9] Remove incorrect error returns SetDialogBoxMode
...
The Microsoft docs for this are incorrect based on my tests of all the described edge-cases.
https://docs.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3ddevice9-setdialogboxmode
2020-01-04 21:10:26 +00:00