shader
This type represents a shader. HLSL documentation
This type inherits managed
type. All of its base methods and fields are also available in this type.
Only fragment shaders (aka Pixel Shaders) are supported.
Rendering system uses Shader Version 4 (ps_4_0).
HLSL structures
The constant buffer fields are the following:
Name
Type
Description
mvp
float4x4
Projection matrix.
tex
float2
Texture dimensions.
time
float
Render time (NOT the frame time).
alpha
float
Global opacity override.
The input fields are the following:
Name
Type
Description
pos
float4
Vertex position on screen (x,y,z over w). Register: SV_POSITION
.
col
float4
Vertex color tint (r, g, b, a). Register: COLOR0
.
uv
float2
UV coordinates (u, v). Register: TEXCOORD0
.
The bound objects are the following:
Name
Type
Description
sampler0
sampler
Texture sampler.
texture0
Texture2D
Texture object.
Template:
__call
Constructs a shader.
Arguments
Name
Type
Description
src
string
Shader source code.
Returns
Type
Description
shader
Shader object.
Example
Last updated