Commit Graph

356 Commits

Author SHA1 Message Date
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 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 d8933ca175 [d3d9] Only do one allocation for all texture subresources 2022-11-06 19:35:03 +00:00
Robin Kertels 9c22a58543 [d3d9] Disable locking non-dynamic default textures 2022-10-24 20:55:00 +01:00
Philip Rebohle 859de7e828 [dxvk] Always enable depth clip feature if supported 2022-10-24 16:39:24 +02: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 a9bdea72e9 [d3d9] Clamp Dref to [0.0, 1.0] if the texture is emulated UNORM 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
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
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