1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-13 07:08:50 +01:00
Commit Graph

924 Commits

Author SHA1 Message Date
Robin Kertels
97a91c816f [d3d9] Disable instancing for non-indexed draws 2023-01-13 21:58:41 +00:00
Philip Rebohle
0342a25e61 [d3d9,dxso] Add d3d9.forceSampleRateShading option 2023-01-09 18:35:02 +01:00
Robin Kertels
f94b42f23f [d3d9] Dont use GenerateDrawInfo in DrawPrimitiveUp
This is confusing because it looks like a race condition
at first glance.
2022-12-30 19:29:34 +00:00
Philip Rebohle
b838b65516 [d3d9] Correctly mask alpha reference push constant
We accidentally lost this during the rework, since the initial
implementation scaled the alpha ref value on the CPU.

Fixes #3123.
2022-12-06 21:25:55 +00:00
Robin Kertels
522909b165 [d3d9] Don't set NeedsReadback when dirtying mip maps
It's impossible to lock non 0 mips anyway.
2022-12-03 15:18:40 +00:00
Robin Kertels
4796eb0b0d [d3d9] Implement capturing lights in state blocks 2022-11-21 16:06:49 +00:00
Robin Kertels
d0a10cc9f8 [d3d9] Handle DS texture uploads 2022-11-21 15:59:25 +00:00
Robin Kertels
3393c5f4ff [d3d9] Only upload mip 0 of managed automipgen textures 2022-11-19 17:34:02 +00:00
Robin Kertels
8a2e4ef481 [d3d9] Allow locking DEFAULT pool based on texture type 2022-11-10 13:37:52 +01:00
Christopher Egert
e30b783505 d3d9: Use a different rvalue for depth bias on NV 2022-11-09 01:15:00 +00:00
Robin Kertels
ecc2302389 [d3d9] Fix query reset counter underflow 2022-11-07 23:34:32 +00:00
Philip Rebohle
03dca539cb [vulkan,d3d9,d3d11] Move surface creation to swap chain implementation 2022-11-07 14:14:05 +01:00
Robin Kertels
d8933ca175 [d3d9] Only do one allocation for all texture subresources 2022-11-06 19:35:03 +00:00
Robin Kertels
4fb7acc64e [d3d9] Implement converter for W11V11U10 2022-11-06 02:55:29 +00:00
Adam Jereczek
0462454d2b
Fix for saving vertex shader constants with a StateBlock
Co-authored-by: aroztkow <aneta.roztkowska@intel.com>
2022-10-31 18:16:15 +00:00
Robin Kertels
0fc5c84e7b [d3d9] Don't advertise support for MS INTZ format 2022-10-30 21:50:44 +00:00
Georg Lehmann
bc31ebe151 [d3d9] Fix OptimizeLayout with feedback loop usage.
We kind of need dcc on GFX8/9.
2022-10-29 11:21:55 +02:00
Robin Kertels
9c22a58543 [d3d9] Disable locking non-dynamic default textures 2022-10-24 20:55:00 +01:00
Robin Kertels
d771f7cf8f [d3d9] Remove dead fields 2022-10-24 20:55:00 +01:00
Philip Rebohle
494e01b353 [d3d9] Avoid querying environment variables on shader creation 2022-10-24 18:01:48 +02:00
Philip Rebohle
859de7e828 [dxvk] Always enable depth clip feature if supported 2022-10-24 16:39:24 +02:00
Joshua Ashton
1d3decf100 [build] Add version scripts for native builds
FEX would like clean symbols for experimenting with making thunks down the line.

We also just shouldn't be exporting a bunch of random crap -- sadly -fvisibility=hidden doesn't help with a bunch of stuff :(

For reference, RADV also does this.
2022-10-15 19:10:57 +02:00
Joshua Ashton
25798f6fe1 [build] Set name_prefix to libdxvk_ for native builds
Less rude and nicer than just d3d9.so.
Matches old DXVK native behaviour too.
2022-10-15 19:10:57 +02:00
Robin Kertels
4bcabe8d46 [d3d9] Return 0 if any vertex decl element can't be represented as fvf 2022-10-12 23:07:23 +01:00
Robin Kertels
7090105573 [d3d9] Remove declaration fvf mapping log spam 2022-10-12 23:07:23 +01:00
Robin Kertels
2b964f0c67 [d3d9] Make MapD3DDeclToFvf more readable
All branches return, so we might as well
give it a bit more room to breath.
2022-10-12 23:07:23 +01:00
Adam Jereczek
b2ad25755a
[d3d9] Fix for missing restriction check in ProcessVertices
Co-authored-by: aroztkow <aneta.roztkowska@intel.com>
2022-09-28 12:10:41 -02:30
Joshua Ashton
49854dbfba [d3d9] Saturate viewport depth range
Viewport depth range in D3D9 is clamped at 0-1, same as OpenGL.

Drivers like RADV, etc support VK_EXT_depth_range_unrestricted,
which makes the regular UB of this actually work -- which isn't what
we want.

We also don't enable VK_EXT_depth_range_unrestricted, so we shouldn't
be setting depth ranges outside of the 0-1 bounds anyway.

Closes: #2960
2022-09-27 18:58:40 -02:30
Georg Lehmann
50857537d6 [d3d9] Use D32 not D32_S8 when upgrading formats without stencil aspect. 2022-09-27 18:58:32 +01:00
Georg Lehmann
a9bdea72e9 [d3d9] Clamp Dref to [0.0, 1.0] if the texture is emulated UNORM 2022-09-26 21:39:51 +01:00
Georg Lehmann
6fe96d7d82 [dxso] Support clamping Dref. 2022-09-26 21:39:51 +01:00
Georg Lehmann
5684e29718 [d3d9] Track if a texture is upgraded to D32f 2022-09-26 21:39:51 +01:00
Georg Lehmann
6188ffa23a [d3d9] Add a config option for D24 -> D32 2022-09-26 21:39:51 +01:00
Joshua Ashton
f2950953e0 [d3d9] Avoid depth degenerate viewports 2022-09-23 13:26:50 +01:00
Joshua Ashton
d221bb7a9c [d3d9] Add ID3D9VkInteropDevice
Provides access to the device and instance handles
as well as the queue that is used for rendering.
2022-09-22 17:58:54 +01:00
Joshua Ashton
e976218e17 [d3d9] Make GetDXVKDevice return a const Rc reference
Avoids some useless reffing.
2022-09-22 17:58:54 +01:00
Joshua Ashton
ac13112619 [d3d9] Add ID3D9VkInteropTexture
Provides access to the backing resource of a D3D9 texture.
2022-09-22 17:58:54 +01:00
Joshua Ashton
ae2465079e [d3d9] Add ID3D9VkInteropInterface
Allows getting the VkInstance handle from a IDirect3D9 interface,
as well as VkPhysicalDevices from adapter ordinals.
2022-09-22 17:58:54 +01:00
Joshie
1451032b83
[d3d9] Minor cleanups in vertex declaration code (#2950) 2022-09-22 09:46:51 +00:00
Krzysztof Dobrowolski
1e1ef8f1bd
[d3d9] Fix for missing mapping of VertexElements declarations to FVF bits
When Vertex declaration is created by CreateVertexDeclaration
and SetFVF is not called then GetFVF returns 0.
This code change implements mapping of D3D declarations to FVF mask
and sets it if FVF was not set previously.
2022-09-22 08:41:40 +00:00
Philip Rebohle
4fb6c200d7 [d3d9] Use precise matrix-vector operations to compute vertex position 2022-09-16 20:04:01 +01:00
Philip Rebohle
b56ec10deb [d3d9] Add helpers for precise matrix-vector products 2022-09-16 20:04:01 +01:00
Paul Gofman
10d6e15646 [d3d9] Do not set window size and position when restoring from fullscreen state
Closes #2920.
2022-09-15 09:33:24 +01:00
Krzysztof Dobrowolski
19b76825d0 [d3d9] Fix for missing restriction check in UpdateSurface.
The spec of IDirect3DDevice9::UpdateSurface contains the following restriction:
- Neither surface can be created with multisampling.
  The only valid flag for both surfaces is D3DMULTISAMPLE_NONE.

This commit adds this check and returns D3DERR_INVALIDCALL
when source or destination surfaces are multisampled.
2022-09-15 09:32:31 +01:00
Philip Rebohle
3a636f6094 [dxvk] Introduce DxvkFormatQuery 2022-09-11 16:40:02 +02:00
Joshua Ashton
10bb285f2e [d3d9] Remove unused dstExtent + friends in GetRenderTargetData 2022-09-10 21:46:07 +00:00
Joshua Ashton
b0ac267fd5 [d3d9] Explicitly cast to D3DRENDERSTATETYPE in ColorWriteIndex
Need this to silence warnings after doing some arithmetic on an enum.
2022-09-10 21:27:04 +00:00
Georg Lehmann
bd5d9d90c9 [d3d9] Use xor to swap bit in depth mask. 2022-09-10 04:16:30 +00:00
Georg Lehmann
1bc6f9660a [d3d9] Force D3DTADDRESS_CLAMP for cubes. 2022-09-10 04:16:30 +00:00
Philip Rebohle
4b8387c9b1 [d3d9] Set host stage and access bits for image staging buffers
This is already being done for buffers.
2022-09-08 19:26:55 +02:00
Joshua Ashton
c49b1ee390 [d3d9] Use SetStateTexture in Reset
Fixes m_activeTextures not getting updated
2022-08-29 10:16:21 +00:00
Robin Kertels
bfd47ec876 [d3d9] Try to match either top or bottom mips in UpdateTexture 2022-08-26 20:56:42 +01:00
Philip Rebohle
2329c71b6f [dxvk] Implement sampler reduction mode 2022-08-26 05:53:03 +02:00
Philip Rebohle
e923cc5b69 [dxvk] Change emitGraphicsBarrier to specify a dependency 2022-08-26 05:53:03 +02:00
Philip Rebohle
3ee808afd6 [dxvk] Make memory object of an image publicly accessible 2022-08-26 05:53:03 +02:00
Robin Kertels
a8b578b2a2 [d3d9] Fix crash when auto generating mip maps for unmappable textures 2022-08-22 01:48:35 +01:00
Philip Rebohle
23c3960f65 [dxvk] Store WSI semaphore pair directly with the command list 2022-08-22 00:07:15 +02:00
Joshua Ashton
968bdccbef [d3d9] Include win32 compat headers where applicable 2022-08-21 21:40:55 +02:00
Joshua Ashton
ad386305ff [d3d9] Correct DLLEXPORT for native builds 2022-08-21 21:36:50 +02:00
Joshua Ashton
0e4e9355cb [d3d9] Ifdef out code for enumerating adapters by attached displays 2022-08-21 19:29:05 +00:00
Joshua Ashton
bf99127ee3 [d3d9] Stub out cursor code on non-Windows platforms 2022-08-21 19:29:05 +00:00
Joshua Ashton
c6c8acb000 [d3d9] Use wsi's isWindow in LeaveFullscreenMode 2022-08-21 19:29:05 +00:00
Joshua Ashton
5f9df1f6e3 [d3d9] Remove leftover GetWindowRect
This is already done for us.
2022-08-21 19:29:05 +00:00
Joshua Ashton
1c679edbfb [d3d9] Use topath helpers in shader code 2022-08-21 21:28:04 +02:00
Joshua Ashton
f3992658a4 [d3d9] Remove unused util_monitor include 2022-08-20 20:27:07 +02:00
Joshua Ashton
69eba93764 [d3d9] Make window proc code use new wsi interface 2022-08-20 20:27:07 +02:00
Joshua Ashton
9690b2a9e4 [d3d9] Make adapter code use new wsi abstraction 2022-08-20 20:27:07 +02:00
Joshua Ashton
dac7e38f4b [d3d9] Make swapchain use new wsi abstraction 2022-08-20 20:27:07 +02:00
Joshua Ashton
654b517057 [d3d9] Add helpers for new WSI interface 2022-08-20 20:27:07 +02:00
Philip Rebohle
76ee76d6da [d3d9,dxso] Use DemoteToHelperInvocation for alpha test
May enable additional compiler optimizations.
2022-08-19 14:49:18 +00:00
Philip Rebohle
ea4e0bc470 [d3d9,d3d11] Require shaderDemoteToHelperInvocation feature 2022-08-19 13:36:54 +00:00
Philip Rebohle
85cc87e42a
[d3d9] Fix invalid shader in fixed-function alpha test 2022-08-18 17:08:59 +02:00
Philip Rebohle
a695644fea [d3d9] Remove alphaTestWiggleRoom option 2022-08-18 00:10:39 +02:00
Philip Rebohle
5a3cb5ad3e [d3d9] Adjust alpha test precision based on render target format
More or less matches what Nvidia's D3D9 driver does on Turing.
2022-08-18 00:10:39 +02:00
Philip Rebohle
47fa3824dc [d3d9] Re-implement alpha test to support configurable accuracy
The current implementation always uses 12 bits of accuracy.
2022-08-18 00:10:39 +02:00
Philip Rebohle
2c713a34c9 [d3d9,dxso] Factor out common alpha test code 2022-08-18 00:10:39 +02:00
Philip Rebohle
3806bd44d8
[dxvk] Change descriptor info to take only one shader stage
And fix the binding index -> descriptor mapping.
This affects D3D9 since the spec constant change.
2022-08-17 22:40:58 +02:00
Philip Rebohle
3c2fc41e4c [d3d9] Re-bind framebuffer if RT hazards change
Otherwise we never set the feedback loop bits in the backend.
2022-08-17 18:36:30 +00:00
Philip Rebohle
80fc1d8b25
[d3d9] Use new format support queries 2022-08-17 15:39:03 +02:00
Philip Rebohle
61025c0079
[dxvk] Don't disable frame rate limiter if vsync is enabled
This only works if we know the actual refresh rate of the display.
However, in a wine virtual desktop or with proton's fshack, this
is often not the case, so we'd see a 60 Hz mode on a high-refresh
rate display and never actually enable the limiter.
2022-08-17 01:53:24 +02:00
Joshua Ashton
084969135b [d3d9] Only set feedback loop usage on textures, not plain surfaces 2022-08-16 12:33:17 +00:00
Joshua Ashton
a78aab147e [d3d9] Add feedback loop usage for DS 2022-08-16 10:39:06 +00:00
Joshua Ashton
870dd18f92 [d3d9] Set VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT for render targets
Closes: #2825
2022-08-16 08:43:52 +00:00
Joshua Ashton
6baaa3a5f2 [d3d9] New window proc code on multiple platforms 2022-08-14 17:22:58 +00:00
Joshua Ashton
7506f65801 [d3d9] Move window proc handling code to own file 2022-08-14 17:18:10 +00:00
Robin Kertels
de8d2b37bb [d3d9] FF: Don't change flatShadingMask for outputs 2022-08-13 14:38:57 +01:00
Robin Kertels
46cb05ce45 [d3d9+util] Always ignore D3DLOCK_DONOTWAIT
We only ever stall when locking a texture that was
previously used with GetRenderTargetData or
GetFrontBufferData. Games are known to break
if locking those textures doesn't succeed.
2022-08-12 14:18:13 +01:00
Philip Rebohle
0d33d063ca
[dxvk] Remove device LUID workaround
winevulkan properly supports this now.
2022-08-11 16:01:53 +02:00
Philip Rebohle
9bd0040a90
[d3d9] Request high-priority shader compiles as necessary 2022-08-11 12:39:28 +02:00
Robin Kertels
b5b74116fa [d3d9] Fix rare hang when waiting for staging buffer markers 2022-08-11 12:37:28 +02:00
Philip Rebohle
02f653fdd2 [d3d9] Limit amount of staging memory in flight 2022-08-10 17:31:55 +02:00
Robin Kertels
8feabc653e [d3d9] Do implicit flush after uploading textures or buffers 2022-08-10 17:31:55 +02:00
Robin Kertels
1fcd5dc0af [d3d9] Unmap stored shader bytecode 2022-08-08 23:15:21 +01:00
Robin Kertels
49e9ba2ca7 [d3d9] Move d3d9 bytecode into D3D9Shader
This reduces the amount of times we copy the bytecode
and actually frees it when the game frees the associated shader.
2022-08-08 23:15:21 +01:00
Robin Kertels
1628b9e63a [d3d9] Add 64bit implementation for D3D9MemoryAllocator
This just uses malloc & free but allows us to use
the same code for D3D9 shader bytecode on 64 bit builds.
2022-08-08 23:15:21 +01:00
Robin Kertels
01fb40423d [d3d9] Remove some dead debug code
Oops.
2022-08-08 23:15:21 +01:00
Robin Kertels
36d8bb77a5 [d3d9] Fix synchronization in UpdateTextureFromBuffer 2022-08-08 23:14:30 +01:00
Robin Kertels
ac1e44f120 [d3d9] Fix typo 2022-08-08 23:14:30 +01:00
Philip Rebohle
7789fd53ff [d3d9] Use new flat shading state for fixed-function pipelines 2022-08-08 13:34:59 +02:00
Philip Rebohle
8f1024c094 [d3d9] Use new flat shading state for DXSO shaders 2022-08-08 13:34:59 +02:00
Philip Rebohle
0adf64f085 [dxvk] Add flat shading parameter to rasterizer state 2022-08-08 13:34:59 +02:00
Joshua Ashton
4f0c217633 [d3d9] Fix recording MultiplyTransform 2022-08-08 03:53:25 +01:00
Philip Rebohle
2e6a2f1be3
[dxvk] Make shader stage parameter in bindShader a template parameter 2022-08-07 18:44:44 +02:00
Philip Rebohle
29a2cb9a5e
[d3d9,d3d11] Make GetShaderStage functions constexpr 2022-08-07 18:44:44 +02:00
Philip Rebohle
1c1958be44
[d3d9] Use new resource view binding methods 2022-08-07 17:59:20 +02:00
Philip Rebohle
64169316e6
[d3d9] Compute vertex extent in BindInputLayout 2022-08-07 17:58:19 +02:00
Robin Kertels
ddb528cc8e [d3d9] Change texture before updating fetch4 2022-08-07 00:56:38 +01:00
Georg Lehmann
6589966fce [d3d9] Fix FF VS fog with GPL 2022-08-06 12:35:23 +02:00
Joshua Ashton
65da0da954 [d3d9] Support for graphics pipeline libraries 2022-08-06 01:20:22 +00:00
Joshua Ashton
9108f8c76c [d3d9] Clean up fetch4 handling 2022-08-06 01:35:43 +01:00
Joshua Ashton
8c9601b4cd [d3d9] Remove generalHazards option
Move everything into MarkRenderHazard.

We are doing a big bump for driver support anyway, no reason to keep this around. Old drivers can take the perf penalty.
2022-08-06 01:33:30 +01:00
Joshua Ashton
63d582a6e7 [d3d9] Use VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_EXT for hazards if available 2022-08-06 01:33:30 +01:00
Joshua Ashton
90abd993d4 [d3d9] Pass feedback loop aspect mask to backend 2022-08-06 01:33:30 +01:00
Joshua Ashton
8d070e54a1 [d3d9] Enable extAttachmentFeedbackLoopLayout feature if available 2022-08-06 01:33:30 +01:00
Joshua Ashton
31d17efb48 [dxvk] Add feedback loop aspect flags to bindRenderTargets 2022-08-06 01:33:30 +01:00
Robin Kertels
9e1ecec79f [d3d9] Disable fetch4 when binding an incompatible texture
Fixes lighting in Spider-Man: Shattered Dimensions.
2022-08-05 19:33:32 +01:00
Philip Rebohle
d498551a23 [dxso] Add bit selectors to D3D9ShaderSpecConstantManager
Avoids doing double bitfield extractions which isn't
optimized right now.
2022-08-05 19:31:02 +01:00
Joshua Ashton
b2cbf198e4 [d3d9, dxso] Refactor spec constants to use a bitfield layout
This allows us to use the same information to dump into a push constant for unoptimized pipelines.
2022-08-05 19:31:02 +01:00
Philip Rebohle
0f94971193
[d3d11,d3d9] Lock context/device in EndFrame
Fixes #2787.
2022-08-05 12:10:03 +02:00
Philip Rebohle
0315997fcd
[d3d9] Use mutable lambdas to avoid some redundant ref counting 2022-08-04 13:43:35 +02:00
Rosen Penev
08424ccb2e
[d3d9] Add missing vector header
Fixes compilation under MSYS2's clang backend.
2022-08-02 13:10:12 +02:00
pchome
8db2eb51fa [d3d9] fix ordinal values in the DEF file 2022-07-31 14:57:58 +01:00
Philip Rebohle
a2ef99b95c [d3d9] Generalize D3D9ConstantBuffer constructor 2022-07-31 02:10:37 +01:00
Philip Rebohle
db786cda6c
[dxvk] Remove old code to process specialization constants
We barely use spec constants anymore, so a much simpler solution will do.
2022-07-31 02:53:20 +02:00
Philip Rebohle
0eaad2eb5b [dxso] Don't create shader object for redundant PS permutations 2022-07-30 22:15:41 +01:00
Philip Rebohle
4d8b75c8fb
[d3d9] Fix spec constant derp 2022-07-30 20:38:58 +02:00
Philip Rebohle
10e6d0ef8a
[dxvk] Don't redundantly reset spec constant values
No longer needed.
2022-07-30 20:38:04 +02:00
Robin Kertels
bad7d4690b [d3d9] Handle very large Up draws 2022-07-30 20:29:31 +02:00
Joshua Ashton
753aede1fc [d3d9] Correct comment about ProjectionType 2022-07-30 12:34:18 +00:00
Joshua Ashton
1d1f0c7e7e [d3d9] Document D3D9SpecConstantId 2022-07-30 12:30:33 +00:00
Robin Kertels
ea76bfd019 [d3d9] Unmap unused resources 2022-07-29 13:14:33 +01:00
Robin Kertels
6ca6554452 [d3d9] Use memory mapped files for textures 2022-07-29 13:14:33 +01:00
Robin Kertels
d598fd3156 [d3d9] Add HUD item for unmappable memory 2022-07-29 13:14:33 +01:00
Robin Kertels
c3dbb6429f [d3d9] Implement memory allocator for memory mapped files 2022-07-29 13:14:33 +01:00
Robin Kertels
08ad6583ea [d3d9] Only set upload bit for managed textures
Otherwise D3DPOOL_DEFAULT can hit the draw time late
upload path.
2022-07-29 13:14:33 +01:00
Robin Kertels
ba4d95c5fc [d3d9] Remove direct upload path
And remove some tracking that will no longer be necessary.
2022-07-29 13:14:33 +01:00
Robin Kertels
45c1d7911e [d3d9] Remove evictManagedOnUnlock
This is annoying to maintain and hopefully won't be necessary anymore.
2022-07-29 13:14:33 +01:00
Robin Kertels
116feca6af [d3d9] Handle unbound textures in fixed function shaders 2022-07-28 14:56:28 +00:00
Philip Rebohle
6c5f73ac26
[dxvk] Reintroduce VkPhysicalDeviceIDProperties
We need this to get the device LUID. Wine does not fill in the
LUID properties in VkPhysicalDeviceVulkan11Properties right now.

Fixes DLSS not working, as well as other potential issues.
2022-07-26 22:38:33 +02:00
Krzysztof Dobrowolski
abf5ed154f [dxvk] Add Direct3D9ForceHybridEnumeration empty export function. 2022-07-25 12:04:27 +00:00
Philip Rebohle
f15466a2c5
[dxvk] Remove remaining built-in specialization constants 2022-07-17 17:06:42 +02:00
Philip Rebohle
cdf22a4086
[dxvk] Rename imageFormatInfo -> lookupFormatInfo 2022-07-15 17:25:13 +02:00
Philip Rebohle
320534cb34
[spirv] Automatically track interface variables 2022-07-15 16:10:16 +02:00
Philip Rebohle
d6d7d5137b
[dxvk] Drop VK_EXT_4444_formats
These formats are core in Vulkan 1.3 and all relevant drivers support them.
2022-07-14 21:21:34 +02:00
Philip Rebohle
f60bdcbcbf
[dxvk] Replace VK_EXT_shader_demote_to_helper_invocation with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle
223a4fd186
[d3d9] Always assume RADV has fast mulz support
All supported Mesa version support this.
2022-07-14 21:21:34 +02:00
Philip Rebohle
131af0d677
[dxvk] Replace VK_KHR_driver_properties with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle
956f293a69
[dxvk] Replace VK_KHR_depth_stencil_resolve with core feature 2022-07-14 21:21:34 +02:00
Philip Rebohle
0b47297b7d
[dxvk] Replace VK_EXT_host_query_reset with core feature
And make it a hard requirement in the backend. We no longer support
the old fallback path for queries anyway.
2022-07-14 21:21:34 +02:00
Philip Rebohle
eee4ac1e91
[dxvk] Replace VK_KHR_sampler_mirror_clamp_to_edge with core features
And make it a hard requirement. We're not checking for feature support
anyway and all relevant drivers support this feature anyway.
2022-07-14 21:21:34 +02:00
Philip Rebohle
2774a04195
[dxvk] Use VkPhysicalDeviceVulkan11{Features,Properties} where appropriate 2022-07-14 21:21:34 +02:00
Philip Rebohle
6ac5ca3bff [d3d9] Use existing staging buffer implementation for managed uploads 2022-07-14 18:22:23 +02:00
Philip Rebohle
f07a6e160c [d3d9] Rework UP buffer allocation 2022-07-14 18:22:23 +02:00
Joshua Ashton
e884413c49 [dxvk] Don't synchronize device if going for DLL shutdown
All our other threads have been destroyed and we can no longer synchronize with them properly.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2022-07-14 17:04:52 +02:00
Georg Lehmann
5ae5476d71 [d3d9] Make reported sample counts consistent with DecodeMultiSampleType behavior. 2022-07-14 15:32:42 +01:00
Philip Rebohle
9e110cd3e5 [d3d9] Fix up unsupported sample counts 2022-07-14 14:58:58 +01:00
Philip Rebohle
74a8bfb774 [d3d9] Remove CreateConstantBuffer method 2022-07-14 15:55:08 +02:00
Philip Rebohle
4635c72e95 [d3d9] Use generic constant buffers for SWVP 2022-07-14 15:55:08 +02:00
Philip Rebohle
08c3c45853 [d3d9] Use generic constant buffer implementation 2022-07-14 15:55:08 +02:00
Philip Rebohle
e8d5ce94ea [d3d9] Introduce D3D9ConstantBuffer 2022-07-14 15:55:08 +02:00
Robin Kertels
ce48b57f94
[d3d9] Allow POOL_SCRATCH targets in GetFrontBufferData 2022-07-13 14:01:12 +02:00
Blisto91
64d2260656
[d3d9] add D3DFMT_UNKNOWN to windowed BackBufferFormat 2022-07-13 13:03:05 +02:00
Philip Rebohle
95995041b0
[d3d9] Explicitly check for Unknown in CheckDeviceFormatConversion 2022-07-13 12:35:33 +02:00
Robin Kertels
10b174b52c [d3d9] Fix barriers with staging buffers 2022-07-12 21:16:32 +01:00
Philip Rebohle
bd68f05c9b
[dxvk] Make emitRenderTargetReadbackBarrier more generic
And also remove the redundant pipeline barrier.
2022-07-12 17:29:11 +02:00
Philip Rebohle
e8f48c71ab
[dxvk] Always enable robustBufferAccess2 feature
And respect the required alignments when creating buffers.
2022-07-12 02:11:32 +02:00
Georg Lehmann
913129d3b6 [d3d9] Add an config option to disable non seamless cube maps. 2022-07-07 14:18:49 +01:00
Georg Lehmann
cd8e2360f4 [d3d9] Use non seamless samplers if supported. 2022-07-07 14:18:49 +01:00
Georg Lehmann
f2b1805d7e [dxvk] Allow non seamless samplers. 2022-07-07 14:18:49 +01:00
Philip Rebohle
7c4d602863
[dxvk] Change spec constant IDs
We no longer support per-resource spec constants, so there is no good
reason not to use a 1:1 mapping for user-defined constants.
2022-07-03 13:41:06 +02:00
Philip Rebohle
735e741681
[d3d9] Add spec constant for null samplers
And rework the way spec constants are updated.
2022-07-03 13:41:06 +02:00
Philip Rebohle
186dc29384
[d3d9] Remove bound spec constants from fixed-function shaders
Texture stages are disabled anyway when textures are unbound,
so we will never hit the unbound case.
2022-07-03 13:41:06 +02:00
Philip Rebohle
2e7e9eac7a
[dxvk] Require EXT_robustness2 and the null descriptor feature 2022-07-03 13:41:03 +02:00
Philip Rebohle
e406484b84
[d3d9] Don't use VK_RESOLVE_MODE_AVERAGE_BIT_KHR for stencil resolves
Doesn't work, always write sample zero instead.
2022-07-02 16:48:10 +02:00
Philip Rebohle
76ba03398d
[d3d9,dxso] Fix push constant validation errors
Derp.
2022-07-01 18:06:47 +02:00
Philip Rebohle
db07861518
[dxvk] Remove old pipeline layout implementation 2022-06-28 14:35:58 +02:00
Philip Rebohle
acf70501d2
[d3d9] Call endFrame at the end of each frame 2022-06-28 14:35:57 +02:00
Philip Rebohle
ab0c15ea54
[dxvk] Introduce DxvkContextType 2022-06-28 14:35:57 +02:00
Philip Rebohle
ecbada30f5
[d3d9] Pass new binding info struct to fixed-function shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle
5edd8e92a8
[d3d9] Pass new binding info struct to various helper shaders 2022-06-28 14:32:31 +02:00
Philip Rebohle
4cc559d690
[d3d9] Pass shader stage when binding shader resources 2022-06-28 14:32:30 +02:00
Philip Rebohle
0fb1227792
[d3d9] Pass shader stage when binding format conversion resources 2022-06-28 14:32:30 +02:00
Andrew Eikum
279b4b7ec2 [d3d9] Defer surface creation if no HWND is given to device
Planetary Annihilation: TITANS creates a device with a NULL HWND and
requires it to succeed.
2022-06-03 13:07:43 +00:00
Paul Gofman
cc11bb8240 [d3d9] Don't adjust window position and size in windowed mode. 2022-05-23 07:53:13 +00:00
Joshua Ashton
5b7406fed5 [d3d9] Fix crash when using StretchRect with NULL rts 2022-05-10 02:02:35 +01:00
Robin Kertels
3004026db8 [d3d9] Only bind RT if we actually write to it
The alternative render path for shadow maps in Dead Space relies on this.
2022-04-20 00:58:17 +01:00
Robin Kertels
bdafa16e39 [d3d9] Only bind depth buffer if the depth or stencil test is enabled 2022-04-20 00:58:17 +01:00
Joshua Ashton
147f3738f9 [d3d9] Use strlcpy helper 2022-04-19 17:08:17 +01:00
Robin Kertels
9302d33ac7 [d3d9+util] Enable invariant position by default 2022-04-18 12:40:46 +01:00
Philip Rebohle
427f51eda7 [d3d9] Use new DxvkShader constructor for format conversion 2022-04-18 13:20:16 +02:00
Philip Rebohle
98ec79f6fa [d3d9] Use new DxvkShader constructor for SWVP emulation 2022-04-18 13:20:16 +02:00
Philip Rebohle
ab95b61e44 [d3d9] Use new DxvkShader constructor for fixed-function shaders 2022-04-18 13:20:16 +02:00
Robin Kertels
42c66c410e [d3d9] Calculate slice alignment when uploading straight from the mapping buffer 2022-04-06 18:52:58 +00:00
Paul Gofman
957a305ca8 [d3d9] Ignore multiple app activation window messages. 2022-04-06 18:51:50 +00:00
Paul Gofman
b0ed9e30ce [d3d9] Filter window messages when processing WM_ACTIVATEAPP. 2022-04-06 18:51:50 +00:00
Philip Rebohle
e7e7fa231c
[dxvk] GPU query reset path
Require VK_EXT_host_query_reset instead. This fallback path is
untested nowadays and too slow to be useful.
2022-03-30 13:32:18 +02:00
Robin Kertels
4e34c29c56 [d3d9] Disable culling when the app passes an invalid value 2022-03-25 17:13:12 +01:00
Robin Kertels
b2f22d5719 [d3d9] UpdateTexture: Handle automatic mip gen properly 2022-03-24 02:31:42 +00:00
Oleg Kuznetsov
b36ca2c758 [d3d9] Fix Visual Studio build to resolve 'operator !=' is ambiguous error for RECT 2022-03-17 11:35:19 +01:00
Joshua Ashton
cf1cee04b8 [d3d11] Register annotation interfaces with D3D9
Some apps try use the D3DPERF_ functions for debug markers/annotations.

This utilizes the DXVK_RegisterAnnotation hidden functions to share the interfaces.

Co-authored-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2022-03-17 11:35:19 +01:00
Joshua Ashton
937a60c882 [d3d9] Add hidden exports for registering annotations
Adds DXVK_RegisterAnnotation at ordinal 28257 and DXVK_UnRegisterAnnotation at ordinal 28258.
2022-03-17 11:35:19 +01:00
Joshua Ashton
787a979514 [d3d9] Implement D3D9UserDefinedAnnotation 2022-03-17 11:35:19 +01:00
Joshua Ashton
47b1ab52ce [d3d9] Implement D3D9GlobalAnnotationList 2022-03-17 11:35:19 +01:00
Joshua Ashton
a010397f34 [util] Move DecodeD3DColor to util
This will be used in the D3D11UserDefinedAnnotation implementation to handle PIX calls which contain a color.
2022-03-17 11:35:19 +01:00
Georg Lehmann
2550cff149 [build] Cleanup build system.
No changes except dropping support for msvc before 15.3.
2022-03-17 01:38:58 +00:00
Joshua Ashton
1f88ee595f [d3d9] Don't expose D32 format
Not supported anywhere except REF device it seems... *sigh*

Supercedes: #2547
2022-03-16 19:11:16 +00:00
Robin Kertels
115385d1d9 [d3d9] Update buffer seq number in FlushBuffer
How did I miss this?!
2022-03-15 01:24:54 +00:00
Robin Kertels
5f4fc56226 [d3d9] Update texture sequence number AFTER using it 2022-03-13 17:13:00 +00:00
Robin Kertels
a6357a254d [d3d9] Fix CS thread synchronization for directly mapped buffers 2022-03-13 17:13:00 +00:00
Philip Rebohle
caa83247d9
[d3d9] Mark backend image as shared for shared resources
Otherwise, the backend may not transition the image to the correct
layout after each submission.
2022-03-13 02:32:56 +01:00
Philip Rebohle
59e3c96976
[d3d9] Fix texture formats that can be exported 2022-03-12 22:24:05 +01:00
Derek Lesho
1d1d8adee6
[d3d9] Fix shared handle check for exporting images
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-12 21:35:42 +01:00
Derek Lesho
6640cc350c
[d3d9] Add support for shared IDirect3DTexture9 resources. 2022-03-12 16:23:06 +01:00
Derek Lesho
02d3e0d31f
[dxvk] Add shared handle access to DxvkImage memory.
Based off preliminary work from Josh.
2022-03-12 16:23:06 +01:00
Joshua Ashton
dc6c350cf2 [d3d9] Add fallthrough comment to SetRenderState
Silences a warning
2022-03-10 00:47:38 +01:00
Joshua Ashton
b2d96ee087 [d3d9] Fix fallthroughs in PickFormats 2022-03-10 00:47:38 +01:00
Joshua Ashton
53b9a723ac [d3d9] Set initial dirty state flags
We had a bug where initial state values caused the data to not get sent to the backend.

Let's fix that going forward and dirty everything we possibly can on device creation.
2022-03-09 23:33:12 +00:00
Joshua Ashton
d4d4f0ca18 [d3d9] Fix default initialization of some state values
If we end up being the same as what we are, we don't dirty initially.
2022-03-09 23:33:08 +00:00
Robin Kertels
b42c07253e [d3d9] Fix sysmem readback 2022-02-24 07:49:55 +00:00
Robin Kertels
a81c653b42 [d3d9] Fix synchronization after readback 2022-02-22 21:49:28 +00:00
Robin Kertels
29d8812709 [d3d9] Don't set NeedsReadback for POOL_SYSMEM textures
... or in SetRenderTarget because we always do readback for render targets.
2022-02-21 13:43:04 +00:00
Robin Kertels
b163a99bde [d3d9] Clean up texture locking
We had two code paths that largely did the same.
2022-02-21 00:08:41 +00:00
Robin Kertels
dde83717f1 [d3d9] Rename WrittenByGPU to NeedsReadback 2022-02-21 00:08:41 +00:00
Robin Kertels
40444c1f50 [d3d9] Unify texture uploads 2022-02-21 00:08:41 +00:00
Robin Kertels
cf4c5c3422 [d3d9] Add option to disable direct buffer mapping 2022-02-20 03:30:03 +00:00
Robin Kertels
6d71eea516 [d3d9] Store buffer map mode in D3D9CommonBuffer 2022-02-20 03:30:03 +00:00
Robin Kertels
97ae14b6a0 [d3d9] Synchronize only to given sequence number in WaitForResources 2022-02-20 03:29:31 +00:00
Robin Kertels
917a8d00a2 [d3d9] Track last staging resource usage with a sequence number 2022-02-20 03:29:31 +00:00
Robin Kertels
c12cd1952c [d3d9] Handle different mip chain lengths in UpdateTexture 2022-02-20 03:29:04 +00:00
Philip Rebohle
6ae5488157
[d3d9] Use initBuffer method 2022-02-17 20:58:31 +01:00
Philip Rebohle
752f98cf00
[d3d9] Use initImage to clear uninitialized image resources 2022-02-17 20:58:31 +01:00
Philip Rebohle
4d9b464f7c
[d3d9] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle
a03c038f03
[d3d9] Exit early in ProcessVertices if the vertex count is 0
We don't want to pass a zero-sized copy to the backend.
2022-02-13 02:08:19 +01:00
Philip Rebohle
d96c5a1076
[dxvk] Store DXVK device inside DxvkCsThread object 2022-02-13 02:07:48 +01:00
Philip Rebohle
37f3d9208b
[dxvk] Introduce sequence numbers for CS submissions 2022-02-11 18:17:34 +01:00
Robin Kertels
b220c8989b [d3d9] Only enable FETCH4 for single channel formats 2022-01-28 21:34:18 +00:00
Georg Lehmann
4e6db51230 [d3d9] Fix float emulation detection.
ffs
2022-01-21 16:08:00 +01:00
Georg Lehmann
14df2f7251 [d3d9] Enable strict float emulation by default for new radv. 2022-01-20 23:47:41 +00:00
Georg Lehmann
f5744284eb [d3d9] Dirty FF vertex shader if any D3D9VertexDeclFlags change.
The vertex shader depends on all of these in some way.
2022-01-10 22:06:15 +00:00
Christopher Egert
b1a6cbad7f [d3d9] Update FFVS when D3DFVF_PSIZE is specified.
This fixes #2387
2022-01-10 20:05:41 +00:00
Robin Kertels
4cdee69bc9 [d3d9] Always upload all managed texture mips after AddDirtyBox call
Co-authored-by: Paul Gofman <gofmanp@gmail.com>
2022-01-10 18:55:08 +00:00
Robin Kertels
6c17b8801c [d3d9] Add strict option to float emulation setting 2021-12-05 16:49:19 +00:00
Robin Kertels
804eca9cad [d3d9] Respect shader defined constants for HWVP/PS buffer binding range 2021-11-30 01:57:22 +00:00
Robin Kertels
0061139652 [d3d9] Copy shader defined constants into SWVP UBO
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Georg Lehmann <dadschoorse@gmail.com>
2021-11-30 01:57:22 +00:00
Robin Kertels
39039f9ac8 [dxso+d3d9] Clean up texture slots 2021-11-30 01:57:22 +00:00
Paul Gofman
b672c07a93 [d3d9] Send WM_ACTIVATEAPP messsage on WM_SIZE. 2021-11-30 01:48:24 +00:00
Joshua Ashton
4c0eee89e4 [d3d9] Use clamped LOD for creating new views 2021-11-11 23:53:38 +00:00
Joshua Ashton
c22dcdbaa3 [d3d9] Clamp LOD in calls to SetLOD
MSDN says this is clamped and returns the clamped value.

Closes: #1869
2021-11-11 23:52:35 +00:00
Joshua Ashton
5d4b7db9e6 [d3d9] Fix = alignent in CreateView 2021-11-11 23:51:59 +00:00
Joshua Ashton
8912c7adb0 [d3d9] Fix long driver/device names not being null terminated
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-22 02:58:53 +00:00
Robin Kertels
7f89fe1406 [d3d9+utils] Remove swvp hack 2021-10-15 10:54:18 +01:00
Robin Kertels
530f87f158 [d3d9+dxso] Rely on robustness for unset HW VS & PS constants 2021-10-15 10:54:18 +01:00
Robin Kertels
869f75895c [d3d9+dxso] Switch constant buffer order 2021-10-15 10:54:18 +01:00
Robin Kertels
791d533a1d [d3d9+dxso] Rely on robustness for unset SWVP constants 2021-10-15 10:54:18 +01:00
Robin Kertels
01f633289b [d3d9] Use mapped slice when locking POOL_DEFAULT textures
Fixes an issue where the game would end up using the wrong
buffer slice if it previously mapped the same texture with DISCARD.

Fixes #2329
2021-10-15 10:46:40 +01:00
Robin Kertels
c8341e4be3 [d3d9] Fix lenient clears 2021-09-28 21:14:02 +01:00
Robin Kertels
c4449faf5a [d3d9] Don't clamp clears to the size of RT 0 2021-09-27 21:57:15 +01:00
Robin Kertels
29ee1a74e6 Revert "[d3d9] Avoid depth degenerate viewports"
This reverts commit 78d22cc7a5.
2021-09-27 14:55:49 +01:00
Georg Lehmann
827c7a892c [util] Replace countof with std::size 2021-09-10 11:58:46 +01:00
Georg Lehmann
ed70f9a07c [d3d9] Support unsupported formats in LockRect 2021-08-23 17:38:50 +01:00
Georg Lehmann
82d40f5bba [d3d9] Return a pointer in GetUnsupportedFormatInfo 2021-08-23 17:38:50 +01:00
Georg Lehmann
04474b761b [d3d9] Brain-dead gamma ramp validation 2021-08-23 15:41:59 +01:00
Georg Lehmann
41d0fcff95 [d3d9] Disable projection for PS 1.4 2021-08-19 01:47:42 -07:00
Robin Kertels
956b23c9e9 [d3d9] Use correct pitch to calculate buffer offset 2021-08-18 13:31:00 -07:00
Robin Kertels
97e91b6c0f [d3d9] Respect pitch alignment in GetFrontBufferData 2021-08-18 13:31:00 -07:00
Joshua Ashton
3718cee9eb [d3d9] Clean up texture type tracking
Additionally stops leaky pipelines on PS 1.x shaders from partial mask updates.
2021-08-17 07:02:56 -07:00
Joshua Ashton
64852f05c3 [d3d9] Track fixed function sampler bitfields
Cleans some stuff up a little bit and makes FF draws faster when this gets incorrectly invalidated.
2021-08-17 07:02:56 -07:00
Joshua Ashton
c6a4c41d20 [d3d9] Batch texture unbinding 2021-08-17 07:02:56 -07:00
Joshua Ashton
a346949304
[d3d9] Remove needless locks in SetTexture and SetSamplerState 2021-08-16 19:09:16 +01:00
Georg Lehmann
6103e3c800 [d3d9] Use BitMask helper 2021-08-16 08:49:46 -07:00
Joshua Ashton
b09b912797
[d3d9] Fix unbinding textures
Closes: #2236
2021-08-16 15:33:49 +01:00
Georg Lehmann
a75cf2f39d [d3d9] Fix parital DS clears with full RT clear 2021-08-15 19:00:47 +00:00
Joshua Ashton
7acbd0f4e1
[d3d9] Expose D3DPMISCCAPS_CLIPTLVERTS
Matches what we actually do and fixes a Wine test
2021-08-11 12:44:28 +01:00
Joshua Ashton
a6156856e5 [d3d9] Don't check for NULL pViewport
This cannot be NULL.
2021-08-11 11:44:09 +00:00
Joshua Ashton
78d22cc7a5 [d3d9] Avoid depth degenerate viewports 2021-08-11 11:44:09 +00:00
Joshua Ashton
5f4f4d57df
[d3d9] Fix initial mapping of images written by GPU 2021-08-11 12:14:17 +01:00
Joshua Ashton
679d703efc [d3d9] Fix upload race with default image mapping
Fixes a Wine test
2021-08-11 11:53:17 +02:00
Robin Kertels
60a7047550 [d3d9] Fix D3DLOCK_READONLY handling with evictManagedOnUnlock 2021-08-11 07:35:39 +00:00
Joshua Ashton
2c8099adf1
[d3d9] Use Texture2D for CommonTexture resolution
Using the generic texture type was a nice idea in theory, but some compilers did not give it a vtable as it was abstract, resulting in a crash here.
2021-08-11 04:25:29 +01:00
Joshua Ashton
ab7fc42f2f
[d3d9] Fix stateblock refcounting 2021-08-11 01:38:50 +01:00
Joshua Ashton
a1f0bb99ee
[d3d9] Cleanup D3D9DeviceEx members 2021-08-11 01:38:34 +01:00
Joshua Ashton
5e48035e99
[d3d9] Only bind textures if they are used by the shader 2021-08-11 01:08:13 +01:00
Joshua Ashton
c0c1565cba [d3d9, dxso] Alias color and depth samplers and improve tracking
Takes me from 340 -> 460fps in A Hat in Time's main menu when CPU bound.
2021-08-10 23:46:03 +00:00
Joshua Ashton
3f78bde928 [d3d9] Optimize GetCommonTexture 2021-08-10 23:46:03 +00:00
Joshua Ashton
85468a5526 [d3d9] Add extra brackets to fetch4 filter check 2021-08-09 22:54:19 +00:00
Joshua Ashton
674f008e23 [d3d9] Use m_activeTexture mask for SRGB check 2021-08-09 22:54:19 +00:00
Joshua Ashton
1823a098a1 [d3d9] Clean up SetStateSamplerState 2021-08-09 22:54:19 +00:00
Joshua Ashton
ea4aa87336 [d3d9] Add unlikelies to rare vendor hacks 2021-08-09 22:54:19 +00:00
Georg Lehmann
1ea79cf136 [d3d9] Only respect relevant bits of D3DRS_STENCILREF 2021-08-09 22:54:06 +00:00
Georg Lehmann
152a08191c [d3d9] Downgrade format fall back warnings to info 2021-08-09 13:17:43 +02:00
Joshua Ashton
abba425ed0 [d3d9] Optimize MarkTextureBindingDirty with tzcnt loop of m_activeTextures 2021-08-09 09:54:12 +00:00
Joshua Ashton
242b7b6d9c [d3d9, dxso] Remove AlphaTestEnable spec constant
Go based on the func we already have. Avoids wasting a spec const.
2021-08-09 09:52:07 +00:00
Georg Lehmann
ada463badc [d3d9] Mark mips as dirty on Clear if needed 2021-08-08 10:27:43 +00:00
Georg Lehmann
92deba0310 [d3d9] Implement D3DTOP_BLENDTEXTUREALPHAPM 2021-08-08 10:12:40 +00:00
Georg Lehmann
9162aa5fdf [d3d9] Captured NULL vertex declarations are not applied 2021-08-08 08:50:00 +00:00
Georg Lehmann
28a07ef445 [d3d9] Validate vertex declaration on draws 2021-08-08 08:50:00 +00:00
Georg Lehmann
8c0003552c [d3d9] Reject depth stencil StrechRect during an active scene 2021-08-08 08:50:00 +00:00
Georg Lehmann
09e5939502 [d3d9] Reject 2 BeginScene + EndScene without Begin 2021-08-08 08:50:00 +00:00
Georg Lehmann
6071e998fd [d3d9] Handle invalid modes in Device::Reset 2021-08-08 08:50:00 +00:00
Georg Lehmann
64c4eea922 [d3d9] Mark texture dirty on SetLod 2021-08-08 02:28:44 +00:00