video_core: Use binary memory-literals for memory-sizes (#7127)
Replaces `... * 1024 * 1024` with `_MiB`/`_GiB` literals.
This commit is contained in:
parent
5193a5d222
commit
8fe147b8f9
4 changed files with 20 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <json.hpp>
|
#include <json.hpp>
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/memory_detect.h"
|
#include "common/memory_detect.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
@ -26,6 +27,8 @@ MICROPROFILE_DEFINE(CustomTexManager_TickFrame, "CustomTexManager", "TickFrame",
|
||||||
|
|
||||||
constexpr std::size_t MAX_UPLOADS_PER_TICK = 8;
|
constexpr std::size_t MAX_UPLOADS_PER_TICK = 8;
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
bool IsPow2(u32 value) {
|
bool IsPow2(u32 value) {
|
||||||
return value != 0 && (value & (value - 1)) == 0;
|
return value != 0 && (value & (value - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
@ -206,9 +209,9 @@ void CustomTexManager::PreloadTextures(const std::atomic_bool& stop_run,
|
||||||
u64 size_sum = 0;
|
u64 size_sum = 0;
|
||||||
size_t preloaded = 0;
|
size_t preloaded = 0;
|
||||||
const u64 sys_mem = Common::GetMemInfo().total_physical_memory;
|
const u64 sys_mem = Common::GetMemInfo().total_physical_memory;
|
||||||
const u64 recommended_min_mem = 2 * size_t(1024 * 1024 * 1024);
|
const u64 recommended_min_mem = 2_GiB;
|
||||||
|
|
||||||
// keep 2GB memory for system stability if system RAM is 4GB+ - use half of memory in other
|
// keep 2GiB memory for system stability if system RAM is 4GiB+ - use half of memory in other
|
||||||
// cases
|
// cases
|
||||||
const u64 max_mem =
|
const u64 max_mem =
|
||||||
(sys_mem / 2 < recommended_min_mem) ? (sys_mem / 2) : (sys_mem - recommended_min_mem);
|
(sys_mem / 2 < recommended_min_mem) ? (sys_mem / 2) : (sys_mem - recommended_min_mem);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
|
@ -28,12 +29,13 @@ MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192));
|
||||||
MICROPROFILE_DEFINE(OpenGL_Display, "OpenGL", "Display", MP_RGB(128, 128, 192));
|
MICROPROFILE_DEFINE(OpenGL_Display, "OpenGL", "Display", MP_RGB(128, 128, 192));
|
||||||
|
|
||||||
using VideoCore::SurfaceType;
|
using VideoCore::SurfaceType;
|
||||||
|
using namespace Common::Literals;
|
||||||
using namespace Pica::Shader::Generator;
|
using namespace Pica::Shader::Generator;
|
||||||
|
|
||||||
constexpr std::size_t VERTEX_BUFFER_SIZE = 16 * 1024 * 1024;
|
constexpr std::size_t VERTEX_BUFFER_SIZE = 16_MiB;
|
||||||
constexpr std::size_t INDEX_BUFFER_SIZE = 2 * 1024 * 1024;
|
constexpr std::size_t INDEX_BUFFER_SIZE = 2_MiB;
|
||||||
constexpr std::size_t UNIFORM_BUFFER_SIZE = 2 * 1024 * 1024;
|
constexpr std::size_t UNIFORM_BUFFER_SIZE = 2_MiB;
|
||||||
constexpr std::size_t TEXTURE_BUFFER_SIZE = 2 * 1024 * 1024;
|
constexpr std::size_t TEXTURE_BUFFER_SIZE = 2_MiB;
|
||||||
|
|
||||||
GLenum MakePrimitiveMode(Pica::PipelineRegs::TriangleTopology topology) {
|
GLenum MakePrimitiveMode(Pica::PipelineRegs::TriangleTopology topology) {
|
||||||
switch (topology) {
|
switch (topology) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
|
@ -28,11 +29,12 @@ MICROPROFILE_DEFINE(Vulkan_Drawing, "Vulkan", "Drawing", MP_RGB(128, 128, 192));
|
||||||
using TriangleTopology = Pica::PipelineRegs::TriangleTopology;
|
using TriangleTopology = Pica::PipelineRegs::TriangleTopology;
|
||||||
using VideoCore::SurfaceType;
|
using VideoCore::SurfaceType;
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
using namespace Pica::Shader::Generator;
|
using namespace Pica::Shader::Generator;
|
||||||
|
|
||||||
constexpr u64 STREAM_BUFFER_SIZE = 64 * 1024 * 1024;
|
constexpr u64 STREAM_BUFFER_SIZE = 64_MiB;
|
||||||
constexpr u64 UNIFORM_BUFFER_SIZE = 4 * 1024 * 1024;
|
constexpr u64 UNIFORM_BUFFER_SIZE = 4_MiB;
|
||||||
constexpr u64 TEXTURE_BUFFER_SIZE = 2 * 1024 * 1024;
|
constexpr u64 TEXTURE_BUFFER_SIZE = 2_MiB;
|
||||||
|
|
||||||
constexpr vk::BufferUsageFlags BUFFER_USAGE =
|
constexpr vk::BufferUsageFlags BUFFER_USAGE =
|
||||||
vk::BufferUsageFlagBits::eVertexBuffer | vk::BufferUsageFlagBits::eIndexBuffer;
|
vk::BufferUsageFlagBits::eVertexBuffer | vk::BufferUsageFlagBits::eIndexBuffer;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "video_core/custom_textures/material.h"
|
#include "video_core/custom_textures/material.h"
|
||||||
|
@ -35,6 +36,7 @@ using VideoCore::MapType;
|
||||||
using VideoCore::PixelFormat;
|
using VideoCore::PixelFormat;
|
||||||
using VideoCore::SurfaceType;
|
using VideoCore::SurfaceType;
|
||||||
using VideoCore::TextureType;
|
using VideoCore::TextureType;
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
struct RecordParams {
|
struct RecordParams {
|
||||||
vk::ImageAspectFlags aspect;
|
vk::ImageAspectFlags aspect;
|
||||||
|
@ -244,8 +246,8 @@ vk::ImageSubresourceRange MakeSubresourceRange(vk::ImageAspectFlags aspect, u32
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr u64 UPLOAD_BUFFER_SIZE = 512 * 1024 * 1024;
|
constexpr u64 UPLOAD_BUFFER_SIZE = 512_MiB;
|
||||||
constexpr u64 DOWNLOAD_BUFFER_SIZE = 16 * 1024 * 1024;
|
constexpr u64 DOWNLOAD_BUFFER_SIZE = 16_MiB;
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue