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
ApiVersion
Gets the API version of the graphics backend.
public abstract GraphicsApiVersion ApiVersion { get; }
Property Value
BackendType
Gets a value identifying the specific graphics API used by this instance.
public abstract GraphicsBackend BackendType { get; }
Property Value
DeviceName
Gets the name of the device.
public abstract string DeviceName { get; }
Property Value
Features
Gets a GraphicsDeviceFeatures which enumerates the optional features supported by this instance.
public abstract GraphicsDeviceFeatures Features { get; }
Property Value
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
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
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
LinearSampler
Gets a simple linear-filtered Sampler object owned by this instance. This object is created with Linear.
public Sampler LinearSampler { get; }
Property Value
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
PointSampler
Gets a simple point-filtered Sampler object owned by this instance. This object is created with Point.
public Sampler PointSampler { get; }
Property Value
ResourceFactory
Gets the ResourceFactory controlled by this instance.
public abstract ResourceFactory ResourceFactory { get; }
Property Value
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
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
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
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
VendorName
Gets the name of the device vendor.
public abstract string VendorName { get; }
Property Value
Methods
CreateD3D11(GraphicsDeviceOptions)
Creates a new GraphicsDevice using Direct3D 11.
public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options)
Parameters
optionsGraphicsDeviceOptionsDescribes 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
d3d11OptionsD3D11DeviceOptionsThe 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
d3d11OptionsD3D11DeviceOptionsThe Direct3D11-specific options used to create the device.
swapchainDescriptionSwapchainDescriptionA 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
swapchainDescriptionSwapchainDescriptionA 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
hwndnintThe Win32 window handle to render into.
widthuintThe initial width of the window.
heightuintThe 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
swapChainPanelobjectA COM object which must implement the ISwapChainPanelNative or ISwapChainBackgroundPanelNative interface. Generally, this should be a SwapChainPanel or SwapChainBackgroundPanel contained in your application window.
renderWidthdoubleThe renderable width of the swapchain panel.
renderHeightdoubleThe renderable height of the swapchain panel.
logicalDpifloatThe logical DPI of the swapchain panel.
Returns
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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
platformInfoOpenGLPlatformInfoAn OpenGLPlatformInfo object encapsulating necessary OpenGL context information.
widthuintThe initial width of the window.
heightuintThe 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
swapchainDescriptionSwapchainDescriptionA 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
optionsGraphicsDeviceOptionsDescribes 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
swapchainDescriptionSwapchainDescriptionA 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
swapchainDescriptionSwapchainDescriptionA description of the main Swapchain to create.
vkOptionsVulkanDeviceOptionsThe 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
surfaceSourceVkSurfaceSourceThe source from which a Vulkan surface can be created.
widthuintThe initial width of the window.
heightuintThe 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
optionsGraphicsDeviceOptionsDescribes several common properties of the GraphicsDevice.
vkOptionsVulkanDeviceOptionsThe 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
disposableIDisposableAn 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
infoBackendInfoD3D11If 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
infoBackendInfoOpenGLIf 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
formatPixelFormatThe PixelFormat to query.
typeTextureTypeThe TextureType to query.
usageTextureUsageThe 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
formatPixelFormatThe PixelFormat to query.
typeTextureTypeThe TextureType to query.
usageTextureUsageThe TextureUsage to query.
propertiesPixelFormatPropertiesIf 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
propertiescontains 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
formatPixelFormatThe format to query.
depthFormatboolWhether 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
infoBackendInfoVulkanIf 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
backendGraphicsBackendThe 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
resourceMappableResourceThe DeviceBuffer or Texture resource to map.
modeMapModeThe 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
resourceMappableResourceThe DeviceBuffer or Texture resource to map.
modeMapModeThe MapMode to use.
subresourceuintThe 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
resourceMappableResourcemodeMapModesubresourceuint
Returns
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
resourceMappableResourceThe DeviceBuffer or Texture resource to map.
modeMapModeThe MapMode to use.
Returns
- MappedResourceView<T>
A MappedResource structure describing the mapped data region.
Type Parameters
TThe 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
resourceMappableResourceThe DeviceBuffer or Texture resource to map.
modeMapModeThe MapMode to use.
subresourceuintThe 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
TThe 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
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
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
commandListCommandListThe 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
commandListCommandListThe completed CommandList to execute. End() must have been previously called on this object.
fenceFenceA 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
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
resourceMappableResourceThe 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
resourceMappableResourceThe resource to unmap.
subresourceuintThe 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
resourceMappableResourcesubresourceuint
UpdateBuffer(DeviceBuffer, uint, nint, uint)
Updates a DeviceBuffer region with new data.
public void UpdateBuffer(DeviceBuffer buffer, uint bufferOffsetInBytes, nint source, uint sizeInBytes)
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourcenintA pointer to the start of the data to upload.
sizeInBytesuintThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceReadOnlySpan<T>A readonly span containing the data to upload.
Type Parameters
TThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceSpan<T>A span containing the data to upload.
Type Parameters
TThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer storage, at which new data will be uploaded.
sourceTThe value to upload.
Type Parameters
TThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceTA reference to the single value to upload.
Type Parameters
TThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceTA reference to the first of a series of values to upload.
sizeInBytesuintThe total size of the uploaded data, in bytes.
Type Parameters
TThe 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
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceT[]An array containing the data to upload.
Type Parameters
TThe 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
textureTextureThe resource to update.
sourcenintA pointer to the start of the data to upload. This must point to tightly-packed pixel data for the region specified.
sizeInBytesuintThe number of bytes to upload. This value must match the total size of the texture region specified.
xuintThe minimum X value of the updated region.
yuintThe minimum Y value of the updated region.
zuintThe minimum Z value of the updated region.
widthuintThe width of the updated region, in texels.
heightuintThe height of the updated region, in texels.
depthuintThe depth of the updated region, in texels.
mipLeveluintThe mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.
arrayLayeruintThe 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
textureTextureThe resource to update.
sourceReadOnlySpan<T>A readonly span containing the data to upload. This must contain tightly-packed pixel data for the region specified.
xuintThe minimum X value of the updated region.
yuintThe minimum Y value of the updated region.
zuintThe minimum Z value of the updated region.
widthuintThe width of the updated region, in texels.
heightuintThe height of the updated region, in texels.
depthuintThe depth of the updated region, in texels.
mipLeveluintThe mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.
arrayLayeruintThe 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
textureTextureThe resource to update.
sourceSpan<T>A readonly span containing the data to upload. This must contain tightly-packed pixel data for the region specified.
xuintThe minimum X value of the updated region.
yuintThe minimum Y value of the updated region.
zuintThe minimum Z value of the updated region.
widthuintThe width of the updated region, in texels.
heightuintThe height of the updated region, in texels.
depthuintThe depth of the updated region, in texels.
mipLeveluintThe mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.
arrayLayeruintThe 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
textureTextureThe resource to update.
sourceT[]An array containing the data to upload. This must contain tightly-packed pixel data for the region specified.
xuintThe minimum X value of the updated region.
yuintThe minimum Y value of the updated region.
zuintThe minimum Z value of the updated region.
widthuintThe width of the updated region, in texels.
heightuintThe height of the updated region, in texels.
depthuintThe depth of the updated region, in texels.
mipLeveluintThe mipmap level to update. Must be less than the total number of mipmaps contained in the Texture.
arrayLayeruintThe 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
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
fenceFenceThe Fence instance to wait on.
timeoutTimeSpanA 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
fenceFenceThe Fence instance to wait on.
nanosecondTimeoutulongA 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
fencesFence[]An array of Fence objects to wait on.
waitAllboolIf 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
fencesFence[]An array of Fence objects to wait on.
waitAllboolIf 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.
timeoutTimeSpanA 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
fencesFence[]An array of Fence objects to wait on.
waitAllboolIf 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.
nanosecondTimeoutulongA 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()