Add fallback path to use d3dcompiler from renderdoc folder. Refs #153

* This should be a very rare case, but e.g. if the D3D11 runtime hasn't
  been loaded ever, d3dcompiler won't be in the system dll path.
This commit is contained in:
baldurk
2015-09-15 23:11:02 +02:00
parent 822a235349
commit 60081dcfe7
3 changed files with 27 additions and 3 deletions
+2 -2
View File
@@ -51,9 +51,9 @@ rm -f dist/ReleasePDBs{32,64}/*.{exp,lib,metagen} dist/Release{32,64}/*.vshost.*
# In the 64bit release folder, make an x86 subfolder and copy in renderdoc 32bit
mkdir -p dist/Release64/x86
rm -rf dist/Release32/pdblocate/x64 dist/ReleasePDBs32/pdblocate/x64
cp -R dist/Release32/{renderdoc.dll,renderdocshim32.dll,renderdoccmd.exe,pdblocate} dist/Release64/x86/
cp -R dist/Release32/{d3dcompiler_47.dll,renderdoc.dll,renderdocshim32.dll,renderdoccmd.exe,pdblocate} dist/Release64/x86/
mkdir -p dist/ReleasePDBs64/x86
cp -R dist/ReleasePDBs32/{renderdoc.dll,renderdoc.pdb,renderdocshim32.dll,renderdocshim32.pdb,renderdoccmd.exe,renderdoccmd.pdb,pdblocate} dist/ReleasePDBs64/x86/
cp -R dist/ReleasePDBs32/{d3dcompiler_47.dll,renderdoc.dll,renderdoc.pdb,renderdocshim32.dll,renderdocshim32.pdb,renderdoccmd.exe,renderdoccmd.pdb,pdblocate} dist/ReleasePDBs64/x86/
if [[ $AUTOBUILD -eq 0 ]]; then
echo "Ready to make installer MSIs - make sure to bump version numbers on package."
+3 -1
View File
@@ -67,7 +67,7 @@
<Component Id='RenderDocCPP' Win64="yes" Guid='9D5949F9-0447-47B6-829D-77465E1FDAD9'>
<File Id='RenderDocCPP' Name='renderdoc.dll' DiskId='1' Source='dist/Release64/renderdoc.dll' KeyPath='yes' />
<File Id='D3DCompiler47' Name='d3dcompiler_47.dll' DiskId='1' Source='dist/Release64/d3dcompiler_47.dll' />
<File Id='D3DCompiler47DLL64' Name='d3dcompiler_47.dll' DiskId='1' Source='dist/Release64/d3dcompiler_47.dll' />
<File Id='RenderDocSHIM' Name='renderdocshim64.dll' DiskId='1' Source='dist/Release64/renderdocshim64.dll' />
<RegistryValue Root="HKLM" Id="RDCCLSID" Action="write"
@@ -140,6 +140,8 @@
<File Id='renderdocX86DLL' Name='renderdoc.dll' DiskId='1' Source='dist/Release64/x86/renderdoc.dll' KeyPath='yes' />
<File Id='renderdocshimX86DLL' Name='renderdocshim32.dll' DiskId='1' Source='dist/Release64/x86/renderdocshim32.dll' />
<File Id='renderdocX86CMD' Name='renderdoccmd.exe' DiskId='1' Source='dist/Release64/x86/renderdoccmd.exe' />
<File Id='D3DCompiler47DLL32' Name='d3dcompiler_47.dll' DiskId='1' Source='dist/Release64/x86/d3dcompiler_47.dll' />
<RegistryValue Root="HKLM" Id="RDCCLSID32" Action="write"
Key="Software\Wow6432Node\Classes\CLSID\{5D6BF029-A6BA-417A-8523-120492B1DCE3}"
+22
View File
@@ -33,6 +33,9 @@
#include "driver/d3d11/d3d11_resources.h"
#include "driver/d3d11/d3d11_renderstate.h"
// gives us an address to identify this dll with
static int dllLocator=0;
HMODULE GetD3DCompiler()
{
static HMODULE ret = NULL;
@@ -60,6 +63,25 @@ HMODULE GetD3DCompiler()
}
}
// all else failed, couldn't find d3dcompiler loaded,
// and couldn't even loadlibrary any version!
// we'll have to loadlibrary the version that ships with
// RenderDoc.
HMODULE hModule = NULL;
GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCTSTR)&dllLocator,
&hModule);
wchar_t curFile[512] = {0};
GetModuleFileNameW(hModule, curFile, 511);
wstring path = wstring(curFile);
path = dirname(path);
wstring dll = path + L"/d3dcompiler_47.dll";
ret = LoadLibraryW(dll.c_str());
return ret;
}