docs.unity.cn
    Show / Hide Table of Contents

    Class ConstantBuffer<CBType>

    An instance of a constant buffer.

    Inheritance
    Object
    ConstantBufferBase
    ConstantBuffer<CBType>
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Rendering
    Syntax
    public class ConstantBuffer<CBType> : ConstantBufferBase where CBType : struct
    Type Parameters
    Name Description
    CBType

    The type of structure representing the constant buffer data.

    Constructors

    ConstantBuffer()

    Constant Buffer constructor.

    Declaration
    public ConstantBuffer()

    Methods

    PushGlobal(in CBType, Int32)

    Update the GPU data of the constant buffer and bind it globally.

    Declaration
    public void PushGlobal(in CBType data, int shaderId)
    Parameters
    Type Name Description
    CBType data

    Input data of the constant buffer.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    PushGlobal(CommandBuffer, in CBType, Int32)

    Update the GPU data of the constant buffer and bind it globally via a command buffer.

    Declaration
    public void PushGlobal(CommandBuffer cmd, in CBType data, int shaderId)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used to execute the graphic commands.

    CBType data

    Input data of the constant buffer.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    Release()

    Release the constant buffers.

    Declaration
    public override void Release()
    Overrides
    ConstantBufferBase.Release()

    Set(ComputeShader, Int32)

    Bind the constant buffer to a compute shader.

    Declaration
    public void Set(ComputeShader cs, int shaderId)
    Parameters
    Type Name Description
    ComputeShader cs

    Compute shader to which the constant buffer should be bound.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    Set(Material, Int32)

    Bind the constant buffer to a material.

    Declaration
    public void Set(Material mat, int shaderId)
    Parameters
    Type Name Description
    Material mat

    Material to which the constant buffer should be bound.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    Set(CommandBuffer, ComputeShader, Int32)

    Bind the constant buffer to a compute shader via a command buffer.

    Declaration
    public void Set(CommandBuffer cmd, ComputeShader cs, int shaderId)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used to execute the graphic commands.

    ComputeShader cs

    Compute shader to which the constant buffer should be bound.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    SetGlobal(Int32)

    Bind the constant buffer globally.

    Declaration
    public void SetGlobal(int shaderId)
    Parameters
    Type Name Description
    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    SetGlobal(CommandBuffer, Int32)

    Bind the constant buffer globally via a command buffer.

    Declaration
    public void SetGlobal(CommandBuffer cmd, int shaderId)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used to execute the graphic commands.

    Int32 shaderId

    Shader porperty id to bind the constant buffer to.

    UpdateData(in CBType)

    Update the GPU data of the constant buffer.

    Declaration
    public void UpdateData(in CBType data)
    Parameters
    Type Name Description
    CBType data

    Input data of the constant buffer.

    UpdateData(CommandBuffer, in CBType)

    Update the GPU data of the constant buffer via a command buffer.

    Declaration
    public void UpdateData(CommandBuffer cmd, in CBType data)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used to execute the graphic commands.

    CBType data

    Input data of the constant buffer.

    Extension Methods

    AnalyticsUtils.ToNestedColumn<T>(T, Boolean)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 08 September 2023