Class GPUBufferDescription
A common description for all GPU buffers.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class GPUBufferDescription : ValueType, IEquatable<GPUBufferDescription>
Fields
Flags
Format
InitData
The pointer to location of initial resource data. Null if not used.
Declaration
public IntPtr InitData
Field Value
System.IntPtr
|
Size
The buffer total size.
Declaration
public uint Size
Field Value
System.UInt32
|
Stride
The buffer structure stride (size in bytes per element).
Declaration
public uint Stride
Field Value
System.UInt32
|
Usage
Value that identifies how the buffer is to be read from and written to. The most common value is Default; see GPUResourceUsage for all possible values.
Declaration
public GPUResourceUsage Usage
Field Value
GPUResourceUsage
|
Properties
Default
The default GPUBufferDescription.
Declaration
public static GPUBufferDescription Default { get; }
Property Value
GPUBufferDescription
|
ElementsCount
Gets the number elements in the buffer.
Declaration
public uint ElementsCount { get; }
Property Value
System.UInt32
|
IsShaderResource
Gets a value indicating whether this instance is a shader resource.
Declaration
public bool IsShaderResource { get; }
Property Value
System.Boolean
|
IsUnorderedAccess
Gets a value indicating whether this instance is a unordered access.
Declaration
public bool IsUnorderedAccess { get; }
Property Value
System.Boolean
|
Methods
Argument(Int32, GPUResourceUsage)
Creates argument buffer description.
Declaration
public static GPUBufferDescription Argument(int size, GPUResourceUsage usage)
Parameters
System.Int32
size
The size (in bytes). |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Argument(IntPtr, Int32, GPUResourceUsage)
Creates argument buffer description.
Declaration
public static GPUBufferDescription Argument(IntPtr data, int size, GPUResourceUsage usage)
Parameters
System.IntPtr
data
The initial data. |
System.Int32
size
The size (in bytes). |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Buffer(Int32, GPUBufferFlags, PixelFormat, IntPtr, Int32, GPUResourceUsage)
Creates the buffer description.
Declaration
public static GPUBufferDescription Buffer(int size, GPUBufferFlags flags, PixelFormat format, IntPtr initData = default(IntPtr), int stride = 0, GPUResourceUsage usage)
Parameters
System.Int32
size
The size (in bytes). |
GPUBufferFlags
flags
The flags. |
PixelFormat
format
The format. |
System.IntPtr
initData
The initial data. |
System.Int32
stride
The stride. |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Buffer(UInt32, GPUBufferFlags, PixelFormat, IntPtr, UInt32, GPUResourceUsage)
Creates the buffer description.
Declaration
public static GPUBufferDescription Buffer(uint size, GPUBufferFlags flags, PixelFormat format, IntPtr initData = default(IntPtr), uint stride = 0U, GPUResourceUsage usage)
Parameters
System.UInt32
size
The size (in bytes). |
GPUBufferFlags
flags
The flags. |
PixelFormat
format
The format. |
System.IntPtr
initData
The initial data. |
System.UInt32
stride
The stride. |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Clear()
Clears description.
Declaration
public void Clear()
Equals(GPUBufferDescription)
Declaration
public bool Equals(GPUBufferDescription other)
Parameters
GPUBufferDescription
other
|
Returns
System.Boolean
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
|
Returns
System.Boolean
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
System.Int32
|
Index(Int32, Int32, GPUResourceUsage)
Creates index buffer description.
Declaration
public static GPUBufferDescription Index(int elementStride, int elementsCount, GPUResourceUsage usage)
Parameters
System.Int32
elementStride
The element stride. |
System.Int32
elementsCount
The elements count. |
GPUResourceUsage
usage
The usage mode. |
Returns
GPUBufferDescription
The buffer description. |
Index(Int32, Int32, IntPtr)
Creates index buffer description.
Declaration
public static GPUBufferDescription Index(int elementStride, int elementsCount, IntPtr data)
Parameters
System.Int32
elementStride
The element stride. |
System.Int32
elementsCount
The elements count. |
System.IntPtr
data
The data. |
Returns
GPUBufferDescription
The buffer description. |
Raw(Int32, GPUBufferFlags, GPUResourceUsage)
Creates raw buffer description.
Declaration
public static GPUBufferDescription Raw(int size, GPUBufferFlags additionalFlags, GPUResourceUsage usage)
Parameters
System.Int32
size
The size (in bytes). |
GPUBufferFlags
additionalFlags
The additional bindings (for example, to create a combined raw/index buffer, pass IndexBuffer). |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Raw(IntPtr, Int32, GPUBufferFlags, GPUResourceUsage)
Creates raw buffer description.
Declaration
public static GPUBufferDescription Raw(IntPtr data, int size, GPUBufferFlags additionalFlags, GPUResourceUsage usage)
Parameters
System.IntPtr
data
The initial data. |
System.Int32
size
The size (in bytes). |
GPUBufferFlags
additionalFlags
The additional bindings (for example, to create a combined raw/index buffer, pass IndexBuffer). |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Structured(Int32, Int32, Boolean)
Creates structured buffer description.
Declaration
public static GPUBufferDescription Structured(int elementCount, int elementSize, bool isUnorderedAccess = false)
Parameters
System.Int32
elementCount
The element count. |
System.Int32
elementSize
Size of the element (in bytes). |
System.Boolean
isUnorderedAccess
if set to |
Returns
GPUBufferDescription
The buffer description. |
Remarks
Example in HLSL: StructuredBuffer<float4> or RWStructuredBuffer<float4> for structured buffers supporting unordered access.
StructuredAppend(Int32, Int32)
Creates append buffer description (structured buffer).
Declaration
public static GPUBufferDescription StructuredAppend(int elementCount, int elementSize)
Parameters
System.Int32
elementCount
The element count. |
System.Int32
elementSize
Size of the element (in bytes). |
Returns
GPUBufferDescription
The buffer description. |
Remarks
Example in HLSL: AppendStructuredBuffer<float4> or ConsumeStructuredBuffer<float4>.
StructuredCounter(Int32, Int32)
Creates counter buffer description (structured buffer).
Declaration
public static GPUBufferDescription StructuredCounter(int elementCount, int elementSize)
Parameters
System.Int32
elementCount
The element count. |
System.Int32
elementSize
Size of the element (in bytes). |
Returns
GPUBufferDescription
The buffer description. |
Remarks
Example in HLSL: StructuredBuffer<float4> or RWStructuredBuffer<float4> for structured buffers supporting unordered access.
ToStagingReadback()
Gets the staging readback description for this instance.
Declaration
public GPUBufferDescription ToStagingReadback()
Returns
GPUBufferDescription
A staging buffer description |
ToStagingUpload()
Gets the staging upload description for this instance.
Declaration
public GPUBufferDescription ToStagingUpload()
Returns
GPUBufferDescription
A staging buffer description |
Typed(Int32, PixelFormat, Boolean, GPUResourceUsage)
Creates typed buffer description.
Declaration
public static GPUBufferDescription Typed(int count, PixelFormat viewFormat, bool isUnorderedAccess = false, GPUResourceUsage usage)
Parameters
System.Int32
count
The elements count. |
PixelFormat
viewFormat
The view format. |
System.Boolean
isUnorderedAccess
True if use UAV, otherwise false. |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Remarks
Example in HLSL: Buffer<float4>.
Typed(IntPtr, Int32, PixelFormat, Boolean, GPUResourceUsage)
Creates typed buffer description.
Declaration
public static GPUBufferDescription Typed(IntPtr data, int count, PixelFormat viewFormat, bool isUnorderedAccess = false, GPUResourceUsage usage)
Parameters
System.IntPtr
data
The data. |
System.Int32
count
The elements count. |
PixelFormat
viewFormat
The view format. |
System.Boolean
isUnorderedAccess
True if use UAV, otherwise false. |
GPUResourceUsage
usage
The usage. |
Returns
GPUBufferDescription
The buffer description. |
Remarks
Example in HLSL: Buffer<float4>.
Vertex(Int32, GPUResourceUsage)
Creates vertex buffer description.
Declaration
public static GPUBufferDescription Vertex(int size, GPUResourceUsage usage)
Parameters
System.Int32
size
The size (in bytes). |
GPUResourceUsage
usage
The usage mode. |
Returns
GPUBufferDescription
The buffer description. |
Vertex(Int32, Int32, GPUResourceUsage)
Creates vertex buffer description.
Declaration
public static GPUBufferDescription Vertex(int elementStride, int elementsCount, GPUResourceUsage usage)
Parameters
System.Int32
elementStride
The element stride. |
System.Int32
elementsCount
The elements count. |
GPUResourceUsage
usage
The usage mode. |
Returns
GPUBufferDescription
The buffer description. |
Vertex(Int32, Int32, IntPtr)
Creates vertex buffer description.
Declaration
public static GPUBufferDescription Vertex(int elementStride, int elementsCount, IntPtr data)
Parameters
System.Int32
elementStride
The element stride. |
System.Int32
elementsCount
The elements count. |
System.IntPtr
data
The data. |
Returns
GPUBufferDescription
The buffer description. |