Show / Hide Table of Contents

Class GraphicsDevice

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

Inheritance
System.Object
GraphicsDevice
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Veldrid
Assembly: cs.temp.dll.dll
Syntax
public abstract class GraphicsDevice : IDisposable

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.

Declaration
public Sampler Aniso4xSampler { get; }
Property Value
Type Description
Sampler

BackendType

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

Declaration
public abstract GraphicsBackend BackendType { get; }
Property Value
Type Description
GraphicsBackend

Features

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

Declaration
public abstract GraphicsDeviceFeatures Features { get; }
Property Value
Type Description
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).

Declaration
public abstract bool IsClipSpaceYInverted { get; }
Property Value
Type Description
System.Boolean

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.

Declaration
public abstract bool IsDepthRangeZeroToOne { get; }
Property Value
Type Description
System.Boolean

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.

Declaration
public abstract bool IsUvOriginTopLeft { get; }
Property Value
Type Description
System.Boolean

LinearSampler

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

Declaration
public Sampler LinearSampler { get; }
Property Value
Type Description
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.

Declaration
public abstract Swapchain MainSwapchain { get; }
Property Value
Type Description
Swapchain

PointSampler

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

Declaration
public Sampler PointSampler { get; }
Property Value
Type Description
Sampler

ResourceFactory

Gets the ResourceFactory controlled by this instance.

Declaration
public abstract ResourceFactory ResourceFactory { get; }
Property Value
Type Description
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.

Declaration
public uint StructuredBufferMinOffsetAlignment { get; }
Property Value
Type Description
System.UInt32

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.

Declaration
public Framebuffer SwapchainFramebuffer { get; }
Property Value
Type Description
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.

Declaration
public virtual bool SyncToVerticalBlank { get; set; }
Property Value
Type Description
System.Boolean

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.

Declaration
public uint UniformBufferMinOffsetAlignment { get; }
Property Value
Type Description
System.UInt32

Methods

CreateD3D11(GraphicsDeviceOptions)

Creates a new GraphicsDevice using Direct3D 11.

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, IntPtr, UInt32, UInt32)

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

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, IntPtr hwnd, uint width, uint height)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

System.IntPtr hwnd

The Win32 window handle to render into.

System.UInt32 width

The initial width of the window.

System.UInt32 height

The initial height of the window.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, Object, Double, Double, Single)

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

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, object swapChainPanel, double renderWidth, double renderHeight, float logicalDpi)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

System.Object swapChainPanel

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

System.Double renderWidth

The renderable width of the swapchain panel.

System.Double renderHeight

The renderable height of the swapchain panel.

System.Single logicalDpi

The logical DPI of the swapchain panel.

Returns
Type Description
GraphicsDevice

CreateD3D11(GraphicsDeviceOptions, D3D11DeviceOptions)

Creates a new GraphicsDevice using Direct3D 11.

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, D3D11DeviceOptions d3d11Options)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

D3D11DeviceOptions d3d11Options

The Direct3D11-specific options used to create the device.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, D3D11DeviceOptions, SwapchainDescription)

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

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, D3D11DeviceOptions d3d11Options, SwapchainDescription swapchainDescription)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

D3D11DeviceOptions d3d11Options

The Direct3D11-specific options used to create the device.

SwapchainDescription swapchainDescription

A description of the main Swapchain to create.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateD3D11(GraphicsDeviceOptions, SwapchainDescription)

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

Declaration
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

SwapchainDescription swapchainDescription

A description of the main Swapchain to create.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Direct3D 11 API.

CreateMetal(GraphicsDeviceOptions)

Creates a new GraphicsDevice using Metal.

Declaration
public static GraphicsDevice CreateMetal(GraphicsDeviceOptions options)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Metal API.

CreateMetal(GraphicsDeviceOptions, IntPtr)

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

Declaration
public static GraphicsDevice CreateMetal(GraphicsDeviceOptions options, IntPtr nsWindow)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

System.IntPtr nsWindow

A pointer to an NSWindow object, which will be used to create the Metal device's swapchain.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Metal API.

CreateMetal(GraphicsDeviceOptions, SwapchainDescription)

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

Declaration
public static GraphicsDevice CreateMetal(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

SwapchainDescription swapchainDescription

A description of the main Swapchain to create.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Metal API.

CreateOpenGL(GraphicsDeviceOptions, OpenGLPlatformInfo, UInt32, UInt32)

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

Declaration
public static GraphicsDevice CreateOpenGL(GraphicsDeviceOptions options, OpenGLPlatformInfo platformInfo, uint width, uint height)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

OpenGLPlatformInfo platformInfo

An OpenGLPlatformInfo object encapsulating necessary OpenGL context information.

System.UInt32 width

The initial width of the window.

System.UInt32 height

The initial height of the window.

Returns
Type Description
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.

Declaration
public static GraphicsDevice CreateOpenGLES(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)
Parameters
Type Name Description
GraphicsDeviceOptions options

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
Type Description
GraphicsDevice

A new GraphicsDevice using the OpenGL or OpenGL ES API.

CreateVulkan(GraphicsDeviceOptions)

Creates a new GraphicsDevice using Vulkan.

Declaration
public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, SwapchainDescription)

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

Declaration
public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

SwapchainDescription swapchainDescription

A description of the main Swapchain to create.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, SwapchainDescription, VulkanDeviceOptions)

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

Declaration
public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription, VulkanDeviceOptions vkOptions)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

SwapchainDescription swapchainDescription

A description of the main Swapchain to create.

VulkanDeviceOptions vkOptions

The Vulkan-specific options used to create the device.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, VkSurfaceSource, UInt32, UInt32)

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

Declaration
public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, VkSurfaceSource surfaceSource, uint width, uint height)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

VkSurfaceSource surfaceSource

The source from which a Vulkan surface can be created.

System.UInt32 width

The initial width of the window.

System.UInt32 height

The initial height of the window.

Returns
Type Description
GraphicsDevice

A new GraphicsDevice using the Vulkan API.

CreateVulkan(GraphicsDeviceOptions, VulkanDeviceOptions)

Creates a new GraphicsDevice using Vulkan.

Declaration
public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, VulkanDeviceOptions vkOptions)
Parameters
Type Name Description
GraphicsDeviceOptions options

Describes several common properties of the GraphicsDevice.

VulkanDeviceOptions vkOptions

The Vulkan-specific options used to create the device.

Returns
Type Description
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.

Declaration
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.

Declaration
public void DisposeWhenIdle(IDisposable disposable)
Parameters
Type Name Description
System.IDisposable disposable

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.

Declaration
public BackendInfoD3D11 GetD3D11Info()
Returns
Type Description
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.

Declaration
public virtual bool GetD3D11Info(out BackendInfoD3D11 info)
Parameters
Type Name Description
BackendInfoD3D11 info

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

Returns
Type Description
System.Boolean

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.

Declaration
public BackendInfoOpenGL GetOpenGLInfo()
Returns
Type Description
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.

Declaration
public virtual bool GetOpenGLInfo(out BackendInfoOpenGL info)
Parameters
Type Name Description
BackendInfoOpenGL info

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

Returns
Type Description
System.Boolean

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.

Declaration
public bool GetPixelFormatSupport(PixelFormat format, TextureType type, TextureUsage usage)
Parameters
Type Name Description
PixelFormat format

The PixelFormat to query.

TextureType type

The TextureType to query.

TextureUsage usage

The TextureUsage to query.

Returns
Type Description
System.Boolean

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.

Declaration
public bool GetPixelFormatSupport(PixelFormat format, TextureType type, TextureUsage usage, out PixelFormatProperties properties)
Parameters
Type Name Description
PixelFormat format

The PixelFormat to query.

TextureType type

The TextureType to query.

TextureUsage usage

The TextureUsage to query.

PixelFormatProperties properties

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

Returns
Type Description
System.Boolean

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, Boolean)

Gets the maximum sample count supported by the given PixelFormat.

Declaration
public abstract TextureSampleCount GetSampleCountLimit(PixelFormat format, bool depthFormat)
Parameters
Type Name Description
PixelFormat format

The format to query.

System.Boolean depthFormat

Whether the format will be used in a depth texture.

Returns
Type Description
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.

Declaration
public BackendInfoVulkan GetVulkanInfo()
Returns
Type Description
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.

Declaration
public virtual bool GetVulkanInfo(out BackendInfoVulkan info)
Parameters
Type Name Description
BackendInfoVulkan info

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

Returns
Type Description
System.Boolean

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.

Declaration
public static bool IsBackendSupported(GraphicsBackend backend)
Parameters
Type Name Description
GraphicsBackend backend

The GraphicsBackend to check.

Returns
Type Description
System.Boolean

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.

Declaration
public MappedResource Map(MappableResource resource, MapMode mode)
Parameters
Type Name Description
MappableResource resource

The DeviceBuffer or Texture resource to map.

MapMode mode

The MapMode to use.

Returns
Type Description
MappedResource

A MappedResource structure describing the mapped data region.

Map(MappableResource, MapMode, UInt32)

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

Declaration
public MappedResource Map(MappableResource resource, MapMode mode, uint subresource)
Parameters
Type Name Description
MappableResource resource

The DeviceBuffer or Texture resource to map.

MapMode mode

The MapMode to use.

System.UInt32 subresource

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

Returns
Type Description
MappedResource

A MappedResource structure describing the mapped data region.

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.

Declaration
public MappedResourceView<T> Map<T>(MappableResource resource, MapMode mode)
    where T : struct
Parameters
Type Name Description
MappableResource resource

The DeviceBuffer or Texture resource to map.

MapMode mode

The MapMode to use.

Returns
Type Description
MappedResourceView<T>

A MappedResource structure describing the mapped data region.

Type Parameters
Name Description
T

The blittable value type which mapped data is viewed as.

Map<T>(MappableResource, MapMode, UInt32)

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

Declaration
public MappedResourceView<T> Map<T>(MappableResource resource, MapMode mode, uint subresource)
    where T : struct
Parameters
Type Name Description
MappableResource resource

The DeviceBuffer or Texture resource to map.

MapMode mode

The MapMode to use.

System.UInt32 subresource

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

Returns
Type Description
MappedResourceView<T>

A MappedResource structure describing the mapped data region.

Type Parameters
Name Description
T

The blittable value type which mapped data is viewed as.

MapCore(MappableResource, MapMode, UInt32)

Declaration
protected abstract MappedResource MapCore(MappableResource resource, MapMode mode, uint subresource)
Parameters
Type Name Description
MappableResource resource
MapMode mode
System.UInt32 subresource
Returns
Type Description
MappedResource

PlatformDispose()

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

Declaration
protected abstract void PlatformDispose()

PostDeviceCreated()

Creates and caches common device resources after device creation completes.

Declaration
protected void PostDeviceCreated()

ResetFence(Fence)

Resets the given Fence to the unsignaled state.

Declaration
public abstract void ResetFence(Fence fence)
Parameters
Type Name Description
Fence fence

The Fence instance to reset.

ResizeMainWindow(UInt32, UInt32)

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(UInt32, UInt32). This method can only be called if this GraphicsDevice was created with a main Swapchain.

Declaration
public void ResizeMainWindow(uint width, uint height)
Parameters
Type Name Description
System.UInt32 width

The new width of the main window.

System.UInt32 height

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.

Declaration
public void SubmitCommands(CommandList commandList)
Parameters
Type Name Description
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.

Declaration
public void SubmitCommands(CommandList commandList, Fence fence)
Parameters
Type Name Description
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.

Declaration
public void SwapBuffers()

SwapBuffers(Swapchain)

Swaps the buffers of the given swapchain.

Declaration
public void SwapBuffers(Swapchain swapchain)
Parameters
Type Name Description
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.

Declaration
public void Unmap(MappableResource resource)
Parameters
Type Name Description
MappableResource resource

The resource to unmap.

Unmap(MappableResource, UInt32)

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

Declaration
public void Unmap(MappableResource resource, uint subresource)
Parameters
Type Name Description
MappableResource resource

The resource to unmap.

System.UInt32 subresource

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, UInt32)

Declaration
protected abstract void UnmapCore(MappableResource resource, uint subresource)
Parameters
Type Name Description
MappableResource resource
System.UInt32 subresource

UpdateBuffer(DeviceBuffer, UInt32, IntPtr, UInt32)

Updates a DeviceBuffer region with new data.

Declaration
public void UpdateBuffer(DeviceBuffer buffer, uint bufferOffsetInBytes, IntPtr source, uint sizeInBytes)
Parameters
Type Name Description
DeviceBuffer buffer

The resource to update.

System.UInt32 bufferOffsetInBytes

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

System.IntPtr source

A pointer to the start of the data to upload.

System.UInt32 sizeInBytes

The total size of the uploaded data, in bytes.

UpdateBuffer<T>(DeviceBuffer, UInt32, T)

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

Declaration
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T source)
    where T : struct
Parameters
Type Name Description
DeviceBuffer buffer

The resource to update.

System.UInt32 bufferOffsetInBytes

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

T source

The value to upload.

Type Parameters
Name Description
T

The type of data to upload.

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

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

Declaration
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source)
    where T : struct
Parameters
Type Name Description
DeviceBuffer buffer

The resource to update.

System.UInt32 bufferOffsetInBytes

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

T source

A reference to the single value to upload.

Type Parameters
Name Description
T

The type of data to upload.

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

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

Declaration
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source, uint sizeInBytes)
    where T : struct
Parameters
Type Name Description
DeviceBuffer buffer

The resource to update.

System.UInt32 bufferOffsetInBytes

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

T source

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

System.UInt32 sizeInBytes

The total size of the uploaded data, in bytes.

Type Parameters
Name Description
T

The type of data to upload.

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

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

Declaration
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T[] source)
    where T : struct
Parameters
Type Name Description
DeviceBuffer buffer

The resource to update.

System.UInt32 bufferOffsetInBytes

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

T[] source

An array containing the data to upload.

Type Parameters
Name Description
T

The type of data to upload.

UpdateTexture(Texture, IntPtr, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32)

Updates a portion of a Texture resource with new data.

Declaration
public void UpdateTexture(Texture texture, IntPtr source, uint sizeInBytes, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer)
Parameters
Type Name Description
Texture texture

The resource to update.

System.IntPtr source

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

System.UInt32 sizeInBytes

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

System.UInt32 x

The minimum X value of the updated region.

System.UInt32 y

The minimum Y value of the updated region.

System.UInt32 z

The minimum Z value of the updated region.

System.UInt32 width

The width of the updated region, in texels.

System.UInt32 height

The height of the updated region, in texels.

System.UInt32 depth

The depth of the updated region, in texels.

System.UInt32 mipLevel

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

System.UInt32 arrayLayer

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

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

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

Declaration
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 : struct
Parameters
Type Name Description
Texture texture

The resource to update.

T[] source

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

System.UInt32 x

The minimum X value of the updated region.

System.UInt32 y

The minimum Y value of the updated region.

System.UInt32 z

The minimum Z value of the updated region.

System.UInt32 width

The width of the updated region, in texels.

System.UInt32 height

The height of the updated region, in texels.

System.UInt32 depth

The depth of the updated region, in texels.

System.UInt32 mipLevel

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

System.UInt32 arrayLayer

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

Type Parameters
Name Description
T

WaitForFence(Fence)

Blocks the calling thread until the given Fence becomes signaled.

Declaration
public void WaitForFence(Fence fence)
Parameters
Type Name Description
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.

Declaration
public bool WaitForFence(Fence fence, TimeSpan timeout)
Parameters
Type Name Description
Fence fence

The Fence instance to wait on.

System.TimeSpan timeout

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

Returns
Type Description
System.Boolean

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

WaitForFence(Fence, UInt64)

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

Declaration
public abstract bool WaitForFence(Fence fence, ulong nanosecondTimeout)
Parameters
Type Name Description
Fence fence

The Fence instance to wait on.

System.UInt64 nanosecondTimeout

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

Returns
Type Description
System.Boolean

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

WaitForFences(Fence[], Boolean)

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

Declaration
public void WaitForFences(Fence[] fences, bool waitAll)
Parameters
Type Name Description
Fence[] fences

An array of Fence objects to wait on.

System.Boolean waitAll

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[], Boolean, 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.

Declaration
public bool WaitForFences(Fence[] fences, bool waitAll, TimeSpan timeout)
Parameters
Type Name Description
Fence[] fences

An array of Fence objects to wait on.

System.Boolean waitAll

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.

System.TimeSpan timeout

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

Returns
Type Description
System.Boolean

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

WaitForFences(Fence[], Boolean, UInt64)

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

Declaration
public abstract bool WaitForFences(Fence[] fences, bool waitAll, ulong nanosecondTimeout)
Parameters
Type Name Description
Fence[] fences

An array of Fence objects to wait on.

System.Boolean waitAll

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.

System.UInt64 nanosecondTimeout

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

Returns
Type Description
System.Boolean

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.

Declaration
public void WaitForIdle()

Implements

System.IDisposable
Back to top