Commit Graph

4413 Commits

Author SHA1 Message Date
Pokechu22 78e43a4404 Make all custom fmt::formatter's format functions const
fmt 8.0.0 requires this.
2022-01-13 11:11:08 -08:00
Pokechu22 0cc211d1ef Use fmt::format_string 2022-01-13 11:11:08 -08:00
Pokechu22 ff8965c40b Replace uses of undocumented/deprecated fmt::format_to overload
This was deprecated in fmt 8.0.0.
2022-01-13 11:11:08 -08:00
Pokechu22 fc0d958e26 PixelShaderGen: Fix invalid use of int3(0)
This syntax is allowed by GLSL, but HLSL doesn't allow it.  This meant that games using R8 comparisons in equal mode would produce shaders that failed to compile.  Super Mario Galaxy's water levels were affected by this.
2022-01-12 21:50:34 -08:00
JMC47 c18abfaecc
Merge pull request #10356 from AdmiralCurtiss/config-port-core-4
Config: Port remaining Core settings to new config system (the rest).
2022-01-11 16:08:19 -05:00
Pokechu22 161c627466 Treewide: Remove unused inclusions of <cinttypes>
Most of these became unneeded when fmt was introduced.
2022-01-09 12:43:11 -08:00
Pokechu22 44e93e91d7 Common/Assert: Switch to fmt 2022-01-09 12:43:11 -08:00
Admiral H. Curtiss c82b2dccb5
Config: Port SyncGPU settings to new config system. 2022-01-09 21:29:12 +01:00
Admiral H. Curtiss d8825f5635
Config: Port dual core setting to new config system. 2022-01-09 21:29:11 +01:00
JMC47 4c0dcf42b8
Merge pull request #10346 from iwubcode/fixed_shader_precompile_parallelization
VideoCommon: Fix shader precompilization detection
2022-01-06 16:28:15 -05:00
Admiral H. Curtiss d98c6b0b1d
Config: Port GPUDeterminismMode setting to new config system. 2022-01-06 16:13:55 +01:00
Admiral H. Curtiss fb47035f97
Config: Port emulation speed setting to new config system. 2022-01-06 16:13:54 +01:00
iwubcode 9b4e5b00ee VideoCommon: assume the majority of os/drivers support parallel compiling of shaders, we can create bugs if there are issues. Android is assumed buggy 2022-01-04 20:40:07 -06:00
JMC47 9a914d33d5
Merge pull request #9414 from DevJPM/master
Fix CPU Core Count detection and Enable Parallel Shader Compilation
2022-01-04 10:15:12 -05:00
Léo Lam 0de008da11
Merge pull request #10332 from AdmiralCurtiss/config-port-general
Config: Port remaining General settings to new config system.
2022-01-03 01:40:37 +01:00
Pokechu22 afd02b79a5 VideoCommon: Add names for textures and shaders 2022-01-01 11:38:56 -08:00
Admiral H. Curtiss d590aa88a4
Config: Port remaining General settings to new config system. 2022-01-01 19:02:45 +01:00
Admiral H. Curtiss aa437d9805
Config: Port Movie settings to new config system. 2021-12-30 20:16:17 +01:00
JosJuice a96cfe2531 GLES: Fix LOD bias int/float mismatch
Another simple GLES shader compilation error.
2021-12-28 19:19:22 +01:00
JMC47 01e8e950e8
Merge pull request #10292 from OatmealDome/lodbias-take-two
PixelShaderGen: Use LOD bias when sampling texture on Metal and OpenGL ES
2021-12-28 02:45:14 -05:00
OatmealDome 056613ecc5 PixelShaderGen: Add LOD bias to texture() call on systems that don't support it in the sampler 2021-12-28 02:10:45 -05:00
OatmealDome 4e12d6e871 ShaderGenCommon: Add bit for LOD bias 2021-12-28 02:10:39 -05:00
OatmealDome 08396c56e5 VideoConfig: Add bool for sampler LOD bias support 2021-12-25 15:16:27 -05:00
Pokechu22 1cd148d4c5 GeomeryShaderGen: Set gl_ClipDistance on Vulkan as well as OpenGL
Fixes https://bugs.dolphin-emu.org/issues/12548
2021-12-23 17:56:21 -08:00
Pokechu22 85025612bc LightingShaderGen: Make s_lighting_struct not inline
This generated warnings on the freebsd builder.
2021-12-22 15:17:52 -08:00
JosJuice e6f40fa015
Merge pull request #10279 from Pokechu22/intensity-alpha
TextureConverterShaderGen: Set alpha to 1 on intensity formats if EFB lacks alpha
2021-12-23 00:14:06 +01: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 fd2324e40a Fifo analyzer: Rename mipmap filter to half scale for EFB copies
The field itself is named half_scale, and it can be used for things unrelated to mipmaps, so reflecting that name in the fifo analyzer helps.
2021-12-20 11:34:05 -08:00
Pokechu22 2f6953efb6 TextureConverterShaderGen: Set alpha to 1 on intensity formats if EFB lacks alpha
We were already doing this for non-intensity formats, but it seems like the same applies to intensity formats.
2021-12-20 11:34:05 -08:00
Pokechu22 e7d5f8ad5c TextureCacheBase: Re-wrap GetTexture comment 2021-12-18 15:21:48 -08:00
Pokechu22 d1cc539476 BPMemory: Correct spelling of MaxAniso 2021-12-18 15:21:48 -08:00
Pokechu22 27cb704466 Eliminate VarType for ComponentFormat 2021-12-18 15:21:48 -08:00
Pokechu22 1a964891f8 VertexLoader_Color: Use Common::swap24 2021-12-18 15:21:48 -08:00
Pokechu22 95e0f833f9 Fifo analyzer: Display equations for color/alpha combiners 2021-12-18 15:21:48 -08:00
Pokechu22 0afe318b55 OpcodeDecoding: Make s_is_fifo_error_seen static 2021-12-18 15:21:48 -08:00
Pokechu22 d039b1bc0d VideoCommon: Move VertexLoaderManager logic out of CPState 2021-12-18 15:21:48 -08:00
Pokechu22 d84d695fdf Remove DataReader from LoadXFReg 2021-12-18 15:21:48 -08:00
Pokechu22 b5fd35f951 Refactor OpcodeDecoding and FIFO analyzer to use callbacks 2021-12-18 15:21:36 -08:00
Pokechu22 1914087998 Create and use CPArray enum class 2021-12-18 12:51:56 -08:00
Pokechu22 3aaeb2b9ef Convert OpcodeDecoder::Opcode and OpcodeDecoder::Primitive to enum class 2021-12-18 12:51:56 -08:00
Pokechu22 205ab23d80 GeometryShaderGen: Convert to EnumMap 2021-12-18 12:51:55 -08:00
Pokechu22 f53dc6564f UberShaderPixel: Convert to EnumMap 2021-12-18 12:51:55 -08:00
Pokechu22 380b333387 PixelShaderGen: Convert to EnumMap 2021-12-18 12:51:55 -08:00
Pokechu22 2b1d1038a6 VertexLoader: Convert to EnumMap 2021-12-18 12:51:55 -08:00
Pokechu22 327126d1e8 ShaderGenCommon: Add WriteSwitch 2021-12-18 12:51:55 -08:00
Pokechu22 2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
OatmealDome 74a979db09 UberShaderPixel: Add shader logic ops support on OpenGL ES 2021-12-06 22:36:40 -05:00
OatmealDome 18b2f6953d PixelShaderGen: Add shader logic ops support on OpenGL ES
To do this, I had to decouple framebuffer fetch from shader blending. We need to be able to access framebuffer fetch input when using shader logic ops.
2021-12-06 22:36:40 -05:00
OatmealDome a77ae14d94 UberShaderPixel: Add shader logic ops support on Metal 2021-12-06 22:36:40 -05:00
OatmealDome e0837cb847 PixelShaderGen: Add shader logic ops support on Metal 2021-12-06 22:36:40 -05:00
OatmealDome 426c68b5a0 ShaderCache: Don't turn on logic ops approximation if framebuffer fetch is supported 2021-12-06 22:36:40 -05:00
OatmealDome c12b9b013b PixelShaderGen: Add logic ops to pixel_shader_uid_data 2021-12-06 22:36:34 -05:00
Scott Mansell 0327bc2ab6
Merge pull request #10256 from malleoz/show-rerecord-count
Renderbase: Show rerecord count
2021-12-03 14:42:10 +13:00
JMC47 c12e4e8ee0
Merge pull request #10244 from phire/ban-timetravel
Delay singlecore gpu interrupts; Fixes Bomberman Jetters in single core mode.
2021-12-02 07:21:41 -05:00
sowens99 e4fed7cce8 Add Rerecord Count display
Simply shows Movie::s_rerecords in the ImGui Movie window
2021-11-30 20:08:29 -05:00
OatmealDome 04ec02c06b ConstantManager: Add logic ops to PixelShaderConstants 2021-11-24 17:52:26 -05:00
Scott Mansell f5c550e9cb Delay singlecore gpu interrupts
Fixes Bomberman Jetters in single core mode.

When single core mode pauses the CPU to execute the GPU
FIFO it greedily executes the whole thing. Before this commit,
Finish and Token interrupts would happen instantly, not even
taking into account how long the current FIFO window has
taken to execute. The interrupts would be effectively backdated
to the start of this execution window.

This commit does two things: It pipes the current FIFO window
execution time though to the interrupt scheduling and it enforces
a minimum delay of 500 cycles before an interrupt will be fired.
2021-11-25 11:11:01 +13:00
Léo Lam aa5cb35c86
Merge pull request #10143 from Pokechu22/png-compression-level
Add option for setting the PNG zlib compression level
2021-11-23 16:40:34 +01:00
unknown f43122cd8a Trust MacOS not to crash during shader pre-compilation 2021-11-22 15:32:28 +01:00
DevJPM 613c4563c2 VideoCommon: Gate Multi-Threaded Shader Pre-Compilation behind a bug entry 2021-11-22 09:34:28 +01:00
DevJPM 61cfd8696e Fix CPU Core Count detection and Enable Parallel Shader Compilation
This does this following things:

- Default to the runtime automatic number of threads for pre-compiling shaders
- Adds a distinct automatic thread count computation for pre-compilation  (which has less other things going on
and should scale better beyond 4 cores)
- Removes the unused logical_core_count field from the CPU detection
- Changes the semantics of num_cores from maximaum addressable number of cores to actually available CPU cores
(which is also how it was actually used)
- Updates the computation of the HTT flag now that AMD no longer lies about it for its Zen processors
- Background shader compilation is *not* enabled by default
2021-11-20 16:08:10 +01:00
JMC47 dbaebdc585
Merge pull request #10222 from phire/fix-copy-filter-clamping
Fix copy filter clamping
2021-11-18 17:48:33 -05:00
Pokechu22 94ccf765af Add option for setting the PNG zlib compression level 2021-11-18 13:10:22 -08:00
Pokechu22 1adff1c467 VideoCommon: Skip textureQueryLevels if it doesn't exist 2021-11-17 21:28:39 -08:00
Pokechu22 bdcfb31187 VideoCommon: Handle custom texture sizes correctly
Specifically, when using Manual Texture Sampling, if textures sizes don't match the size the game specifies, things previously broke.  That can happen with custom textures, and also with scaled EFB copies at non-native IRs.  It breaks most obviously by not scaling the texture coordinates (so only part of the texture shows up), but the hardware wrapping functionality also assumes texture sizes are a power of 2 (or else it will behave weirdly in a way that matches how hardware behaves weirdly).  The fix is to provide alternative texture wrapping logic when custom texture sizes are possible.
2021-11-17 21:28:36 -08:00
Pokechu22 93eea7cb13 VideoCommon: Add option to use old behavior (Fast Texture Sampling)
Co-authored-by: JosJuice <josjuice@gmail.com>
2021-11-17 21:27:32 -08:00
Pokechu22 ee80298ca4 VideoCommon: Implement diagonal LOD
Note that both GLSL and HLSL provide a fwidth (fragment width) function defined as `fwidth(p) = abs(dFdx(p)) + abs(dFdy(p))`.  However, it's easy enough to implement this ourselves (and it makes the code a bit more obvious).
2021-11-17 20:04:34 -08:00
Pokechu22 51e3334526 VideoCommon: Use coarse derivatives for Manual Texture Sampling if possible 2021-11-17 20:04:34 -08:00
Pokechu22 ddf2691395 VideoCommon: Manually handle texture wrapping and sampling 2021-11-17 20:04:34 -08:00
Pokechu22 4a9b26de86 VideoCommon: Expose SamplerState to shaders
The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly.
2021-11-17 20:04:34 -08:00
Pokechu22 9ef228503a VideoCommon: Provide raw texdims to shaders 2021-11-17 20:04:34 -08:00
Pokechu22 a273b65566 RenderState: Use operator== for operator!= and adjust constructors 2021-11-17 20:04:34 -08:00
Pokechu22 6236a0d494 Eliminate SamplerCommon 2021-11-17 20:04:34 -08:00
Pokechu22 3096f77ba0 Eliminate SamplerCommon::AreBpTexMode0MipmapsEnabled
This was added in 0b9a72a62d but became irrelevant in 70f9fc4e75 as the check is now self-explanatory due to a rejiggering of the bitfields.
2021-11-17 20:04:34 -08:00
Pokechu22 d2041b4c2a VideoCommon: Add signed version of BitfieldExtract 2021-11-17 20:04:33 -08:00
Pokechu22 555a93057c VideoCommon: Allow BitfieldExtract in specialized shaders 2021-11-17 20:04:33 -08:00
Scott Mansell 7128befb39 Fix copy filter clamping regression in Spyro
This fixes horizontal lines in the bloom effect of Spyro: A Hero's Tail,
which is a regression caused by PR #10204

Screenshot of regression:
https://user-images.githubusercontent.com/138484/142030503-90fcd8d5-63d3-4820-874a-72e9be0c4768.png

Fixed:
https://user-images.githubusercontent.com/138484/142031598-b85ff55c-1302-4e4d-bcb2-57848974056b.png

Spyro uses an 640x80 pixel sub-buffer within the EFB to calculate
it's bloom effects, which it places below the main 640x448 buffer.

EFB layout:
https://user-images.githubusercontent.com/138484/142030573-e933b6ae-c37e-4be6-86d4-0bc779b92535.png
Note: Colors are wrong because the main color buffer uses RGBA6,
      while the bloom is calculated in RGB8

This allows it to do bloom without backing up part of the EFB to
main memory, as most games do.

But, since some of the sub-buffers used in the bloom effect are taller
than 80 pixels, they need to be sliced up into smaller sub, sub buffers
which get combined later when copied to main memory.

At one point, a 320x224 buffer is broken up into 320x80, 320x64 and
320x80 slices. These are copied out with the copy filter set to a
vertical blur.

Because there was an off-by-one errror in the clamping coordinates,
the bottom line of the color buffer would be blurred into
the top of each slice.

Final combined EFB copy:
https://user-images.githubusercontent.com/138484/142031360-2c076839-7c96-4b3b-a093-d899d0a2c7ae.png

Fixed version:
https://user-images.githubusercontent.com/138484/142031370-72e41a35-3b3e-4662-a483-79203e357ecc.png

Before #10204 the copy filter wasn't enabled for efb copies, and most
other games don't do this type of slicing.

FIFO CI shows that a few other games are effected, it's always just a minor difference to the top line where there was previously a slight hint of garbage.
2021-11-17 06:12:46 +13:00
Pokechu22 868de78f16 VideoCommon: Use the copy filter for EFB copies as well as XFB copies
This fixes the pink screens in EA Sports Active.  See https://gist.github.com/Pokechu22/49455f9094ed0ff017da64e3f7aa0404 for details.
2021-11-11 17:22:50 -08:00
Mai M 6c72e6814d
Merge pull request #10169 from leoetlino/fmt-localtime
Use fmt::localtime instead of thread-unsafe std::localtime
2021-11-07 00:08:14 -04:00
Emmanuel Gil Peyrot 5a1333026b VideoCommon: Add missing algorithm include for std::none_of
Otherwise this is an error on gcc/libstdc++, and there are no transitive
includes for this header.
2021-11-02 13:50:21 +01:00
Emmanuel Gil Peyrot 7590f07b80 FrameDump: Remove deprecated call to av_init_packet()
This function was deprecated in ffmpeg in January[1], while its
replacement got introduced in 2015[2], so now might be the time to start
using it in Dolphin. :)

[1] f7db77bd87
[2] a9a6010637
2021-11-02 13:50:21 +01:00
Emmanuel Gil Peyrot 25b136ac17 VideoCommon: Fix a -Wclass-memaccess in gcc 11 2021-11-02 13:50:21 +01:00
Pokechu22 db54e4f2b0 Externals: Update imgui to 1.85 2021-10-26 15:07:57 -07:00
Léo Lam fd7df2ccae
Use fmt::localtime instead of thread-unsafe std::localtime
fmt::localtime is also less awkward to use compared to std::localtime.
2021-10-15 22:49:13 +02:00
Pokechu22 a372a5947b VideoCommon: Fix color channel logic when per-pixel lighting is in use
This was broken in #10012 (specifically by 06579e4d53 and c3dec34391).
2021-10-13 20:43:32 -07:00
Pokechu22 78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Scott Mansell edb66dab84 TextureCache: Remove deleted textures from bound_textures
Fixes issue where vulkan might crash trying to bind a deleted
texture.
2021-10-12 15:51:24 +13:00
Scott Mansell d771bee0fe TMEM: Add some helpful comments 2021-10-12 15:51:24 +13:00
Scott Mansell a33cf27885 TMEM: Handle savestate and init 2021-10-12 15:51:24 +13:00
Scott Mansell 88bd10cd30 Extend TMEM cache implementation
Now works with games that deliberately avoid invalidating TMEM because
they know textures are too large to fit:

 * Sonic Riders
 * Metal Arms: Glitch in the System
 * Godzilla: Destroy All Monsters Melee
 * NHL Slapshot
 * Tak and the Power of Juju
 * Night at the Museum: Battle of the Smithsonian
 * 428: Fūsa Sareta Shibuya de
2021-10-12 15:51:24 +13:00
Scott Mansell 5a8455e8ce BoundingBox: Add missing include 2021-10-10 13:21:31 +13:00
Scott Mansell 9fa26624b0 BPMemory: Refactor/consolidate TexUnit Addressing
Currently the logic for addressing the individual TexUnits is splattered all
across dolphin's codebase, this commit attempts to consolidate it all into a
single place and formalise it using our new TexUnitAddress struct.
2021-10-10 09:09:43 +13:00
Scott Mansell ef0e401708 BPMem: Abstract TexUnit Addressing into struct
The addressing of the texture units is a bit non-obvious.
This struct abstracts the complexity away.
2021-10-10 09:01:57 +13:00
iwubcode 514475646d VideoCommon: update Free Look camera's 'FieldOfView' function to 'FieldOfViewMultiplier' to better reflect usage 2021-10-08 18:17:20 -05:00
iwubcode aa07fde8a0 VideoCommon: update fov multiplier variables and add constant variables for defaults to the Free Look camera 2021-10-08 18:17:20 -05:00
iwubcode e70157474b Core / VideoCommon: refactor FreeLookCamera to have the underlying controller handle all the logic (field-of-view, movement, etc) 2021-10-08 18:16:32 -05:00
Léo Lam ff1cb5a1c0
Merge pull request #9803 from Techjar/bbox-videocommon
VideoCommon: Abstract bounding box
2021-10-08 22:24:38 +02:00
nonoteal 90437d1574 Change how FFmpeg is imported for Apple computers.
Imports Apple libraries and also pulls swresample in, so when compiling Dolphin doesn't throw undefined symbols.
2021-10-06 18:11:32 -10:00
Techjar 1161af8059 VideoCommon: Abstract bounding box
This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
2021-10-04 15:51:24 -04:00
Shawn Hoffman e11fdaabf1 fix unused variable warning 2021-09-30 14:27:53 -04:00