Gorgon
Show / Hide Table of Contents

Interface IGorgonBufferInfo

Provides the necessary information required to set up a generic unstructured buffer.

Inherited Members
IGorgonNamedObject.Name
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public interface IGorgonBufferInfo : IGorgonNamedObject
Remarks

This provides an immutable view of the buffer information so that it cannot be modified after the buffer is created.

Properties

| Edit this page View Source

AllowCpuRead

Property to set or return whether to allow the CPU read access to the buffer.

Declaration
bool AllowCpuRead { get; }
Property Value
Type Description
bool
Remarks

This value controls whether or not the CPU can directly access the buffer for reading. If this value is false, the buffer still can be read, but will be done through an intermediate staging buffer, which is obviously less performant.

This value is treated as false if the buffer does not have a Binding containing the Shader flag, and does not have a Usage of Default. This means any reads will be done through an intermediate staging buffer, impacting performance.

If the Usage property is set to Staging, then this value is treated as true because staging buffers are CPU only and as such, can be read directly by the CPU regardless of this value.

The default for this value is false.

| Edit this page View Source

AllowRawView

Property to return whether to allow raw unordered views of the buffer.

Declaration
bool AllowRawView { get; }
Property Value
Type Description
bool
Remarks

When this value is true, then unordered access views for this buffer can use byte addressing to read/write the buffer in a shader. If it is false, then the SRV format or StructureSize will determine how to address data in the buffer.

The default value is false.

| Edit this page View Source

Binding

Property to return the type of binding for the GPU.

Declaration
BufferBinding Binding { get; }
Property Value
Type Description
BufferBinding
Remarks

The type of binding should be used to determine what type of view to apply to the buffer when accessing it from shaders. This will also help determine how data will be interpreted.

Different bindings may be applied at the same time by OR'ing the BufferBinding flags together.

If the Usage is set to Staging, then this value must be set to None, otherwise an exception will be raised when the buffer is created.

The default value is None

| Edit this page View Source

IndirectArgs

Property to return whether the buffer will contain indirect argument data.

Declaration
bool IndirectArgs { get; }
Property Value
Type Description
bool
Remarks

This flag only applies to buffers with a Binding of ReadWrite, and/or Shader. If the binding is set to anything else, then this flag is treated as being set to false.

The default value is false.

| Edit this page View Source

SizeInBytes

Property to return the size of the buffer, in bytes.

Declaration
int SizeInBytes { get; }
Property Value
Type Description
int
Remarks

For buffers that set AllowRawView to true, then this value will be rounded up to the nearest multiple of 4 at buffer creation time.

This value should be larger than 0, or else an exception will be thrown when the buffer is created.

| Edit this page View Source

StructureSize

Property to return the size, in bytes, of an individual structure in a structured buffer.

Declaration
int StructureSize { get; }
Property Value
Type Description
int
Remarks

Set this value to a number larger than 0 to indicate that this buffer will contain structured data.

This value should be larger than 0, and less than or equal to 2048 bytes. The structure size should also be a multiple of 4, and will be rounded up at buffer creation if it is not.

Vertex, Index and constant buffers will ignore this flag and will reset it to 0.

The default value is 0.

| Edit this page View Source

Usage

Property to return the intended usage for binding to the GPU.

Declaration
ResourceUsage Usage { get; }
Property Value
Type Description
ResourceUsage

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author