Commit graph

7002 commits

Author SHA1 Message Date
Zephyron
f380744c61 android: Fix compilation by adding missing log.h include
Adds missing include for common/logging/log.h in gpu.h which was causing
compilation failures on Android. This header is needed for logging
functionality used in GPU-related operations.

The include was previously indirectly available through other headers,
but making it explicit improves code clarity and prevents potential
future compilation issues.
2025-01-27 00:46:46 +10:00
Zephyron
be191f740a buffer_cache: Simplify storage buffer binding logic
Reverts overly restrictive storage buffer validation and size calculation
that was causing rendering issues in The Legend of Zelda: Tears of the
Kingdom, particularly in underground/depth areas. The simplified approach:

- Uses GetMemoryLayoutSize() instead of manual page probing
- Removes unnecessary 4GB memory bounds validation
- Streamlines address translation and alignment handling

This fixes numerous reported cases of missing or corrupted rendering in
TOTK's underground areas where storage buffer operations are heavily used
for depth-related effects.
2025-01-26 16:13:05 +10:00
Zephyron
774d8d9eba service/nvdrv: Relax GPU validation and improve error handling
Relaxes validation checks in the NVDRV GPU service and improves error notifier
handling to prevent potential hangs. Key changes:

- Remove strict size validation in SetErrorNotifier
- Relax GPFIFO entry count validation to only check for non-zero values
- Add proper error notifier state tracking in GPU class
- Improve debug logging messages

The previous strict validation was causing issues with some games like ACNH.
These changes maintain necessary checks while being more permissive with
edge cases that don't impact functionality.

Technical changes:
- Store error notifier state in GPU class for future implementation
- Remove upper bound check on GPFIFO entries
- Simplify error notifier setup flow

This should resolve hanging issues while maintaining core functionality.
2025-01-21 16:07:44 +10:00
Zephyron
d7dc87bbf3 service/nvdrv: Implement stubbed GPU functions
Implements several previously stubbed functions in the NVDRV service:
- Initialize proper transfer memory handling
- Add error notifier configuration
- Implement channel timeout and timeslice management
- Add object context allocation and tracking
- Add GPU interface stubs for new functionality

The changes improve the accuracy of GPU-related operations while maintaining
compatibility with the existing codebase. All functions now properly validate
parameters and handle endianness correctly using _le types.
2025-01-20 18:04:11 +10:00
Zephyron
d4d3061eb7 arm/video: Fix shader extension and exception handling
Two main changes in this commit:

1. Replace NVIDIA-specific GL_NV_gpu_shader5 extension with the more widely
   supported GL_EXT_shader_explicit_arithmetic_types_float16 in the scaleforce
   shader. This improves compatibility across different GPU vendors.

2. Refactor ARM32 exception handling:
   - Restructure exception cases for better readability
   - Update exception handling to match current Dynarmic API
   - Fix indentation in switch statement
   - Remove AccessViolation case as it's no longer supported in current API

These changes improve shader compatibility and align the exception handling
with the current Dynarmic implementation.
2025-01-18 19:09:03 +10:00
Zephyron
9ae0eeeb87 Revert incorrect copyright attribution for non-contributed files
- In commit b3facaa6bb, the copyright header was
  updated to include "Citron Homebrew Project" across multiple files, regardless
  of whether any contributions were made.

- This commit removes the incorrect attribution and reverts the copyright header
  to its previous state.

- Copyright attribution should only be added when meaningful contributions have
  been made to the file.

- This commit ensures proper compliance with copyright standards and maintains
  correct attribution to the respective contributors.

- Special thanks to Tachi for pointing out the need for these corrections and
  ensuring that proper attribution practices are followed.
2025-01-14 15:33:24 +10:00
Zephyron
6d5475a9cf Android: Update build system and dependencies
- Update Gradle from 8.1 to 8.10.2
- Update Android Gradle Plugin from 8.1.2 to 8.8.0
- Update Kotlin from 1.9.20 to 2.1.20-Beta1
- Update various AndroidX dependencies to latest versions
- Update NDK from 26.1 to 27.2 (with RC1/RC2 options commented)
- Update Java target from 17 to 21
- Update Android target SDK from 34 to 35
- Enable additional optimizations in release builds:
  - Enable shrinkResources
  - Use proguard-android-optimize.txt
  - Disable JNI debugging
- Replace vector drawables with PNG for ic_citron
- Comment out unused ComputeInline constant in dma_pusher.cpp
- Update Gradle wrapper and configuration files

This updates the Android build system and dependencies to their latest
versions while enabling additional optimizations for release builds.
The ic_citron icon was converted from vector to PNG format for better
compatibility.
2025-01-13 15:17:39 +10:00
Zephyron
0cf545858d
vulkan: Fix crashes with bindless texture constant buffer handling
Previously, the code would unconditionally add a constant buffer descriptor
at index 0 whenever storage buffers were present, which could cause conflicts
and crashes. This change:

- Adds validation to check if constant buffer 0 already exists
- Only adds the descriptor if it's not already present
- Prevents potential descriptor conflicts in shaders

This should resolve crashes in Vulkan games related to invalid descriptor
layouts and resource binding conflicts.
2025-01-09 17:13:12 +10:00
Zephyron
c65c8ac45e
vulkan: Add bindless texture constant buffer support in compute pipeline
Add support for bindless texture constant buffers in the compute pipeline
creation process. When storage buffer descriptors are present, create a
constant buffer descriptor to handle bindless textures. This fixes the
"Failed to track bindless texture constant buffer" error.

Changes:
- Add constant buffer descriptor with index 0 and count 1 when storage
  buffers are present
- Place descriptor creation before SPIR-V code generation to ensure proper
  shader compilation

This resolves issues with bindless texture access in compute shaders.
2025-01-08 19:13:03 +10:00
Zephyron
eb2a666a69
buffer_cache: Fix storage buffer memory validation and size detection
Fixes the StorageBufferBinding function to properly handle memory validation
and size detection. Key changes include:

- Fix ReadBlock usage to properly handle void return values
- Implement safer memory validation using byte-level reads
- Improve size detection logic for storage buffers
- Fix NVN buffer size reading
- Add proper bounds checking for device memory addresses
- Add better error logging for invalid conditions

This addresses the "Failed to find storage buffer for cbuf index 0" errors
by implementing more robust memory validation and size detection. The changes
ensure proper handling of invalid memory addresses and prevent crashes from
accessing out-of-bounds memory.
2025-01-02 18:03:47 +10:00
Zephyron
1cbcd142fa
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-01-02 16:38:18 +10:00
Zephyron
468ace6b0b
core: Update copyright headers
- Update copyright headers to include Citron Homebrew Project
- Add 2025 to copyright years
2024-12-31 17:36:08 +10:00
Zephyron
b3facaa6bb
chore: update project references and add Citron copyright
- Replaced all references to the old project name with Citron.
- Added Citron copyright information alongside existing notices in all files.
2024-12-31 17:07:49 +10:00
yuzubot
2ddac7b02b "Merge Tagged PR 13178" 2024-03-04 13:02:53 +00:00
liamwhite
f1b1530249
Merge pull request #13171 from liamwhite/fake-address
texture_cache: do not track invalid addresses
2024-02-27 09:42:46 -05:00
liamwhite
6948ac8c16
general: workarounds for SMMU syncing issues (#12749) 2024-02-27 15:42:15 +01:00
liamwhite
b2e129eaa5
vk_rasterizer: flip scissor y on lower left origin mode (#13122) 2024-02-27 15:40:33 +01:00
liamwhite
1de37306a5
buffer_cache: avoid overflow in usage tracker (#13166) 2024-02-27 15:39:11 +01:00
liamwhite
9bc85dda5f
texture_cache: use two-pass collection for costly load resources (#13096) 2024-02-27 15:38:14 +01:00
Narr the Reg
1bec420695
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
a0e254e7c4 renderer_opengl: declare geometry stream support in profile 2024-02-26 11:18:30 -05:00
Liam
25c3bbba0e settings: remove global override for smash on amdvlk 2024-02-26 11:16:18 -05:00
Liam
d66ca8b731 video_core: make gpu context aware of rendering program 2024-02-26 11:16:14 -05:00
Liam
fd9ed54f27 texture_cache: do not track invalid addresses 2024-02-26 10:26:27 -05:00
Narr the Reg
984396a21a
Merge pull request #13001 from liamwhite/scaled-availability
vulkan_device: don't use fixed cap for memory limits
2024-02-22 11:31:17 -06:00
Narr the Reg
4f95ee5209
Merge pull request #13075 from liamwhite/mali-having-a-bad-time
shader_recompiler: throw on missing geometry streams in geometry shaders
2024-02-22 11:30:26 -06:00
Matías Locatti
e0c17a2113
Merge pull request #10529 from liamwhite/critical-spacing
caches: make critical reclamation less eager and possible in more cases
2024-02-20 23:19:27 -03:00
FearlessTobi
310c1f50be scope_exit: Make constexpr
Allows the use of the macro in constexpr-contexts.
Also avoids some potential problems when nesting braces inside it.
2024-02-19 16:00:46 +01:00
Liam
f46dc31683 shader_recompiler: throw on missing geometry streams in geometry shaders 2024-02-19 00:34:00 -05:00
Liam
56810541f0 vulkan_device: don't use fixed cap for memory limits 2024-02-18 18:59:13 -05:00
Liam
3067bfd126 buffer_cache: use mapped range with large vertex buffer size 2024-02-13 08:27:33 -05:00
liamwhite
f75fceb3c0
Merge pull request #12975 from FernandoS27/keep-your-own-vodoo-doll-away-from-gf
Texture Cache: Fix untracking on GPU remap
2024-02-13 08:17:59 -05:00
Narr the Reg
2ff45cd0da
Merge pull request #12756 from liamwhite/applet-multiprocess-hwc
general: applet multiprocess
2024-02-11 20:58:28 -06:00
Liam
368bf2211f texture_cache: tweak iteration tracking change 2024-02-11 13:41:13 -05:00
Liam
de8a623932 texture_cache: avoid overestimation of ASTC texture sizes 2024-02-11 13:41:13 -05:00
Liam
865a0186b6 caches: make critical reclamation less eager and possible in more cases 2024-02-11 13:41:13 -05:00
Liam
4eeac731ff host_shaders: add vendor workaround for adreno drivers 2024-02-10 12:02:37 -05:00
Fernando Sahmkow
9ce43ee677 Texture Cache: Fix untracking on GPU remap 2024-02-10 14:49:49 +01:00
Liam
78aac6b403 gpu: dependency-inject scaling/antialiasing filter state for capture layers 2024-02-09 09:20:53 -05:00
Liam
0cb413c3d3 nvnflinger/gpu: implement applet capture 2024-02-09 09:20:53 -05:00
Liam
962c82540c nvnflinger/gpu: implement blending 2024-02-09 09:20:53 -05:00
Liam
0cbb555e9a video_core: defensively program around unmapped device pointers 2024-02-09 09:20:53 -05:00
liamwhite
263dfa95e4
Merge pull request #12914 from FernandoS27/vc-refactor
VideoCore Refactor Part 1.
2024-02-08 10:59:59 -05:00
liamwhite
c10e720ba9
Merge pull request #12883 from FernandoS27/memory_manager_mem
MemoryManager: Reduce the page table size based on last big page address.
2024-02-06 10:25:03 -05:00
Fernando Sahmkow
fa47ac1c9f Common: Rename SplitRangeSet to OverlapRangeSet 2024-02-05 23:01:17 +01:00
Fernando Sahmkow
0d5a3abeae Buffer Cache: Refactor to use Range sets instead 2024-02-05 11:06:52 +01:00
Fernando Sahmkow
4841dc0b74 VideoCore: Move Slot Vector to Common 2024-02-04 20:01:47 +01:00
liamwhite
3ac46aeced
Merge pull request #12885 from Moonlacer/eclipse-fix
structured_control_flow: Add Samsung Proprietary Driver ID to Reorder Pass
2024-02-02 09:08:54 -05:00
Fernando S
58cf2ee1f9
Merge pull request #12761 from liamwhite/mp-composite
video_core: rewrite presentation for layer composition
2024-02-02 15:08:06 +01:00
Moonlacer
11a8ef6640 Clang Fix 2024-02-01 18:15:21 -06:00