summaryrefslogtreecommitdiffstats
path: root/docs/user-guide
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-22 09:40:15 -0800
committerGitHub <noreply@github.com>2025-01-22 09:40:15 -0800
commit8000e0ede34e920cc7f37d69a335d74a472eff42 (patch)
treeccf7b3c7fb97d3d5df3afd38fde9e3221e3349de /docs/user-guide
parent04353fb7602b7eb6a8b86193510ebe0c670b7724 (diff)
Cache and reuse glsl module. (#6152)
* Cache and reuse glsl module. * Fix. * Implement record/replay for the new api. * Fix record replay. * Fix test.
Diffstat (limited to 'docs/user-guide')
-rw-r--r--docs/user-guide/08-compiling.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/user-guide/08-compiling.md b/docs/user-guide/08-compiling.md
index 147bc8144..c600b8cbb 100644
--- a/docs/user-guide/08-compiling.md
+++ b/docs/user-guide/08-compiling.md
@@ -589,12 +589,16 @@ A global session is created using the function `slang::createGlobalSession()`:
using namespace slang;
Slang::ComPtr<IGlobalSession> globalSession;
-createGlobalSession(globalSession.writeRef());
+SlangGlobalSessionDesc desc = {};
+createGlobalSession(&desc, globalSession.writeRef());
```
When a global session is created, the Slang system will load its internal representation of the _core module_ that the compiler provides to user code.
The core module can take a significant amount of time to load, so applications are advised to use a single global session if possible, rather than creating and then disposing of one for each compile.
+If you want to enable GLSL compatibility mode, you need to set `SlangGlobalSessionDesc::enableGLSL` to `true` when calling `createGlobalSession()`. This will load the necessary GLSL intrinsic module
+for compiling GLSL code. Without this setting, compiling GLSL code will result in an error.
+
> #### Note ####
> Currently, the global session type is *not* thread-safe.
> Applications that wish to compile on multiple threads will need to ensure that each concurrent thread compiles with a distinct global session.
@@ -874,6 +878,7 @@ The only functions which are currently thread safe are
```C++
SlangSession* spCreateSession(const char* deprecated);
SlangResult slang_createGlobalSession(SlangInt apiVersion, slang::IGlobalSession** outGlobalSession);
+SlangResult slang_createGlobalSession2(const SlangGlobalSessionDesc* desc, slang::IGlobalSession** outGlobalSession);
SlangResult slang_createGlobalSessionWithoutCoreModule(SlangInt apiVersion, slang::IGlobalSession** outGlobalSession);
ISlangBlob* slang_getEmbeddedCoreModule();
SlangResult slang::createGlobalSession(slang::IGlobalSession** outGlobalSession);