Table of Contents

Class GraphicsDevice

Namespace
NeoVeldrid
Assembly
NeoVeldrid.dll

Represents an abstract graphics device, capable of creating device resources and executing commands.

public abstract class GraphicsDevice : IDisposable
Inheritance
GraphicsDevice
Implements
Inherited Members

Properties

Aniso4xSampler

Gets a simple 4x anisotropic-filtered Sampler object owned by this instance. This object is created with Aniso4x. This property can only be used when SamplerAnisotropy is supported.

public Sampler Aniso4xSampler { get; }

Property Value

Sampler

ApiVersion

Gets the API version of the graphics backend.

public abstract GraphicsApiVersion ApiVersion { get; }

Property Value

GraphicsApiVersion

BackendType

Gets a value identifying the specific graphics API used by this instance.

public abstract GraphicsBackend BackendType { get; }

Property Value

GraphicsBackend

DeviceName

Gets the name of the device.

public abstract string DeviceName { get; }

Property Value

string

Features

Gets a GraphicsDeviceFeatures which enumerates the optional features supported by this instance.

public abstract GraphicsDeviceFeatures Features { get; }

Property Value

GraphicsDeviceFeatures

IsClipSpaceYInverted

Gets a value indicating whether this device's clip space Y values increase from top (-1) to bottom (1). If false, clip space Y values instead increase from bottom (-1) to top (1).

public abstract bool IsClipSpaceYInverted { get; }

Property Value

bool

IsDepthRangeZeroToOne

Gets a value indicating whether this device's depth values range from 0 to 1. If false, depth values instead range from -1 to 1.

public abstract bool IsDepthRangeZeroToOne { get; }

Property Value

bool

IsUvOriginTopLeft

Gets a value identifying whether texture coordinates begin in the top left corner of a Texture. If true, (0, 0) refers to the top-left texel of a Texture. If false, (0, 0) refers to the bottom-left texel of a Texture. This property is useful for determining how the output of a Framebuffer should be sampled.

public abstract bool IsUvOriginTopLeft { get; }

Property Value

bool

LinearSampler

Gets a simple linear-filtered Sampler object owned by this instance. This object is created with Linear.

public Sampler LinearSampler { get; }

Property Value

Sampler

MainSwapchain

Retrieves the main Swapchain for this device. This property is only valid if the device was created with a main Swapchain, and will return null otherwise.

public abstract Swapchain MainSwapchain { get; }

Property Value

Swapchain

PointSampler

Gets a simple point-filtered Sampler object owned by this instance. This object is created with Point.

public Sampler PointSampler { get; }

Property Value

Sampler

ResourceFactory

Gets the ResourceFactory controlled by this instance.

public abstract ResourceFactory ResourceFactory { get; }

Property Value

ResourceFactory

StructuredBufferMinOffsetAlignment

The required alignment, in bytes, for structured buffer offsets. Offset must be a multiple of this value. When binding a ResourceSet to a CommandList with an overload accepting dynamic offsets, each offset must be a multiple of this value.

public uint StructuredBufferMinOffsetAlignment { get; }

Property Value

uint

SwapchainFramebuffer

Gets a Framebuffer object representing the render targets of the main swapchain. This is equivalent to MainSwapchain.Framebuffer. If this GraphicsDevice was created without a main Swapchain, then this returns null.

public Framebuffer SwapchainFramebuffer { get; }

Property Value

Framebuffer

SyncToVerticalBlank

Gets or sets whether the main Swapchain's SwapBuffers() should be synchronized to the window system's vertical refresh rate. This is equivalent to MainSwapchain.SyncToVerticalBlank. This property cannot be set if this GraphicsDevice was created without a main Swapchain.

public virtual bool SyncToVerticalBlank { get; set; }

Property Value

bool

UniformBufferMinOffsetAlignment

The required alignment, in bytes, for uniform buffer offsets. Offset must be a multiple of this value. When binding a ResourceSet to a CommandList with an overload accepting dynamic offsets, each offset must be a multiple of this value.

public uint UniformBufferMinOffsetAlignment { get; }

Property Value

uint

VendorName

Gets the name of the device vendor.

public abstract string VendorName { get; }

Property Value

string

Methods

CreateD3D11(GraphicsDeviceOptions)

Creates a new GraphicsDevice using Direct3D 11.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

Returns

GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, D3D11DeviceOptions)

Creates a new GraphicsDevice using Direct3D 11.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, D3D11DeviceOptions d3d11Options)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

d3d11Options D3D11DeviceOptions

The Direct3D11-specific options used to create the device.

Returns

GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, D3D11DeviceOptions, SwapchainDescription)

Creates a new GraphicsDevice using Direct3D 11, with a main Swapchain.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, D3D11DeviceOptions d3d11Options, SwapchainDescription swapchainDescription)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

d3d11Options D3D11DeviceOptions

The Direct3D11-specific options used to create the device.

swapchainDescription SwapchainDescription

A description of the main Swapchain to create.

Returns

GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, SwapchainDescription)

Creates a new GraphicsDevice using Direct3D 11, with a main Swapchain.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

swapchainDescription SwapchainDescription

A description of the main Swapchain to create.

Returns

GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, nint, uint, uint)

Creates a new GraphicsDevice using Direct3D 11, with a main Swapchain.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, nint hwnd, uint width, uint height)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

hwnd nint

The Win32 window handle to render into.

width uint

The initial width of the window.

height uint

The initial height of the window.

Returns

GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, object, double, double, float)

Creates a new GraphicsDevice using Direct3D 11, with a main Swapchain.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, object swapChainPanel, double renderWidth, double renderHeight, float logicalDpi)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

swapChainPanel object

A COM object which must implement the ISwapChainPanelNative or ISwapChainBackgroundPanelNative interface. Generally, this should be a SwapChainPanel or SwapChainBackgroundPanel contained in your application window.

renderWidth double

The renderable width of the swapchain panel.

renderHeight double

The renderable height of the swapchain panel.

logicalDpi float

The logical DPI of the swapchain panel.

Returns

GraphicsDevice

CreateOpenGL(GraphicsDeviceOptions, OpenGLPlatformInfo, uint, uint)

Creates a new GraphicsDevice using OpenGL or OpenGL ES, with a main Swapchain.

public static GraphicsDevice CreateOpenGL(GraphicsDeviceOptions options, OpenGLPlatformInfo platformInfo, uint width, uint height)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

platformInfo OpenGLPlatformInfo

An OpenGLPlatformInfo object encapsulating necessary OpenGL context information.

width uint

The initial width of the window.

height uint

The initial height of the window.

Returns

GraphicsDevice

A new GraphicsDevice using the OpenGL or OpenGL ES API.

CreateOpenGLES(GraphicsDeviceOptions, SwapchainDescription)

Creates a new GraphicsDevice using OpenGL ES, with a main Swapchain. This overload can only be used on iOS or Android to create a GraphicsDevice for an Android Surface or an iOS UIView.

public static GraphicsDevice CreateOpenGLES(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

swapchainDescription SwapchainDescription

A description of the main Swapchain to create. The SwapchainSource must have been created from an Android Surface or an iOS UIView.

Returns

GraphicsDevice

A new GraphicsDevice using the OpenGL or OpenGL ES API.

CreateVulkan(GraphicsDeviceOptions)

Creates a new GraphicsDevice using Vulkan.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

Returns

GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, SwapchainDescription)

Creates a new GraphicsDevice using Vulkan, with a main Swapchain.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

swapchainDescription SwapchainDescription

A description of the main Swapchain to create.

Returns

GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, SwapchainDescription, VulkanDeviceOptions)

Creates a new GraphicsDevice using Vulkan, with a main Swapchain.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription, VulkanDeviceOptions vkOptions)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

swapchainDescription SwapchainDescription

A description of the main Swapchain to create.

vkOptions VulkanDeviceOptions

The Vulkan-specific options used to create the device.

Returns

GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, VkSurfaceSource, uint, uint)

Creates a new GraphicsDevice using Vulkan, with a main Swapchain.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, VkSurfaceSource surfaceSource, uint width, uint height)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

surfaceSource VkSurfaceSource

The source from which a Vulkan surface can be created.

width uint

The initial width of the window.

height uint

The initial height of the window.

Returns

GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, VulkanDeviceOptions)

Creates a new GraphicsDevice using Vulkan.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, VulkanDeviceOptions vkOptions)

Parameters

options GraphicsDeviceOptions

Describes several common properties of the GraphicsDevice.

vkOptions VulkanDeviceOptions

The Vulkan-specific options used to create the device.

Returns

GraphicsDevice

A new GraphicsDevice using the Vulkan API.

Dispose()

Frees unmanaged resources controlled by this device. All created child resources must be Disposed prior to calling this method.

public void Dispose()

DisposeWhenIdle(IDisposable)

Adds the given object to a deferred disposal list, which will be processed when this GraphicsDevice becomes idle. This method can be used to safely dispose a device resource which may be in use at the time this method is called, but which will no longer be in use when the device is idle.

public void DisposeWhenIdle(IDisposable disposable)

Parameters

disposable IDisposable

An object to dispose when this instance becomes idle.

GetD3D11Info()

Gets a BackendInfoD3D11 for this instance. This method will only succeed if this is a D3D11 GraphicsDevice. Otherwise, this method will throw an exception.

public BackendInfoD3D11 GetD3D11Info()

Returns

BackendInfoD3D11

The BackendInfoD3D11 for this instance.

GetD3D11Info(out BackendInfoD3D11)

Tries to get a BackendInfoD3D11 for this instance. This method will only succeed if this is a D3D11 GraphicsDevice.

public virtual bool GetD3D11Info(out BackendInfoD3D11 info)

Parameters

info BackendInfoD3D11

If successful, this will contain the BackendInfoD3D11 for this instance.

Returns

bool

True if this is a D3D11 GraphicsDevice and the operation was successful. False otherwise.

GetOpenGLInfo()

Gets a BackendInfoOpenGL for this instance. This method will only succeed if this is an OpenGL GraphicsDevice. Otherwise, this method will throw an exception.

public BackendInfoOpenGL GetOpenGLInfo()

Returns

BackendInfoOpenGL

The BackendInfoOpenGL for this instance.

GetOpenGLInfo(out BackendInfoOpenGL)

Tries to get a BackendInfoOpenGL for this instance. This method will only succeed if this is an OpenGL GraphicsDevice.

public virtual bool GetOpenGLInfo(out BackendInfoOpenGL info)

Parameters

info BackendInfoOpenGL

If successful, this will contain the BackendInfoOpenGL for this instance.

Returns

bool

True if this is an OpenGL GraphicsDevice and the operation was successful. False otherwise.

GetPixelFormatSupport(PixelFormat, TextureType, TextureUsage)

Gets whether or not the given PixelFormat, TextureType, and TextureUsage combination is supported by this instance.

public bool GetPixelFormatSupport(PixelFormat format, TextureType type, TextureUsage usage)

Parameters

format PixelFormat

The PixelFormat to query.

type TextureType

The TextureType to query.

usage TextureUsage

The TextureUsage to query.

Returns

bool

True if the given combination is supported; false otherwise.

GetPixelFormatSupport(PixelFormat, TextureType, TextureUsage, out PixelFormatProperties)

Gets whether or not the given PixelFormat, TextureType, and TextureUsage combination is supported by this instance, and also gets the device-specific properties supported by this instance.

public bool GetPixelFormatSupport(PixelFormat format, TextureType type, TextureUsage usage, out PixelFormatProperties properties)

Parameters

format PixelFormat

The PixelFormat to query.

type TextureType

The TextureType to query.

usage TextureUsage

The TextureUsage to query.

properties PixelFormatProperties

If the combination is supported, then this parameter describes the limits of a Texture created using the given combination of attributes.

Returns

bool

True if the given combination is supported; false otherwise. If the combination is supported, then properties contains the limits supported by this instance.

GetSampleCountLimit(PixelFormat, bool)

Gets the maximum sample count supported by the given PixelFormat.

public abstract TextureSampleCount GetSampleCountLimit(PixelFormat format, bool depthFormat)

Parameters

format PixelFormat

The format to query.

depthFormat bool

Whether the format will be used in a depth texture.

Returns

TextureSampleCount

A TextureSampleCount value representing the maximum count that a Texture of that format can be created with.

GetVulkanInfo()

Gets a BackendInfoVulkan for this instance. This method will only succeed if this is a Vulkan GraphicsDevice. Otherwise, this method will throw an exception.

public BackendInfoVulkan GetVulkanInfo()

Returns

BackendInfoVulkan

The BackendInfoVulkan for this instance.

GetVulkanInfo(out BackendInfoVulkan)

Tries to get a BackendInfoVulkan for this instance. This method will only succeed if this is a Vulkan GraphicsDevice.

public virtual bool GetVulkanInfo(out BackendInfoVulkan info)

Parameters

info BackendInfoVulkan

If successful, this will contain the BackendInfoVulkan for this instance.

Returns

bool

True if this is a Vulkan GraphicsDevice and the operation was successful. False otherwise.

IsBackendSupported(GraphicsBackend)

Checks whether the given GraphicsBackend is supported on this system.

public static bool IsBackendSupported(GraphicsBackend backend)

Parameters

backend GraphicsBackend

The GraphicsBackend to check.

Returns

bool

True if the GraphicsBackend is supported; false otherwise.

Map(MappableResource, MapMode)

Maps a DeviceBuffer or Texture into a CPU-accessible data region. For Texture resources, this overload maps the first subresource.

public MappedResource Map(MappableResource resource, MapMode mode)

Parameters

resource MappableResource

The DeviceBuffer or Texture resource to map.

mode MapMode

The MapMode to use.

Returns

MappedResource

A MappedResource structure describing the mapped data region.

Map(MappableResource, MapMode, uint)

Maps a DeviceBuffer or Texture into a CPU-accessible data region.

public MappedResource Map(MappableResource resource, MapMode mode, uint subresource)

Parameters

resource MappableResource

The DeviceBuffer or Texture resource to map.

mode MapMode

The MapMode to use.

subresource uint

The subresource to map. Subresources are indexed first by mip slice, then by array layer. For DeviceBuffer resources, this parameter must be 0.

Returns

MappedResource

A MappedResource structure describing the mapped data region.

MapCore(MappableResource, MapMode, uint)

protected abstract MappedResource MapCore(MappableResource resource, MapMode mode, uint subresource)

Parameters

resource MappableResource
mode MapMode
subresource uint

Returns

MappedResource

Map<T>(MappableResource, MapMode)

Maps a DeviceBuffer or Texture into a CPU-accessible data region, and returns a structured view over that region. For Texture resources, this overload maps the first subresource.

public MappedResourceView<T> Map<T>(MappableResource resource, MapMode mode) where T : unmanaged

Parameters

resource MappableResource

The DeviceBuffer or Texture resource to map.

mode MapMode

The MapMode to use.

Returns

MappedResourceView<T>

A MappedResource structure describing the mapped data region.

Type Parameters

T

The blittable value type which mapped data is viewed as.

Map<T>(MappableResource, MapMode, uint)

Maps a DeviceBuffer or Texture into a CPU-accessible data region, and returns a structured view over that region.

public MappedResourceView<T> Map<T>(MappableResource resource, MapMode mode, uint subresource) where T : unmanaged

Parameters

resource MappableResource

The DeviceBuffer or Texture resource to map.

mode MapMode

The MapMode to use.

subresource uint

The subresource to map. Subresources are indexed first by mip slice, then by array layer.

Returns

MappedResourceView<T>

A MappedResource structure describing the mapped data region.

Type Parameters

T

The blittable value type which mapped data is viewed as.

PlatformDispose()

Performs API-specific disposal of resources controlled by this instance.

protected abstract void PlatformDispose()

PostDeviceCreated()

Creates and caches common device resources after device creation completes.

protected void PostDeviceCreated()

ResetFence(Fence)

Resets the given Fence to the unsignaled state.

public abstract void ResetFence(Fence fence)

Parameters

fence Fence

The Fence instance to reset.

ResizeMainWindow(uint, uint)

Notifies this instance that the main window has been resized. This causes the SwapchainFramebuffer to be appropriately resized and recreated. This is equivalent to calling MainSwapchain.Resize(uint, uint). This method can only be called if this GraphicsDevice was created with a main Swapchain.

public void ResizeMainWindow(uint width, uint height)

Parameters

width uint

The new width of the main window.

height uint

The new height of the main window.

SubmitCommands(CommandList)

Submits the given CommandList for execution by this device. Commands submitted in this way may not be completed when this method returns. Use WaitForIdle() to wait for all submitted commands to complete. End() must have been called on commandList for this method to succeed.

public void SubmitCommands(CommandList commandList)

Parameters

commandList CommandList

The completed CommandList to execute. End() must have been previously called on this object.

SubmitCommands(CommandList, Fence)

Submits the given CommandList for execution by this device. Commands submitted in this way may not be completed when this method returns. Use WaitForIdle() to wait for all submitted commands to complete. End() must have been called on commandList for this method to succeed.

public void SubmitCommands(CommandList commandList, Fence fence)

Parameters

commandList CommandList

The completed CommandList to execute. End() must have been previously called on this object.

fence Fence

A Fence which will become signaled after this submission fully completes execution.

SwapBuffers()

Swaps the buffers of the main swapchain and presents the rendered image to the screen. This is equivalent to passing MainSwapchain to SwapBuffers(Swapchain). This method can only be called if this GraphicsDevice was created with a main Swapchain.

public void SwapBuffers()

SwapBuffers(Swapchain)

Swaps the buffers of the given swapchain.

public void SwapBuffers(Swapchain swapchain)

Parameters

swapchain Swapchain

The Swapchain to swap and present.

Unmap(MappableResource)

Invalidates a previously-mapped data region for the given DeviceBuffer or Texture. For Texture resources, this unmaps the first subresource.

public void Unmap(MappableResource resource)

Parameters

resource MappableResource

The resource to unmap.

Unmap(MappableResource, uint)

Invalidates a previously-mapped data region for the given DeviceBuffer or Texture.

public void Unmap(MappableResource resource, uint subresource)

Parameters

resource MappableResource

The resource to unmap.

subresource uint

The subresource to unmap. Subresources are indexed first by mip slice, then by array layer. For DeviceBuffer resources, this parameter must be 0.

UnmapCore(MappableResource, uint)

protected abstract void UnmapCore(MappableResource resource, uint subresource)

Parameters

resource MappableResource
subresource uint

UpdateBuffer(DeviceBuffer, uint, nint, uint)

Updates a DeviceBuffer region with new data.

public void UpdateBuffer(DeviceBuffer buffer, uint bufferOffsetInBytes, nint source, uint sizeInBytes)

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source nint

A pointer to the start of the data to upload.

sizeInBytes uint

The total size of the uploaded data, in bytes.

UpdateBuffer<T>(DeviceBuffer, uint, ReadOnlySpan<T>)

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ReadOnlySpan<T> source) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source ReadOnlySpan<T>

A readonly span containing the data to upload.

Type Parameters

T

The type of data to upload.

UpdateBuffer<T>(DeviceBuffer, uint, Span<T>)

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, Span<T> source) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source Span<T>

A span containing the data to upload.

Type Parameters

T

The type of data to upload.

UpdateBuffer<T>(DeviceBuffer, uint, T)

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T source) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer storage, at which new data will be uploaded.

source T

The value to upload.

Type Parameters

T

The type of data to upload.

UpdateBuffer<T>(DeviceBuffer, uint, ref T)

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source T

A reference to the single value to upload.

Type Parameters

T

The type of data to upload.

UpdateBuffer<T>(DeviceBuffer, uint, ref T, uint)

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source, uint sizeInBytes) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source T

A reference to the first of a series of values to upload.

sizeInBytes uint

The total size of the uploaded data, in bytes.

Type Parameters

T

The type of data to upload.

UpdateBuffer<T>(DeviceBuffer, uint, T[])

Updates a DeviceBuffer region with new data. This function must be used with a blittable value type T.

public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T[] source) where T : unmanaged

Parameters

buffer DeviceBuffer

The resource to update.

bufferOffsetInBytes uint

An offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.

source T[]

An array containing the data to upload.

Type Parameters

T

The type of data to upload.

UpdateTexture(Texture, nint, uint, uint, uint, uint, uint, uint, uint, uint, uint)

Updates a portion of a Texture resource with new data.

public void UpdateTexture(Texture texture, nint source, uint sizeInBytes, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer)

Parameters

texture Texture

The resource to update.

source nint

A pointer to the start of the data to upload. This must point to tightly-packed pixel data for the region specified.

sizeInBytes uint

The number of bytes to upload. This value must match the total size of the texture region specified.

x uint

The minimum X value of the updated region.

y uint

The minimum Y value of the updated region.

z uint

The minimum Z value of the updated region.

width uint

The width of the updated region, in texels.

height uint

The height of the updated region, in texels.

depth uint

The depth of the updated region, in texels.

mipLevel uint

The mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.

arrayLayer uint

The array layer to update. Must be less than the total array layer count contained in the Texture.

UpdateTexture<T>(Texture, ReadOnlySpan<T>, uint, uint, uint, uint, uint, uint, uint, uint)

Updates a portion of a Texture resource with new data contained in an array

public void UpdateTexture<T>(Texture texture, ReadOnlySpan<T> source, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer) where T : unmanaged

Parameters

texture Texture

The resource to update.

source ReadOnlySpan<T>

A readonly span containing the data to upload. This must contain tightly-packed pixel data for the region specified.

x uint

The minimum X value of the updated region.

y uint

The minimum Y value of the updated region.

z uint

The minimum Z value of the updated region.

width uint

The width of the updated region, in texels.

height uint

The height of the updated region, in texels.

depth uint

The depth of the updated region, in texels.

mipLevel uint

The mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.

arrayLayer uint

The array layer to update. Must be less than the total array layer count contained in the Texture.

Type Parameters

T

UpdateTexture<T>(Texture, Span<T>, uint, uint, uint, uint, uint, uint, uint, uint)

Updates a portion of a Texture resource with new data contained in an array

public void UpdateTexture<T>(Texture texture, Span<T> source, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer) where T : unmanaged

Parameters

texture Texture

The resource to update.

source Span<T>

A readonly span containing the data to upload. This must contain tightly-packed pixel data for the region specified.

x uint

The minimum X value of the updated region.

y uint

The minimum Y value of the updated region.

z uint

The minimum Z value of the updated region.

width uint

The width of the updated region, in texels.

height uint

The height of the updated region, in texels.

depth uint

The depth of the updated region, in texels.

mipLevel uint

The mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.

arrayLayer uint

The array layer to update. Must be less than the total array layer count contained in the Texture.

Type Parameters

T

UpdateTexture<T>(Texture, T[], uint, uint, uint, uint, uint, uint, uint, uint)

Updates a portion of a Texture resource with new data contained in an array

public void UpdateTexture<T>(Texture texture, T[] source, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer) where T : unmanaged

Parameters

texture Texture

The resource to update.

source T[]

An array containing the data to upload. This must contain tightly-packed pixel data for the region specified.

x uint

The minimum X value of the updated region.

y uint

The minimum Y value of the updated region.

z uint

The minimum Z value of the updated region.

width uint

The width of the updated region, in texels.

height uint

The height of the updated region, in texels.

depth uint

The depth of the updated region, in texels.

mipLevel uint

The mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.

arrayLayer uint

The array layer to update. Must be less than the total array layer count contained in the Texture.

Type Parameters

T

WaitForFence(Fence)

Blocks the calling thread until the given Fence becomes signaled.

public void WaitForFence(Fence fence)

Parameters

fence Fence

The Fence instance to wait on.

WaitForFence(Fence, TimeSpan)

Blocks the calling thread until the given Fence becomes signaled, or until a time greater than the given TimeSpan has elapsed.

public bool WaitForFence(Fence fence, TimeSpan timeout)

Parameters

fence Fence

The Fence instance to wait on.

timeout TimeSpan

A TimeSpan indicating the maximum time to wait on the Fence.

Returns

bool

True if the Fence was signaled. False if the timeout was reached instead.

WaitForFence(Fence, ulong)

Blocks the calling thread until the given Fence becomes signaled, or until a time greater than the given TimeSpan has elapsed.

public abstract bool WaitForFence(Fence fence, ulong nanosecondTimeout)

Parameters

fence Fence

The Fence instance to wait on.

nanosecondTimeout ulong

A value in nanoseconds, indicating the maximum time to wait on the Fence.

Returns

bool

True if the Fence was signaled. False if the timeout was reached instead.

WaitForFences(Fence[], bool)

Blocks the calling thread until one or all of the given Fence instances have become signaled.

public void WaitForFences(Fence[] fences, bool waitAll)

Parameters

fences Fence[]

An array of Fence objects to wait on.

waitAll bool

If true, then this method blocks until all of the given Fences become signaled. If false, then this method only waits until one of the Fences become signaled.

WaitForFences(Fence[], bool, TimeSpan)

Blocks the calling thread until one or all of the given Fence instances have become signaled, or until the given timeout has been reached.

public bool WaitForFences(Fence[] fences, bool waitAll, TimeSpan timeout)

Parameters

fences Fence[]

An array of Fence objects to wait on.

waitAll bool

If true, then this method blocks until all of the given Fences become signaled. If false, then this method only waits until one of the Fences become signaled.

timeout TimeSpan

A TimeSpan indicating the maximum time to wait on the Fences.

Returns

bool

True if the Fence was signaled. False if the timeout was reached instead.

WaitForFences(Fence[], bool, ulong)

Blocks the calling thread until one or all of the given Fence instances have become signaled, or until the given timeout has been reached.

public abstract bool WaitForFences(Fence[] fences, bool waitAll, ulong nanosecondTimeout)

Parameters

fences Fence[]

An array of Fence objects to wait on.

waitAll bool

If true, then this method blocks until all of the given Fences become signaled. If false, then this method only waits until one of the Fences become signaled.

nanosecondTimeout ulong

A value in nanoseconds, indicating the maximum time to wait on the Fence. Pass ulong.MaxValue to wait indefinitely.

Returns

bool

True if the Fence was signaled. False if the timeout was reached instead.

WaitForIdle()

A blocking method that returns when all submitted CommandList objects have fully completed.

public void WaitForIdle()