Commit Graph

48 Commits

Author SHA1 Message Date
Admiral H. Curtiss 3bcd7aced9
Merge pull request #8467 from CookiePLMonster/interruptable-shader-precompile
Make shader precompilation interruptable
2022-07-02 13:08:37 +02:00
TellowKrinkle f79ac768d8 VideoCommon:ShaderCache: Add const to some local variables 2022-06-17 20:14:32 -05:00
TellowKrinkle c7892d7371 VideoCommon: Name ubershaders 2022-06-16 02:08:45 -05:00
TellowKrinkle 23c1721fbd VideoCommon: Reduce duplicates of non-palette-requiring texture decode shaders 2022-06-16 02:08:45 -05:00
Silent 7faf5ea170
Clear the UI after async shader compilation 2022-06-10 17:19:59 +02:00
Silent dcad3ec892
Allow to interrupt shader precompilation by stopping emulation 2022-06-10 17:11:32 +02:00
Admiral H. Curtiss 36cfcb530f
IOFile: Make origin parameter to Seek() an enum class. 2022-01-29 06:49:21 +01:00
Pokechu22 afd02b79a5 VideoCommon: Add names for textures and shaders 2022-01-01 11:38:56 -08:00
JMC47 b1f79d9ecf
Merge pull request #10215 from OatmealDome/shader-logic-ops
VideoCommon: Support shader logic ops on Metal (Apple GPUs) and OpenGL ES
2021-12-22 16:39:54 -05:00
Pokechu22 27cb704466 Eliminate VarType for ComponentFormat 2021-12-18 15:21:48 -08:00
OatmealDome 426c68b5a0 ShaderCache: Don't turn on logic ops approximation if framebuffer fetch is supported 2021-12-06 22:36:40 -05:00
Pokechu22 db54e4f2b0 Externals: Update imgui to 1.85 2021-10-26 15:07:57 -07:00
Pokechu22 eb81968fe6 Convert ShaderHostConfig to BitField 2021-07-28 21:35:36 -07:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Pokechu22 70f9fc4e75 Convert BPMemory to BitField and enum class
Additional changes:
- For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare.  (Shift has also been renamed to scale)
- In TexMode0, min_filter has been split into min_mip and min_filter.
- In TexImage1, image_type is now cache_manually_managed.
- The unused bit in GenMode is now exposed.
- LPSize's lineaspect is now named adjust_for_aspect_ratio.
2021-03-06 19:27:19 -08:00
Léo Lam eafe005672
Fix -Wclass-memaccess warnings
We want to clear/memset the padding bytes, not just each member,
so using assignment or {} initialization is not an option.

To silence the warnings, cast the object pointer to u8* (which is not
undefined behavior) to make it explicit to the compiler that we want
to fill the object representation.
2020-12-16 15:37:43 +01:00
Lioncash 3d9b2aa005 VideoCommon: Migrate over to fmt
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05:00
Lioncash 86f8768268 VideoCommon/ShaderGenCommon: Make template functions regular functions
These are only ever used with ShaderCode instances and nothing else.
Given that, we can convert these helper functions to expect that type of
object as an argument and remove the need for templates, improving
compiler throughput a marginal amount, as the template instantiation
process doesn't need to be performed.

We can also move the definitions of these functions into the cpp file,
which allows us to remove a few inclusions from the ShaderGenCommon
header. This uncovered a few instances of indirect inclusions being
relied upon in other source files.

One other benefit is this allows changes to be made to the definitions
of the functions without needing to recompile all translation units that
make use of these functions, making change testing a little quicker.

Moving the definitions into the cpp file also allows us to completely
hide DefineOutputMember() from external view, given it's only ever used
inside of GenerateVSOutputMembers().
2020-05-25 21:12:29 -04:00
Lioncash aa77dff3a2 VideoCommon/TextureConversionShader: Convert over to using ShaderCode
Migrates the shader generator off the use of a global array, eliminating
the use of some global state. This also allows us to move the shader
generation over to using fmt in a subsequent change.
2020-01-23 14:19:36 -05:00
Stenzek 135f0a1385 ShaderCache: EFB2RAM pipelines should not use a geometry shader
Only the left eye is used when creating the RAM copy.
2019-10-01 11:44:31 +10:00
Stenzek c989e5c50c ShaderCache: Recompile shared pipelines on shader cache reload
Fixes broken stereoscopy when switching on/off at runtime.
2019-10-01 11:43:02 +10:00
Stenzek f6f9dc0cac RenderState: Approximate logic op with blending if unsupported
This is a giant hack which was previously removed because it causes
broken rendering. However, it seems that some devices still do not
support logical operations (looking at you, Adreno/Mali). Therefore, for
a handful of cases where the hack actually makes things slightly better,
we can use it.

... but not without spamming the log with warnings. With my warning
message PR, we can inform the users before emulation starts anyway.
2019-08-04 14:06:08 +10:00
Stenzek 946571b759 TextureCache: Support reinterpreting formats for VRAM textures 2019-07-14 19:16:27 +10:00
Lioncash d4337eebde VideoCommon/Statistics: Rename stats global to g_stats
Makes the global variable follow our convention of prefixing g_ on
global variables to make it obvious in surrounding code that it's not a
local variable.
2019-07-10 23:34:54 -04:00
Lioncash a99c7d01e1 VideoCommon/Statistics: Normalize statistic variable names
Normalizes all variables related to statistics so that they follow our
coding style.

These are relatively low traffic areas, so this modification isn't too
noisy.
2019-07-10 23:19:10 -04:00
Lioncash 4f1f55093f Common/MsgHandler: Namespace code within the Common namespace
Closes another gap in the Common library where code isn't being
namespaced under it.
2019-06-19 16:03:55 -04:00
Lioncash e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00
Stenzek 9577d0641b ShaderCache: Fix crash at shutdown on shared shader compilation fail 2019-04-21 14:28:14 +10:00
Stenzek c6b45c5ca9 ShaderCache: Fix crash if pipeline from uid cache fails creation 2019-04-20 23:16:29 +10:00
Stenzek 00b83b4196 ShaderCache: Utilize pipeline cache data where possible 2019-04-16 00:39:43 +10:00
Stenzek 61a656570e AbstractPipeline: Support returning "cache data"
"Cache data" can be used to assist a driver with creating pipelines by
using previously-compiled shader ISA.
2019-04-16 00:09:47 +10:00
Stenzek e9cfcf4632 ShaderCache: Don't create invalid logic op pipelines
uint_output will never be set unless logic ops are enabled. Also clears
the bits so we're not compiling unused pixel shaders on the other
backends.
2019-03-28 20:35:02 +10:00
Stenzek 5732769a3c ShaderCache: Set correct primitive in dummy ubershader pipelines 2019-03-28 20:35:02 +10:00
Stenzek f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
Stenzek 78588ce79d ShaderCache: Use imgui for shader compilation dialog 2019-01-25 11:15:57 +10:00
Stenzek c2fab7f016 ShaderCache: Don't create or load shader cache with Null backend 2018-10-14 20:03:57 +10:00
Stenzek 3323265d91 FramebufferManager: Dynamic selection of EFB depth format 2018-07-19 21:47:42 +10:00
Stenzek 9a5c2119e5 ShaderCache: Remove unused UID bits before inserting into shader map 2018-05-26 00:09:10 +10:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Stenzek 8587403e0e ShaderCache: Write currently-known UIDs to cache when re-creating file
This way, if we load a UID cache where the data was incomplete (e.g.
Dolphin crashed), we don't lose the existing UIDs which were previously
at the beginning.
2018-04-02 01:13:24 +10:00
Stenzek 36ea2f7a26 ShaderCache: Fix issue where shader cache wasn't recreated when invalid 2018-04-02 01:02:20 +10:00
Stenzek 93865b327f ShaderCache: Implement compile priority
Currently, when immediately compile shaders is not enabled, the
ubershaders will be placed before any specialized shaders in the compile
queue in hybrid ubershaders mode. This means that Dolphin could
potentially use the ubershaders for a longer time than it would have if
we blocked startup until all shaders were compiled, leading to a drop in
performance.
2018-03-17 01:53:11 +10:00
Stenzek 517a977444 ShaderCache: Fix several issues in background shader compiling
- In D3D, shaders could be compiled on the main thread, blocking
startup.
- Reduced the latency between a pipeline being requested and used in all
backends in hybrid ubershader mode, when no shader stages were present.
- Fixed a case where async compilation could cause the same UID to be
appended multiple times to the UID cache.
- Fix incorrect number of threads being used when immediately compile
shaders was enabled.
2018-03-15 01:50:47 +10:00
Stenzek 427aa188d4 ShaderCache: Use a version number for pipeline UID caches 2018-03-11 14:48:09 +10:00
Stenzek e31cc1f679 ShaderCache: Implement background shader compilation
This enables shaders to be compiled while the game is starting, instead
of blocking startup. If a shader is needed before it is compiled,
emulation will block.
2018-03-10 16:11:19 +10:00
Stenzek 9fa24700b6 VideoConfig: Collapse ubershader configuration fields to a single value 2018-03-10 15:56:45 +10:00
Stenzek f9c829c7f7 OGL: Re-implement async shader compiling 2018-03-10 15:56:34 +10:00
Stenzek dec0c3bce8 Move shader caches to VideoCommon 2018-03-10 15:56:30 +10:00