From 9436dbf8c33e489a7f486f4b42e443fff73fce76 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 6 Feb 2020 16:01:14 +0000 Subject: [PATCH] Fix sampling program source for ld_ms sampling --- renderdoc/driver/d3d11/d3d11_shaderdebug.cpp | 8 +++++++- renderdoc/driver/d3d12/d3d12_shaderdebug.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp b/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp index 9fec8c4a9..8a51f5be8 100644 --- a/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp +++ b/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp @@ -1320,7 +1320,7 @@ bool D3D11DebugAPIWrapper::CalculateSampleGather( { sampleProgram = StringFormat::Fmt("%s : register(t0);\n\n", textureDecl.c_str()); sampleProgram += funcRet + " main() : SV_Target0\n{\n"; - sampleProgram += StringFormat::Fmt("t.Load(%s, int(%d) %s)%s;\n", texcoords.c_str(), + sampleProgram += StringFormat::Fmt("return t.Load(%s, int(%d) %s)%s;\n", texcoords.c_str(), multisampleIndex, offsets.c_str(), strSwizzle.c_str()); sampleProgram += "\n}\n"; } @@ -1349,6 +1349,12 @@ bool D3D11DebugAPIWrapper::CalculateSampleGather( ID3D11PixelShader *ps = m_pDevice->GetShaderCache()->MakePShader(sampleProgram.c_str(), "main", "ps_5_0"); + if(!vs || !ps) + { + RDCERR("Sample VS or PS failed to compile"); + return false; + } + ID3D11DeviceContext *context = NULL; m_pDevice->GetImmediateContext(&context); diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index 7f2bf7510..b75c6cbc9 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -879,7 +879,7 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather( sampleProgram = StringFormat::Fmt("%s : register(%s);\n\n", textureDecl.c_str(), strResourceBinding.c_str()); sampleProgram += funcRet + " main() : SV_Target0\n{\n"; - sampleProgram += StringFormat::Fmt("t.Load(%s, int(%d) %s)%s;\n", texcoords.c_str(), + sampleProgram += StringFormat::Fmt("return t.Load(%s, int(%d) %s)%s;\n", texcoords.c_str(), multisampleIndex, offsets.c_str(), strSwizzle.c_str()); sampleProgram += "\n}\n"; }