Commit Graph

4605 Commits

Author SHA1 Message Date
Merry b0717607b2 TextureInfo: Reorder members in constructor
m_stage is initialized last
2022-08-29 21:16:21 +01:00
Merry 3323375efb GraphicsModManager: Reorder DecoratedAction members to initialization order
m_action_impl is initialized before m_mod in constructor
2022-08-29 21:15:49 +01:00
Pokechu22 698def66ff Fifo analyzer: Fix various XF mistakes
* 'hangle' was a typo
* Light colors include an alpha value, so they should be 8 characters, not 6
* The XF command format adds 1 to the count internally (so 0 is one word), but we need to subtract that back to produce a valid command
* XFMEM_POSTMATRICES was calculating the row by subtracting XFMEM_POSMATRICES (POS vs POST), resulting in incorrect row numbering
2022-08-29 11:10:05 -07:00
Pokechu22 3fb09e3297 Fifo analyzer: Improve some BP descriptions
Mainly, the improvements are passing in the current command ID so that e.g. stage numbers can be directly included, instead of saying 0/1 or even/odd.
2022-08-29 11:10:05 -07:00
Pokechu22 546f9952a2 UberShaderPixel: Fix typo 2022-08-29 11:10:05 -07:00
Pokechu22 5ef8a7973e BPMemory: Make TevKSel more clear
It stores both the konst selection value for alpha and color channels (for two tev stages per ksel), and half of a swap table row (there are 4 total swap tables, which can be used for swizzling the rasterized color and the texture color, and indices selecting which tables to use are stored per tev stage in the alpha combiner).  Since these are indexed very differently, the old code was hard to follow.
2022-08-29 11:10:05 -07:00
Pokechu22 f21798b9b6 BPMemory: Use even/odd in TwoTevStageOrders instead of 0/1 2022-08-29 11:10:05 -07:00
Pokechu22 e43f02c752 BPMemory: Improve consistency of hex offset comments
I search for these somewhat often with control+f, but tend to default to adding a 0x prefix, which means I don't find them until I remove it.
2022-08-29 11:10:05 -07:00
Pokechu22 0cced44142 Use `__VA_OPT__(, ) __VA_ARGS__` instead of `##__VA_ARGS__`
Per https://en.cppreference.com/w/cpp/preprocessor/replace#.23_and_.23.23_operators the `##` behavior is a nonstandard extension; this extension seems to be supported by all compilers we care about, but IntelliSense in visual studio doesn't correctly handle it, resulting in false errors in the IDE (but not when compiling).

Per https://en.cppreference.com/w/cpp/preprocessor/replace#Function-like_macros C++20 introduced a workaround, where `__VA_OPT__(, )` generates a comma if and only if `__VA_ARGS__` is non-empty.

This PR replaces all occurrences, with the exception of Externals, DSPSpy (which is not likely to be edited in MSVC and does not target C++20 currently), and JitArm64_Integer.cpp (which uses `Function(__VA_ARGS__)`, and thus does not ever need a comma).
2022-08-23 12:09:57 -07:00
PEmu2 b516ae12ca
Edit error message
Edit error message to be less sarcastic. I doubt many users appreciate this when Dolphin has just crashed.
2022-08-22 19:52:13 -07:00
JosJuice 724bd3e597 VideoCommon: Fix OpenGL ES GPU texture decoding 2022-08-20 23:21:23 +02:00
CasualPokePlayer ab8a8e6f84 Fix crashes in dual core mode on a PI_FIFO_RESET 2022-08-18 13:38:37 -07:00
iwubcode 637dca680c VideoCommon: update ubershader pixel to not enforce d3d when writing color output that has been defined as uints 2022-08-06 16:08:58 -05:00
iwubcode 05135b4f43 VideoCommon: fix uint shader compiler error in specialized shaders. This error is in renderers that use uint for their color output (for logic ops). Remove D3D check for uint output since other backends could use uint output as well. 2022-08-06 16:08:58 -05:00
iwubcode 0b5f7d2c5f VideoCommon: fix graphics target not properly setting 'draw_started' texture names for efb/xfb 2022-08-06 12:01:33 -05:00
Scott Mansell ebf95370ef
Merge pull request #10946 from Pokechu22/remove-iLog
VideoCommon: Remove old iLog field
2022-08-05 22:42:09 +12:00
Pokechu22 354530cf61 VideoCommon: Remove old iLog field
Prior to 7854bd7109, this was used by the debugger for the OpenGL and D3D9 plugins to control logging (via PRIM_LOG and INFO_LOG/DEBUG_LOG in VideoCommon code; PRIM_LOG was changed in 77215fd27c), and also framedumping (removed in 64927a2f81 and 2d8515c0cf), shader dumping (removed in 2d8515c0cf and this commit), and texture dumping (removed in 54aeec7a8f). Apart from shader dumping, all of these features have modern alternatives, and shader source code can be seen in RenderDoc if "Enable API Validation Layers" is checked (which also enables source attachment), so there's no point in keeping this around.
2022-08-04 15:49:39 -07:00
Pokechu22 20a2a2174d Vulkan: Call setSourceFile in addition to addSourceText 2022-08-04 15:09:12 -07:00
Pokechu22 8129874d11 Sanitize and use increased precision when normalizing light directions
This normalization was added in 02ac5e95c8, and changed to use floats in 4bf031c064.  The conversion to floats means that sometimes there is insufficient precision for the normalization process, which results in values of NaN or infinity.  Performing the whole process with doubles prevents that, but games also sometimes set the values to NaN or infinity directly (possibly accidentally due to the values not being initialized due to them not being used in the current configuration?).

The version of Mesa currently in use on FifoCI (20.3.5) has issues with NaN.  Although this bug has been fixed (b3f3287eac in 21.2.0), FifoCI is stuck with the older version.

This change may or may not be incorrect, but it should result in the same behavior as already present in Dolphin, while working around the Mesa bug.
2022-08-04 08:52:44 -07:00
Shawn Hoffman fec61f89a3 Timer: protect usages of ms timers from rollover 2022-08-02 22:24:06 -07:00
Shawn Hoffman 09089eeee0 Common::Timer: use chrono::steady_clock internally 2022-08-02 22:24:06 -07:00
Shawn Hoffman 17c554c165 Common/Hash: use zlib-ng for adler32. small cleanups. 2022-08-01 10:07:27 -07:00
JosJuice 97100290ee
Merge pull request #10885 from JosJuice/android-graphics-mods
Android: Add graphics mods support to GUI
2022-07-26 15:44:01 +02:00
Admiral H. Curtiss a9edf129e3
Merge pull request #10889 from shuffle2/spng
replace libpng with libspng
2022-07-26 12:53:04 +02:00
Shawn Hoffman 76b4318b88 CPUDetect: improve win/arm64 support
read brand_string on macos/arm64
remove unused flags
report family/model info instead of vendor name
2022-07-25 21:21:11 -07:00
Shawn Hoffman acb10f0006 replace libpng with libspng 2022-07-25 18:32:16 -07:00
JosJuice e5a177ece9
Merge pull request #10868 from tellowkrinkle/UsesDSBFix
VideoCommon: Fix IsDualSrc check for dst blend factors
2022-07-23 22:14:07 +02:00
JosJuice 8f410bff15 Android: Add graphics mods support to CheatsActivity 2022-07-23 21:58:45 +02:00
Pokechu22 6a7aa8f2c6 Convert CP/XF matrix indices mismatch panic alert to a warning
https://bugs.dolphin-emu.org/issues/12977 indicates that this happens on startup of Spider-Man 2, even in single-core. I don't have the game, so I can't directly determine why this is happening, but presumably real hardware does not hang in this case, so we can make it less obtrusive.
2022-07-23 09:01:22 -07:00
TellowKrinkle 6ee0248eab VideoBackends:Metal: MSAA support 2022-07-21 20:44:19 -05:00
TellowKrinkle a5ef9dfd53 VideoBackends:Metal: Use DriverDetails for bugs 2022-07-21 20:44:19 -05:00
TellowKrinkle 716c0980d7 VideoBackends: Add Metal renderer 2022-07-21 20:44:19 -05:00
Admiral H. Curtiss b0b5faa793
Merge pull request #10874 from JosJuice/cmpr-layout
VideoCommon: Fix CMPR compute shader layout
2022-07-19 12:05:29 +02:00
JosJuice 1a2bc2eff9 VideoCommon: Fix CMPR compute shader layout
Looks like a copy-paste gone wrong. The compute shaders for the other
formats use a group size of 8 * 8, whereas the CMPR compute shader
is supposed to use a flattened 64 * 1 as I understand it.
2022-07-18 18:56:50 +02:00
TellowKrinkle 88c85ce471 VideoCommon: Fix IsDualSrc check for dst blend factors 2022-07-17 20:50:53 -05:00
Joon Park 319288de8e Fix OpenGL error on M1 Mac.
Followup to #10466. Resolves the following error:

ERROR: 0:85: '&' does not operate on 'uvec3' and 'int'
2022-07-17 08:54:39 -04:00
JMC47 70b0b03c3c
Merge pull request #10747 from tellowkrinkle/LateUIDFixup
Add a post-cache shader UID fixup pass
2022-07-17 00:43:16 -04:00
Pokechu22 a6e06f38ad Add notes about precision of YUV->RGB conversion factors for XFB 2022-07-16 00:07:10 -07:00
Pokechu22 e7339d63f1 Rework TextureConversionShader for hardware accuracy and simplicity 2022-07-16 00:07:10 -07:00
Pokechu22 b16ec5b6dc Rework TextureConverterShaderGen for hardware accuracy and simplicity 2022-07-16 00:07:10 -07:00
Pokechu22 791bd16b28 Restructure parameters to TetxureConverterShaderGen/TextureConversionShader
This will be used for later refactoring for increased accuracy.
2022-07-16 00:07:10 -07:00
TellowKrinkle 89ae060214 VideoCommon: Increase uniform stream buffer size to 64mb
Densha De Go uses 27mb per frame, and we want enough space for the CPU to be encoding one frame while the GPU is rendering the previous
2022-07-15 18:21:50 -05:00
TellowKrinkle fb5648541c VideoCommon: Remove dstalpha from BlendingState
It's not supported by any PC graphics API, and therefore completely unused
2022-07-15 15:31:47 -05:00
TellowKrinkle 991024173e VideoCommon: Always use fbfetch in ubershaders if available
Reduce the number of different pipelines needed.  Also works around drivers that break when you combine fbfetch with dual source blending
2022-07-15 15:31:47 -05:00
Pokechu22 d20094efa2 Add extra Low and High fields to CopyFilterCoefficients
This struct is the only one in BPMemory that uses u64 as its base.  These fields are to allow viewing it as two u32s instead.  It's not used by Dolphin right now, but it is used in the copy of BPMemory.h used by hwtests.
2022-07-15 12:29:40 -07:00
Pokechu22 bed278d3b7 Create dedicated enum for EFB/XFB gamma correction
This also changes the behavior for the invalid gamma value, which was confirmed to behave the same as 2.2.

Note that currently, the gamma value is only used for XFB copies, even though hardware testing indicates it also works for EFB copies.  This will be changed in a later commit.
2022-07-15 12:29:40 -07:00
Pokechu22 dd41a72378 Only use intensity formats if both intensity_fmt and auto_conv are set
auto_conv is normally always set for EFB copies, but hardware testing indicates that intensity_fmt does nothing if auto_conv is not set.
2022-07-15 12:29:40 -07:00
Pokechu22 cd2cc5fa22 Rename EFB copy bit 2 from yuv to unknown_bit
It was named yuv in 522746b2c2, but hardware testing indicates that that bit does nothing (the intensity format bit enables YUV conversion, instead).
2022-07-15 12:29:40 -07:00
Pokechu22 850e524514 Use fmt::to_string for texture format overlay
This required adding parentheses to the font used by that.
2022-07-15 12:29:40 -07:00
Pokechu22 290e62f179 Remove casts to integers for texture and EFB formats
The only remaining casts for these types that I know of are in TextureInfo (where format_name is set to the int version of the format, and since that affects filenames and probably would break resource packs, I'm not changing it) and in TextureDecoder_Common's TexDecoder_DrawOverlay, which will be handled separately.
2022-07-15 12:29:40 -07:00
TellowKrinkle 6ab24e6c17 VideoCommon: Better driver bug handling
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader
2022-07-13 21:51:24 -05:00
JMC47 e237aa1435
Merge pull request #10777 from tellowkrinkle/EFBFlush
VideoCommon: Remember to flush command buffers after multiple EFB copies
2022-07-13 19:45:31 -04:00
JMC47 5663a44962
Merge pull request #10842 from tellowkrinkle/ClearBackendInfo
VideoCommon: Clear backend_info before populating
2022-07-13 16:40:46 -04:00
TellowKrinkle f83015649c VideoCommon: Clear backend_info before populating 2022-07-13 02:55:54 -05:00
TellowKrinkle 6bd0fc86ba VideoCommon: Properly mask fbfetch logic op emulation 2022-07-13 02:27:45 -05:00
JMC47 cce6133ef6
Merge pull request #10749 from tellowkrinkle/IntelUbershaders
VideoCommon: Fix ubershaders on MoltenVK Intel
2022-07-10 19:35:55 -04:00
Admiral H. Curtiss e072aaa769
ShaderCache: Fix inverted usage of palette_format. 2022-07-09 13:17:53 +02:00
JMC47 fac66897af
Merge pull request #10819 from Dentomologist/fix_shader_compilation_warnings
VideoCommon: Fix D3D shader compilation warnings
2022-07-08 18:46:29 -04:00
JMC47 828afc6735
Merge pull request #10673 from iwubcode/spirv-backends
D3D: Generate HLSL from SPIRV*
2022-07-08 15:29:58 -04:00
Dentomologist e1e0f42b37 VideoCommon: Fix D3D shader warning X3557 (single iteration loop)
Fix warning "loop only executes for 1 iteration(s), forcing loop to
unroll" when vertex_in == 1
2022-07-08 00:25:55 -07:00
Dentomologist 71541c1324 VideoCommon: Fix D3D shader warning X4000 (uninitialized variables)
Initialize alpha_A and alpha_B. They were previously only initialized in
cases where they were used, but D3D isn't able to figure that out.
2022-07-08 00:25:14 -07:00
Dentomologist 0fac1d6e87 VideoCommon: Fix D3D shader warning X3571 (negative base for pow())
Add abs() to fix "pow(f, e) will not work for negative f, use abs(f) or
conditionally handle negative values if you expect them".
2022-07-08 00:19:05 -07:00
TellowKrinkle 3ee4b89a46 VideoCommon: Remember to flush command buffers after multiple EFB copies 2022-07-06 18:38:05 -05:00
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
JosJuice 07a15a3228
Merge pull request #10624 from Minty-Meeo/resolve-gcc-warnings
Resolve Linux GCC Warnings
2022-07-02 09:17:44 +02:00
Minty-Meeo 69e32dea52 Resolve GCC Warnings 2022-06-30 15:26:48 -05:00
iwubcode 4788a05c76 VideoCommon: fix projection graphics mod affecting more than the intended draw call 2022-06-29 20:04:59 -05:00
iwubcode 1480b78f64 VideoCommon: dump EFB with size and texture format details and dump XFB with size details. Finally move count to front of image for XFB/EFB dumps so as to make it easier to see them in order. Change the count value prefix to 'n' 2022-06-27 18:20:52 -05:00
iwubcode 69839df1eb VideoCommon: support dynamically updating game mods at runtime 2022-06-27 18:20:52 -05:00
iwubcode 892678648e VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls) 2022-06-27 18:20:52 -05:00
iwubcode 62c186e14b VideoCommon: add UninitializeEFBMemory to mirror XFB function 2022-06-27 18:20:52 -05:00
iwubcode 0f88155729 Core / DolphinQt / VideoCommon: add setting for enabling graphic mods 2022-06-27 18:20:52 -05:00
iwubcode f416b71925 VideoCommon: add logic to handle a GraphicsMod while Dolphin is running 2022-06-27 18:20:52 -05:00
iwubcode 254246b814 VideoCommon: add logic to read a GraphicsMod from configuration 2022-06-27 18:20:52 -05:00
iwubcode f92beb611f VideoCommon: add game mod constants 2022-06-26 21:53:21 -05:00
iwubcode 4fbbd85ef4 VideoCommon: create variables for EFB/XFB copy prefix. Reword prefix to 'efb1' and 'xfb1' to match textures 2022-06-26 21:53:21 -05:00
iwubcode b9995b04a0 VideoCommon: add a way to get have a graphics directory count for all games by using a special 'all.txt' instead of a 'gameid.txt' file 2022-06-26 00:45:13 -05:00
iwubcode 7854afe512 VideoCommon: add support for setting and getting the stage from the texture info 2022-06-26 00:45:13 -05:00
iwubcode a1892a9c68 VideoCommon: add function to check whether TextureFormat is a valid value 2022-06-26 00:45:13 -05:00
iwubcode a8b5266347 VideoCommon: enable optimizer and remove debug details when converting GLSL to SPIR-V with validation layers turned off 2022-06-24 18:09:53 -05:00
iwubcode dda1479ecf VideoBackends / VideoCommon: refactor Vulkan to use new SPIRV functionality 2022-06-24 18:09:53 -05:00
iwubcode c2d3b7e7f5 VideoCommon: update pixel shader output to match old D3D code 2022-06-24 18:09:53 -05:00
iwubcode cad1d6ce90 VideoCommon: fix support of stereoscopic rendering after moving d3d to SPIRV generation 2022-06-24 18:09:53 -05:00
iwubcode 993fa3bf94 VideoCommon: update UberShaderPixel to properly support logic ops, matching the specialized shader 2022-06-24 18:09:53 -05:00
iwubcode 5dd2704416 D3D / VideoCommon: generate HLSL from SPIRV 2022-06-24 18:09:53 -05:00
iwubcode 3790c99a7d VideoCommon: add common spirv helper functions
Co-authored-by: tellowkrinkle <tellowkrinkle@gmail.com>
2022-06-24 17:52:31 -05:00
Pokechu22 1faca4bfc7
Merge pull request #10752 from tellowkrinkle/BetterShaderNames
VideoCommon: Better shader names
2022-06-24 15:50:48 -07:00
JMC47 ffa3bf86fb
Merge pull request #10760 from tellowkrinkle/std430
VideoCommon: Fix SSBO layout and remove associated "bug"
2022-06-24 18:40:47 -04:00
Pierre Bourdon 6ddff87d42
Merge pull request #10755 from tellowkrinkle/DebugUID
VideoCommon: Don't add garbage to shader uids in debug builds
2022-06-22 14:33:23 +02:00
Braxton Anderson 2b2b8e932d Rename FPS_REFRESH_INTERVAL in VideoCommon/FPSCounter 2022-06-17 20:11:53 -06:00
TellowKrinkle f79ac768d8 VideoCommon:ShaderCache: Add const to some local variables 2022-06-17 20:14:32 -05:00
TellowKrinkle 26529a31ab VideoCommon: Fix SSBO layout and remove associated "bug" 2022-06-16 20:26:11 -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
TellowKrinkle 3fe1a1a3d7 VideoCommon: Don't add garbage to shader uids in debug builds
There wasn't anything stopping compilers from doing it in release builds either, but most optimizations would make the padding zero
2022-06-14 21:51:58 -05:00
TellowKrinkle 25929789c1 VideoCommon: Don't pass State by inout
Spirv-cross's MSL codegen makes the amazing choice of compiling calls to inout functions as `State temp = s; call_function(temp); s = temp`.  Not all Metal backends handle this mess well.  In particular, it causes register spills on Intel, losing about 5% in performance.
2022-06-14 00:48:47 -05:00
TellowKrinkle db6e928c8d VideoCommon: Fix Intel GPUs on Metal/Vulkan locking up in ubershaders 2022-06-14 00:48:47 -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
OatmealDome 6e2febd404 VideoBackendBase: Remove __builtin_available for macOS 10.14 2022-06-01 22:57:51 -04:00