diff options
author | George Kyriazis <[email protected]> | 2018-01-19 15:47:07 -0600 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-01-19 16:52:40 -0600 |
commit | fe107e3c1702c23cb8e3cdf01f3aef83b2e5abcb (patch) | |
tree | 4d2fd77dea47e12512dc5c659bbd6946b60601ee /src/gallium/drivers/swr | |
parent | 0cd9ad98a3364f9be04964069ec602bb0ba3119d (diff) |
swr/rast: jit shader lib debug work
Create shader_lib during build, link with shaders at DLL generation time
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 5 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index 5e5bba6f703..70f31379a79 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -586,6 +586,11 @@ int ExecUnhookedProcess(const char* pCmdLine) } #endif +#if defined(_WIN64) && defined(ENABLE_JIT_DEBUG) && defined(JIT_BASE_DIR) +EXTERN_C IMAGE_DOS_HEADER __ImageBase; +static __inline HINSTANCE GetModuleHINSTANCE() { return (HINSTANCE)&__ImageBase; } +#endif + /// notifyObjectCompiled - Provides a pointer to compiled code for Module M. void JitCache::notifyObjectCompiled(const llvm::Module *M, llvm::MemoryBufferRef Obj) { diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index 351ff0bf9c2..091db2449c1 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -2890,6 +2890,10 @@ bool isComponentEnabled(ComponentEnable enableMask, uint8_t component) } } +// Don't want two threads compiling the same fetch shader simultaneously +// Has problems in the JIT cache implementation +// This is only a problem for fetch right now. +static std::mutex gFetchCodegenMutex; ////////////////////////////////////////////////////////////////////////// /// @brief JITs from fetch shader IR @@ -2902,6 +2906,7 @@ PFN_FETCH_FUNC JitFetchFunc(HANDLE hJitMgr, const HANDLE hFunc) JitManager* pJitMgr = reinterpret_cast<JitManager*>(hJitMgr); PFN_FETCH_FUNC pfnFetch; + gFetchCodegenMutex.lock(); pfnFetch = (PFN_FETCH_FUNC)(pJitMgr->mpExec->getFunctionAddress(func->getName().str())); // MCJIT finalizes modules the first time you JIT code from them. After finalized, you cannot add new IR to the module pJitMgr->mIsModuleFinalized = true; @@ -2916,6 +2921,7 @@ PFN_FETCH_FUNC JitFetchFunc(HANDLE hJitMgr, const HANDLE hFunc) #endif pJitMgr->DumpAsm(const_cast<llvm::Function*>(func), "final"); + gFetchCodegenMutex.unlock(); |