summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Wunkolo2021-06-23 14:18:27 -0700
committerGravatar Wunkolo2021-06-24 09:27:40 -0700
commit4569f39c7c1e3d7ce010f0b120e1f45dbba17b1c (patch)
tree591792bc47e26bc812e753b0891aab94a8a88352 /src
parentMerge pull request #6504 from Kelebek1/samples-played (diff)
downloadyuzu-4569f39c7c1e3d7ce010f0b120e1f45dbba17b1c.tar.gz
yuzu-4569f39c7c1e3d7ce010f0b120e1f45dbba17b1c.tar.xz
yuzu-4569f39c7c1e3d7ce010f0b120e1f45dbba17b1c.zip
common: Replace common_sizes into user-literals
Removes common_sizes.h in favor of having `_KiB`, `_MiB`, `_GiB`, etc user-literals within literals.h. To keep the global namespace clean, users will have to use: ``` using namespace Common::Literals; ``` to access these literals.
Diffstat (limited to 'src')
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/common/common_sizes.h44
-rw-r--r--src/common/literals.h31
-rw-r--r--src/common/logging/backend.cpp11
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp7
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp6
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp37
-rw-r--r--src/core/hle/kernel/k_address_space_info.cpp35
-rw-r--r--src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp5
-rw-r--r--src/core/hle/kernel/k_memory_layout.h27
-rw-r--r--src/core/hle/kernel/k_page_table.cpp5
-rw-r--r--src/core/hle/kernel/k_trace.h6
-rw-r--r--src/core/hle/kernel/kernel.cpp17
-rw-r--r--src/tests/common/host_memory.cpp4
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h11
-rw-r--r--src/video_core/renderer_opengl/gl_stream_buffer.h5
-rw-r--r--src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp8
-rw-r--r--src/video_core/renderer_vulkan/vk_stream_buffer.cpp5
-rw-r--r--src/video_core/texture_cache/texture_cache.h12
19 files changed, 152 insertions, 126 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 7534eb8f1..a6fa9a85d 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -110,7 +110,6 @@ add_library(common STATIC
110 cityhash.cpp 110 cityhash.cpp
111 cityhash.h 111 cityhash.h
112 common_funcs.h 112 common_funcs.h
113 common_sizes.h
114 common_types.h 113 common_types.h
115 concepts.h 114 concepts.h
116 div_ceil.h 115 div_ceil.h
@@ -134,6 +133,7 @@ add_library(common STATIC
134 host_memory.cpp 133 host_memory.cpp
135 host_memory.h 134 host_memory.h
136 intrusive_red_black_tree.h 135 intrusive_red_black_tree.h
136 literals.h
137 logging/backend.cpp 137 logging/backend.cpp
138 logging/backend.h 138 logging/backend.h
139 logging/filter.cpp 139 logging/filter.cpp
diff --git a/src/common/common_sizes.h b/src/common/common_sizes.h
deleted file mode 100644
index d07b7ee5a..000000000
--- a/src/common/common_sizes.h
+++ /dev/null
@@ -1,44 +0,0 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <limits>
8
9#include "common/common_types.h"
10
11namespace Common {
12
13enum : u64 {
14 Size_1_KB = 0x400ULL,
15 Size_64_KB = 64ULL * Size_1_KB,
16 Size_128_KB = 128ULL * Size_1_KB,
17 Size_1_MB = 0x100000ULL,
18 Size_2_MB = 2ULL * Size_1_MB,
19 Size_4_MB = 4ULL * Size_1_MB,
20 Size_5_MB = 5ULL * Size_1_MB,
21 Size_14_MB = 14ULL * Size_1_MB,
22 Size_32_MB = 32ULL * Size_1_MB,
23 Size_33_MB = 33ULL * Size_1_MB,
24 Size_128_MB = 128ULL * Size_1_MB,
25 Size_448_MB = 448ULL * Size_1_MB,
26 Size_507_MB = 507ULL * Size_1_MB,
27 Size_512_MB = 512ULL * Size_1_MB,
28 Size_562_MB = 562ULL * Size_1_MB,
29 Size_1554_MB = 1554ULL * Size_1_MB,
30 Size_2048_MB = 2048ULL * Size_1_MB,
31 Size_2193_MB = 2193ULL * Size_1_MB,
32 Size_3285_MB = 3285ULL * Size_1_MB,
33 Size_4916_MB = 4916ULL * Size_1_MB,
34 Size_1_GB = 0x40000000ULL,
35 Size_2_GB = 2ULL * Size_1_GB,
36 Size_4_GB = 4ULL * Size_1_GB,
37 Size_6_GB = 6ULL * Size_1_GB,
38 Size_8_GB = 8ULL * Size_1_GB,
39 Size_64_GB = 64ULL * Size_1_GB,
40 Size_512_GB = 512ULL * Size_1_GB,
41 Size_Invalid = std::numeric_limits<u64>::max(),
42};
43
44} // namespace Common
diff --git a/src/common/literals.h b/src/common/literals.h
new file mode 100644
index 000000000..d55fed40b
--- /dev/null
+++ b/src/common/literals.h
@@ -0,0 +1,31 @@
1// Copyright 2021 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9namespace Common::Literals {
10
11constexpr u64 operator""_KiB(unsigned long long int x) {
12 return 1024ULL * x;
13}
14
15constexpr u64 operator""_MiB(unsigned long long int x) {
16 return 1024_KiB * x;
17}
18
19constexpr u64 operator""_GiB(unsigned long long int x) {
20 return 1024_MiB * x;
21}
22
23constexpr u64 operator""_TiB(unsigned long long int x) {
24 return 1024_GiB * x;
25}
26
27constexpr u64 operator""_PiB(unsigned long long int x) {
28 return 1024_TiB * x;
29}
30
31} // namespace Common::Literals
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 47ce06478..b6fa4affb 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -19,6 +19,8 @@
19#include "common/assert.h" 19#include "common/assert.h"
20#include "common/fs/file.h" 20#include "common/fs/file.h"
21#include "common/fs/fs.h" 21#include "common/fs/fs.h"
22#include "common/literals.h"
23
22#include "common/logging/backend.h" 24#include "common/logging/backend.h"
23#include "common/logging/log.h" 25#include "common/logging/log.h"
24#include "common/logging/text_formatter.h" 26#include "common/logging/text_formatter.h"
@@ -98,8 +100,8 @@ private:
98 write_logs(entry); 100 write_logs(entry);
99 } 101 }
100 102
101 // Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a case 103 // Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a
102 // where a system is repeatedly spamming logs even on close. 104 // case where a system is repeatedly spamming logs even on close.
103 const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100; 105 const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100;
104 int logs_written = 0; 106 int logs_written = 0;
105 while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) { 107 while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) {
@@ -169,10 +171,11 @@ FileBackend::FileBackend(const std::filesystem::path& filename) {
169FileBackend::~FileBackend() = default; 171FileBackend::~FileBackend() = default;
170 172
171void FileBackend::Write(const Entry& entry) { 173void FileBackend::Write(const Entry& entry) {
174 using namespace Common::Literals;
172 // prevent logs from going over the maximum size (in case its spamming and the user doesn't 175 // prevent logs from going over the maximum size (in case its spamming and the user doesn't
173 // know) 176 // know)
174 constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024; 177 constexpr std::size_t MAX_BYTES_WRITTEN = 100_MiB;
175 constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024; 178 constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1_GiB;
176 179
177 if (!file->IsOpen()) { 180 if (!file->IsOpen()) {
178 return; 181 return;
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index f871f7bf4..77a44f862 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -8,6 +8,7 @@
8#include <dynarmic/interface/A32/config.h> 8#include <dynarmic/interface/A32/config.h>
9#include <dynarmic/interface/A32/context.h> 9#include <dynarmic/interface/A32/context.h>
10#include "common/assert.h" 10#include "common/assert.h"
11#include "common/literals.h"
11#include "common/logging/log.h" 12#include "common/logging/log.h"
12#include "common/page_table.h" 13#include "common/page_table.h"
13#include "common/settings.h" 14#include "common/settings.h"
@@ -22,6 +23,8 @@
22 23
23namespace Core { 24namespace Core {
24 25
26using namespace Common::Literals;
27
25class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks { 28class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
26public: 29public:
27 explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_) 30 explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
@@ -143,8 +146,8 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
143 config.wall_clock_cntpct = uses_wall_clock; 146 config.wall_clock_cntpct = uses_wall_clock;
144 147
145 // Code cache size 148 // Code cache size
146 config.code_cache_size = 512 * 1024 * 1024; 149 config.code_cache_size = 512_MiB;
147 config.far_code_offset = 400 * 1024 * 1024; 150 config.far_code_offset = 400_MiB;
148 151
149 // Safe optimizations 152 // Safe optimizations
150 if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { 153 if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index ba524cd05..75332e348 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -7,6 +7,7 @@
7#include <dynarmic/interface/A64/a64.h> 7#include <dynarmic/interface/A64/a64.h>
8#include <dynarmic/interface/A64/config.h> 8#include <dynarmic/interface/A64/config.h>
9#include "common/assert.h" 9#include "common/assert.h"
10#include "common/literals.h"
10#include "common/logging/log.h" 11#include "common/logging/log.h"
11#include "common/page_table.h" 12#include "common/page_table.h"
12#include "common/settings.h" 13#include "common/settings.h"
@@ -24,6 +25,7 @@
24namespace Core { 25namespace Core {
25 26
26using Vector = Dynarmic::A64::Vector; 27using Vector = Dynarmic::A64::Vector;
28using namespace Common::Literals;
27 29
28class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks { 30class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
29public: 31public:
@@ -184,8 +186,8 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
184 config.wall_clock_cntpct = uses_wall_clock; 186 config.wall_clock_cntpct = uses_wall_clock;
185 187
186 // Code cache size 188 // Code cache size
187 config.code_cache_size = 512 * 1024 * 1024; 189 config.code_cache_size = 512_MiB;
188 config.far_code_offset = 400 * 1024 * 1024; 190 config.far_code_offset = 400_MiB;
189 191
190 // Safe optimizations 192 // Safe optimizations
191 if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { 193 if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
index 86472b5ce..6f335c251 100644
--- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
+++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
@@ -4,7 +4,8 @@
4 4
5#include <random> 5#include <random>
6 6
7#include "common/common_sizes.h" 7#include "common/literals.h"
8
8#include "core/hle/kernel/board/nintendo/nx/k_system_control.h" 9#include "core/hle/kernel/board/nintendo/nx/k_system_control.h"
9#include "core/hle/kernel/board/nintendo/nx/secure_monitor.h" 10#include "core/hle/kernel/board/nintendo/nx/secure_monitor.h"
10#include "core/hle/kernel/k_trace.h" 11#include "core/hle/kernel/k_trace.h"
@@ -25,6 +26,8 @@ constexpr const std::size_t RequiredNonSecureSystemMemorySize =
25 26
26namespace { 27namespace {
27 28
29using namespace Common::Literals;
30
28u32 GetMemoryModeForInit() { 31u32 GetMemoryModeForInit() {
29 return 0x01; 32 return 0x01;
30} 33}
@@ -57,11 +60,11 @@ size_t KSystemControl::Init::GetIntendedMemorySize() {
57 switch (GetMemorySizeForInit()) { 60 switch (GetMemorySizeForInit()) {
58 case Smc::MemorySize_4GB: 61 case Smc::MemorySize_4GB:
59 default: // All invalid modes should go to 4GB. 62 default: // All invalid modes should go to 4GB.
60 return Common::Size_4_GB; 63 return 4_GiB;
61 case Smc::MemorySize_6GB: 64 case Smc::MemorySize_6GB:
62 return Common::Size_6_GB; 65 return 6_GiB;
63 case Smc::MemorySize_8GB: 66 case Smc::MemorySize_8GB:
64 return Common::Size_8_GB; 67 return 8_GiB;
65 } 68 }
66} 69}
67 70
@@ -79,17 +82,17 @@ std::size_t KSystemControl::Init::GetApplicationPoolSize() {
79 switch (GetMemoryArrangeForInit()) { 82 switch (GetMemoryArrangeForInit()) {
80 case Smc::MemoryArrangement_4GB: 83 case Smc::MemoryArrangement_4GB:
81 default: 84 default:
82 return Common::Size_3285_MB; 85 return 3285_MiB;
83 case Smc::MemoryArrangement_4GBForAppletDev: 86 case Smc::MemoryArrangement_4GBForAppletDev:
84 return Common::Size_2048_MB; 87 return 2048_MiB;
85 case Smc::MemoryArrangement_4GBForSystemDev: 88 case Smc::MemoryArrangement_4GBForSystemDev:
86 return Common::Size_3285_MB; 89 return 3285_MiB;
87 case Smc::MemoryArrangement_6GB: 90 case Smc::MemoryArrangement_6GB:
88 return Common::Size_4916_MB; 91 return 4916_MiB;
89 case Smc::MemoryArrangement_6GBForAppletDev: 92 case Smc::MemoryArrangement_6GBForAppletDev:
90 return Common::Size_3285_MB; 93 return 3285_MiB;
91 case Smc::MemoryArrangement_8GB: 94 case Smc::MemoryArrangement_8GB:
92 return Common::Size_4916_MB; 95 return 4916_MiB;
93 } 96 }
94 }(); 97 }();
95 98
@@ -103,22 +106,22 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
103 switch (GetMemoryArrangeForInit()) { 106 switch (GetMemoryArrangeForInit()) {
104 case Smc::MemoryArrangement_4GB: 107 case Smc::MemoryArrangement_4GB:
105 default: 108 default:
106 return Common::Size_507_MB; 109 return 507_MiB;
107 case Smc::MemoryArrangement_4GBForAppletDev: 110 case Smc::MemoryArrangement_4GBForAppletDev:
108 return Common::Size_1554_MB; 111 return 1554_MiB;
109 case Smc::MemoryArrangement_4GBForSystemDev: 112 case Smc::MemoryArrangement_4GBForSystemDev:
110 return Common::Size_448_MB; 113 return 448_MiB;
111 case Smc::MemoryArrangement_6GB: 114 case Smc::MemoryArrangement_6GB:
112 return Common::Size_562_MB; 115 return 562_MiB;
113 case Smc::MemoryArrangement_6GBForAppletDev: 116 case Smc::MemoryArrangement_6GBForAppletDev:
114 return Common::Size_2193_MB; 117 return 2193_MiB;
115 case Smc::MemoryArrangement_8GB: 118 case Smc::MemoryArrangement_8GB:
116 return Common::Size_2193_MB; 119 return 2193_MiB;
117 } 120 }
118 }(); 121 }();
119 122
120 // Return (possibly) adjusted size. 123 // Return (possibly) adjusted size.
121 constexpr size_t ExtraSystemMemoryForAtmosphere = Common::Size_33_MB; 124 constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
122 return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; 125 return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
123} 126}
124 127
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp
index c7549f7a2..ca29edc88 100644
--- a/src/core/hle/kernel/k_address_space_info.cpp
+++ b/src/core/hle/kernel/k_address_space_info.cpp
@@ -5,34 +5,37 @@
5#include <array> 5#include <array>
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/common_sizes.h" 8#include "common/literals.h"
9#include "core/hle/kernel/k_address_space_info.h" 9#include "core/hle/kernel/k_address_space_info.h"
10 10
11namespace Kernel { 11namespace Kernel {
12 12
13namespace { 13namespace {
14 14
15using namespace Common::Literals;
16
17constexpr u64 Size_Invalid = UINT64_MAX;
18
15// clang-format off 19// clang-format off
16constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{ 20constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
17 { .bit_width = 32, .address = Common::Size_2_MB , .size = Common::Size_1_GB - Common::Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, }, 21 { .bit_width = 32, .address = 2_MiB , .size = 1_GiB - 2_MiB , .type = KAddressSpaceInfo::Type::MapSmall, },
18 { .bit_width = 32, .address = Common::Size_1_GB , .size = Common::Size_4_GB - Common::Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, 22 { .bit_width = 32, .address = 1_GiB , .size = 4_GiB - 1_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
19 { .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, }, 23 { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Alias, },
20 { .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, }, 24 { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Heap, },
21 { .bit_width = 36, .address = Common::Size_128_MB , .size = Common::Size_2_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, }, 25 { .bit_width = 36, .address = 128_MiB , .size = 2_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::MapSmall, },
22 { .bit_width = 36, .address = Common::Size_2_GB , .size = Common::Size_64_GB - Common::Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, }, 26 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
23 { .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, 27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
24 { .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, }, 28 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
25 { .bit_width = 39, .address = Common::Size_128_MB , .size = Common::Size_512_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, }, 29 { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
26 { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall }, 30 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
27 { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, }, 31 { .bit_width = 39, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
28 { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, }, 32 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },
29 { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, }, 33 { .bit_width = 39, .address = Size_Invalid, .size = 2_GiB , .type = KAddressSpaceInfo::Type::Stack, },
30}}; 34}};
31// clang-format on 35// clang-format on
32 36
33constexpr bool IsAllowedIndexForAddress(std::size_t index) { 37constexpr bool IsAllowedIndexForAddress(std::size_t index) {
34 return index < AddressSpaceInfos.size() && 38 return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid;
35 AddressSpaceInfos[index].address != Common::Size_Invalid;
36} 39}
37 40
38using IndexArray = 41using IndexArray =
diff --git a/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp b/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
index a78551291..af652af58 100644
--- a/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
+++ b/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/alignment.h" 5#include "common/alignment.h"
6#include "common/literals.h"
6#include "core/hle/kernel/k_memory_layout.h" 7#include "core/hle/kernel/k_memory_layout.h"
7#include "core/hle/kernel/k_memory_manager.h" 8#include "core/hle/kernel/k_memory_manager.h"
8#include "core/hle/kernel/k_system_control.h" 9#include "core/hle/kernel/k_system_control.h"
@@ -12,8 +13,10 @@ namespace Kernel {
12 13
13namespace { 14namespace {
14 15
16using namespace Common::Literals;
17
15constexpr size_t CarveoutAlignment = 0x20000; 18constexpr size_t CarveoutAlignment = 0x20000;
16constexpr size_t CarveoutSizeMax = (512ULL * 1024 * 1024) - CarveoutAlignment; 19constexpr size_t CarveoutSizeMax = (512_MiB) - CarveoutAlignment;
17 20
18bool SetupPowerManagementControllerMemoryRegion(KMemoryLayout& memory_layout) { 21bool SetupPowerManagementControllerMemoryRegion(KMemoryLayout& memory_layout) {
19 // Above firmware 2.0.0, the PMC is not mappable. 22 // Above firmware 2.0.0, the PMC is not mappable.
diff --git a/src/core/hle/kernel/k_memory_layout.h b/src/core/hle/kernel/k_memory_layout.h
index 288642d9a..57ff538cc 100644
--- a/src/core/hle/kernel/k_memory_layout.h
+++ b/src/core/hle/kernel/k_memory_layout.h
@@ -7,8 +7,7 @@
7#include <utility> 7#include <utility>
8 8
9#include "common/alignment.h" 9#include "common/alignment.h"
10#include "common/common_sizes.h" 10#include "common/literals.h"
11#include "common/common_types.h"
12#include "core/device_memory.h" 11#include "core/device_memory.h"
13#include "core/hle/kernel/k_memory_region.h" 12#include "core/hle/kernel/k_memory_region.h"
14#include "core/hle/kernel/k_memory_region_type.h" 13#include "core/hle/kernel/k_memory_region_type.h"
@@ -16,20 +15,22 @@
16 15
17namespace Kernel { 16namespace Kernel {
18 17
19constexpr std::size_t L1BlockSize = Common::Size_1_GB; 18using namespace Common::Literals;
20constexpr std::size_t L2BlockSize = Common::Size_2_MB; 19
20constexpr std::size_t L1BlockSize = 1_GiB;
21constexpr std::size_t L2BlockSize = 2_MiB;
21 22
22constexpr std::size_t GetMaximumOverheadSize(std::size_t size) { 23constexpr std::size_t GetMaximumOverheadSize(std::size_t size) {
23 return (Common::DivideUp(size, L1BlockSize) + Common::DivideUp(size, L2BlockSize)) * PageSize; 24 return (Common::DivideUp(size, L1BlockSize) + Common::DivideUp(size, L2BlockSize)) * PageSize;
24} 25}
25 26
26constexpr std::size_t MainMemorySize = Common::Size_4_GB; 27constexpr std::size_t MainMemorySize = 4_GiB;
27constexpr std::size_t MainMemorySizeMax = Common::Size_8_GB; 28constexpr std::size_t MainMemorySizeMax = 8_GiB;
28 29
29constexpr std::size_t ReservedEarlyDramSize = 0x60000; 30constexpr std::size_t ReservedEarlyDramSize = 384_KiB;
30constexpr std::size_t DramPhysicalAddress = 0x80000000; 31constexpr std::size_t DramPhysicalAddress = 0x80000000;
31 32
32constexpr std::size_t KernelAslrAlignment = Common::Size_2_MB; 33constexpr std::size_t KernelAslrAlignment = 2_MiB;
33constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39; 34constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39;
34constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48; 35constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48;
35 36
@@ -40,7 +41,7 @@ constexpr std::size_t KernelVirtualAddressSpaceLast = KernelVirtualAddressSpaceE
40constexpr std::size_t KernelVirtualAddressSpaceSize = 41constexpr std::size_t KernelVirtualAddressSpaceSize =
41 KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase; 42 KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase;
42constexpr std::size_t KernelVirtualAddressCodeBase = KernelVirtualAddressSpaceBase; 43constexpr std::size_t KernelVirtualAddressCodeBase = KernelVirtualAddressSpaceBase;
43constexpr std::size_t KernelVirtualAddressCodeSize = 0x62000; 44constexpr std::size_t KernelVirtualAddressCodeSize = 392_KiB;
44constexpr std::size_t KernelVirtualAddressCodeEnd = 45constexpr std::size_t KernelVirtualAddressCodeEnd =
45 KernelVirtualAddressCodeBase + KernelVirtualAddressCodeSize; 46 KernelVirtualAddressCodeBase + KernelVirtualAddressCodeSize;
46 47
@@ -53,14 +54,14 @@ constexpr std::size_t KernelPhysicalAddressSpaceSize =
53constexpr std::size_t KernelPhysicalAddressCodeBase = DramPhysicalAddress + ReservedEarlyDramSize; 54constexpr std::size_t KernelPhysicalAddressCodeBase = DramPhysicalAddress + ReservedEarlyDramSize;
54 55
55constexpr std::size_t KernelPageTableHeapSize = GetMaximumOverheadSize(MainMemorySizeMax); 56constexpr std::size_t KernelPageTableHeapSize = GetMaximumOverheadSize(MainMemorySizeMax);
56constexpr std::size_t KernelInitialPageHeapSize = Common::Size_128_KB; 57constexpr std::size_t KernelInitialPageHeapSize = 128_KiB;
57 58
58constexpr std::size_t KernelSlabHeapDataSize = Common::Size_5_MB; 59constexpr std::size_t KernelSlabHeapDataSize = 5_MiB;
59constexpr std::size_t KernelSlabHeapGapsSize = Common::Size_2_MB - Common::Size_64_KB; 60constexpr std::size_t KernelSlabHeapGapsSize = 2_MiB - 64_KiB;
60constexpr std::size_t KernelSlabHeapSize = KernelSlabHeapDataSize + KernelSlabHeapGapsSize; 61constexpr std::size_t KernelSlabHeapSize = KernelSlabHeapDataSize + KernelSlabHeapGapsSize;
61 62
62// NOTE: This is calculated from KThread slab counts, assuming KThread size <= 0x860. 63// NOTE: This is calculated from KThread slab counts, assuming KThread size <= 0x860.
63constexpr std::size_t KernelSlabHeapAdditionalSize = 0x68000ULL; 64constexpr std::size_t KernelSlabHeapAdditionalSize = 416_KiB;
64 65
65constexpr std::size_t KernelResourceSize = 66constexpr std::size_t KernelResourceSize =
66 KernelPageTableHeapSize + KernelInitialPageHeapSize + KernelSlabHeapSize; 67 KernelPageTableHeapSize + KernelInitialPageHeapSize + KernelSlabHeapSize;
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 66d260635..701268545 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/alignment.h" 5#include "common/alignment.h"
6#include "common/assert.h" 6#include "common/assert.h"
7#include "common/literals.h"
7#include "common/scope_exit.h" 8#include "common/scope_exit.h"
8#include "core/core.h" 9#include "core/core.h"
9#include "core/hle/kernel/k_address_space_info.h" 10#include "core/hle/kernel/k_address_space_info.h"
@@ -23,6 +24,8 @@ namespace Kernel {
23 24
24namespace { 25namespace {
25 26
27using namespace Common::Literals;
28
26constexpr std::size_t GetAddressSpaceWidthFromType(FileSys::ProgramAddressSpaceType as_type) { 29constexpr std::size_t GetAddressSpaceWidthFromType(FileSys::ProgramAddressSpaceType as_type) {
27 switch (as_type) { 30 switch (as_type) {
28 case FileSys::ProgramAddressSpaceType::Is32Bit: 31 case FileSys::ProgramAddressSpaceType::Is32Bit:
@@ -89,7 +92,7 @@ ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_
89 } 92 }
90 93
91 // Set code regions and determine remaining 94 // Set code regions and determine remaining
92 constexpr std::size_t RegionAlignment{2 * 1024 * 1024}; 95 constexpr std::size_t RegionAlignment{2_MiB};
93 VAddr process_code_start{}; 96 VAddr process_code_start{};
94 VAddr process_code_end{}; 97 VAddr process_code_end{};
95 std::size_t stack_region_size{}; 98 std::size_t stack_region_size{};
diff --git a/src/core/hle/kernel/k_trace.h b/src/core/hle/kernel/k_trace.h
index 91ebf9ab2..79391bccb 100644
--- a/src/core/hle/kernel/k_trace.h
+++ b/src/core/hle/kernel/k_trace.h
@@ -4,9 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/common_funcs.h"
8
7namespace Kernel { 9namespace Kernel {
8 10
11using namespace Common::Literals;
12
9constexpr bool IsKTraceEnabled = false; 13constexpr bool IsKTraceEnabled = false;
10constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16 * 1024 * 1024 : 0; 14constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16_MiB : 0;
11 15
12} // namespace Kernel 16} // namespace Kernel
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 2ceeaeb5f..64bd0c494 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -12,7 +12,6 @@
12#include <utility> 12#include <utility>
13 13
14#include "common/assert.h" 14#include "common/assert.h"
15#include "common/common_sizes.h"
16#include "common/logging/log.h" 15#include "common/logging/log.h"
17#include "common/microprofile.h" 16#include "common/microprofile.h"
18#include "common/thread.h" 17#include "common/thread.h"
@@ -180,7 +179,7 @@ struct KernelCore::Impl {
180 system_resource_limit->Reserve(LimitableResource::PhysicalMemory, kernel_size); 179 system_resource_limit->Reserve(LimitableResource::PhysicalMemory, kernel_size);
181 180
182 // Reserve secure applet memory, introduced in firmware 5.0.0 181 // Reserve secure applet memory, introduced in firmware 5.0.0
183 constexpr u64 secure_applet_memory_size{Common::Size_4_MB}; 182 constexpr u64 secure_applet_memory_size{4_MiB};
184 ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemory, 183 ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemory,
185 secure_applet_memory_size)); 184 secure_applet_memory_size));
186 185
@@ -320,8 +319,8 @@ struct KernelCore::Impl {
320 const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd; 319 const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
321 320
322 // Setup the containing kernel region. 321 // Setup the containing kernel region.
323 constexpr size_t KernelRegionSize = Common::Size_1_GB; 322 constexpr size_t KernelRegionSize = 1_GiB;
324 constexpr size_t KernelRegionAlign = Common::Size_1_GB; 323 constexpr size_t KernelRegionAlign = 1_GiB;
325 constexpr VAddr kernel_region_start = 324 constexpr VAddr kernel_region_start =
326 Common::AlignDown(code_start_virt_addr, KernelRegionAlign); 325 Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
327 size_t kernel_region_size = KernelRegionSize; 326 size_t kernel_region_size = KernelRegionSize;
@@ -368,7 +367,7 @@ struct KernelCore::Impl {
368 367
369 // Decide on the actual size for the misc region. 368 // Decide on the actual size for the misc region.
370 constexpr size_t MiscRegionAlign = KernelAslrAlignment; 369 constexpr size_t MiscRegionAlign = KernelAslrAlignment;
371 constexpr size_t MiscRegionMinimumSize = Common::Size_32_MB; 370 constexpr size_t MiscRegionMinimumSize = 32_MiB;
372 const size_t misc_region_size = Common::AlignUp( 371 const size_t misc_region_size = Common::AlignUp(
373 std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign); 372 std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
374 ASSERT(misc_region_size > 0); 373 ASSERT(misc_region_size > 0);
@@ -381,7 +380,7 @@ struct KernelCore::Impl {
381 misc_region_start, misc_region_size, KMemoryRegionType_KernelMisc)); 380 misc_region_start, misc_region_size, KMemoryRegionType_KernelMisc));
382 381
383 // Setup the stack region. 382 // Setup the stack region.
384 constexpr size_t StackRegionSize = Common::Size_14_MB; 383 constexpr size_t StackRegionSize = 14_MiB;
385 constexpr size_t StackRegionAlign = KernelAslrAlignment; 384 constexpr size_t StackRegionAlign = KernelAslrAlignment;
386 const VAddr stack_region_start = 385 const VAddr stack_region_start =
387 memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion( 386 memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
@@ -414,7 +413,7 @@ struct KernelCore::Impl {
414 slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab)); 413 slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
415 414
416 // Setup the temp region. 415 // Setup the temp region.
417 constexpr size_t TempRegionSize = Common::Size_128_MB; 416 constexpr size_t TempRegionSize = 128_MiB;
418 constexpr size_t TempRegionAlign = KernelAslrAlignment; 417 constexpr size_t TempRegionAlign = KernelAslrAlignment;
419 const VAddr temp_region_start = 418 const VAddr temp_region_start =
420 memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion( 419 memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
@@ -470,7 +469,7 @@ struct KernelCore::Impl {
470 // Determine size available for kernel page table heaps, requiring > 8 MB. 469 // Determine size available for kernel page table heaps, requiring > 8 MB.
471 const PAddr resource_end_phys_addr = slab_start_phys_addr + resource_region_size; 470 const PAddr resource_end_phys_addr = slab_start_phys_addr + resource_region_size;
472 const size_t page_table_heap_size = resource_end_phys_addr - slab_end_phys_addr; 471 const size_t page_table_heap_size = resource_end_phys_addr - slab_end_phys_addr;
473 ASSERT(page_table_heap_size / Common::Size_4_MB > 2); 472 ASSERT(page_table_heap_size / 4_MiB > 2);
474 473
475 // Insert a physical region for the kernel page table heap region 474 // Insert a physical region for the kernel page table heap region
476 ASSERT(memory_layout.GetPhysicalMemoryRegionTree().Insert( 475 ASSERT(memory_layout.GetPhysicalMemoryRegionTree().Insert(
@@ -495,7 +494,7 @@ struct KernelCore::Impl {
495 ASSERT(linear_extents.GetEndAddress() != 0); 494 ASSERT(linear_extents.GetEndAddress() != 0);
496 495
497 // Setup the linear mapping region. 496 // Setup the linear mapping region.
498 constexpr size_t LinearRegionAlign = Common::Size_1_GB; 497 constexpr size_t LinearRegionAlign = 1_GiB;
499 const PAddr aligned_linear_phys_start = 498 const PAddr aligned_linear_phys_start =
500 Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign); 499 Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
501 const size_t linear_region_size = 500 const size_t linear_region_size =
diff --git a/src/tests/common/host_memory.cpp b/src/tests/common/host_memory.cpp
index e241f8be5..2dc7b5d5e 100644
--- a/src/tests/common/host_memory.cpp
+++ b/src/tests/common/host_memory.cpp
@@ -5,11 +5,13 @@
5#include <catch2/catch.hpp> 5#include <catch2/catch.hpp>
6 6
7#include "common/host_memory.h" 7#include "common/host_memory.h"
8#include "common/literals.h"
8 9
9using Common::HostMemory; 10using Common::HostMemory;
11using namespace Common::Literals;
10 12
11static constexpr size_t VIRTUAL_SIZE = 1ULL << 39; 13static constexpr size_t VIRTUAL_SIZE = 1ULL << 39;
12static constexpr size_t BACKING_SIZE = 4ULL * 1024 * 1024 * 1024; 14static constexpr size_t BACKING_SIZE = 4_GiB;
13 15
14TEST_CASE("HostMemory: Initialize and deinitialize", "[common]") { 16TEST_CASE("HostMemory: Initialize and deinitialize", "[common]") {
15 { HostMemory mem(BACKING_SIZE, VIRTUAL_SIZE); } 17 { HostMemory mem(BACKING_SIZE, VIRTUAL_SIZE); }
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 6d04d00da..9d726a6fb 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -16,9 +16,9 @@
16 16
17#include <boost/container/small_vector.hpp> 17#include <boost/container/small_vector.hpp>
18 18
19#include "common/common_sizes.h"
20#include "common/common_types.h" 19#include "common/common_types.h"
21#include "common/div_ceil.h" 20#include "common/div_ceil.h"
21#include "common/literals.h"
22#include "common/microprofile.h" 22#include "common/microprofile.h"
23#include "common/scope_exit.h" 23#include "common/scope_exit.h"
24#include "common/settings.h" 24#include "common/settings.h"
@@ -48,8 +48,11 @@ constexpr u32 NUM_COMPUTE_UNIFORM_BUFFERS = 8;
48constexpr u32 NUM_STORAGE_BUFFERS = 16; 48constexpr u32 NUM_STORAGE_BUFFERS = 16;
49constexpr u32 NUM_STAGES = 5; 49constexpr u32 NUM_STAGES = 5;
50 50
51using namespace Common::Literals;
52
51template <typename P> 53template <typename P>
52class BufferCache { 54class BufferCache {
55
53 // Page size for caching purposes. 56 // Page size for caching purposes.
54 // This is unrelated to the CPU page size and it can be changed as it seems optimal. 57 // This is unrelated to the CPU page size and it can be changed as it seems optimal.
55 static constexpr u32 PAGE_BITS = 16; 58 static constexpr u32 PAGE_BITS = 16;
@@ -66,8 +69,8 @@ class BufferCache {
66 69
67 static constexpr BufferId NULL_BUFFER_ID{0}; 70 static constexpr BufferId NULL_BUFFER_ID{0};
68 71
69 static constexpr u64 EXPECTED_MEMORY = Common::Size_512_MB; 72 static constexpr u64 EXPECTED_MEMORY = 512_MiB;
70 static constexpr u64 CRITICAL_MEMORY = Common::Size_1_GB; 73 static constexpr u64 CRITICAL_MEMORY = 1_GiB;
71 74
72 using Maxwell = Tegra::Engines::Maxwell3D::Regs; 75 using Maxwell = Tegra::Engines::Maxwell3D::Regs;
73 76
@@ -96,7 +99,7 @@ class BufferCache {
96 }; 99 };
97 100
98public: 101public:
99 static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4096; 102 static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4_KiB;
100 103
101 explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_, 104 explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_,
102 Tegra::Engines::Maxwell3D& maxwell3d_, 105 Tegra::Engines::Maxwell3D& maxwell3d_,
diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.h b/src/video_core/renderer_opengl/gl_stream_buffer.h
index 6dbb6bfba..2e67922a6 100644
--- a/src/video_core/renderer_opengl/gl_stream_buffer.h
+++ b/src/video_core/renderer_opengl/gl_stream_buffer.h
@@ -12,12 +12,15 @@
12#include <glad/glad.h> 12#include <glad/glad.h>
13 13
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/literals.h"
15#include "video_core/renderer_opengl/gl_resource_manager.h" 16#include "video_core/renderer_opengl/gl_resource_manager.h"
16 17
17namespace OpenGL { 18namespace OpenGL {
18 19
20using namespace Common::Literals;
21
19class StreamBuffer { 22class StreamBuffer {
20 static constexpr size_t STREAM_BUFFER_SIZE = 64 * 1024 * 1024; 23 static constexpr size_t STREAM_BUFFER_SIZE = 64_MiB;
21 static constexpr size_t NUM_SYNCS = 16; 24 static constexpr size_t NUM_SYNCS = 16;
22 static constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / NUM_SYNCS; 25 static constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / NUM_SYNCS;
23 static constexpr size_t MAX_ALIGNMENT = 256; 26 static constexpr size_t MAX_ALIGNMENT = 256;
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
index 7a1232497..0412b5234 100644
--- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
+++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
@@ -12,6 +12,7 @@
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/bit_util.h" 13#include "common/bit_util.h"
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/literals.h"
15#include "video_core/renderer_vulkan/vk_scheduler.h" 16#include "video_core/renderer_vulkan/vk_scheduler.h"
16#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" 17#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h"
17#include "video_core/vulkan_common/vulkan_device.h" 18#include "video_core/vulkan_common/vulkan_device.h"
@@ -19,12 +20,15 @@
19 20
20namespace Vulkan { 21namespace Vulkan {
21namespace { 22namespace {
23
24using namespace Common::Literals;
25
22// Maximum potential alignment of a Vulkan buffer 26// Maximum potential alignment of a Vulkan buffer
23constexpr VkDeviceSize MAX_ALIGNMENT = 256; 27constexpr VkDeviceSize MAX_ALIGNMENT = 256;
24// Maximum size to put elements in the stream buffer 28// Maximum size to put elements in the stream buffer
25constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8 * 1024 * 1024; 29constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8_MiB;
26// Stream buffer size in bytes 30// Stream buffer size in bytes
27constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128 * 1024 * 1024; 31constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128_MiB;
28constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS; 32constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
29 33
30constexpr VkMemoryPropertyFlags HOST_FLAGS = 34constexpr VkMemoryPropertyFlags HOST_FLAGS =
diff --git a/src/video_core/renderer_vulkan/vk_stream_buffer.cpp b/src/video_core/renderer_vulkan/vk_stream_buffer.cpp
index a09fe084e..7b4875d0e 100644
--- a/src/video_core/renderer_vulkan/vk_stream_buffer.cpp
+++ b/src/video_core/renderer_vulkan/vk_stream_buffer.cpp
@@ -10,6 +10,7 @@
10 10
11#include "common/alignment.h" 11#include "common/alignment.h"
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/literals.h"
13#include "video_core/renderer_vulkan/vk_scheduler.h" 14#include "video_core/renderer_vulkan/vk_scheduler.h"
14#include "video_core/renderer_vulkan/vk_stream_buffer.h" 15#include "video_core/renderer_vulkan/vk_stream_buffer.h"
15#include "video_core/vulkan_common/vulkan_device.h" 16#include "video_core/vulkan_common/vulkan_device.h"
@@ -19,6 +20,8 @@ namespace Vulkan {
19 20
20namespace { 21namespace {
21 22
23using namespace Common::Literals;
24
22constexpr VkBufferUsageFlags BUFFER_USAGE = 25constexpr VkBufferUsageFlags BUFFER_USAGE =
23 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | 26 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
24 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; 27 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
@@ -26,7 +29,7 @@ constexpr VkBufferUsageFlags BUFFER_USAGE =
26constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000; 29constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000;
27constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000; 30constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000;
28 31
29constexpr u64 PREFERRED_STREAM_BUFFER_SIZE = 256 * 1024 * 1024; 32constexpr u64 PREFERRED_STREAM_BUFFER_SIZE = 256_MiB;
30 33
31/// Find a memory type with the passed requirements 34/// Find a memory type with the passed requirements
32std::optional<u32> FindMemoryType(const VkPhysicalDeviceMemoryProperties& properties, 35std::optional<u32> FindMemoryType(const VkPhysicalDeviceMemoryProperties& properties,
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index e7f8478b4..84530a179 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -19,9 +19,8 @@
19#include <boost/container/small_vector.hpp> 19#include <boost/container/small_vector.hpp>
20 20
21#include "common/alignment.h" 21#include "common/alignment.h"
22#include "common/common_funcs.h"
23#include "common/common_sizes.h"
24#include "common/common_types.h" 22#include "common/common_types.h"
23#include "common/literals.h"
25#include "common/logging/log.h" 24#include "common/logging/log.h"
26#include "common/settings.h" 25#include "common/settings.h"
27#include "video_core/compatible_formats.h" 26#include "video_core/compatible_formats.h"
@@ -59,6 +58,7 @@ using VideoCore::Surface::PixelFormat;
59using VideoCore::Surface::PixelFormatFromDepthFormat; 58using VideoCore::Surface::PixelFormatFromDepthFormat;
60using VideoCore::Surface::PixelFormatFromRenderTargetFormat; 59using VideoCore::Surface::PixelFormatFromRenderTargetFormat;
61using VideoCore::Surface::SurfaceType; 60using VideoCore::Surface::SurfaceType;
61using namespace Common::Literals;
62 62
63template <class P> 63template <class P>
64class TextureCache { 64class TextureCache {
@@ -79,8 +79,8 @@ class TextureCache {
79 /// Sampler ID for bugged sampler ids 79 /// Sampler ID for bugged sampler ids
80 static constexpr SamplerId NULL_SAMPLER_ID{0}; 80 static constexpr SamplerId NULL_SAMPLER_ID{0};
81 81
82 static constexpr u64 DEFAULT_EXPECTED_MEMORY = Common::Size_1_GB; 82 static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB;
83 static constexpr u64 DEFAULT_CRITICAL_MEMORY = Common::Size_2_GB; 83 static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB;
84 84
85 using Runtime = typename P::Runtime; 85 using Runtime = typename P::Runtime;
86 using Image = typename P::Image; 86 using Image = typename P::Image;
@@ -400,8 +400,8 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface&
400 minimum_memory = 0; 400 minimum_memory = 0;
401 } else { 401 } else {
402 // on OGL we can be more conservatives as the driver takes care. 402 // on OGL we can be more conservatives as the driver takes care.
403 expected_memory = DEFAULT_EXPECTED_MEMORY + Common::Size_512_MB; 403 expected_memory = DEFAULT_EXPECTED_MEMORY + 512_MiB;
404 critical_memory = DEFAULT_CRITICAL_MEMORY + Common::Size_1_GB; 404 critical_memory = DEFAULT_CRITICAL_MEMORY + 1_GiB;
405 minimum_memory = expected_memory; 405 minimum_memory = expected_memory;
406 } 406 }
407} 407}