summaryrefslogtreecommitdiff
path: root/src/video_core/vulkan_common
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-04-11 02:50:30 -0300
committerGravatar ameerj2021-07-22 21:51:27 -0400
commit479ca00071ccaab6ca9ac28daf375e1ed15dc447 (patch)
tree2054d994b73a6b1862099a95b069914a347e5e46 /src/video_core/vulkan_common
parentspirv: Move phi node patching to a separate function (diff)
downloadyuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.gz
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.tar.xz
yuzu-479ca00071ccaab6ca9ac28daf375e1ed15dc447.zip
nsight_aftermath_tracker: Report used shaders to Nsight Aftermath
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() {
73 } 73 }
74} 74}
75 75
76void NsightAftermathTracker::SaveShader(const std::vector<u32>& spirv) const { 76void NsightAftermathTracker::SaveShader(std::span<const u32> spirv) const {
77 if (!initialized) { 77 if (!initialized) {
78 return; 78 return;
79 } 79 }
80 80 std::vector<u32> spirv_copy(spirv.begin(), spirv.end());
81 std::vector<u32> spirv_copy = spirv;
82 GFSDK_Aftermath_SpirvCode shader; 81 GFSDK_Aftermath_SpirvCode shader;
83 shader.pData = spirv_copy.data(); 82 shader.pData = spirv_copy.data();
84 shader.size = static_cast<u32>(spirv_copy.size() * 4); 83 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 @@
6 6
7#include <filesystem> 7#include <filesystem>
8#include <mutex> 8#include <mutex>
9#include <span>
9#include <string> 10#include <string>
10#include <vector> 11#include <vector>
11 12
@@ -33,7 +34,7 @@ public:
33 NsightAftermathTracker(NsightAftermathTracker&&) = delete; 34 NsightAftermathTracker(NsightAftermathTracker&&) = delete;
34 NsightAftermathTracker& operator=(NsightAftermathTracker&&) = delete; 35 NsightAftermathTracker& operator=(NsightAftermathTracker&&) = delete;
35 36
36 void SaveShader(const std::vector<u32>& spirv) const; 37 void SaveShader(std::span<const u32> spirv) const;
37 38
38private: 39private:
39#ifdef HAS_NSIGHT_AFTERMATH 40#ifdef HAS_NSIGHT_AFTERMATH
@@ -61,21 +62,21 @@ private:
61 bool initialized = false; 62 bool initialized = false;
62 63
63 Common::DynamicLibrary dl; 64 Common::DynamicLibrary dl;
64 PFN_GFSDK_Aftermath_DisableGpuCrashDumps GFSDK_Aftermath_DisableGpuCrashDumps; 65 PFN_GFSDK_Aftermath_DisableGpuCrashDumps GFSDK_Aftermath_DisableGpuCrashDumps{};
65 PFN_GFSDK_Aftermath_EnableGpuCrashDumps GFSDK_Aftermath_EnableGpuCrashDumps; 66 PFN_GFSDK_Aftermath_EnableGpuCrashDumps GFSDK_Aftermath_EnableGpuCrashDumps{};
66 PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier GFSDK_Aftermath_GetShaderDebugInfoIdentifier; 67 PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier GFSDK_Aftermath_GetShaderDebugInfoIdentifier{};
67 PFN_GFSDK_Aftermath_GetShaderHashSpirv GFSDK_Aftermath_GetShaderHashSpirv; 68 PFN_GFSDK_Aftermath_GetShaderHashSpirv GFSDK_Aftermath_GetShaderHashSpirv{};
68 PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder GFSDK_Aftermath_GpuCrashDump_CreateDecoder; 69 PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder GFSDK_Aftermath_GpuCrashDump_CreateDecoder{};
69 PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder GFSDK_Aftermath_GpuCrashDump_DestroyDecoder; 70 PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder GFSDK_Aftermath_GpuCrashDump_DestroyDecoder{};
70 PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON GFSDK_Aftermath_GpuCrashDump_GenerateJSON; 71 PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON GFSDK_Aftermath_GpuCrashDump_GenerateJSON{};
71 PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON GFSDK_Aftermath_GpuCrashDump_GetJSON; 72 PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON GFSDK_Aftermath_GpuCrashDump_GetJSON{};
72#endif 73#endif
73}; 74};
74 75
75#ifndef HAS_NSIGHT_AFTERMATH 76#ifndef HAS_NSIGHT_AFTERMATH
76inline NsightAftermathTracker::NsightAftermathTracker() = default; 77inline NsightAftermathTracker::NsightAftermathTracker() = default;
77inline NsightAftermathTracker::~NsightAftermathTracker() = default; 78inline NsightAftermathTracker::~NsightAftermathTracker() = default;
78inline void NsightAftermathTracker::SaveShader(const std::vector<u32>&) const {} 79inline void NsightAftermathTracker::SaveShader(std::span<const u32>) const {}
79#endif 80#endif
80 81
81} // namespace Vulkan 82} // 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 {
493 std::this_thread::sleep_for(std::chrono::seconds{15}); 493 std::this_thread::sleep_for(std::chrono::seconds{15});
494} 494}
495 495
496void Device::SaveShader(const std::vector<u32>& spirv) const { 496void Device::SaveShader(std::span<const u32> spirv) const {
497 if (nsight_aftermath_tracker) { 497 if (nsight_aftermath_tracker) {
498 nsight_aftermath_tracker->SaveShader(spirv); 498 nsight_aftermath_tracker->SaveShader(spirv);
499 } 499 }
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 @@
7#include <string> 7#include <string>
8#include <string_view> 8#include <string_view>
9#include <unordered_map> 9#include <unordered_map>
10#include <span>
10#include <vector> 11#include <vector>
11 12
12#include "common/common_types.h" 13#include "common/common_types.h"
@@ -43,7 +44,7 @@ public:
43 void ReportLoss() const; 44 void ReportLoss() const;
44 45
45 /// Reports a shader to Nsight Aftermath. 46 /// Reports a shader to Nsight Aftermath.
46 void SaveShader(const std::vector<u32>& spirv) const; 47 void SaveShader(std::span<const u32> spirv) const;
47 48
48 /// Returns the name of the VkDriverId reported from Vulkan. 49 /// Returns the name of the VkDriverId reported from Vulkan.
49 std::string GetDriverName() const; 50 std::string GetDriverName() const;