Commit Graph

1468 Commits

Author SHA1 Message Date
Henrik Rydgård
d90671e877 Add some comments. 2023-06-12 13:16:13 +02:00
Henrik Rydgård
186b0f105c Simplify the vertex cache ID handling 2023-06-12 13:16:13 +02:00
Henrik Rydgård
f54f905be5 Vulkan: Remove support for other index types than 16-bit.
We don't have any use for them anyway.
2023-05-30 10:15:34 +02:00
Henrik Rydgård
80e47b7bd3 Only dirty the uniform UVSCALEOFFSET when really needed
Broken out from #17479

With OpenGL, greatly reduces the amount of glUniform4fv calls in many games (and
similar in the other backends).
2023-05-25 15:00:57 +02:00
Henrik Rydgård
72cf531759 Bump shader cache version 2023-05-25 10:19:01 +02:00
Henrik Rydgård
7178c0cd42 Restore fragmentshader ID flags double and texalpha. Add a ubershader mode that uses dynamic state. 2023-05-25 10:19:01 +02:00
Henrik Rydgård
dfb446f89d Allow other backends than Vulkan to have GPU memory stats. Implement for GL. 2023-05-24 14:33:01 +02:00
Henrik Rydgård
f16f879b41 Some renaming to follow the standard of appending _ to member vars 2023-05-23 18:00:50 +02:00
Henrik Rydgård
d51d1413a3 DrawEngineCommon: Rename decoded to decoded_ 2023-05-23 16:46:43 +02:00
Henrik Rydgård
a4baed4c0c Minor GLPushBuffer cleanup (now same API as the VK one) 2023-05-23 08:41:09 +02:00
Henrik Rydgård
05b6bbdc56 Add a trivial profiling tool to the OpenGL backend - meaasure the time it takes to run a frame of commands.
Accessed from the in-game dev menu just like the Vulkan frame profiler.

With this we can easily see that actually submitting the GL commands is often the bottleneck on old
devices like a Galaxy S3.
2023-05-17 14:38:11 +02:00
Henrik Rydgård
9512bc6174 Don't cache render target copies for shader blending, only cache copies for overlap
Fixes #17451, while also keeping the Dante performance fix from #17032.

Of course, it's possible that something else could slow down now... But
hopefully not. This could also fix other problems.
2023-05-11 12:04:29 +02:00
Henrik Rydgård
b42670cf59 Manually revert the rest of the lmode optimization 2023-05-09 18:44:24 +02:00
Henrik Rydgård
f42c682d34 Revert "Merge pull request #16628 from hrydgard/remove-fog-fshader-flag"
This reverts commit 10dee90c83, reversing
changes made to 34c11c8acf.
2023-05-08 22:01:38 +02:00
Henrik Rydgård
14887d6b04 Bump shader cache version (should have done it in the release) 2023-05-06 16:15:32 +02:00
Henrik Rydgård
d56e27aa2c Let's have DispatchFlush check for drawcalls before calling DoFlush, too. 2023-05-03 23:49:41 +02:00
Henrik Rydgård
c9b7c815a1 ~GPU_Vulkan: Check that we still have a draw_ pointer before trying to drain the compile queue. 2023-05-03 22:33:34 +02:00
Henrik Rydgård
2cca0b265e Vulkan: Turn off the ubershader on T880, T860 and T830 on old driver versions. 2023-05-03 11:53:32 +02:00
Henrik Rydgård
97488c0a79 Vulkan: Before cleaning the shader managers, drain the shader compile queue.
Mainly paranoia, but might help with the mutex crash from #17364
2023-05-02 22:05:28 +02:00
Henrik Rydgård
16b243b007 Centralize allocation of vertex decode buffers 2023-04-24 12:11:58 +02:00
Henrik Rydgård
ccab375ddb
Merge pull request #17246 from hrydgard/i18n-indexing
I18N: Switch to getting categories by index instead of by string lookup
2023-04-08 09:20:51 +02:00
Henrik Rydgård
3616e0fb3c Revert "Turn off light ubershader generation on Broadcom GPUs."
See #16824

This reverts commit 1374fb040c.
2023-04-07 16:43:50 +02:00
Henrik Rydgård
ee6234ecb6 I18N: Switch to getting categories by index instead of by string lookup
Also gets rid of the shared_ptr usage, and generally makes things nicer.

Needed for later config refactorings, good to get in early.
2023-04-07 10:35:01 +02:00
Henrik Rydgård
3a69569580 Don't use inaccurate depth with Vulkan on any GPU except some special-cased Mali drivers.
Fixes #17044
2023-04-03 22:36:13 +02:00
Henrik Rydgård
1374fb040c Turn off light ubershader generation on Broadcom GPUs.
Attempt at working around #16824
2023-04-02 17:39:28 +02:00
Henrik Rydgård
5e6d181eb6 Vulkan: Disable framebuffer fetch (through input attachments) for now.
This is a conceptually cool trick that just doesn't seem to be worth
it, compared to the old approach of copy + blend-in-shader. I haven't
found any game that benefits more than absolutely minimally, and having
two paths to test isn't great, when the win is so small.

So I'm disabling it. I'm keeping the code for now, but might clear it
out later.

Fixes #17069
2023-04-01 23:07:32 +02:00
Henrik Rydgård
4e41233bb7 Replacement: Save textures even if already replaced, if the png is missing.
Fixes #17182

Not exactly sure what behavior we really want, but I think this one is
OK, and at least more similar to the old one. Now we save
already-replaced textures if the named replacement texture is missing, and there
isn't already a hash-named one in new or the "root".
2023-03-27 15:43:18 +02:00
Henrik Rydgård
b13c5c2d1b Add compat setting to force using maximum depth resolution
Fixes #17014

Even if our depth-testing-equal heuristic believes that the game needs
lower depth resolution.

This removes some depth-fighting artifacts (that are present on the real
PSP, but nice to avoid) in Outrun, Split/Second and Cars: Race-o-Rama -
essentially reverting these to the behavior we had before the heuristic.

(The heuristic is good though - it means less compat.ini hacks going in
the other direction).

In the case of Outrun, this relies on two passes that pass exactly the
same vertex coordinates twice resulting in the exact same final
geometry. This is actually guaranteed by the spec if the vertex math is
exactly the same and "invariant" is set on the position output, though
I guess you never know.. Haven't seen any issues at least.

Also sneak in disabling some validation messages from using extra Vulkan
validation layers other than the default.
2023-03-26 00:27:58 +01:00
Henrik Rydgård
d586ec0d5e Don't create Host objects except in headless/unittest 2023-03-25 10:47:01 +01:00
Henrik Rydgård
9e125eeba7 Remove NotifyUserMessage from Host 2023-03-25 10:32:09 +01:00
Henrik Rydgård
75bcb9b10c Some renaming, flag updates 2023-03-18 11:46:22 +01:00
Henrik Rydgård
5f76fbe1ad Implement padding-on-copy for compressed textures as well. 2023-03-17 14:00:14 +01:00
Henrik Rydgård
cf6cce0744 Remove scaleFactor from struct ReplacedTextureDecodeInfo, instead pass in both unscaled and scaled dimensions 2023-03-16 10:21:57 +01:00
Henrik Rydgård
f2a5a5abe7 Avoid input/output arguments in the texture scaler too 2023-03-16 10:14:41 +01:00
Henrik Rydgård
87a16b0386 Fix the stats 2023-03-15 10:19:00 +01:00
Henrik Rydgård
089b63c22f Address feedback, except the stats. 2023-03-15 10:09:39 +01:00
Henrik Rydgård
2ac74e3d37 Remove the PushBufferType enum 2023-03-15 09:59:00 +01:00
Henrik Rydgård
181ddf8266 Change the API of the old VulkanPushBuffer to match VulkanPushPool. 2023-03-15 09:56:32 +01:00
Henrik Rydgård
6d3a25e81f Tweak some sizes. 2023-03-15 01:25:03 +01:00
Henrik Rydgård
c8b25e50b0 Better debug vis for push pools 2023-03-15 01:25:03 +01:00
Henrik Rydgård
9fcd6d6612 Use thin3d's push pool in the draw engine too. 2023-03-15 01:25:03 +01:00
Henrik Rydgård
700b1cd6a7 More conversion to pushPool 2023-03-15 01:25:03 +01:00
Henrik Rydgård
3d372400e1 Start converting over to it 2023-03-15 01:25:03 +01:00
Henrik Rydgård
56d792f422 Sketch the new VulkanPushPool 2023-03-15 01:25:00 +01:00
Henrik Rydgård
effbe6376a Remove an unused VulkanPushBuffer.
Saves about 0.75MB of VRAM, but mainly just to clean things up.

I think I meant to use this one instead of grabbing the one from
DrawEngine in the TextureCache.
2023-03-14 23:39:47 +01:00
Henrik Rydgård
6d520d6d6b Vulkan: Enable mobile compressed formats too (oops) 2023-03-14 11:55:21 +01:00
Henrik Rydgård
91900eda7e Don't try to generate mips for compressed replacement images 2023-03-14 11:55:21 +01:00
Henrik Rydgård
2b1e87792f Vulkan: During texture upload, batch the buffer->image copies to do all the mips at once. 2023-03-14 10:11:19 +01:00
Henrik Rydgård
1860a73d58 Address feedback from previous PR 2023-03-12 23:15:09 +01:00
Henrik Rydgård
f88633b696 Add support for loading multiple mipmaps from DDS files. 2023-03-12 23:05:45 +01:00
Henrik Rydgård
6a84d96a3c Add actual support for DDS textures to the replacer. Vulkan only. 2023-03-11 11:34:28 +01:00
Henrik Rydgård
092bbf5eaa Fix saving of textures 2023-03-09 10:51:15 +01:00
Henrik Rydgård
bda09be109 Texture color format doesn't belong as a per-level property, that's not supported.
All levels of a texture must have the same format.
2023-03-09 00:10:46 +01:00
Henrik Rydgård
4ba2001479 Replacer: Make the cache data model texture-centric instead of level-centric 2023-03-09 00:10:46 +01:00
Henrik Rydgård
226197f30f Replace "none_" with nullptr. 2023-03-08 13:17:10 +01:00
Henrik Rydgård
3b39e9e068 Turn the VFS into a class, to be able to reuse it for other purposes. 2023-03-06 16:42:47 +01:00
Henrik Rydgård
cc9c01b1d0 Vulkan texture uploads: Take optimalBufferCopyRowPitchAlignment into account
Might marginally increase texture upload performance on some GPUs, but
mainly just the right thing to do.

For example, on Intel, this is 64.
2023-03-05 17:32:41 +01:00
Henrik Rydgård
ef4f17e998 Resurrect the Vulkan memory visualizer, but now it's global stats and pushbuffer stats. 2023-02-27 01:11:11 +01:00
Unknown W. Brackets
9e46a30c13 GPU: Correct some missing override specifiers. 2023-02-26 15:58:58 -08:00
Henrik Rydgård
b3ce31c61e Address feedback 2023-02-26 19:54:30 +01:00
Henrik Rydgård
72bed6f2b5 Some DeviceLost/DeviceRestore cleanup 2023-02-26 11:05:52 +01:00
Henrik Rydgård
3dc47c7fef Unify TextureCache ::StartFrame as much as possible.
Tiny optimization avoiding a Vulkan pool reset on most frames.
2023-02-25 23:20:41 +01:00
Henrik Rydgård
4c45f8a4b0 Pass in draw directly in GPUCommon::DeviceRestore, instead of awkwardly fetching it 2023-02-25 23:04:27 +01:00
Henrik Rydgård
af2fd7b038 Move Vulkan clear detection logic into DrawEngine like the other backends. 2023-02-25 19:23:07 +01:00
Henrik Rydgård
8fb75e0c12 Unify most of the DebugGetShader* functions 2023-02-25 16:42:09 +01:00
Henrik Rydgård
c2c479b217 Remove function InitClear. Was only implemented for DX9, and only barely meaningful in non-buffered. 2023-02-25 16:32:50 +01:00
Henrik Rydgård
8ba665e258 More unification work 2023-02-25 16:12:24 +01:00
Henrik Rydgård
c74f5b2189 Prepare for unifying more stuff 2023-02-25 16:01:32 +01:00
Henrik Rydgård
285ffbaa52 Unify CopyDisplayToOutput 2023-02-25 14:42:15 +01:00
Henrik Rydgård
18999c3687 Create the GPUCommonHW class. 2023-02-25 14:42:10 +01:00
Henrik Rydgård
0d57f3beee Unify GPUCommon::DoState. 2023-02-25 12:21:03 +01:00
Henrik Rydgård
609a8f6d36 Unify ExecuteOp between the accelerated backends 2023-02-25 12:21:03 +01:00
Henrik Rydgård
ed03348c65 Unify PreExecuteOp, keep the soft GPU as a special case 2023-02-25 12:21:03 +01:00
Henrik Rydgård
da561aa9de Unify CheckFlushOp 2023-02-25 12:21:03 +01:00
Henrik Rydgård
30120560ab Include file cleanup in framebuffer managers 2023-02-25 12:21:00 +01:00
Henrik Rydgård
1b5148bb6c Remove kinda-duplicate function. 2023-02-24 23:54:04 +01:00
Henrik Rydgård
d426ce5118 Clear depth buffers after changing depth rounding mode.
And thus change of depth buffer scale/offset.

Previously, old depth buffers with values that now are out of range
could stick around, causing #16941. This clears them to the expected 0
value, which helps Outrun. Ideally we should convert depth buffers to
the new format, but if we can get away without that, that's also nice.

This is enough for #16941.
2023-02-10 10:03:14 +01:00
Henrik Rydgård
d7605c6877 Use dedicated threads for the shader object creation. Bypasses the deadlock possibility. 2023-02-01 11:15:33 +01:00
Henrik Rydgård
6b0903f566 Add facility to run tasks on dedicated threads using the ThreadManager interface.
Useful for things that should be run ASAP even if the threadpool is full,
at a small extra cost. (Not recommended for very small tasks).

Considering using this to resolve the deadlocks in #16802.
2023-01-31 11:07:40 +01:00
Unknown W. Brackets
1c8bedbed9 Vulkan: Align for all Apple devices, not just M1. 2023-01-18 07:28:12 -08:00
Unknown W. Brackets
8d4007ce3f Vulkan: Force align verts to 4 on Apple devices. 2023-01-18 07:24:18 -08:00
Henrik Rydgård
784e8ab782 Fix a race condition during Vulkan shader cache load.
Could lead to unnecessary pipelines being created.
2023-01-13 10:35:04 +01:00
Henrik Rydgård
1cfc7b11b8 Only force indexed draws on PowerVR / Vulkan. 2023-01-11 22:59:30 +01:00
Henrik Rydgård
beed3c06d2 Vulkan: Don't use non-indexed draws for pure tristrips and fans, creates extra pipelines.
Bump shader cache version
2023-01-11 22:57:23 +01:00
Henrik Rydgård
3d376b0ab7 Remove the rather redundant DoTexture flag from vshaders.
Slightly reduces the number of unique vertex shaders but doesn't do much
for the pipeline count, as the fragment shader has a tex flag. Still
worth doing for the simplification.
2023-01-11 14:16:46 +01:00
Henrik Rydgård
088d0c39dc Remove the FS_TEXTURE_AT_OFFSET fragment shader flag 2023-01-10 12:37:21 +01:00
Henrik Rydgård
c7c48abb37 Switch the 2x flag to a uniform 2023-01-10 12:36:28 +01:00
Henrik Rydgård
d4ce134292 Shader generator: Move FS_TEX_ALPHA to a uniform bool.
Part of #16567
2023-01-10 09:42:54 +01:00
Henrik Rydgård
7672556e5c Better pipeline descriptions in shader viewer (shorter in overview, longer after click) 2023-01-09 11:22:35 +01:00
Henrik Rydgård
cf52324e9e Vulkan: Fix pipeline cache clearing.
Extracted from #16759 and bugfixed. Fixes a leak of Vulkan pipelines.

I guess another way would be to queue the variants for destruction at
the same time as we queue the callback, but I like this better.
2023-01-09 09:49:55 +01:00
Unknown W. Brackets
06045b9459 GLES: Cache equal flag, load from cache. 2023-01-05 18:24:29 -08:00
Unknown W. Brackets
de3c2783f4 Vulkan: Reload shaders if use flags change. 2023-01-05 18:24:29 -08:00
Unknown W. Brackets
23d254ec21 Vulkan: Clear items as they're loaded from cache.
It's possible we could hit a double insert assert since we're on a
background thread.
2023-01-05 18:24:29 -08:00
Unknown W. Brackets
3f20562b9f Vulkan: Store saw equal depth flag in cache. 2023-01-05 18:24:29 -08:00
Henrik Rydgård
13d07f6ff4 Bump shader cache version 2023-01-05 13:12:11 +01:00
Henrik Rydgård
85e6b4e592 Increment numFlushes near the other stat increments
Might be better for the cache, heh.
2023-01-04 17:10:56 +01:00
Henrik Rydgård
06d69e9953 Bump shader cache version 2023-01-04 11:10:38 +01:00
Henrik Rydgård
18d00b0718 Remove lmode flag bit from fragment and geometry shaders 2023-01-04 11:04:23 +01:00
Henrik Rydgård
10dee90c83
Merge pull request #16628 from hrydgard/remove-fog-fshader-flag
Make fog-enable driven by uniform instead of fragment shader flag bit
2023-01-04 11:01:19 +01:00
Henrik Rydgård
34c11c8acf
Merge pull request #16584 from hrydgard/vertex-format-vshader-id
Pass in the vertex decoder to the shader ID computation
2023-01-04 10:26:18 +01:00