ShaderImpl

clay.Resourceclay.graphics.Shaderbackend.ShaderImpl (Class)

Clay backend implementation of GPU shader programs.

This class extends Clay's base Shader class to add Ceramic-specific functionality like custom vertex attributes and multi-texture batching support. It manages the compiled shader code and provides cloning capabilities for shader reuse.

Shaders in Ceramic consist of:

  • Vertex shader: Transforms vertices from model to screen space
  • Fragment shader: Calculates the color of each pixel
  • Custom attributes: Additional per-vertex data
  • Uniforms: Global shader parameters
See: ceramic.Shader For the high-level shader API, ceramic.ShaderAttribute For custom vertex attributes

Instance Members

Custom vertex attributes defined for this shader. These allow passing additional per-vertex data beyond the standard position, color, and texture coordinates.


clay
isBatchingMultiTexture: Bool

Whether this shader supports multi-texture batching. When true, the shader can render multiple textures in a single draw call, improving performance for complex scenes with many different textures.


clay
clone(): ShaderImpl

Creates a deep copy of this shader.

The cloned shader will have the same source code, attributes, and settings but will be a separate GPU resource. This is useful for creating shader variations or when multiple materials need similar but independent shaders.

Note: Currently recompiles the shader source. Future optimization could share compiled shader programs between clones.

Returns Description
ShaderImpl A new ShaderImpl instance with the same configuration

clay
new(): Void