Commit Graph

4872 Commits

Author SHA1 Message Date
Philip Rebohle 76e6b2764b [dxgi] Change CreateSwapChain to take a surface factory 2022-11-07 14:14:05 +01:00
Philip Rebohle 03dca539cb [vulkan,d3d9,d3d11] Move surface creation to swap chain implementation 2022-11-07 14:14:05 +01:00
Philip Rebohle 49cf0ecf54 [vulkan] Don't handle SURFACE_LOST in Vulkan presenter 2022-11-07 14:14:05 +01:00
Philip Rebohle 3a9e975a71 [dxgi] Implement DxgiSurfaceFactory 2022-11-07 14:14:05 +01:00
Philip Rebohle 1754b73ade [wsi] Change interface for surface creation
This temporarily breaks Win32 swap chains, but we're fine with that
since this will take some refactoring.
2022-11-07 14:14:05 +01:00
Philip Rebohle bd87e19de1 [dxgi] Introduce IDXGIVkSurfaceFactory 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
Blisto91 145c1ce127 [util] Limit fps to 60 for some WayForward games 2022-11-06 15:32:28 +01:00
Robin Kertels 4fb7acc64e [d3d9] Implement converter for W11V11U10 2022-11-06 02:55:29 +00:00
Vlad 40a4908a2a Support for MW:R H1-Mod 2022-11-05 16:07:16 +01:00
Blisto91 e1eec9b359 [util] Set Fallout 3 to Nvidia vendor id 2022-11-05 16:07:04 +01:00
Robin Kertels 892f676605 [util] Disable direct buffer mapping for Dragon Age Origins 2022-11-02 16:12:28 +01:00
Philip Rebohle 0b9f785bc5 [dxvk] Remove broken memory budget logic for UMA systems
All heaps on an UMA systems are by definition device-local, so this
just leads to unnecessary issues.
2022-11-01 12:48:03 +01: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
Winter Snowfall f84f992d44 [util] Also enable workaround for the "mod load exe" of ToEE 2022-10-25 03:45:53 +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 b055c2daea [d3d11] Avoid querying environment variables on shader creation 2022-10-24 17:58:57 +02:00
Philip Rebohle fea86ef116 [dxvk] Use dynamic depth clip enable for linked pipelines if supported
This way we won't have to compile any vertex shader pipelines twice.
2022-10-24 16:39:24 +02:00
Philip Rebohle 8e7ea899d2 [dxvk] Enable VK_EXT_extended_dynamic_state_3 if available 2022-10-24 16:39:24 +02:00
Philip Rebohle 859de7e828 [dxvk] Always enable depth clip feature if supported 2022-10-24 16:39:24 +02:00
Paul Gofman e311f25287 [dxgi] Store device pointer in DxgiSwapChainDispatcher 2022-10-20 19:05:19 +02:00
Philip Rebohle 53a0c3726c [dxvk] Don't crash immediately on pipeline library compile error
Things will blow up down the line but there's no good reason to crash
immediately. Also ignore returned pipeline on error so we'll always
return null.
2022-10-18 00:07:41 +02:00
Philip Rebohle 69d7af42a4 [dxgi] Change swap chain interface to better map to D3D12 needs 2022-10-16 16:38:29 +02:00
Philip Rebohle d7ac21b6c7 [dxgi] Use new DXVK swap chain factory if available 2022-10-16 16:38:29 +02:00
Philip Rebohle aca67f64da [d3d11] Implement IDXGIVkSwapChainFactory for D3D11 2022-10-16 16:38:29 +02:00
Philip Rebohle 580dd5cf4a [dxgi] Add swap chain factory interface definition 2022-10-16 16:38:29 +02:00
Joshua Ashton d83e184afd [d3d10] Enable native builds
This started working at some point... may as well!
2022-10-15 18:17:29 +01: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
Joshua Ashton 3b90f5a77f [util] Enable apitrace mode for Hammer World Editor 2022-10-15 17:21:29 +01: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
Philip Rebohle bd7d2aac71 [dxgi] Get rid of NotifyModeChange method
Was only used for the FPS limiter.
2022-10-07 13:25:56 +02:00
Vinjul1704 038ed23a5d [util] Force SM1 for the Escape from Tarkov launcher 2022-10-06 21:32:19 +02:00
Joshua Ashton fa45e5838e [util] Fix tzcnt on ARM64 + Clang
This needed brackets around this conditional.
2022-10-05 19:01:05 +01:00
Philip Rebohle ab622760a0 [dxbc] Emit new block only after emitting switch instruction
Otherwise emitting the OpSwitch will reset the block ID, which
is not desireable. Fixes #2975.
2022-10-04 21:00:50 +02:00
Blisto91 f8bd19f210 [util] Cap Sonic Adventure 2 to 60 fps 2022-09-30 19:14:59 -02:30
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
Georg Lehmann 7552cfe62a [dxso] Always lower projection 2022-09-26 21:39:51 +01:00
Philip Rebohle f1f8d45fcd [dxvk] Rework allocation logic for large resources
This may reduce internal fragmentation with very large resources.

We previously changed behaviour to not do this in order to reduce memory
pressure in the average case, however by trying to suballocate from existing
chunks and falling back to a dedicated allocation on failure, rather than
allocating a new chunk, we can mostly avoid that situation.
2022-09-24 17:06:00 +02:00
Philip Rebohle 15588004b4 [dxvk] Bump memory chunk size to 256 MiB. 2022-09-24 17:06:00 +02: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
Joshua Ashton 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
Michał Pyrzowski 82ebc29e18
[dxso] Fix for illegal OpCompositeConstruct while translating Crs opcode
During the translation of the Crs opcode to SPIR-V there is an assumption that the result type is a composite type. This is not always true. If the result is a scalar type the translation adds an OpCompositeConstruct with a scalar result type. This is a spec violation.

This change checks if the result type is a composite type and does not add the OpCompositeConstruct in case of scalar types.
2022-09-21 10:47:16 +00:00
Robin Kertels 5c22e2fbda [util] Enable GTA IV config for Episodes from Liberty City 2022-09-19 15:11:01 +01:00
Robin Kertels c759fb45aa [util] Disable DF support for pretty mirrors in GTA IV 2022-09-19 15:11:01 +01:00
Robin Kertels 5962be44c6 [dxso] Define color inputs as centroids on SM3 too 2022-09-19 15:10:43 +01:00
Philip Rebohle a14ce8d1b0 [d3d11] Enable ROV support if corresponding Vulkan features are supported 2022-09-19 15:44:23 +02:00
Philip Rebohle 35a84053b5 [dxbc] Implement rasterizer ordered views 2022-09-19 15:44:23 +02:00
Philip Rebohle 8ca5edeacd [dxbc] Decode rasterizer ordered flag for UAVs 2022-09-19 15:44:23 +02:00
Philip Rebohle 9532126f7c [dxvk] Enable VK_EXT_fragment_shader_interlock 2022-09-19 15:44:23 +02:00
Philip Rebohle 0bb0c1e646 [util] Enable ignoreGraphicsBarriers for FFXV
Massively improves performance when VXAO is enabled.
2022-09-19 15:43:45 +02:00
Philip Rebohle 2a7706ba53 [dxbc] Do not enable SPV_KHR_shader_float_controls
This is core in Vulkan 1.2 and SPIR-V 1.5.
2022-09-18 02:27:03 +02:00
Philip Rebohle 9fa587e13c [dxgi] Always use swap chain-local present count for frame statistics
Doesn't appear to match Windows behaviour, but there may be scenarios
when we can't query the current monitor. Statistics still need to be
consistent in this case.

See #2933.
2022-09-17 05:01:36 +02:00
Philip Rebohle 5b6b9923ab [dxbc] Write point size in vertex shaders
Silences some validation errors when point rendering is enabled.
2022-09-17 01:52:19 +02:00
Philip Rebohle d93568f1a9 [dxbc] Don't emit built-in position as a block variable
This is no longer needed for interface matching.
2022-09-17 01:52:19 +02:00
xpander69 07094ac4f9 [util] Remove fps cap from Warhammer Online
This is a bit embarrassing. Added this config few days ago to counter the animation breakages, but now Return of Reckoning devs patched the executable on their side to cap the framerate by default. So the workaround is not needed anymore.
2022-09-16 21:32:49 +01: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
Philip Rebohle 3a63c7cb31 [dxvk] Hide some more format compatibility validation errors 2022-09-16 17:24:33 +02:00
Philip Rebohle 67bd2b5e76 [dxgi] Report swap chain frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle fe3fc82d8e [dxgi] Handle mode changes for frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle faaa6bf1df [dxgi] Promote output stored in swap chain to IDXGIOutput1 2022-09-16 12:49:42 +02:00
Philip Rebohle 57af9e8760 [dxgi] Estimate vblank count for frame statistics 2022-09-16 12:49:42 +02:00
Philip Rebohle c56a9b5a3f [dxgi] Implement WaitForVBlank using new sleep helper
Not very accurate, but probably good enough if the display
refresh rate is known.
2022-09-16 12:49:42 +02:00
Philip Rebohle 3543673c5c [util] Add helper to compute display refresh related stuff 2022-09-16 12:49:42 +02:00
Philip Rebohle e019edc8c3 [util] Add helper to get time point from raw counter value 2022-09-16 12:49:42 +02:00
Philip Rebohle c1ab09a048 [util] Move platform-specific sleep code to dedicated helper class 2022-09-16 12:49:42 +02:00
Joshua Ashton 000a647c56 [d3d11] Store D3D11DeviceContextState as private ref
Avoids a circular dependency
2022-09-16 12:49:10 +02:00
Joshua Ashton a69c65265a [d3d11] Store context predication query as private ref 2022-09-16 12:49:10 +02:00
Joshua Ashton 9e4877be81 [d3d11] Store SoTarget buffer as a private ref 2022-09-16 12:49:10 +02:00
Joshua Ashton b40935a48d [d3d11] Store context state ID buffers as private refs 2022-09-16 12:49:10 +02:00
Joshua Ashton ca38cebe0b [d3d11] Store private refs for IA layout 2022-09-16 12:49:10 +02:00
Joshua Ashton 9545281542 [d3d11] Store private refs for VB + IB bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 9bfe46ac50 [d3d11] Store private refs for srv and rtv bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 2419226456 [d3d11] Store private refs for constant buffer bindings 2022-09-16 12:49:10 +02:00
Joshua Ashton 8758bcedae [d3d11] Store private refs to context shaders 2022-09-16 12:49:10 +02:00
Joshua Ashton 699d56e35d [d3d11] Handle nullptr RasterizerState in ApplyRasterizerSampleCount
This broke as of a637134c56 is causing a crash in the BGFX d3d11 samples.
2022-09-16 11:40:36 +02:00
Joshua Ashton 3a6f8fa413 [d3d11] Assign ForcedSampleCount to correct value in ApplyRasterizerSampleCount
ForcedSampleCount was never being respected as it would always be replaced with 1 as it was being assigned to the wrong variable.

This was also probably causing a bunch of redundant CS work as it was changing state that was dirty checked.
2022-09-16 11:40:36 +02:00
Philip Rebohle 1c33d8be1f [dxgi] Fix return value of ChangeDisplayMode 2022-09-15 15:35:54 +02: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
Georg Lehmann 18a801de84 [dxso] Use a * (y - x) + x for lerp.
Fixes Alice: Madness Returns.
2022-09-13 23:10:11 +01:00
Rhys Perry 63ca34bb29 [dxbc] Fix forceVolatileTgsmAccess for stores
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
2022-09-13 21:41:59 +02:00