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

5845 Commits

Author SHA1 Message Date
Blisto91
98fa338be0 [util] Move Far Cry 2 config to d3d9 section 2024-10-14 18:39:02 +02:00
Blisto91
b707ca1309 [util] Enable memoryTrackTest for Secret World Legends
Otherwise d3d9 mode thinks we only have 512MB vram which will lock the higher graphics presets.
2024-10-14 18:39:02 +02:00
Robin Kertels
f65897be4c [d3d9] Remove a few unnecessary bitmasks 2024-10-13 17:13:31 +02:00
Robin Kertels
421ead5b30 [d3d9] Only dirty frame buffer on render state changes if render area is impacted 2024-10-13 17:13:31 +02:00
WinterSnowfall
b99012d332 [d3d9] Adjust matrix inversion boundary 2024-10-13 11:09:13 +00:00
Blisto91
05d089bee5 [d3d9] Silence unhandled render state D3DRS_ADAPTIVETESS_Y 2024-10-13 12:31:14 +02:00
Philip Rebohle
458b8e3b41 [util] Add missing includes small_vector
Fixes #4357.
2024-10-13 12:29:12 +02:00
Philip Rebohle
693ee7898d [dxvk] Refactor queries to be properly ref-counted
Should fix a long-standing lifetime tracking issue with timestamp
queries as well as invalid Vulkan usage with overlapping scoped
queries.
2024-10-13 12:08:35 +02:00
Philip Rebohle
1b9c59c964 [dxvk] Refactor events to be properly ref-counted
Mostly serves as a proof-of-concept for the pending query rework,
but also cleans up some silly code.
2024-10-13 12:08:35 +02:00
Philip Rebohle
d00669cb52 [dxvk] Rename DxvkGpu{Event,Query} to Dxvk{Event,Query}
The old name only ever existed because DXVK had two separate implementations
of these prior to version 1.1. Let's name them back so that more sensible
names are available for internal use.
2024-10-13 12:08:35 +02:00
Robin Kertels
5890eae32f [d3d9] Don't clear mipGenBit if texture is bound as attachment 2024-10-13 12:07:30 +02:00
Robin Kertels
5ff365b9f1 [d3d9] Remove initializer context 2024-10-12 10:09:17 +02:00
WinterSnowfall
48c57c11e9 [d3d9] Make proper use of X/YHotSpot for software cursors 2024-10-11 12:40:37 +02:00
WinterSnowfall
44b682051b [d3d8] Stub DebugSetMute to fix C&C:Generals performance 2024-10-10 13:06:54 +02:00
WinterSnowfall
c8759418af [d3d9] Fix device reset handling when no cursor is set 2024-10-10 09:31:13 +02:00
Robin Kertels
d39d879838 [d3d9] Add a bunch of missing likely/unlikely to PrepareDraw
PrepareDraw is pretty much the hottest part of the d3d9
frontend, so we take every tiny bit we get.
2024-10-09 21:28:59 +00:00
Robin Kertels
395ac38890 [d3d9] Fix fixed function texture mask
Fixed function supports 8 textures so we need 8 ones.
2024-10-09 21:28:59 +00:00
WinterSnowfall
a1a3800b3f [d3d9] Fix software cursor reset and transitions 2024-10-08 20:20:31 +02:00
Philip Rebohle
a30fdc466b [d3d11] Remove initializer context
This moves all initialization commands to the CS thread and the regular
context in such a way that resource initialization is processed before
any context commands can use the resource.
2024-10-08 17:46:18 +02:00
Philip Rebohle
ac1dfbacb6 [dxvk] Move image initialization to init command buffer 2024-10-08 17:46:18 +02:00
Philip Rebohle
0f6f543583 [dxvk] Silence validation error about invalid shaders
Known validation bug that is already fixed upstream, but this makes
validation layers unusable due to how spammy that is.
2024-10-08 17:46:18 +02:00
Philip Rebohle
df60a061a4 [d3d11] Throttle resource uploads via UpdateSubresource
Otherwise, some games (e.g. Frostpunk, New World) end up allocating over
a gigabyte of staging memory.
2024-10-08 17:46:18 +02:00
Philip Rebohle
ec18dd7846 [d3d11] Throttle resource uploads through staging buffer 2024-10-08 17:46:18 +02:00
Philip Rebohle
d330718353 [dxvk] Implement staging buffer statistics 2024-10-08 17:46:18 +02:00
Philip Rebohle
e137f049ee [dxvk] Make buffer<->image copy format checks more robust
There are situations where the source format may not match
the image format but the copy is valid nonetheless.
2024-10-08 17:46:18 +02:00
Philip Rebohle
e6f90b8003 [dxvk] Remove legacy depth/stencil repacking code 2024-10-08 17:46:18 +02:00
Philip Rebohle
ad1f70beea [dxvk] Support format conversion in copyImageToBuffer 2024-10-08 17:46:18 +02:00
Philip Rebohle
f67c8dd1da [dxvk] Support format conversion in copyBufferToImage 2024-10-08 17:46:18 +02:00
Philip Rebohle
501b0991da [dxvk] Remove per-context staging buffer
No longer used.
2024-10-08 17:46:18 +02:00
Philip Rebohle
725a04b954 [dxvk,d3d11] Refactor uploadImage to consume a staging buffer
And also handle format differences.
2024-10-08 17:46:18 +02:00
Philip Rebohle
34e0f6952b [dxvk] Always enable depth-stencil usage for depth-stencil formats 2024-10-08 17:46:18 +02:00
Philip Rebohle
2fac69b7f9 [dxvk] Add pipelines for buffer-to-image and image-to-buffer copies 2024-10-08 17:46:18 +02:00
Philip Rebohle
15d5b69d2c [dxvk] Add new format conversion shaders
Intended to replace the old pack/unpack shaders.
2024-10-08 17:46:18 +02:00
Philip Rebohle
3c50ac1f12 [dxvk] Rename DxvkCopyBufferImage* stuff
Slightly misleadning name when we're going to introduce copies
between buffers and images.
2024-10-08 17:46:18 +02:00
Philip Rebohle
c92ee8ee07 [dxvk,d3d11] Refactor uploadBuffer to consume a staging buffer 2024-10-08 17:46:18 +02:00
Philip Rebohle
c27cae2f10 [d3d11] Improve per-context staging buffer handling
In D3D11, the staging buffer is only used for UpdateSubresource, which
isn't always used much. Reducing the size and freeing the buffer after
every submission avoids situations where system memory chunks are kept
alive by a single unused 4MB allocation.
2024-10-08 17:46:18 +02:00
Philip Rebohle
c614e537a9 [dxvk] Remove alignment parameter from staging buffers
Just align all suballocations to 256 bytes as usual.
2024-10-08 17:46:18 +02:00
WinterSnowfall
7eec8fb8dc [d3d8] Various logging format adjustments 2024-10-08 00:25:55 +02:00
WinterSnowfall
559398f6a4 [d3d9] Check block alignment on texture creation with DXT formats 2024-10-08 00:25:55 +02:00
WinterSnowfall
1689cacc47 [d3d8] Stub ValidatePixelShader and ValidateVertexShader 2024-10-08 00:25:55 +02:00
WinterSnowfall
66bd9ec4dd [d3d8] Always forward SetRenderTarget calls to D3D9 2024-10-08 00:25:55 +02:00
WinterSnowfall
8c54969552 [d3d8] Skip stride updates for null buffers in SetStreamSource 2024-10-08 00:25:55 +02:00
WinterSnowfall
088cf45439 [d3d9] Validate 0 valued back buffer dimensions for fullscreen mode 2024-10-08 00:25:55 +02:00
WinterSnowfall
6e0c048b88 [d3d9] Return D3DERR_DEVICELOST on reset failure due to losable resources 2024-10-08 00:25:55 +02:00
WinterSnowfall
912a530d1c [d3d9] Enforce various CheckDeviceMultiSampleType validations 2024-10-08 00:25:55 +02:00
WinterSnowfall
eae12e6f23 [d3d8] Cache all back buffers for additional swapchains 2024-10-08 00:25:55 +02:00
WinterSnowfall
bc78fc6ed0 [d3d8] Validate D3D8 present params before conversion 2024-10-08 00:25:55 +02:00
WinterSnowfall
4a8ba388ff [d3d8] Validate CheckDeviceType windowed calls similarly to fullscreen 2024-10-08 00:25:55 +02:00
WinterSnowfall
653559979c [d3d8] Fix LookupSubresource texture type typo 2024-10-08 00:25:55 +02:00
Philip Rebohle
7935f3934f [dxvk] Sanitize sampler LOD range
Silences a validation error in Dishonored 2. At least on AMD,
MinLOD takes precedence over MaxLOD, so let's do the same.
2024-10-07 19:34:02 +02:00
Philip Rebohle
571a2d5811 [dxvk] Tweak staging memory allocation behaviour 2024-10-07 13:32:46 +02:00
Philip Rebohle
813524c146 [d3d11] Remove texel buffer path for ClearUAV
Instead, recreate the image with the given view format as
necessary. Most of the time we will not actually need this.
2024-10-06 08:47:42 +02:00
Philip Rebohle
851f02fa58 [dxvk] Actually apply new create flags when relocating image
Fixes a derp that leads to validation errors when adding view formats.
2024-10-06 08:47:42 +02:00
WinterSnowfall
36907ec01c [d3d8] Adjust shader handles to skip 0x0001 2024-10-05 20:03:05 +02:00
WinterSnowfall
980a8d185c [d3d9] Use D24X8 for D3DFMT_UNKNOWN depth stencils 2024-10-05 20:03:05 +02:00
WinterSnowfall
4f90ad46b9 [d3d8] Validate D3D9 auto depth stencil query 2024-10-05 20:03:05 +02:00
WinterSnowfall
1675aea857 [d3d8] CopyRects validation tweaks 2024-10-05 20:03:05 +02:00
WinterSnowfall
b13b875ca6 [d3d8] Rework D3D8 device GetInfo implementation 2024-10-05 20:03:05 +02:00
WinterSnowfall
bbe82aa534 [d3d9] Fix (most) cursor-related Wine tests 2024-10-05 18:27:19 +02:00
WinterSnowfall
7ff5321910 [d3d9] Implement a software cursor 2024-10-05 18:27:19 +02:00
WinterSnowfall
87a7882812 [d3d8] Automatically capture state on state block creation 2024-10-05 17:58:04 +02:00
WinterSnowfall
050886d08a [d3d8] Capture VB stream state in D3D8 state blocks 2024-10-05 17:58:04 +02:00
WinterSnowfall
9d19fa18a7 [d3d9] Set D3DRS_POINTSIZE_MIN to 0.0f in D3D8 compatibility mode 2024-10-05 17:58:04 +02:00
Philip Rebohle
329d9a0bb2 [dxvk] Add support for drawing a software cursor 2024-10-04 19:10:14 +02:00
Philip Rebohle
4420c39b62 [dxvk] Factor out swapchain blitter texture uploads 2024-10-04 19:10:14 +02:00
Philip Rebohle
dbaa4d8df4 [dxvk] Add blending toggle to swap chain blitter pipelines 2024-10-04 19:10:14 +02:00
Philip Rebohle
836e990dc5 [dxvk] Correctly use VK_SHARING_MODE_CONCURRENT for buffers
Fixes some out-of-spec behaviour introduced with the global buffer rework.
2024-10-04 18:49:23 +02:00
Philip Rebohle
a278d6bf1d [d3d11] Implement sequential swap effects 2024-10-04 12:58:55 +02:00
Philip Rebohle
c9ec2eeab2 [dxvk] Ensure image is in correct layout for invalidation
Otherwise, layout tracking might track a dead image and get confused.
2024-10-04 12:58:55 +02:00
Philip Rebohle
2af3fde5f2 [d3d9] Remove additional swap chain context 2024-10-04 12:58:55 +02:00
Philip Rebohle
172d3450d1 [d3d11] Rename EmitCsChunkExternal for consistency 2024-10-04 12:58:55 +02:00
Philip Rebohle
c678e8c803 [d3d11] Remove additional swap chain context
Do everything on the main context instead. Also only
present once regardless of sync interval.
2024-10-04 12:58:55 +02:00
Philip Rebohle
129efdaba6 [d3d11] Do not use separate context to initialize back buffers 2024-10-04 12:58:55 +02:00
Philip Rebohle
89ebabd8fd [dxgi] Enable frame rate limit for SyncInterval > 1 in windowed mode 2024-10-04 12:58:55 +02:00
Philip Rebohle
bf9dfc77ce [dxvk] Add context method for WSI synchronization
Mostly convenience, but we do want to get rid of Begin/EndRecording
at some point.
2024-10-04 12:58:55 +02:00
Philip Rebohle
63b200f08d [dxvk] Reimplement HUD rendering to use Vulkan directly
And change how rendering works in general so that we emit fewer
draw calls.
2024-10-04 12:58:55 +02:00
Philip Rebohle
b35c0bce4f [dxvk] Always enable multiDrawIndirect and shaderDrawParameters features 2024-10-04 12:58:55 +02:00
Philip Rebohle
46f10c8fd5 [dxvk] Add command list parameter to dispatch-related functions 2024-10-04 12:58:55 +02:00
Philip Rebohle
7d31a7f16f [dxvk] Add command list parameter to some query-related functions
And reintroduce cmdResetQueryPool.
2024-10-04 12:58:55 +02:00
Philip Rebohle
4ce200bcae [dxvk] Add command list parameter to cmdBindDescriptorSet(s) 2024-10-04 12:58:55 +02:00
Philip Rebohle
aa162365ce [dxvk] Add command list parameter to cmdPushConstants
We want to be able to invoke compute shaders during init commands.
2024-10-04 12:58:55 +02:00
Philip Rebohle
207e15eb24 [dxvk] Refactor swap chain blitter to use plain Vulkan
Temporarily disable the HUD until that is refactored too.
2024-10-04 12:58:55 +02:00
Philip Rebohle
1c06431e18 [dxvk] Add method to use a context's command list directly
Also provide the descriptor pool for convenience.
2024-10-04 12:58:55 +02:00
Philip Rebohle
09284988ff [hud] Show memory used percentage relative to budget 2024-10-03 23:47:56 +02:00
Philip Rebohle
0c49e30882 [dxvk] Add memory budget to memory stats 2024-10-03 23:47:56 +02:00
Philip Rebohle
513312885e [dxvk] Use actual memory budget if provided by the implementation
For now, this is only used for the heuristic on when to aggressively
free empty chunks and replaces the 80% heap size heuristic.

Periodically updates the memory budget from the worker thread.
2024-10-03 23:47:56 +02:00
Robin Kertels
7d05a99640 [d3d9] Fix StretchRect fast-path resolve 2024-10-03 00:06:51 +02:00
Robin Kertels
4807af01ad [d3d9] Resolve whole image in StretchRect
Fixes a validation error in Sims 4.
2024-10-02 20:22:37 +02:00
Philip Rebohle
1443e22626 [d3d11] Fix derp with anisotropy option
Fixes #4313.
2024-10-02 11:02:06 +02:00
Philip Rebohle
90b036f550 [dxvk] Fix undefined behaviour move 2024-09-30 17:44:45 +02:00
WinterSnowfall
a5e3f29074 [dxvk] Fix HUD memory chunk colors on UMA 2024-09-30 14:28:44 +02:00
Philip Rebohle
e83446f5c9 [d3d11] Fix remaining synchronization issues with CUDA interop 2024-09-30 10:29:27 +02:00
Philip Rebohle
c26c21edb4 [d3d11] Lock buffers in place when used with CUDA interop 2024-09-30 10:29:27 +02:00
Philip Rebohle
11f8dc0818 [dxvk] Add functions to lock in and query GPU buffer addresses 2024-09-30 10:29:27 +02:00
Philip Rebohle
9f0bd8e17f [d3d11] Lock textures in place when used with CUDA interop
Prevents images from being relocated by the backend.
2024-09-30 10:29:27 +02:00
Philip Rebohle
c59d6bd12c [dxvk] Add flag to ensure stable image GPU addresses 2024-09-30 10:29:27 +02:00
Philip Rebohle
438a08f87c [d3d11] Add functions to emit externally generated CS chunks 2024-09-30 10:29:27 +02:00
Philip Rebohle
abd888a0bb [dxvk] Clean up check whether buffer can be relocated 2024-09-30 10:29:27 +02:00
Philip Rebohle
b164d6e2a7 [d3d9] Do not proactively enable meta copy usage flags
Same as the corresponding D3D11 change, let the backend deal with this
when necessary.
2024-09-30 10:29:27 +02:00
Philip Rebohle
5f3fa9e423 [d3d11] Do not proactively enable meta copy usage flags
Instead, let the backend deal with this and recreate the image as necessary.
2024-09-30 10:29:27 +02:00
Philip Rebohle
2fa773e791 [dxvk] Bump maximum sampler count to 4000
All sampler allocations go through the pool now, so we can do this.
2024-09-30 10:29:27 +02:00
Philip Rebohle
150c40280f [dxvk] Get rid of internal blit samplers 2024-09-30 10:29:27 +02:00
Philip Rebohle
67d1285b08 [dxvk] Refactor meta blits 2024-09-30 10:29:27 +02:00
Philip Rebohle
58dab7e8c6 [dxvk] Refactor mip generation 2024-09-30 10:29:27 +02:00
Philip Rebohle
8c67af680c [dxvk] Refactor meta resolves 2024-09-30 10:29:27 +02:00
Philip Rebohle
2c176f4950 [dxvk] Refactor meta image copies 2024-09-30 10:29:27 +02:00
Philip Rebohle
ae90e74a5a [dxvk] Introduce concept of transfer-only views 2024-09-30 10:29:27 +02:00
Philip Rebohle
fd439c3e54 [dxvk] Ensure image compatibility for packed depth-stencil copies 2024-09-30 10:29:27 +02:00
Philip Rebohle
56a07b5bd0 [dxvk] Add function to recreate image views with guaranteed compatibility 2024-09-30 10:29:27 +02:00
Philip Rebohle
bfbb7987b2 [dxvk] Add functions to recreate images with additional usage info
Useful when we don't know in advance which usage flags are required
and don't want to set them preemptively for performance reasons.
2024-09-30 10:29:27 +02:00
Philip Rebohle
53f14e2914 [dxvk] Add functions to move resources to a different allocation
Basically a batched copy to use when one or more resources are being
recreated for any reason.
2024-09-30 10:29:27 +02:00
Philip Rebohle
ae3a9f595e [dxvk] Allow larger chunks on small heaps
Effectively doubles the size of HVV chunks to 32 MiB on systems that
do not have ReBAR enabled. 16 MiB is too small for some use cases.
2024-09-29 22:07:30 +02:00
Philip Rebohle
e6f89062f5 [d3d9] Ensure that we stay below the maximum sampler count 2024-09-28 20:21:06 +02:00
Philip Rebohle
07dfeeb319 [d3d9] Move building sampler key to CS thread
All this bit twiddling is a bit slow. Introduces another structure
containing a minimal amount of sampler parameters taken from the
raw D3D9 state.
2024-09-28 20:21:06 +02:00
Philip Rebohle
543b5c7af8 [d3d9] Optimize sampler state decoding
This code is rather hot now, so make sure it's fast.
2024-09-28 20:21:06 +02:00
Philip Rebohle
c7dab6a442 [d3d9] Remove internal sampler pool
We have a sampler pool in the backend now, let's use it.
2024-09-28 20:21:06 +02:00
Philip Rebohle
707ddd63a1 [dxvk] Add stat counter for samplers 2024-09-28 20:21:06 +02:00
Philip Rebohle
4635397bb1 [dxvk] Implement sampler pool
Deduplicates redundant sampler objects and makes sampler creation
as well as lifetime tracking a bit more efficient.
2024-09-28 20:21:06 +02:00
Philip Rebohle
5f9f43e658 [util] Add helpers to encode or decode fixed-point numbers 2024-09-28 20:21:06 +02:00
Philip Rebohle
b4e69dce76 [dxvk] Remove DxvkImageViewCreateInfo 2024-09-28 01:50:23 +02:00
Philip Rebohle
8195bea63e [dxvk] Remove DxvkBufferViewCreateInfo
Use the new key struct directly to avoid unnecessary struct conversion.
2024-09-28 01:21:07 +02:00
Philip Rebohle
b0d0959329 [dxvk] Remove DxvkDataBuffer
Unused.
2024-09-28 01:06:57 +02:00
Philip Rebohle
1cefe90ce7 [d3d11] Don't use data buffer for small buffer updates
Embed an array instead and lower the size threshold.
2024-09-28 01:05:40 +02:00
Philip Rebohle
01a7457a6f [dxvk] Remove createImageView function
Use the image's method instead, like we already do for buffers.
2024-09-28 00:03:56 +02:00
Paul Gofman
a172cab34f [dxgi] Delay qualifying foreground loss as occlusion 2024-09-27 18:15:24 +02:00
Philip Rebohle
4ed50ec6be [d3d9] Fix UP buffer allocation 2024-09-27 12:55:59 +02:00
Philip Rebohle
78f5136fde [dxvk] Fix image view swizzling 2024-09-26 17:42:02 +02:00
Philip Rebohle
5e5c283149 [d3d11] Always use fast MAP_WRITE_DISCARD path on deferred contexts
... but keep the SingleUse option as-is anyway because games do not release
their command lists after submission and end up wasting massive amounts of
memory.
2024-09-26 17:37:50 +02:00
Philip Rebohle
39f50999a3 [d3d11] Cache raw mapped pointer rather than allocation object
Reduces ref counting overhead again and matches previous behaviour.

We should probably do something about the possible case of deferred context
execution with MAP_WRITE_DISCARD followed by MAP_WRITE_NO_OVERWRITE on the
immediate context, but we haven't seen a game rely on this yet.
2024-09-26 17:37:50 +02:00
Philip Rebohle
50878f2846 [dxvk] Add function to invalidate images 2024-09-26 17:37:50 +02:00
Philip Rebohle
347925c8b7 [dxvk] Remove legacy DxvkMemory class 2024-09-26 17:37:50 +02:00
Philip Rebohle
25076d9220 [dxvk] Rework image view creation 2024-09-26 17:37:50 +02:00
Philip Rebohle
713b76bea5 [dxvk] Rework image creation
Uses DxvkResourceAllocation to manage image backing storage,
which will allow invalidating images in the future.
2024-09-26 17:37:50 +02:00
Philip Rebohle
d7e1794e29 [dxvk] Add function to import existing Vulkan image 2024-09-26 17:37:50 +02:00
Philip Rebohle
eec4f0fb35 [dxvk] Implement sparse image creation in allocator 2024-09-26 17:37:50 +02:00
Philip Rebohle
bcd12a5b56 [dxvk] Refactor sparse page table initialization for images 2024-09-26 17:37:50 +02:00
Philip Rebohle
0f23a17d8f [dxvk] Refactor sparse page allocation
Uses the new allocator directly.
2024-09-26 17:37:50 +02:00
Philip Rebohle
af4a2f7973 [dxvk] Introduce DxvkResourceMemoryInfo
And replace the old sparse thing.
2024-09-26 17:37:50 +02:00
Philip Rebohle
bbd2461c8f [dxvk] Reimplement sparse buffer support 2024-09-26 17:37:50 +02:00
Philip Rebohle
1ba6b81901 [dxvk] Reimplement imported buffers 2024-09-26 17:37:50 +02:00
Philip Rebohle
5263307c4a [dxvk] Improve lifetime tracking logic
Reduces ref counting overhead on the CS thread a bit.
2024-09-26 17:37:50 +02:00
Philip Rebohle
7ac9918b39 [hud] Add cache statistics to detailed memory item 2024-09-26 17:37:50 +02:00
Philip Rebohle
9cf72b5b19 [dxvk] Implement basic pool balancing for shared allocation cache
This makes the entire cache available to all allocation sizes rather than
having fixed-size pools for every allocation size. Improves hit rate in
games that primarily use one constant buffer size.
2024-09-26 17:37:50 +02:00
Philip Rebohle
428b1087a0 [dxvk] Implement shared cache statistics 2024-09-26 17:37:50 +02:00
Philip Rebohle
2722a41675 [dxvk] Implement shared allocation cache
Allows refilling local caches in constant time.
2024-09-26 17:37:50 +02:00
Philip Rebohle
9a51849920 [d3d11] Use allocation cache for dynamic buffers 2024-09-26 17:37:50 +02:00
Philip Rebohle
4db0007af3 [dxvk] Implement local allocation cache 2024-09-26 17:37:50 +02:00
Philip Rebohle
93547aec8d [dxvk] Do not track buffer view objects
No longer necessary as they have the same lifetime as the
parent buffer now. Only track the buffers themselves.
2024-09-26 17:37:50 +02:00
Philip Rebohle
088ba404a6 [dxvk] Rework buffer view creation 2024-09-26 17:37:50 +02:00
Philip Rebohle
1fd3c8040d [dxvk] Remove DxvkBufferAllocation 2024-09-26 17:37:50 +02:00
Philip Rebohle
14990dbb49 [dxvk] Rework buffer slice allocation
Temporary solution that hits the allocator on every single invalidation,
which isn't great but will do for now.
2024-09-26 17:37:50 +02:00
Philip Rebohle
ec2f43e5e3 [dxvk] Make DxvkResource manage its own destruction
Necessary for actual resource refactors. We want view objects
to use the resource's reference count wehenever possible.
2024-09-26 17:37:50 +02:00
Philip Rebohle
10164fdf4d [dxvk] Store GPU address for allocated chunk memory 2024-09-26 17:37:50 +02:00
Philip Rebohle
51649f6da6 [dxvk] Add function to create image resource 2024-09-26 17:37:50 +02:00
Philip Rebohle
5813e7c031 [dxvk] Add function to create buffer resource 2024-09-26 17:37:50 +02:00
Philip Rebohle
00f7545d15 [dxvk] Add helper to get memory type mask for buffer usage 2024-09-26 17:37:50 +02:00
Philip Rebohle
e80dd6db5f [dxvk] Cache memory type mask with global buffer support 2024-09-26 17:37:50 +02:00
Philip Rebohle
3bee390d91 [dxvk] Don't log memory errors prematurely
Fallback allocations are a thing.
2024-09-26 17:37:50 +02:00
Philip Rebohle
f36a536288 [dxvk] Use DxvkResourceAllocation internally
Changes DxvkMemory to be nothing more than a wrapper.
2024-09-26 17:37:50 +02:00
Philip Rebohle
5dd7a29261 [dxvk] Introduce DxvkResourceAllocation 2024-09-26 17:37:50 +02:00
Philip Rebohle
4064c89e8c [dxvk] Remove legacy buffer renaming interface 2024-09-26 17:37:50 +02:00
Philip Rebohle
6f6e75b4b8 [d3d9] Use DxvkBufferAllocation where appropriate 2024-09-26 17:37:50 +02:00
Philip Rebohle
8e45a60542 [d3d11] Use DxvkBufferAllocation where appropriate 2024-09-26 17:37:50 +02:00
Philip Rebohle
eae66201f6 [dxvk] Use DxvkBufferAllocation for HUD rendering 2024-09-26 17:37:50 +02:00
Philip Rebohle
75dadf2c1c [dxvk] Use DxvkBufferAllocation in swap chain blitter 2024-09-26 17:37:50 +02:00
Philip Rebohle
5c2f56c9cc [dxvk] Introduce DxvkBufferAllocation
For now, this is merely a wrapper around the existing buffer slice
struct in order to allow easier refactoring.
2024-09-26 17:37:50 +02:00
Philip Rebohle
d0832f8431 [vulkan] Move stage and access mask definitions to header 2024-09-26 17:37:50 +02:00
Philip Rebohle
7ec75aaf81 [util] Make likely/unlikely less annoying to use 2024-09-26 17:37:50 +02:00
Philip Rebohle
888906a6da [util] Add some functionality to smart pointer
Basically lets us deal with objects that manage their own destruction,
which ideally shold be all of them at some point.

Also adds some missing comparison operators.
2024-09-26 17:37:50 +02:00
Philip Rebohle
06baa48c2b [dxvk] Align allocation size to create global buffer 2024-09-26 13:13:48 +02:00
Philip Rebohle
401ca41091 [dxvk] Do not always keep an empty chunk around
Outdated thinking, we have a 20 second timer on this which should
be more than enough to ensure we're not spamming device memory
allocations.
2024-09-26 13:13:48 +02:00
Philip Rebohle
3cd7e3efb5 [dxvk] Tweak memory allocation behaviour on mapped memory types 2024-09-26 13:13:48 +02:00
Philip Rebohle
5c8728abd2 [hud] Use different colors to highlight mapped or non-mapped allocations
Useful on UMA systems or when we have to fall back to system memory.
2024-09-26 13:13:48 +02:00
Philip Rebohle
d00ca261af [dxvk] Use worker to update adapter's memory statistics
Takes a bunch of pointer indirections and atomics off the hot path.
2024-09-26 13:13:48 +02:00
Philip Rebohle
27088beea8 [dxvk] Use worker thread to periodically free unused memory
System memory allocations typically peak very high while loading, but
just sit there unused afterwards. This allows us to free them based
on when they have last been used.

Works well in practice since best-fit avoids using empty chunks as much
as possible.
2024-09-26 13:13:48 +02:00
Philip Rebohle
e1fd2bff2c [dxvk] Rewrite memory allocator
Uses a single allocator pair per memory type in order to make memory
allocations on the entire memory pool faster, and further reduce
fragmentation by applying the best fit strategy to the whole memory
pool.
2024-09-26 13:13:48 +02:00
Philip Rebohle
3a4dadb528 [dxvk] Add chunk concept to page allocator
This allows the allocator to operate on the entire allocated memory pool.
2024-09-26 13:13:48 +02:00
Philip Rebohle
266b99ad8d [hud] Add HUD item to visualize memory chunk allocation 2024-09-26 13:13:48 +02:00
Philip Rebohle
f679d7d90f [dxvk] Add detailed allocation statistics 2024-09-26 13:13:48 +02:00
Philip Rebohle
b46ef2ceff [dxvk] Move memory statistics from memory types to heaps 2024-09-26 13:13:48 +02:00
Philip Rebohle
35fea6475d [dxvk] Tune small buffer allocation sizes
The pool allocator works on powers of two, so buffers should too.
2024-09-26 13:13:48 +02:00
Philip Rebohle
3faa1a76da [dxvk] Simplify memory chunk allocation
Reduces overall waste of memory by reusing already allocated
chunks more aggressively.
2024-09-26 13:13:48 +02:00
Philip Rebohle
661385584a [dxvk] Use new allocators for chunk suballocation 2024-09-26 13:13:48 +02:00
Philip Rebohle
5efaa06c61 [dxvk] Add new page allocator implementation 2024-09-26 13:13:48 +02:00
Philip Rebohle
1eec969448 [util] Add 64-bit lzcnt 2024-09-26 13:13:48 +02:00
Philip Rebohle
15365f2d82 [d3d11] Synchronize shared texture initialization 2024-09-26 08:21:43 +02:00
WinterSnowfall
97091aad39 [util] Enable legacy DISCARD for Rayman 3 2024-09-26 06:48:13 +02:00
WinterSnowfall
a7b3b1e3a4 [d3d8] Add an option to respect DISCARD only for dynamic write-only buffers 2024-09-26 06:48:13 +02:00
WinterSnowfall
4fad20d77c [d3d8] Relax viewport validation in windowed mode 2024-09-25 20:46:48 +02:00
琴梨梨OvO
bb6d1b3b4c [util]Add support for Time Leap Paradise 2024-09-25 19:54:24 +02:00
Robin Kertels
f5ca3cf5df [d3d9] ResolveZ: Only copy aspects that both images support 2024-09-25 00:32:13 +01:00
Robin Kertels
d7c2e3ac76 [d3d9] Use correct aspect mask when blitting depth stencil textures
We don't want to blit stencil when the D3D9 format doesn't have
stencil.
2024-09-25 00:32:13 +01:00
Robin Kertels
ca3aa2014b [d3d9] Improve comment about synchronization with ProcessVertices 2024-09-22 22:53:55 +02:00
Robin Kertels
1d49f247ac [d3d9] Remove incorrect early-exit
The same texture could be bound to
multiple slots and if the shader doesn't
use the lower index texture, we'd never
end up uploading it.
2024-09-22 22:53:55 +02:00
Robin Kertels
ef8bad33a5 [d3d9] Optimize late buffer uploads
... similar to what we're doing for textures.
2024-09-22 22:53:55 +02:00
Blisto91
5a08b3c451 [util] Cap fps for F.E.A.R 1 & expansions
Visual glitches can occur at very high fps
2024-09-22 21:07:08 +02:00
Robin Kertels
04ad98690b [d3d9] Add SWVP HUD item 2024-09-22 21:03:23 +02:00
Robin Kertels
033104f335 [d3d9] Cleanup buffer memory flag selection 2024-09-22 21:03:23 +02:00
Robin Kertels
5bb8d09a96 [d3d9] Always use per-draw buffer uploads on pure SWVP devices 2024-09-22 21:03:23 +02:00
WinterSnowfall
97fb6e4f6d [d3d9] Clean up supported formats from GetUnsupportedFormatInfo 2024-09-22 20:51:15 +02:00