diff options
| author | Yong He <yonghe@outlook.com> | 2021-01-27 10:02:44 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-27 10:02:44 -0800 |
| commit | 615dfba810964bed1caad8ecb87850c8eb1544b4 (patch) | |
| tree | 3fefe8c801a15213ca16eb947ce305a5ed69c6fa /tools/gfx/cuda/render-cuda.cpp | |
| parent | a90c850735664e2928e4cc961442a126c6859b97 (diff) | |
Make own a slang session. (#1678)
Diffstat (limited to 'tools/gfx/cuda/render-cuda.cpp')
| -rw-r--r-- | tools/gfx/cuda/render-cuda.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/gfx/cuda/render-cuda.cpp b/tools/gfx/cuda/render-cuda.cpp index d1e320224..057674550 100644 --- a/tools/gfx/cuda/render-cuda.cpp +++ b/tools/gfx/cuda/render-cuda.cpp @@ -6,6 +6,7 @@ #include "../renderer-shared.h" #include "../render-graphics-common.h" +#include "../slang-context.h" #ifdef GFX_ENABLE_CUDA #include <cuda.h> @@ -782,6 +783,7 @@ private: CUcontext m_context = nullptr; CUDAPipelineState* currentPipeline = nullptr; CUDARootShaderObject* currentRootObject = nullptr; + SlangContext slangContext; public: ~CUDARenderer() { @@ -792,6 +794,8 @@ private: } virtual SLANG_NO_THROW SlangResult SLANG_MCALL initialize(const Desc& desc, void* inWindowHandle) override { + SLANG_RETURN_ON_FAIL(slangContext.initialize(desc.slang, SLANG_PTX, "sm_5_1")); + SLANG_RETURN_ON_FAIL(_initCuda(reportType)); SLANG_RETURN_ON_FAIL(_findMaxFlopsDeviceIndex(&m_deviceIndex)); @@ -809,6 +813,13 @@ private: return SLANG_OK; } + virtual SLANG_NO_THROW Result SLANG_MCALL getSlangSession(slang::ISession** outSlangSession) override + { + *outSlangSession = slangContext.session.get(); + slangContext.session->addRef(); + return SLANG_OK; + } + virtual SLANG_NO_THROW Result SLANG_MCALL createTextureResource( IResource::Usage initialUsage, const ITextureResource::Desc& desc, |
