Skip to content

X3DSharedData

Uncategorized - no domain claims this class yet. Categorize

Class Documentation

Edit documentation

The shared shader resources of the renderer: constant buffers, textures, samplers and data buffers that every shader can use without its material providing them. The client reads one object of this class from ASSETS/Shaders/SharedData.bin and registers its four lists once, when it sets up the render device. Each resource is registered under its name. The lists of the shading models are registered after these, see IX3dShadingModel.

Filtering. Before the client creates a resource, it checks the resource's PlatformMask and ShaderModel. A resource that fails either check is not created, and a shader that uses its name finds nothing.

PlatformMask:

Value Effect
0 The resource loads on every platform.
Any other value The resource loads only if the bit of the current platform is set. The Windows client is bit 0x8. What the other bits select is not yet identified.

ShaderModel selects a renderer mode. The client has one mode flag, and the Windows client always sets it:

Value Name Effect
0 Any The resource always loads.
1 Legacy The resource loads only if the mode flag is not set. The Windows client never loads it.
2 Current The resource loads only if the mode flag is set. The Windows client always loads it.

The same flag makes EnvironmentPbrShadingModel load its probes into the shared probe array.

Binding. When the client builds an effect, it matches the textures, samplers and data buffers that the compiled shader declares against the shared resources by name, and binds each match at the slot that the shader declares. register changes this:

register Sampler Texture, data buffer Constant buffer, constant
-1 Bound per effect, at the slot that the shader declares Bound per effect, at the slot that the shader declares Not read
0 or more Bound once, when the client creates it, at this slot of the stage that BindLocation selects. Left out of the effect bindings. Left out of the effect bindings Not read

BindLocation selects the shader stage of a sampler:

Value Stage
0 Vertex shader
Any other value Pixel shader

For textures and data buffers the client stores BindLocation with the resource. How it uses the value there is not yet identified.

Properties