diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_stream_buffer.h | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_stream_buffer.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 12 |
5 files changed, 27 insertions, 14 deletions
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; | |||
| 48 | constexpr u32 NUM_STORAGE_BUFFERS = 16; | 48 | constexpr u32 NUM_STORAGE_BUFFERS = 16; |
| 49 | constexpr u32 NUM_STAGES = 5; | 49 | constexpr u32 NUM_STAGES = 5; |
| 50 | 50 | ||
| 51 | using namespace Common::Literals; | ||
| 52 | |||
| 51 | template <typename P> | 53 | template <typename P> |
| 52 | class BufferCache { | 54 | class 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 | ||
| 98 | public: | 101 | public: |
| 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 | ||
| 17 | namespace OpenGL { | 18 | namespace OpenGL { |
| 18 | 19 | ||
| 20 | using namespace Common::Literals; | ||
| 21 | |||
| 19 | class StreamBuffer { | 22 | class 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 | ||
| 20 | namespace Vulkan { | 21 | namespace Vulkan { |
| 21 | namespace { | 22 | namespace { |
| 23 | |||
| 24 | using namespace Common::Literals; | ||
| 25 | |||
| 22 | // Maximum potential alignment of a Vulkan buffer | 26 | // Maximum potential alignment of a Vulkan buffer |
| 23 | constexpr VkDeviceSize MAX_ALIGNMENT = 256; | 27 | constexpr VkDeviceSize MAX_ALIGNMENT = 256; |
| 24 | // Maximum size to put elements in the stream buffer | 28 | // Maximum size to put elements in the stream buffer |
| 25 | constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8 * 1024 * 1024; | 29 | constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8_MiB; |
| 26 | // Stream buffer size in bytes | 30 | // Stream buffer size in bytes |
| 27 | constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128 * 1024 * 1024; | 31 | constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128_MiB; |
| 28 | constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS; | 32 | constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS; |
| 29 | 33 | ||
| 30 | constexpr VkMemoryPropertyFlags HOST_FLAGS = | 34 | constexpr 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 | ||
| 20 | namespace { | 21 | namespace { |
| 21 | 22 | ||
| 23 | using namespace Common::Literals; | ||
| 24 | |||
| 22 | constexpr VkBufferUsageFlags BUFFER_USAGE = | 25 | constexpr 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 = | |||
| 26 | constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000; | 29 | constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000; |
| 27 | constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000; | 30 | constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000; |
| 28 | 31 | ||
| 29 | constexpr u64 PREFERRED_STREAM_BUFFER_SIZE = 256 * 1024 * 1024; | 32 | constexpr 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 |
| 32 | std::optional<u32> FindMemoryType(const VkPhysicalDeviceMemoryProperties& properties, | 35 | std::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; | |||
| 59 | using VideoCore::Surface::PixelFormatFromDepthFormat; | 58 | using VideoCore::Surface::PixelFormatFromDepthFormat; |
| 60 | using VideoCore::Surface::PixelFormatFromRenderTargetFormat; | 59 | using VideoCore::Surface::PixelFormatFromRenderTargetFormat; |
| 61 | using VideoCore::Surface::SurfaceType; | 60 | using VideoCore::Surface::SurfaceType; |
| 61 | using namespace Common::Literals; | ||
| 62 | 62 | ||
| 63 | template <class P> | 63 | template <class P> |
| 64 | class TextureCache { | 64 | class 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 | } |