Native plug-in API for shader compiler
Control shader compiler variants from native plug-ins.
Read time 1 minuteLast updated 14 days ago
Use the Unity low-level shader compiler APIs to inject different variants into a shader. This is an event-driven approach in which the plug-in receives callbacks when certain built-in events happen.
The shader compiler access extension definition exposed by Unity is to be found in header file, located in the PluginAPI folder.
IUnityShaderCompilerAccess.hShader compiler access extension API
To use the rendering extension, plug-ins must export . For more information on implementing the API, refer to the code comments in the header file.
UnityShaderCompilerExtEventIUnityShaderCompilerAccess.hA plug-in receives a callback via whenever Unity triggers one of the built-in events. The callbacks can also be added to CommandBuffers via or commands from scripts.
UnityShaderCompilerExtEventCommandBuffer.IssuePluginEventAndDataCommandBuffer.IssuePluginCustomBlitIn addition to the basic script interface, native plug-ins in Unity can receive callbacks when certain events happen. This is mostly used to implement low-level rendering in your plug-in and enable it to work with Unity's multithreaded rendering.
Shader compiler access configuration interface
Unity provides the () interface for configuring shader compiler access. A plug-in can use this interface to reserve its own keyword(s) and configure shader program and GPU program compiler masks. This determines which shader types or GPU programs to invoke the plug-in for.
IUnityShaderCompilerExtPluginConfigure