Commit Graph

391 Commits

Author SHA1 Message Date
Joshua Ashton 10bb285f2e [d3d9] Remove unused dstExtent + friends in GetRenderTargetData 2022-09-10 21:46:07 +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
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
Robin Kertels a8b578b2a2 [d3d9] Fix crash when auto generating mip maps for unmappable textures 2022-08-22 01:48:35 +01:00
Philip Rebohle ea4e0bc470 [d3d9,d3d11] Require shaderDemoteToHelperInvocation feature 2022-08-19 13:36:54 +00: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 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
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 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 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
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
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
Robin Kertels bad7d4690b [d3d9] Handle very large Up draws 2022-07-30 20:29:31 +02: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 c3dbb6429f [d3d9] Implement memory allocator for memory mapped files 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 cdf22a4086
[dxvk] Rename imageFormatInfo -> lookupFormatInfo 2022-07-15 17:25:13 +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 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 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
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
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 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 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 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 4cc559d690
[d3d9] Pass shader stage when binding shader resources 2022-06-28 14:32:30 +02: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
Robin Kertels 42c66c410e [d3d9] Calculate slice alignment when uploading straight from the mapping buffer 2022-04-06 18:52:58 +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 b2f22d5719 [d3d9] UpdateTexture: Handle automatic mip gen properly 2022-03-24 02:31:42 +00: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
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
Derek Lesho 6640cc350c
[d3d9] Add support for shared IDirect3DTexture9 resources. 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 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
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 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 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