summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
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/video_core/renderer_vulkan
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/video_core/renderer_vulkan')
-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
2 files changed, 10 insertions, 3 deletions
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,