summaryrefslogtreecommitdiffstats
path: root/src/video_core/vulkan_common
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-04-11 07:50:30 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:27 +0200
commit479ca00071ccaab6ca9ac28daf375e1ed15dc447 (patch)
tree2054d994b73a6b1862099a95b069914a347e5e46 /src/video_core/vulkan_common
parentspirv: Move phi node patching to a separate function (diff)
downloadyuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.gz
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.bz2
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.lz
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.xz
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.zst
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.zip
Diffstat (limited to 'src/video_core/vulkan_common')
-rw-r--r--src/video_core/vulkan_common/nsight_aftermath_tracker.cpp5
-rw-r--r--src/video_core/vulkan_common/nsight_aftermath_tracker.h21
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp2
-rw-r--r--src/video_core/vulkan_common/vulkan_device.h3
4 files changed, 16 insertions, 15 deletions
diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
index 758c038ba..209cb1e0a 100644
--- a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
+++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
@@ -73,12 +73,11 @@ NsightAftermathTracker::~NsightAftermathTracker() {
}
}
-void NsightAftermathTracker::SaveShader(const std::vector<u32>& spirv) const {
+void NsightAftermathTracker::SaveShader(std::span<const u32> spirv) const {
if (!initialized) {
return;
}
-
- std::vector<u32> spirv_copy = spirv;
+ std::vector<u32> spirv_copy(spirv.begin(), spirv.end());
GFSDK_Aftermath_SpirvCode shader;
shader.pData = spirv_copy.data();
shader.size = static_cast<u32>(spirv_copy.size() * 4);
diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.h b/src/video_core/vulkan_common/nsight_aftermath_tracker.h
index 4fe2b14d9..eae1891dd 100644
--- a/src/video_core/vulkan_common/nsight_aftermath_tracker.h
+++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.h
@@ -6,6 +6,7 @@
#include <filesystem>
#include <mutex>
+#include <span>
#include <string>
#include <vector>
@@ -33,7 +34,7 @@ public:
NsightAftermathTracker(NsightAftermathTracker&&) = delete;
NsightAftermathTracker& operator=(NsightAftermathTracker&&) = delete;
- void SaveShader(const std::vector<u32>& spirv) const;
+ void SaveShader(std::span<const u32> spirv) const;
private:
#ifdef HAS_NSIGHT_AFTERMATH
@@ -61,21 +62,21 @@ private:
bool initialized = false;
Common::DynamicLibrary dl;
- PFN_GFSDK_Aftermath_DisableGpuCrashDumps GFSDK_Aftermath_DisableGpuCrashDumps;
- PFN_GFSDK_Aftermath_EnableGpuCrashDumps GFSDK_Aftermath_EnableGpuCrashDumps;
- PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier GFSDK_Aftermath_GetShaderDebugInfoIdentifier;
- PFN_GFSDK_Aftermath_GetShaderHashSpirv GFSDK_Aftermath_GetShaderHashSpirv;
- PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder GFSDK_Aftermath_GpuCrashDump_CreateDecoder;
- PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder GFSDK_Aftermath_GpuCrashDump_DestroyDecoder;
- PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON GFSDK_Aftermath_GpuCrashDump_GenerateJSON;
- PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON GFSDK_Aftermath_GpuCrashDump_GetJSON;
+ PFN_GFSDK_Aftermath_DisableGpuCrashDumps GFSDK_Aftermath_DisableGpuCrashDumps{};
+ PFN_GFSDK_Aftermath_EnableGpuCrashDumps GFSDK_Aftermath_EnableGpuCrashDumps{};
+ PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier GFSDK_Aftermath_GetShaderDebugInfoIdentifier{};
+ PFN_GFSDK_Aftermath_GetShaderHashSpirv GFSDK_Aftermath_GetShaderHashSpirv{};
+ PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder GFSDK_Aftermath_GpuCrashDump_CreateDecoder{};
+ PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder GFSDK_Aftermath_GpuCrashDump_DestroyDecoder{};
+ PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON GFSDK_Aftermath_GpuCrashDump_GenerateJSON{};
+ PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON GFSDK_Aftermath_GpuCrashDump_GetJSON{};
#endif
};
#ifndef HAS_NSIGHT_AFTERMATH
inline NsightAftermathTracker::NsightAftermathTracker() = default;
inline NsightAftermathTracker::~NsightAftermathTracker() = default;
-inline void NsightAftermathTracker::SaveShader(const std::vector<u32>&) const {}
+inline void NsightAftermathTracker::SaveShader(std::span<const u32>) const {}
#endif
} // namespace Vulkan
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index c027598ba..78bb741bc 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -493,7 +493,7 @@ void Device::ReportLoss() const {
std::this_thread::sleep_for(std::chrono::seconds{15});
}
-void Device::SaveShader(const std::vector<u32>& spirv) const {
+void Device::SaveShader(std::span<const u32> spirv) const {
if (nsight_aftermath_tracker) {
nsight_aftermath_tracker->SaveShader(spirv);
}
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h
index ac2311e7e..adf62a707 100644
--- a/src/video_core/vulkan_common/vulkan_device.h
+++ b/src/video_core/vulkan_common/vulkan_device.h
@@ -7,6 +7,7 @@
#include <string>
#include <string_view>
#include <unordered_map>
+#include <span>
#include <vector>
#include "common/common_types.h"
@@ -43,7 +44,7 @@ public:
void ReportLoss() const;
/// Reports a shader to Nsight Aftermath.
- void SaveShader(const std::vector<u32>& spirv) const;
+ void SaveShader(std::span<const u32> spirv) const;
/// Returns the name of the VkDriverId reported from Vulkan.
std::string GetDriverName() const;