diff options
Diffstat (limited to '')
6 files changed, 20 insertions, 16 deletions
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 2cfe9d4bd..ec9866605 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -206,6 +206,7 @@ VKComputePass::VKComputePass(const Device& device, VKDescriptorPool& descriptor_ | |||
| 206 | .codeSize = static_cast<u32>(code.size_bytes()), | 206 | .codeSize = static_cast<u32>(code.size_bytes()), |
| 207 | .pCode = code.data(), | 207 | .pCode = code.data(), |
| 208 | }); | 208 | }); |
| 209 | device.SaveShader(code); | ||
| 209 | pipeline = device.GetLogical().CreateComputePipeline({ | 210 | pipeline = device.GetLogical().CreateComputePipeline({ |
| 210 | .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, | 211 | .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, |
| 211 | .pNext = nullptr, | 212 | .pNext = nullptr, |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 25dbefd5c..f699a9bdf 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -770,6 +770,7 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( | |||
| 770 | 770 | ||
| 771 | const Shader::Profile profile{MakeProfile(key, program.stage)}; | 771 | const Shader::Profile profile{MakeProfile(key, program.stage)}; |
| 772 | const std::vector<u32> code{EmitSPIRV(profile, program, binding)}; | 772 | const std::vector<u32> code{EmitSPIRV(profile, program, binding)}; |
| 773 | device.SaveShader(code); | ||
| 773 | modules[stage_index] = BuildShader(device, code); | 774 | modules[stage_index] = BuildShader(device, code); |
| 774 | if (device.HasDebuggingToolAttached()) { | 775 | if (device.HasDebuggingToolAttached()) { |
| 775 | const std::string name{fmt::format("{:016x}{:016x}", key.unique_hashes[index][0], | 776 | const std::string name{fmt::format("{:016x}{:016x}", key.unique_hashes[index][0], |
| @@ -846,7 +847,8 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( | |||
| 846 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; | 847 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; |
| 847 | Shader::IR::Program program{TranslateProgram(pools.inst, pools.block, env, cfg)}; | 848 | Shader::IR::Program program{TranslateProgram(pools.inst, pools.block, env, cfg)}; |
| 848 | u32 binding{0}; | 849 | u32 binding{0}; |
| 849 | std::vector<u32> code{EmitSPIRV(base_profile, program, binding)}; | 850 | const std::vector<u32> code{EmitSPIRV(base_profile, program, binding)}; |
| 851 | device.SaveShader(code); | ||
| 850 | vk::ShaderModule spv_module{BuildShader(device, code)}; | 852 | vk::ShaderModule spv_module{BuildShader(device, code)}; |
| 851 | if (device.HasDebuggingToolAttached()) { | 853 | if (device.HasDebuggingToolAttached()) { |
| 852 | const auto name{fmt::format("{:016x}{:016x}", key.unique_hash[0], key.unique_hash[1])}; | 854 | const auto name{fmt::format("{:016x}{:016x}", key.unique_hash[0], key.unique_hash[1])}; |
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 | ||
| 76 | void NsightAftermathTracker::SaveShader(const std::vector<u32>& spirv) const { | 76 | void 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 | ||
| 38 | private: | 39 | private: |
| 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 |
| 76 | inline NsightAftermathTracker::NsightAftermathTracker() = default; | 77 | inline NsightAftermathTracker::NsightAftermathTracker() = default; |
| 77 | inline NsightAftermathTracker::~NsightAftermathTracker() = default; | 78 | inline NsightAftermathTracker::~NsightAftermathTracker() = default; |
| 78 | inline void NsightAftermathTracker::SaveShader(const std::vector<u32>&) const {} | 79 | inline 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 | ||
| 496 | void Device::SaveShader(const std::vector<u32>& spirv) const { | 496 | void 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; |