docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ShaderTestFramework

    Framework for shader testing.

    Inheritance
    object
    ShaderTestFramework
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.TestTools.Graphics.Shaders
    Assembly: UnityEditor.TestTools.Graphics.dll
    Syntax
    public class ShaderTestFramework : IDisposable
    Remarks

    Manages loading, executing, and resource cleanup for shaders under test.

    Methods

    Dispose()

    Disposes the shader test framework, resetting state and releasing resources

    Declaration
    public void Dispose()

    ExecuteShader<T>(ShaderHandle)

    Executes the given shader and returns the result

    Declaration
    public T ExecuteShader<T>(ShaderHandle shader)
    Parameters
    Type Name Description
    ShaderHandle shader

    The shader to execute.

    Returns
    Type Description
    T

    The shader execution result, in the type of T.

    Type Parameters
    Name Description
    T

    The type of the shader result data. This must match the expected return type of the function or shader being executed.
    For Shaderlab, always use ShaderlabShaderData.
    For HLSL, use the following types:

    HLSL TypeC# Type
    floatfloat
    float2,int2Vector2
    float3,int3Vector3
    float4,int4Vector4
    intint
    uintuint
    float4x4Matrix4x4
    Exceptions
    Type Condition
    NotImplementedException

    Thrown when the shader type is not supported. Currently supported shader types are HLSL and Shaderlab.

    LoadShader(string, ShaderParams)

    Loads a shader by its identifier and type.

    Declaration
    public ShaderHandle LoadShader(string path, ShaderParams shaderParameters)
    Parameters
    Type Name Description
    string path

    The path of the shader to load

    ShaderParams shaderParameters

    The preparation parameters for the shader.

    Returns
    Type Description
    ShaderHandle

    A handle to the loaded shader

    Remarks

    Currently supports loading ShaderLab and HLSL shaders.

    Exceptions
    Type Condition
    NotImplementedException

    Thrown when the shader type is not supported.

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)