C++17ification.

C++17ification!

- Filesystem interaction now uses std::filesystem::path.
- Usage of const char*, std::string have been changed to
  std::string_view where appropriate.
- Usage of printf-style functions changed to use fmt.
This commit is contained in:
gibbed
2020-03-02 09:37:11 -06:00
committed by Rick Gibbed
parent 114cea6fb7
commit 5bf0b34445
220 changed files with 4944 additions and 4294 deletions

View File

@@ -7,6 +7,7 @@ project("xenia-gpu-vulkan")
kind("StaticLib")
language("C++")
links({
"fmt",
"volk",
"xenia-base",
"xenia-gpu",
@@ -31,6 +32,7 @@ project("xenia-gpu-vulkan-trace-viewer")
links({
"aes_128",
"capstone",
"fmt",
"glslang-spirv",
"imgui",
"libavcodec",
@@ -97,6 +99,7 @@ project("xenia-gpu-vulkan-trace-dump")
links({
"aes_128",
"capstone",
"fmt",
"glslang-spirv",
"imgui",
"libavcodec",

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -11,6 +11,7 @@
#include <algorithm>
#include "third_party/fmt/include/fmt/format.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/base/memory.h"
@@ -231,10 +232,11 @@ VkResult CachedTileView::Initialize(VkCommandBuffer command_buffer) {
device_->DbgSetObjectName(
reinterpret_cast<uint64_t>(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
xe::format_string("RT(d): 0x%.8X 0x%.8X(%d) 0x%.8X(%d) %d %d %d",
key.tile_offset, key.tile_width, key.tile_width,
key.tile_height, key.tile_height, key.color_or_depth,
key.msaa_samples, key.edram_format));
fmt::format("RT(d): {:#.8X} {:#.8X}({}) {:#.8X}({}) {} {} {}",
uint32_t(key.tile_offset), uint32_t(key.tile_width),
uint32_t(key.tile_width), uint32_t(key.tile_height),
uint32_t(key.tile_height), uint32_t(key.color_or_depth),
uint32_t(key.msaa_samples), uint32_t(key.edram_format)));
VkMemoryRequirements memory_requirements;
vkGetImageMemoryRequirements(*device_, image, &memory_requirements);

View File

@@ -2,16 +2,16 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/gpu/vulkan/texture_cache.h"
#include "xenia/gpu/vulkan/texture_config.h"
#include <algorithm>
#include "third_party/fmt/include/fmt/format.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/base/memory.h"
@@ -20,6 +20,7 @@
#include "xenia/gpu/sampler_info.h"
#include "xenia/gpu/texture_conversion.h"
#include "xenia/gpu/texture_info.h"
#include "xenia/gpu/vulkan/texture_config.h"
#include "xenia/gpu/vulkan/vulkan_gpu_flags.h"
#include "xenia/ui/vulkan/vulkan_mem_alloc.h"
@@ -522,8 +523,8 @@ TextureCache::Texture* TextureCache::DemandResolveTexture(
device_->DbgSetObjectName(
reinterpret_cast<uint64_t>(texture->image),
VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
xe::format_string(
"RT: 0x%.8X - 0x%.8X (%s, %s)", texture_info.memory.base_address,
fmt::format(
"RT: {:#.8X} - {:#.8X} ({}, {})", texture_info.memory.base_address,
texture_info.memory.base_address + texture_info.memory.base_size,
texture_info.format_info()->name,
get_dimension_name(texture_info.dimension)));
@@ -605,8 +606,8 @@ TextureCache::Texture* TextureCache::Demand(const TextureInfo& texture_info,
device_->DbgSetObjectName(
reinterpret_cast<uint64_t>(texture->image),
VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
xe::format_string(
"T: 0x%.8X - 0x%.8X (%s, %s)", texture_info.memory.base_address,
fmt::format(
"T: {:#.8X} - {:#.8X} ({}, {})", texture_info.memory.base_address,
texture_info.memory.base_address + texture_info.memory.base_size,
texture_info.format_info()->name,
get_dimension_name(texture_info.dimension)));

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -38,7 +38,8 @@ VulkanCommandProcessor::VulkanCommandProcessor(
VulkanCommandProcessor::~VulkanCommandProcessor() = default;
void VulkanCommandProcessor::RequestFrameTrace(const std::wstring& root_path) {
void VulkanCommandProcessor::RequestFrameTrace(
const std::filesystem::path& root_path) {
// Override traces if renderdoc is attached.
if (device_->is_renderdoc_attached()) {
trace_requested_ = true;

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -50,7 +50,7 @@ class VulkanCommandProcessor : public CommandProcessor {
kernel::KernelState* kernel_state);
~VulkanCommandProcessor() override;
void RequestFrameTrace(const std::wstring& root_path) override;
void RequestFrameTrace(const std::filesystem::path& root_path) override;
void TracePlaybackWroteMemory(uint32_t base_ptr, uint32_t length) override;
void RestoreEDRAMSnapshot(const void* snapshot) override;
void ClearCaches() override;

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -26,7 +26,7 @@ class VulkanGraphicsSystem : public GraphicsSystem {
static bool IsAvailable() { return true; }
std::wstring name() const override { return L"Vulkan"; }
std::string name() const override { return "Vulkan"; }
X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state,
ui::Window* target_window) override;

View File

@@ -2,13 +2,14 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/gpu/vulkan/vulkan_shader.h"
#include "third_party/fmt/include/fmt/format.h"
#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
@@ -54,7 +55,7 @@ bool VulkanShader::Prepare() {
: shader_type_ == ShaderType::kVertex ? 'v' : 'u';
device_->DbgSetObjectName(
uint64_t(shader_module_), VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT,
xe::format_string("S(%c): %.16llX", typeChar, ucode_data_hash()));
fmt::format("S({}): {:016X}", typeChar, ucode_data_hash()));
return status == VK_SUCCESS;
}

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2019 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -46,7 +46,7 @@ class VulkanTraceDump : public TraceDump {
}
};
int trace_dump_main(const std::vector<std::wstring>& args) {
int trace_dump_main(const std::vector<std::string>& args) {
VulkanTraceDump trace_dump;
return trace_dump.Main(args);
}
@@ -55,6 +55,6 @@ int trace_dump_main(const std::vector<std::wstring>& args) {
} // namespace gpu
} // namespace xe
DEFINE_ENTRY_POINT(L"xenia-gpu-vulkan-trace-dump",
DEFINE_ENTRY_POINT("xenia-gpu-vulkan-trace-dump",
xe::gpu::vulkan::trace_dump_main, "some.trace",
"target_trace_file");

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2019 Ben Vanik. All rights reserved. *
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -62,7 +62,7 @@ class VulkanTraceViewer : public TraceViewer {
}
};
int trace_viewer_main(const std::vector<std::wstring>& args) {
int trace_viewer_main(const std::vector<std::string>& args) {
VulkanTraceViewer trace_viewer;
return trace_viewer.Main(args);
}
@@ -71,6 +71,6 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
} // namespace gpu
} // namespace xe
DEFINE_ENTRY_POINT(L"xenia-gpu-vulkan-trace-viewer",
DEFINE_ENTRY_POINT("xenia-gpu-vulkan-trace-viewer",
xe::gpu::vulkan::trace_viewer_main, "some.trace",
"target_trace_file");