summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/fs/fs_util.cpp4
-rw-r--r--src/common/fs/fs_util.h11
-rw-r--r--src/shader_recompiler/exception.h12
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h1
-rw-r--r--src/video_core/engines/fermi_2d.h2
-rw-r--r--src/video_core/engines/maxwell_dma.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_compute_pass.cpp5
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.cpp2
9 files changed, 26 insertions, 14 deletions
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp
index 357cf5855..9f8671982 100644
--- a/src/common/fs/fs_util.cpp
+++ b/src/common/fs/fs_util.cpp
@@ -20,6 +20,10 @@ std::string ToUTF8String(std::u8string_view u8_string) {
20 return std::string{u8_string.begin(), u8_string.end()}; 20 return std::string{u8_string.begin(), u8_string.end()};
21} 21}
22 22
23std::string BufferToUTF8String(std::span<const u8> buffer) {
24 return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})};
25}
26
23std::string PathToUTF8String(const std::filesystem::path& path) { 27std::string PathToUTF8String(const std::filesystem::path& path) {
24 return ToUTF8String(path.u8string()); 28 return ToUTF8String(path.u8string());
25} 29}
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h
index ec9950ee7..1ec82eb35 100644
--- a/src/common/fs/fs_util.h
+++ b/src/common/fs/fs_util.h
@@ -47,6 +47,17 @@ concept IsChar = std::same_as<T, char>;
47[[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); 47[[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string);
48 48
49/** 49/**
50 * Converts a buffer of bytes to a UTF8-encoded std::string.
51 * This converts from the start of the buffer until the first encountered null-terminator.
52 * If no null-terminator is found, this converts the entire buffer instead.
53 *
54 * @param buffer Buffer of bytes
55 *
56 * @returns UTF-8 encoded std::string.
57 */
58[[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer);
59
60/**
50 * Converts a filesystem path to a UTF-8 encoded std::string. 61 * Converts a filesystem path to a UTF-8 encoded std::string.
51 * 62 *
52 * @param path Filesystem path 63 * @param path Filesystem path
diff --git a/src/shader_recompiler/exception.h b/src/shader_recompiler/exception.h
index 337e7f0c8..277be8541 100644
--- a/src/shader_recompiler/exception.h
+++ b/src/shader_recompiler/exception.h
@@ -4,7 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <stdexcept> 7#include <exception>
8#include <string> 8#include <string>
9#include <string_view> 9#include <string_view>
10#include <utility> 10#include <utility>
@@ -17,7 +17,7 @@ class Exception : public std::exception {
17public: 17public:
18 explicit Exception(std::string message) noexcept : err_message{std::move(message)} {} 18 explicit Exception(std::string message) noexcept : err_message{std::move(message)} {}
19 19
20 const char* what() const noexcept override { 20 [[nodiscard]] const char* what() const noexcept override {
21 return err_message.c_str(); 21 return err_message.c_str();
22 } 22 }
23 23
@@ -36,21 +36,21 @@ private:
36class LogicError : public Exception { 36class LogicError : public Exception {
37public: 37public:
38 template <typename... Args> 38 template <typename... Args>
39 LogicError(const char* message, Args&&... args) 39 explicit LogicError(const char* message, Args&&... args)
40 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} 40 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
41}; 41};
42 42
43class RuntimeError : public Exception { 43class RuntimeError : public Exception {
44public: 44public:
45 template <typename... Args> 45 template <typename... Args>
46 RuntimeError(const char* message, Args&&... args) 46 explicit RuntimeError(const char* message, Args&&... args)
47 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} 47 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
48}; 48};
49 49
50class NotImplementedException : public Exception { 50class NotImplementedException : public Exception {
51public: 51public:
52 template <typename... Args> 52 template <typename... Args>
53 NotImplementedException(const char* message, Args&&... args) 53 explicit NotImplementedException(const char* message, Args&&... args)
54 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} { 54 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {
55 Append(" is not implemented"); 55 Append(" is not implemented");
56 } 56 }
@@ -59,7 +59,7 @@ public:
59class InvalidArgument : public Exception { 59class InvalidArgument : public Exception {
60public: 60public:
61 template <typename... Args> 61 template <typename... Args>
62 InvalidArgument(const char* message, Args&&... args) 62 explicit InvalidArgument(const char* message, Args&&... args)
63 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} 63 : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
64}; 64};
65 65
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 24c858104..3b43554f9 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -817,7 +817,6 @@ void BufferCache<P>::CommitAsyncFlushesHigh() {
817 const std::size_t size = interval.upper() - interval.lower(); 817 const std::size_t size = interval.upper() - interval.lower();
818 const VAddr cpu_addr = interval.lower(); 818 const VAddr cpu_addr = interval.lower();
819 ForEachBufferInRange(cpu_addr, size, [&](BufferId buffer_id, Buffer& buffer) { 819 ForEachBufferInRange(cpu_addr, size, [&](BufferId buffer_id, Buffer& buffer) {
820 boost::container::small_vector<BufferCopy, 1> copies;
821 buffer.ForEachDownloadRangeAndClear( 820 buffer.ForEachDownloadRangeAndClear(
822 cpu_addr, size, [&](u64 range_offset, u64 range_size) { 821 cpu_addr, size, [&](u64 range_offset, u64 range_size) {
823 const VAddr buffer_addr = buffer.CpuAddr(); 822 const VAddr buffer_addr = buffer.CpuAddr();
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h
index a4170ffff..d76c5ed56 100644
--- a/src/video_core/engines/fermi_2d.h
+++ b/src/video_core/engines/fermi_2d.h
@@ -299,7 +299,7 @@ public:
299 }; 299 };
300 300
301private: 301private:
302 VideoCore::RasterizerInterface* rasterizer; 302 VideoCore::RasterizerInterface* rasterizer = nullptr;
303 303
304 /// Performs the copy from the source surface to the destination surface as configured in the 304 /// Performs the copy from the source surface to the destination surface as configured in the
305 /// registers. 305 /// registers.
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index d3329b0f8..9e457ae16 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -227,7 +227,7 @@ private:
227 Core::System& system; 227 Core::System& system;
228 228
229 MemoryManager& memory_manager; 229 MemoryManager& memory_manager;
230 VideoCore::RasterizerInterface* rasterizer; 230 VideoCore::RasterizerInterface* rasterizer = nullptr;
231 231
232 std::vector<u8> read_buffer; 232 std::vector<u8> read_buffer;
233 std::vector<u8> write_buffer; 233 std::vector<u8> write_buffer;
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 8d6cc074c..1f4dda17e 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -441,7 +441,6 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
441 441
442 std::array<const Shader::Info*, Maxwell::MaxShaderStage> infos{}; 442 std::array<const Shader::Info*, Maxwell::MaxShaderStage> infos{};
443 443
444 OGLProgram source_program;
445 std::array<std::string, 5> sources; 444 std::array<std::string, 5> sources;
446 std::array<std::vector<u32>, 5> sources_spirv; 445 std::array<std::vector<u32>, 5> sources_spirv;
447 Shader::Backend::Bindings binding; 446 Shader::Backend::Bindings binding;
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp
index 73157a15d..561cf5e11 100644
--- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp
+++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp
@@ -258,10 +258,9 @@ std::pair<VkBuffer, VkDeviceSize> Uint8Pass::Assemble(u32 num_vertices, VkBuffer
258 update_descriptor_queue.AddBuffer(src_buffer, src_offset, num_vertices); 258 update_descriptor_queue.AddBuffer(src_buffer, src_offset, num_vertices);
259 update_descriptor_queue.AddBuffer(staging.buffer, staging.offset, staging_size); 259 update_descriptor_queue.AddBuffer(staging.buffer, staging.offset, staging_size);
260 const void* const descriptor_data{update_descriptor_queue.UpdateData()}; 260 const void* const descriptor_data{update_descriptor_queue.UpdateData()};
261 const VkBuffer buffer{staging.buffer};
262 261
263 scheduler.RequestOutsideRenderPassOperationContext(); 262 scheduler.RequestOutsideRenderPassOperationContext();
264 scheduler.Record([this, buffer, descriptor_data, num_vertices](vk::CommandBuffer cmdbuf) { 263 scheduler.Record([this, descriptor_data, num_vertices](vk::CommandBuffer cmdbuf) {
265 static constexpr u32 DISPATCH_SIZE = 1024; 264 static constexpr u32 DISPATCH_SIZE = 1024;
266 static constexpr VkMemoryBarrier WRITE_BARRIER{ 265 static constexpr VkMemoryBarrier WRITE_BARRIER{
267 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER, 266 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
@@ -319,7 +318,7 @@ std::pair<VkBuffer, VkDeviceSize> QuadIndexedPass::Assemble(
319 const void* const descriptor_data{update_descriptor_queue.UpdateData()}; 318 const void* const descriptor_data{update_descriptor_queue.UpdateData()};
320 319
321 scheduler.RequestOutsideRenderPassOperationContext(); 320 scheduler.RequestOutsideRenderPassOperationContext();
322 scheduler.Record([this, buffer = staging.buffer, descriptor_data, num_tri_vertices, base_vertex, 321 scheduler.Record([this, descriptor_data, num_tri_vertices, base_vertex,
323 index_shift](vk::CommandBuffer cmdbuf) { 322 index_shift](vk::CommandBuffer cmdbuf) {
324 static constexpr u32 DISPATCH_SIZE = 1024; 323 static constexpr u32 DISPATCH_SIZE = 1024;
325 static constexpr VkMemoryBarrier WRITE_BARRIER{ 324 static constexpr VkMemoryBarrier WRITE_BARRIER{
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp
index bbf0fccae..70898004a 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.cpp
+++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp
@@ -202,7 +202,7 @@ void SetObjectName(const DeviceDispatch* dld, VkDevice device, T handle, VkObjec
202 const VkDebugUtilsObjectNameInfoEXT name_info{ 202 const VkDebugUtilsObjectNameInfoEXT name_info{
203 .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 203 .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
204 .pNext = nullptr, 204 .pNext = nullptr,
205 .objectType = VK_OBJECT_TYPE_IMAGE, 205 .objectType = type,
206 .objectHandle = reinterpret_cast<u64>(handle), 206 .objectHandle = reinterpret_cast<u64>(handle),
207 .pObjectName = name, 207 .pObjectName = name,
208 }; 208 };