diff options
| author | 2022-12-19 19:29:58 -0500 | |
|---|---|---|
| committer | 2023-01-04 22:22:01 -0500 | |
| commit | 301e9bbc03821ef7943d84b24b32c8b732a39f6a (patch) | |
| tree | 3afaf56153ba07f4a8ec083bac4b59d119ed2723 /src/video_core/host_shaders | |
| parent | Merge pull request #9501 from FernandoS27/yfc-rel-2 (diff) | |
| download | yuzu-301e9bbc03821ef7943d84b24b32c8b732a39f6a.tar.gz yuzu-301e9bbc03821ef7943d84b24b32c8b732a39f6a.tar.xz yuzu-301e9bbc03821ef7943d84b24b32c8b732a39f6a.zip | |
vulkan: implement 'turbo mode' clock booster
Diffstat (limited to 'src/video_core/host_shaders')
| -rw-r--r-- | src/video_core/host_shaders/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/video_core/host_shaders/vulkan_turbo_mode.comp | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index e6dc24f22..f275b2aa9 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt | |||
| @@ -47,6 +47,7 @@ set(SHADER_FILES | |||
| 47 | vulkan_present_scaleforce_fp16.frag | 47 | vulkan_present_scaleforce_fp16.frag |
| 48 | vulkan_present_scaleforce_fp32.frag | 48 | vulkan_present_scaleforce_fp32.frag |
| 49 | vulkan_quad_indexed.comp | 49 | vulkan_quad_indexed.comp |
| 50 | vulkan_turbo_mode.comp | ||
| 50 | vulkan_uint8.comp | 51 | vulkan_uint8.comp |
| 51 | ) | 52 | ) |
| 52 | 53 | ||
diff --git a/src/video_core/host_shaders/vulkan_turbo_mode.comp b/src/video_core/host_shaders/vulkan_turbo_mode.comp new file mode 100644 index 000000000..d651001d9 --- /dev/null +++ b/src/video_core/host_shaders/vulkan_turbo_mode.comp | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #version 460 core | ||
| 5 | |||
| 6 | layout (local_size_x = 16, local_size_y = 8, local_size_z = 1) in; | ||
| 7 | |||
| 8 | layout (binding = 0) buffer ThreadData { | ||
| 9 | uint data[]; | ||
| 10 | }; | ||
| 11 | |||
| 12 | uint xorshift32(uint x) { | ||
| 13 | x ^= x << 13; | ||
| 14 | x ^= x >> 17; | ||
| 15 | x ^= x << 5; | ||
| 16 | return x; | ||
| 17 | } | ||
| 18 | |||
| 19 | uint getGlobalIndex() { | ||
| 20 | return gl_GlobalInvocationID.x + gl_GlobalInvocationID.y * gl_WorkGroupSize.y * gl_NumWorkGroups.y; | ||
| 21 | } | ||
| 22 | |||
| 23 | void main() { | ||
| 24 | uint myIndex = xorshift32(getGlobalIndex()); | ||
| 25 | uint otherIndex = xorshift32(myIndex); | ||
| 26 | |||
| 27 | uint otherValue = atomicAdd(data[otherIndex % data.length()], 0) + 1; | ||
| 28 | atomicAdd(data[myIndex % data.length()], otherValue); | ||
| 29 | } | ||