Commit Graph

7040 Commits

Author SHA1 Message Date
Zephyron
b85fd5fc73 renderer_vulkan: add Extended Dynamic State user setting
Add configurable EDS levels (Disabled/EDS1/EDS2/EDS3) to allow users to
troubleshoot graphics issues by controlling which Vulkan Extended Dynamic
State features are enabled. Defaults to EDS3 for maximum performance.

Implements setting in both desktop and Android frontends with proper
translations and descriptions.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-17 18:52:30 +10:00
Zephyron
ac21b19165 vulkan: fix flickering objects and texture corruption
- Fix critical memory barrier bug: add missing newLayout assignment in write_barrier
- Improve texture swizzling with dynamic block height calculation:
  * RGB565 format: use block_height_log2 = 3
  * Small textures (≤256x256): use block_height_log2 = 3
  * Add validation to prevent corruption from invalid sizes
- Enhance memory barriers with proper stage synchronization:
  * Add VK_ACCESS_SHADER_READ_BIT to source access mask
  * Use correct pipeline stages for transfer operations
  * Ensure proper layout transitions (UNDEFINED → TRANSFER_DST → SHADER_READ_ONLY)
- Fix descriptor set layout: use VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
- Add framebuffer dimension validation (max 8192x8192) to prevent crashes
- Add fallback mechanism for invalid texture data (raw memory copy)

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-17 18:44:07 +10:00
Zephyron
99073c8e19 renderer_vulkan: Add conditional rendering control setting
Adds user option to disable Vulkan conditional rendering, which can fix
flickering objects in some games caused by rapidly toggled draw calls.

Changes:
- Add use_conditional_rendering setting (default: enabled)
- Guard conditional rendering functions with setting check using [[unlikely]]
- Early exit in Pause/Resume and Compare functions when disabled

Disabling this in Graphics (Advanced) fixes flickering at cost of performance.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-17 16:47:57 +10:00
Zephyron
d8d54c5ccf shader_recompiler: Fix alpha-to-coverage fragment output interface
The Vulkan spec requires fragment shaders to declare an output covering
Location 0, Component 3 (alpha) when alpha-to-coverage is enabled. This change:

- Tracks alpha_to_coverage_enabled through RuntimeInfo from pipeline state
- Forces declaration of frag_color[0] with full RGBA when enabled
- Initializes alpha to 1.0 in shader epilogue if not explicitly written

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-17 16:07:35 +10:00
Zephyron
7dea15e642 Revert "fix: Prevent race condition on unmapped memory reads"
This reverts commit 13c60ebcde.

This needs a rework as it caused Shader Corruption On Many Titles
2025-10-16 17:40:53 +10:00
collecting
13c60ebcde fix: Prevent race condition on unmapped memory reads 2025-10-15 04:24:03 +00:00
Zephyron
568ab699f6 feat(renderer): Add ScaleFX pixel art upscaling filter
Implements ScaleFX algorithm for pixel art upscaling with edge
preservation. Supports both OpenGL and Vulkan with FP16/FP32
variants for hardware optimization.

ScaleFX is designed to reduce pixelation while preserving sharp
edges, ideal for low-resolution and pixel art games.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-11 13:35:19 +10:00
collecting
c2d984610b refine: Lanczos Filter 2025-10-07 20:39:18 +00:00
collecting
f0ccc3108e fix: Copyright 2025-10-06 05:00:49 +00:00
collecting
6e315c09e8 fix: Lanczos Frag 2025-10-06 03:24:35 +00:00
collecting
81630008b6 fix: Lanczos 2025-10-06 02:35:05 +00:00
collecting
41fc8ee272 feat: Add Lanczos 2025-10-06 02:13:55 +00:00
collecting
5785ae746e feat: Add Lanczos 2025-10-06 02:12:38 +00:00
collecting
5fb1a16344 feat: Add Lanczos 2025-10-06 02:11:27 +00:00
collecting
37bebbea10 feat: Add Lanczos 2025-10-06 02:10:57 +00:00
collecting
7feef45cee feat: Add Lanczos 2025-10-06 02:10:20 +00:00
collecting
c0c75e43ad feat: Add Lanczos 2025-10-06 02:09:42 +00:00
collecting
0202478a37 feat: Add Lanczos 2025-10-06 02:08:29 +00:00
collecting
c2446eb91e feat: Add Lanczos 2025-10-06 02:07:48 +00:00
collecting
6f2e1f458d feat: Add Lanczos 2025-10-06 02:07:03 +00:00
collecting
a027fad072 feat: Add Lanczos Frag 2025-10-06 02:06:20 +00:00
Zephyron
b903fccf84 Merge branch 'is_wayland_platform' into 'main'
fix: is_wayland_platform flag to prioritize low-latency

See merge request citron/emulator!62
2025-10-01 22:17:07 +10:00
Zephyron
9090a24c2e feat: add Low GPU Accuracy setting for maximum performance
Implements a new "Low" GPU accuracy level that prioritizes performance
over accuracy by aggressively cutting corners in GPU emulation.

Changes:
- Add GpuAccuracy::Low enum and setting infrastructure
- Implement IsGPULevelNormal() helper function
- Skip texture cache checks and query operations
- Use unsafe memory reads for DMA operations
- Disable fence delays and query precision
- Add UI support for desktop (Qt) and Android

Performance optimizations:
- Skips texture cache coherency checks (vk/gl_rasterizer.cpp)
- Non-blocking query synchronization (query_cache.h)
- Unsafe memory operations (dma_pusher.cpp)
- No macro parameter refresh (maxwell_3d.cpp)
- Immediate fence signaling (fence_manager.h)
- Non-precise Vulkan queries (vk_query_cache.cpp)

Ideal for lower-end hardware and users prioritizing FPS over accuracy.
Works on both desktop and Android platforms.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-01 21:45:23 +10:00
collecting
ce2909299f fix: is_wayland_platform flag to prioritize low-latency 2025-09-29 04:11:44 +00:00
collecting
90e39d3c3b Remove unused variable 2025-09-24 04:51:15 +00:00
Zephyron
0b10f729f7 Merge branch 'collecting-main-patch-79513' into 'main'
static_cast

See merge request citron/emulator!30
2025-09-23 11:18:14 +10:00
Zephyron
21f6703fe1 Merge branch 'collecting-main-patch-39194' into 'main'
static_cast

See merge request citron/emulator!31
2025-09-23 11:17:58 +10:00
collecting
bc6a169829 static_cast 2025-09-23 01:10:58 +00:00
collecting
5903a7ad56 static_cast 2025-09-23 01:10:07 +00:00
collecting
a2272afec3 static_cast 2025-09-23 01:09:13 +00:00
Zephyron
19cf31b215 feat: add Temporal Anti-Aliasing (TAA) support for OpenGL and Vulkan
- Add TAA option to AntiAliasing enum in settings
- Implement TAA shaders for both OpenGL (GLSL) and Vulkan (SPIR-V)
- Add OpenGL TAA class with framebuffer management and temporal blending
- Add Vulkan TAA class following existing AntiAliasPass architecture
- Integrate TAA into OpenGL and Vulkan rendering pipelines
- Add UI translations and Android string resources for TAA option
- Implement Halton sequence jittering for temporal sampling
- Add motion vector validation and neighborhood clamping to reduce ghosting
- Configure aggressive temporal blending to minimize visual artifacts
- Add proper descriptor set management for Vulkan TAA implementation

The TAA implementation provides high-quality anti-aliasing by combining
information from multiple frames with per-pixel jittering, resulting
in smoother edges and reduced aliasing artifacts while maintaining
good performance and temporal stability.

Fixes: Black screen issues with proper descriptor set bindings
Fixes: Ghosting artifacts with improved temporal blending parameters
Fixes: Jitter visibility with reduced jitter intensity (50% scaling)
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-21 10:34:19 +10:00
Boss.sfc
a3c4f0614a fix: Linux compiling
Made it so that the updater stuff is windows only.

Signed-off-by: Boss.sfc <boss.sfc@citron-emu.org>
2025-09-14 18:46:18 +07:00
Zephyron
94119302ec feat: Add OpenGL ZBC clear support and refactor ZBC management
Moved ZBCManager to `video_core/zbc_manager.cpp/h` for modularity. Added
`gl_zbc_clear.cpp/h` for efficient OpenGL color, depth, and stencil clears.
Updated `RasterizerOpenGL::Clear` to use ZBC with fallback. Added stencil
type validation. Fixed color mask and logging. Updated `CMakeLists.txt`.
Enhances performance and code organization.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-14 20:28:39 +10:00
Zephyron
6e6b2f438e feat: add High-End and Insane VRAM modes with leak prevention
- Add HighEnd and Insane VRAM usage modes for RTX 4090/4080+ users
- Implement VRAM limits: HighEnd (12GB), Insane (22GB) with scaling
- Optimize buffer allocation with larger chunks for high-end GPUs
- Add VRAM leak detection and aggressive cleanup for Insane mode
- Increase shader compilation buffer sizes for better performance
- Add VRAM monitoring functions to Vulkan rasterizer
- Implement memory usage tracking for staging buffers

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-14 16:05:31 +10:00
Zephyron
50afaefffb feat: Enhanced Nintendo SDK crash detection and recovery system
* Enhanced ARM interface backtrace logging with Nintendo SDK crash detection
  - Detects nnSdk module crashes and initialization-time failures
  - Provides detailed recovery suggestions and logging
  - Identifies recoverable vs non-recoverable crashes

* Improved physical core crash handling
  - Enhanced prefetch abort and data abort recovery
  - Continues execution for Nintendo SDK crashes instead of suspending
  - Better logging for crash analysis and debugging

* Expanded SVC exception handling
  - Added Nintendo SDK-specific crash recovery logic
  - Enhanced general crash recovery for low-address and assertion failures
  - Improved UE4 crash handling integration

* Updated Horizon OS version to 20.4.0
  - Updated HOS_VERSION_MINOR from 1 to 4
  - Updated HOS_VERSION_MICRO from 5 to 0
  - Updated version hash and display strings accordingly

* Fixed Vulkan turbo mode performance metrics
  - Added proper type casting for execution time comparisons
  - Prevents potential integer overflow issues

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-05 14:57:58 +10:00
Zephyron
ae46d4629f Merge branch 'vulkan-turbo-mode-optimization' into 'master'
vulkan: Add adaptive timeout and auto-disable to turbo mode

See merge request citron/rewrite!56
2025-08-26 08:33:43 +00:00
Zephyron
c851521a6b vulkan: Add adaptive timeout and auto-disable to turbo mode
- Implement adaptive timeout system that adjusts based on GPU performance
- Add auto-disable after 10 cycles of persistent timeouts
- Reduce workload (32x32 dispatch, 1MB buffer) for better compatibility
- Add performance monitoring and runtime control
- Fixes persistent timeout warnings by gracefully degrading when GPU is busy

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-08-26 18:30:58 +10:00
Zephyron
4cdc602f1e vulkan: Optimize descriptor update queue performance
- Increase frame count (8→12) and payload size (0x20000→0x40000)
- Add batch operations and memory management helpers
- Improve overflow handling with statistics tracking
- Create specialized classes for different workload types
- Implement smart pre-allocation and memory optimization
- Add comprehensive performance monitoring

Improves performance for Switch titles with complex shaders under Vulkan.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-08-26 16:15:10 +10:00
Zephyron
e27fc65d11 feat: remove frame generation options from all platforms
Frame generation was marked as WIP and not ready for production use.
This commit removes all frame generation related code and UI elements
to prevent users from enabling an incomplete feature.

Changes:
- Remove frame generation settings from Android UI (Kotlin/XML)
- Remove frame generation settings from Desktop UI (Qt/C++)
- Remove frame generation enums and settings from core (C++)
- Remove frame generation Vulkan renderer implementation
- Remove frame generation shader files
- Update CMake build configuration

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-08-17 16:09:05 +10:00
Zephyron
06f13f3cb1 android: Add shader building overlay with performance graph
- Add new settings for shader building overlay and performance graph
- Create ShaderBuildingOverlayView with animated shader building indicator
- Implement JNI bridge to get shader building count from core
- Add performance metrics display (FPS, frametime, emulation speed)
- Include real-time frametime graph with min/avg/max statistics
- Add menu options to toggle overlay and graph independently
- Integrate with existing overlay system in EmulationFragment
- Optimize Vulkan pipeline cache loading with pre-reservation
- Improve async shader building to reduce main thread blocking

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-08-17 15:48:06 +10:00
Zephyron
117c467ff3 feat: Add frame generation and enhance UE4 game compatibility
- Add frame generation settings (enabled/disabled, interpolation/extrapolation modes)
- Add frame skipping settings (enabled/disabled, adaptive/fixed modes)
- Implement frame skipping logic with adaptive and fixed modes
- Enhance UE4 crash handling with recovery mechanisms
- Add support for signed and float 32-bit image formats across shader backends
- Update Vulkan Validation Layers to v1.4.321.0
- Fix duplicate frame skipping options in Qt UI
- Improve memory handling for UE4 games (Hogwarts Legacy compatibility)
- Add enhanced bindless texture handling with fallback approach
- Update Android build configuration and dependencies

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-08-05 19:32:28 +10:00
Zephyron
568999fd59 feat: Improve FSR2 UI with dropdown quality mode and conditional FSR sharpness
- Convert FSR2 quality mode from number input to dropdown with 4 options
- Disable and grey out FSR sharpness slider when FSR2 is selected
- Add proper enum-based settings for FSR2 quality modes
- Update both Vulkan and OpenGL FSR2 implementations
- Connect UI state changes automatically

Provides better UX by using appropriate controls and preventing confusion
between FSR 1.0 and FSR 2.0 sharpening options.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-07-29 15:49:05 +10:00
Zephyron
3b8da3d80a feat: Add FSR 2.0 scaling filter option
- Add FSR2 to ScalingFilter enum alongside existing FSR
- Implement FSR2 classes for both Vulkan and OpenGL renderers
- Add fsr2_quality_mode setting with 4 quality levels (Quality, Balanced, Performance, Ultra Performance)
- Integrate FSR2 into present pipeline for both renderers
- Add UI support for FSR2 option in scaling filter dropdown
- Add FSR2 quality mode setting with dropdown selection
- Update translations and Android strings for new options
- Default to Performance mode for optimal balance

This provides users with FSR 2.0 as a scaling option, offering different
quality/performance characteristics compared to FSR 1.0. The implementation
uses quality-based sharpening values and integrates seamlessly with the
existing rendering pipeline.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-07-29 15:21:36 +10:00
Boss.sfc
fc480dcb69 fix: CachyOS LTO Compilation
Fix LTO linking issues on CachyOS with GCC 15.x

- Add LTO support to all core library targets (input_common, frontend_common,
  network, shader_recompiler, web_service) that were missing LTO configuration
- Create citron_configure_lto() helper function for consistent LTO handling
- Implement CachyOS-specific detection via /etc/os-release and kernel version
- Apply conservative LTO flags (-flto=auto -ffat-lto-objects) only for
  CachyOS + GCC 15+ to resolve linking errors with newer toolchains
- Other distributions continue using aggressive LTO settings for maximum performance
- Disable LTO on executable targets to prevent main function optimization issues

This resolves "undefined symbol" errors when building with -DCITRON_ENABLE_LTO=ON
on CachyOS while maintaining optimal LTO performance on other distributions.

Fixes linking errors including:
- Core::Frontend::EmuWindow symbols
- Core::System methods
- Settings::values
- Common logging functions

Tested on CachyOS with GCC 15.1.1 + LLD 20.1.8

Signed-off-by: Boss.sfc <boss.sfc@citron-emu.org>
2025-07-22 21:37:37 +07:00
Boss.sfc
0fb39034c1 fix: Resolve compilation issues with fmt library and formatters
Fix multiple compilation errors preventing successful build:

* Add const qualifier to custom fmt formatter functions across codebase
  - Updated formatters in logging, shader recompiler, texture cache, and other modules
  - Ensures compatibility with newer fmt library versions

* Add missing fmt/ranges.h includes for fmt::join usage
  - Fixed fmt::join calls in Vulkan renderer, GDB stub, NFC service, and main window
  - Resolves "no member named 'join' in namespace 'fmt'" errors

* Exclude unsupported platforms from Boost.Process usage in debugger
  - Extended conditional compilation to avoid Boost.Process where unavailable

* Fix type casting issues in AOC service manager
  - Resolved std::min type mismatch with explicit casting
2025-07-16 11:11:33 +07:00
Zephyron
99cff6cb9c core/hle/service/bcat: Fix compilation errors and implement missing services
- Fix CMIF serialization alignment error in RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName by reordering parameters (DirectoryName before u64)
- Implement missing INotifierService and IDeliveryTaskSuspensionService classes with proper kernel event handling
- Add missing source files to CMakeLists.txt to resolve linker errors
- Update IServiceCreator to properly implement CreateDeliveryCacheProgressService methods instead of leaving them stubbed
- Add ProgressServiceBackend support to IServiceCreator with proper friend class access
- Fix kernel event creation by using KernelHelpers::ServiceContext instead of direct system calls
- Add proper includes for kernel_helpers.h and event management

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-07-05 23:12:39 +10:00
Zephyron
4aee8c6709 video_core: Suppress MSVC warnings for VulkanMemoryAllocator
- Add citron copyright header
- Disable compiler warnings for vulkan_common/vma.cpp on MSVC builds
  to prevent third-party VMA library warnings from cluttering build output

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-06-16 17:22:29 +10:00
Zephyron
9bb2b769a4 video_core: Use safe memory reads for KeplerCompute inline methods
Changes:
- Remove special case for KeplerCompute inline methods that used unsafe reads in high
  accuracy mode
- Add special case to use safe reads for KeplerCompute inline methods even in normal
  accuracy mode

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-11 16:26:59 +10:00
Zephyron
b2d9cf4a01 chore: update project branding to CITRON
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-06 16:11:33 +10:00
Zephyron
5e16e20427 chore: update project branding to Citron
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-06 16:08:59 +10:00