diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index e06568f11..a65e2dd73 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -320,15 +320,7 @@ vector D3D11Replay::GetDisassemblyTargets() { vector ret; - std::string err; - if(GCNISA::IsSupported(GraphicsAPI::D3D11, err)) - { - GCNISA::GetTargets(GraphicsAPI::D3D11, ret); - } - else - { - RDCLOG("AMD ISA Not available:\n%s", err.c_str()); - } + GCNISA::GetTargets(GraphicsAPI::D3D11, ret); // DXBC is always first ret.insert(ret.begin(), "DXBC"); diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 4cb9d92be..8d0616965 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -260,15 +260,7 @@ vector D3D12Replay::GetDisassemblyTargets() { vector ret; - std::string err; - if(GCNISA::IsSupported(GraphicsAPI::D3D12, err)) - { - GCNISA::GetTargets(GraphicsAPI::D3D12, ret); - } - else - { - RDCLOG("AMD ISA Not available:\n%s", err.c_str()); - } + GCNISA::GetTargets(GraphicsAPI::D3D12, ret); // DXBC is always first ret.insert(ret.begin(), "DXBC"); diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index fcc7404bb..19fb078c9 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -837,15 +837,7 @@ vector GLReplay::GetDisassemblyTargets() { vector ret; - std::string err; - if(GCNISA::IsSupported(GraphicsAPI::OpenGL, err)) - { - GCNISA::GetTargets(GraphicsAPI::OpenGL, ret); - } - else - { - RDCLOG("AMD ISA Not available:\n%s", err.c_str()); - } + GCNISA::GetTargets(GraphicsAPI::OpenGL, ret); // default is always first ret.insert(ret.begin(), "SPIR-V (RenderDoc)"); diff --git a/renderdoc/driver/ihv/amd/amd_isa.cpp b/renderdoc/driver/ihv/amd/amd_isa.cpp index e8c781b7a..07532070f 100644 --- a/renderdoc/driver/ihv/amd/amd_isa.cpp +++ b/renderdoc/driver/ihv/amd/amd_isa.cpp @@ -86,7 +86,7 @@ std::string LocatePlugin(const std::string &fileName) return ret; } -bool IsSupported(GraphicsAPI api, std::string &userMessage) +static bool IsSupported(GraphicsAPI api) { if(api == GraphicsAPI::Vulkan) { @@ -121,9 +121,9 @@ bool IsSupported(GraphicsAPI api, std::string &userMessage) if(api == GraphicsAPI::D3D11 || api == GraphicsAPI::D3D12) { DXBC::DXBCFile *dummy = NULL; - userMessage = Disassemble(dummy, ""); + std::string test = Disassemble(dummy, ""); - return userMessage.empty(); + return test.empty(); } return false; @@ -133,16 +133,36 @@ void GetTargets(GraphicsAPI api, std::vector &targets) { targets.reserve(ARRAY_COUNT(asicInfo) + 1); - // OpenGL doesn't support AMDIL - if(api != GraphicsAPI::OpenGL) - targets.push_back("AMDIL"); + if(IsSupported(api)) + { + // OpenGL doesn't support AMDIL + if(api != GraphicsAPI::OpenGL) + targets.push_back("AMDIL"); - for(const asic &a : asicInfo) - targets.push_back(a.name); + for(const asic &a : asicInfo) + targets.push_back(a.name); + } + else + { + // if unsupported, push a 'dummy' target, so that when the user selects it they'll see the error + // message + targets.push_back("AMD GCN ISA"); + } } std::string Disassemble(const SPVModule *spv, const std::string &entry, const std::string &target) { + if(!IsSupported(GraphicsAPI::Vulkan)) + { + return R"(; SPIR-V disassembly not supported, couldn't locate amdspv.exe. +; Normally it's in plugins/amd/isa/ in your build - if you are building locally you'll need to +; download the plugins package. +; +; To see instructions on how to download and configure the plugins on your system, go to: +; https://github.com/baldurk/renderdoc/wiki/GCN_ISA +)"; + } + std::string cmdLine = "-set spirvDasmLegacyFormat=1 -Dall -l"; bool found = false; @@ -254,6 +274,16 @@ std::string Disassemble(const SPVModule *spv, const std::string &entry, const st std::string Disassemble(ShaderStage stage, const std::vector &glsl, const std::string &target) { + if(!IsSupported(GraphicsAPI::OpenGL)) + { + return R"(; GLSL disassembly not supported, couldn't locate VirtualContext.exe or it failed to run. +; It only works when the AMD driver is currently being used for graphics. +; +; To see instructions on how to download and configure the plugins on your system, go to: +; https://github.com/baldurk/renderdoc/wiki/GCN_ISA +)"; + } + const char *stageName = "unk"; int stageIndex = 0; diff --git a/renderdoc/driver/ihv/amd/amd_isa.h b/renderdoc/driver/ihv/amd/amd_isa.h index 6bc274877..a1fef02a2 100644 --- a/renderdoc/driver/ihv/amd/amd_isa.h +++ b/renderdoc/driver/ihv/amd/amd_isa.h @@ -36,7 +36,6 @@ struct SPVModule; namespace GCNISA { -bool IsSupported(GraphicsAPI api, std::string &userMessage); void GetTargets(GraphicsAPI api, std::vector &targets); std::string Disassemble(const DXBC::DXBCFile *dxbc, const std::string &target); diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index cfae1342a..f201b49e1 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -922,15 +922,7 @@ vector VulkanReplay::GetDisassemblyTargets() { vector ret; - std::string err; - if(GCNISA::IsSupported(GraphicsAPI::Vulkan, err)) - { - GCNISA::GetTargets(GraphicsAPI::Vulkan, ret); - } - else - { - RDCLOG("AMD ISA Not available:\n%s", err.c_str()); - } + GCNISA::GetTargets(GraphicsAPI::Vulkan, ret); // default is always first ret.insert(ret.begin(), "SPIR-V (RenderDoc)");