Legacy Documentation: Version 2018.2 (Go to current version)
Low-level native plugin rendering extensions
AssetBundles
Other Versions

Low-level native plugin Shader compiler access

On top of the low-level native plugin interface, Unity also supports low level access to the shaderA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary
compiler, allowing the user to inject different variants into a shader. It is also an event driven approach in which the plugin will receive callbacks when certain builtin events happen.

The shader compiler access extension definition exposed by Unity is to be found in IUnityShaderCompilerAccess.h and it’s provided with the editor.

These extensions are supported for now only on D3D11. Support for more platforms will follow.

Shader compiler access extension API

In order to take advantage of the renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary
extension, a plugin should export UnityShaderCompilerExtEvent. There is a lot of documentation provided inside the include file.

A plugin will get called via UnityShaderCompilerExtEvent whenever one of the builtin events is triggered by Unity. The callbacks can also be added to CommandBuffers via CommandBuffer.IssuePluginEventAndData or CommandBuffer.IssuePluginCustomBlit command from scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary
.

In addition to the basic script interface, Native Code Plugins in Unity can receive callbacks when certain events happen. This is mostly used to implement low-level rendering in your plugin and enable it to work with Unity’s multithreaded rendering.

Headers defining interfaces exposed by Unity are provided with the editor.

Shader compiler access configuration interface

Unity provides an interface (IUnityShaderCompilerExtPluginConfigure) to which the shader compiler access is configured. This interface is used by the plugin to reserve its own keyword(s) and configure shader program and gpu program compiler masks ( For what types for shader or GPU programs the plugin should be invoked )


Did you find this page useful? Please give it a rating:

Low-level native plugin rendering extensions
AssetBundles