Commit graph

7029 commits

Author SHA1 Message Date
MrPurple666
b695ca5a2a Revert some wip changes 2025-04-28 16:14:42 -03:00
808276b48a Dynamic State Fixes (#57)
- Forcefully disabled dynamic state extensions if Vulkan reports that
  the device doesn't support it (need to update UI for this)
- Adds some more supported state 3 extensions
- Adds back stencil reinterpretation
- default to 0 on Android and 1 on desktop

Signed-off-by: swurl <swurl@swurl.xyz>

Reviewed-on: #57
Co-authored-by: swurl <swurl@swurl.xyz>
Co-committed-by: swurl <swurl@swurl.xyz>
2025-04-27 17:07:49 -04:00
30670bd92a Merge pull request 'Add configurations for VkExtendedDynamicState extensions' (#53) from crueter/eden:dynamic-state-config into master
Reviewed-on: #53
2025-04-24 19:55:58 +00:00
83cf9774e1 switch dynamic state to a slider
Signed-off-by: swurl <swurl@swurl.xyz>
2025-04-24 12:08:01 -04:00
1949e7c438 Add dynamic state extension configs
Signed-off-by: swurl <swurl@swurl.xyz>
2025-04-23 20:57:53 -04:00
c64c404a2f Enable ExtendedDynamicState 3 2025-04-23 19:01:56 +01:00
e96383615b Fixed typo 2025-04-22 21:02:48 -07:00
8823f12f18 Enable ExtendedDynamicState 2 and other features 2025-04-22 20:59:02 -07:00
5080513a5e Enable ExtendedDynamicState 1 across platforms 2025-04-22 18:22:25 -07:00
fc1a3b6310 shader compiler: Ensure all clip distances are initialized when used
Thank you to Ryujinx (riperiperi specifically) for the pointer towards clip distances
Huge thanks to crueter for finding where the code works and Camille for giving pointers along the way.
2025-04-21 13:34:24 -04:00
Zephyron
728de0406e vulkan: Improve memory allocation robustness
Enhances the Vulkan memory allocator with better OOM handling and memory
alignment:

* Add memory recovery by cleaning up empty allocations before failing
* Implement proper fallback to non-device-local memory
* Simplify memory alignment handling for different vendors
* Add better error logging for allocation failures
* Add IsEmpty() helper to track unused allocations
* Fix alignment requirements for Adreno (4KB) vs other vendors

These changes improve the robustness of memory allocation, particularly
in low-memory situations, and streamline vendor-specific alignment
requirements.
2025-04-19 17:19:16 -03:00
MrPurple666
19d28cf97b Fix linux build 2025-04-15 01:03:41 -03:00
Zephyron
389327d3f0 vulkan: Add Samsung driver workarounds
Add workarounds for Samsung Xclipse GPUs:

- Disable extendedDynamicState3ColorBlendEquation as it is broken in Samsung
  drivers, similar to AMD drivers
- Add Samsung's proprietary driver to the validated driver list for clock
  boosting
- Fix log message to indicate both AMD and Samsung drivers have broken
  color blend equation support

Remove stray logical OR operator from validated_driver condition.
2025-04-14 12:17:19 -03:00
MrPurple666
73d973dad6 Based on CamilleLaVey code, fix MSAA and Depth Stencil 2025-04-13 17:19:59 -03:00
MrPurple666
e26a256a44 Fix Zephyron commits 2025-04-13 00:23:18 -03:00
Zephyron
777111dfb4 feat(video_core): Fix Linux compilation issues in Hybrid Memory Manager
- Added missing <thread> header for std::thread usage
- Added <fcntl.h> for O_CLOEXEC and O_NONBLOCK definitions
- Fixed struct initialization order in uffdio_copy to match declaration order

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:42:39 -03:00
Zephyron
34693001aa Add Windows support to Hybrid Memory Manager
This commit adds Windows-specific implementation of the fault-managed memory
system, providing similar functionality to the existing Linux/Android implementation.

Key changes:
- Added Windows-specific memory management using VirtualAlloc/VirtualFree
- Implemented Windows vectored exception handler for page fault handling
- Added proper memory protection and page fault handling on Windows
- Updated memory snapshot functionality to work on Windows
- Added proper cleanup of Windows-specific resources
- Fixed type conversion issues in memory management code
- Added proper error handling for Windows memory operations
- Fixed VRAM Memory Layout Mode to allow up to 12Gb

The implementation uses Windows-specific APIs:
- VirtualAlloc/VirtualFree for memory management
- AddVectoredExceptionHandler for page fault handling
- VirtualProtect for memory protection management

This change maintains feature parity with the Linux/Android implementation
while using Windows-native APIs for better performance and reliability.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:42:24 -03:00
Zephyron
9615e910f9 feat(video_core): Implement HybridMemory for advanced Vulkan memory management
Adds a new cross-platform memory management system with enhanced capabilities:
- Fault-managed memory allocation for Linux/Android platforms
- Memory snapshot and differential snapshot support
- Predictive memory reuse tracking for optimized access patterns
- Vulkan compute buffer integration
- User-configurable settings for enabling features

The system integrates with the existing Vulkan renderer to provide more
efficient memory handling, especially for compute-intensive workloads.

Co-authored-by: boss.sfc <boss.sfc@citron-emu.org>
Co-committed-by: boss.sfc <boss.sfc@citron-emu.org>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:41:26 -03:00
Zephyron
0c5659a198 video_core: Enhance Vulkan shader compilation with async threading system
Implement a robust asynchronous shader compilation system inspired by commit
1fd5fefcb17fe7fe65faed1c991fb41db782ab0f. This enhancement provides:

- True multi-threaded shader compilation with atomic status tracking
- Persistent disk caching for faster shader loading
- Command queue system for background processing
- Integration with Citron's scheduler for better resource management
- Parallel shader loading to reduce startup times
- Improved error handling and recovery mechanisms

These changes significantly reduce shader compilation stuttering and improve
overall performance when using asynchronous shaders. The implementation
maintains compatibility with Citron's existing architecture while adding
more robust threading capabilities.

Co-authored-by: boss.sfc <boss.sfc@citron-emu.org>
Co-committed-by: boss.sfc <boss.sfc@citron-emu.org>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:39:24 -03:00
Zephyron
b550c6e3cc feat(vulkan): implement enhanced texture and shader management
This commit adds improved Vulkan functionality to the Citron emulator:

- Add thread-safe texture management with automatic error recovery
- Implement shader caching with validation support
- Add robust error handling for Vulkan operations
- Implement platform-specific initialization for Windows, Linux, and Android

These enhancements improve stability when handling texture loading errors
and provide better recovery mechanisms for Vulkan failures.

Co-authored-by: boss.sfc <boss.sfc@citron-emu.org>
Co-committed-by: boss.sfc <boss.sfc@citron-emu.org>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:39:19 -03:00
Zephyron
991770b84f build: fix linux compilation
- Removes unnecessary \ from Copyright Line Causing Linux Builds To Fail

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:37:27 -03:00
Zephyron
c57a5fef92 WIP: Enhance shader compilation performance and control
This commit adds new settings and optimizations for shader compilation:

- Add new settings:
  - use_enhanced_shader_building: Enable enhanced shader compilation
  - shader_compilation_priority: Control shader compilation priority

- Improve shader compilation performance:
  - Optimize worker thread allocation based on CPU cores
  - Add smarter async shader compilation heuristics
  - Prioritize vertex and fragment shader compilation
  - Add performance tracking and logging

- Add performance monitoring:
  - Track shader compilation times
  - Log slow shader compilations
  - Monitor async shader compilation statistics

This is a work in progress commit. Further optimizations and refinements
will be needed based on testing and feedback.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-04-12 23:37:11 -03:00
MrPurple666
ce1a1912ae RenderVulkan Experiments: DO-NOT-MERGE: Only recreate when necessary and NEAREST 2025-04-12 22:54:32 -03:00
MrPurple666
2a793d610d RenderVulkan Experiments: DO-NOT-MERGE: Introduce functionality to frame interpolation
The functionality acts much more like a real-time downscale since the FSR1 used by Yuzu is not compatible with a real interpolation and is just upscale and downscale.
2025-04-12 22:54:32 -03:00
Pavel Barabanov
38737f26e5 Optimize SpiriV output 2025-04-12 22:54:32 -03:00
Pavel Barabanov
be2e838f0d FRAME_SKIPPING and FRAME_INTERPOLATION only android and delete "enable" 2025-04-12 22:54:32 -03:00
Pavel Barabanov
d25bea5762 Android: add FRAME_SKIPPING and FRAME_INTERPOLATION 2025-04-12 22:54:32 -03:00
Zephyron
45683a4034 video_core/vulkan: Improve texture format conversion handling
Refactors and improves the texture format conversion system in the Vulkan
renderer:

- Adds proper sRGB to linear conversion for depth formats
- Improves shader accuracy for ABGR8 SRGB to D24S8 conversion
- Adds gamma correction and proper depth range clamping
- Moves GetSupportedFormat implementation to header
- Cleans up format conversion switch statement
- Removes redundant format conversion paths

The changes improve accuracy when converting between color and depth
formats, particularly for sRGB sources. The shader improvements ensure
proper gamma correction and depth range handling.

Technical changes:
- Improves sRGB to linear conversion in fragment shader
- Adds proper depth value clamping
- Consolidates format conversion logic
- Removes duplicate GetSupportedFormat implementation
2025-04-11 17:05:41 -03:00
Zephyron
3e835ac3aa video_core: Add new shader format conversion pipelines
Adds several new shader-based format conversion pipelines to support additional
texture formats and operations:

- RGBA8 to BGRA8 conversion
- YUV420/RGB conversions
- BC7 to RGBA8 decompression
- ASTC HDR to RGBA16F decompression
- RGBA16F to RGBA8 conversion
- Temporal dithering
- Dynamic resolution scaling

Updates the texture cache runtime to handle these new conversion paths and adds
helper functions to check format compatibility for dithering and scaling
operations.

The changes include:
- New shader files and CMake entries
- Additional conversion pipeline setup in BlitImageHelper
- Extended format conversion logic in TextureCacheRuntime
- New format compatibility check helpers
2025-04-11 17:05:30 -03:00
Zephyron
5cb3153f15 video_core: Add sRGB to D24S8 depth-stencil conversion support
Implements conversion from sRGB color formats to D24S8 depth-stencil format
in the Vulkan renderer. This change includes:

- New fragment shader convert_abgr8_srgb_to_d24s8.frag that handles proper
  sRGB to linear conversion before depth calculation
- Added shader to CMake build system
- Extended BlitImageHelper with new conversion pipeline and methods
- Updated texture cache to handle sRGB to D24S8 format conversion paths

The conversion properly handles sRGB color space by first converting to
linear space before calculating luminance values for the depth component,
while preserving alpha channel data for the stencil component.
2025-04-11 17:05:20 -03:00
9cef9f5dce Update fmt to allow for v11
Signed-off-by: swurl <swurl@swurl.xyz>
2025-04-10 01:11:22 +02:00
52eab40fc8 Implement LogicOP Workaround for Vulkan on AMD GPUs
This fixes black sewers in Paper Mario: TTYD
Credit: Antique - [Sudachi] Dev (https://sudachi.emuplace.app/)
2025-04-08 19:17:28 +02:00
MrPurple666
2d2e9208d2 Unified torzu and sudachi friend.cpp + fix android build on dma_pusher 2025-04-04 03:40:49 +02:00
Zephyron
0071e980b8 video_core: Enforce safe memory reads for compute dispatch
- Modify DmaPusher to use safe memory reads when handling compute
  operations at High GPU accuracy
- Prevent potential memory corruption issues that could lead to
  invalid dispatch parameters
- Previously, unsafe reads could result in corrupted launch_description
  data in KeplerCompute::ProcessLaunch, causing invalid vkCmdDispatch
  calls
- By enforcing safe reads specifically for compute operations, we
  maintain performance for other GPU tasks while ensuring compute
  dispatch stability

This change requires >= High GPU accuracy level to take effect.
2025-04-04 03:40:49 +02:00
darktux
492d3856e8 Vulkan validation error fix.
Different image usage flags between image creation and image view
creation.
2025-04-04 03:40:48 +02:00
darktux
edff3d4adb Radeon gpu profiler detection support 2025-04-04 03:40:47 +02:00
darktux
2032d035a3 Removed telemetry and anonymized SCM (git) strings 2025-04-04 03:40:47 +02:00
darktux
616619c8f7 Port changes from Early Access 2025-04-04 03:40:46 +02:00
Briar
4bb6e633e0 externals: Downgrade dynarmic to ae99622 and xbyak to 0d67fd15; modify ABI parameter handling in macro_jit_x64.cpp 2025-04-04 03:23:32 +02:00
voidanix
d60cf76e2d Fix GCC builds with Debug build type 2025-04-01 18:31:44 +02:00
yuzubot
f2aa821f94 "Merge Tagged PR 13178" 2024-03-03 13:02:49 +00:00
liamwhite
3a31129447 Merge pull request #13171 from liamwhite/fake-address
texture_cache: do not track invalid addresses
2024-02-27 09:42:46 -05:00
liamwhite
5f2369bba6 general: workarounds for SMMU syncing issues (#12749) 2024-02-27 15:42:15 +01:00
liamwhite
a918ce6fe9 vk_rasterizer: flip scissor y on lower left origin mode (#13122) 2024-02-27 15:40:33 +01:00
liamwhite
c98e01cee8 buffer_cache: avoid overflow in usage tracker (#13166) 2024-02-27 15:39:11 +01:00
liamwhite
df3712ad06 texture_cache: use two-pass collection for costly load resources (#13096) 2024-02-27 15:38:14 +01:00
Narr the Reg
325e577eec Merge pull request #13172 from liamwhite/gl-streams
renderer_opengl: declare geometry stream support in profile
2024-02-26 11:51:25 -06:00
Liam
71a6d3596a renderer_opengl: declare geometry stream support in profile 2024-02-26 11:18:30 -05:00
Liam
9db29b4e20 settings: remove global override for smash on amdvlk 2024-02-26 11:16:18 -05:00
Liam
e15b1021a4 video_core: make gpu context aware of rendering program 2024-02-26 11:16:14 -05:00