Veldrid by Eric Mellino

<PackageReference Include="Veldrid" Version="4.8.0" />

.NET API 424,448 bytes

 GraphicsDevice

public abstract class GraphicsDevice : IDisposable
Represents an abstract graphics device, capable of creating device resources and executing commands.
public Sampler Aniso4xSampler { get; }

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 abstract GraphicsBackend BackendType { get; }

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

public abstract GraphicsDeviceFeatures Features { get; }

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

public abstract bool IsClipSpaceYInverted { get; }

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 IsDepthRangeZeroToOne { get; }

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 IsUvOriginTopLeft { get; }

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 Sampler LinearSampler { get; }

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

public abstract Swapchain MainSwapchain { get; }

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 Sampler PointSampler { get; }

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

public abstract ResourceFactory ResourceFactory { get; }

Gets the ResourceFactory controlled by this instance.

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.

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 virtual bool SyncToVerticalBlank { get; set; }

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 uint UniformBufferMinOffsetAlignment { get; }

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.

Creates a new GraphicsDevice using Direct3D 11.

public static GraphicsDevice CreateD3D11(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

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

Creates a new GraphicsDevice using Direct3D 11.

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

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

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

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)

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

Creates a new GraphicsDevice using Metal.

public static GraphicsDevice CreateMetal(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

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

public static GraphicsDevice CreateMetal(GraphicsDeviceOptions options, IntPtr nsWindow)

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

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

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

public static GraphicsDevice CreateOpenGLES(GraphicsDeviceOptions options, SwapchainDescription 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.

Creates a new GraphicsDevice using Vulkan.

Creates a new GraphicsDevice using Vulkan.

public static GraphicsDevice CreateVulkan(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)

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

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

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

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

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

public static bool IsBackendSupported(GraphicsBackend backend)

Checks whether the given GraphicsBackend is supported on this system.

public void Dispose()

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

public void DisposeWhenIdle(IDisposable disposable)

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 virtual bool GetD3D11Info(out BackendInfoD3D11 info)

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

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 virtual bool GetOpenGLInfo(out BackendInfoOpenGL info)

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

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 bool GetPixelFormatSupport(PixelFormat format, TextureType type, TextureUsage usage)

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, out PixelFormatProperties properties)

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 abstract TextureSampleCount GetSampleCountLimit(PixelFormat format, bool depthFormat)

Gets the maximum sample count supported by the given PixelFormat.

public virtual bool GetVulkanInfo(out BackendInfoVulkan info)

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

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 MappedResource Map(MappableResource resource, MapMode mode)

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, uint subresource)

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

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

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, uint subresource) where T : struct

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

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

protected abstract void PlatformDispose()

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

protected void PostDeviceCreated()

Creates and caches common device resources after device creation completes.

public abstract void ResetFence(Fence fence)

Resets the given Fence to the unsignaled state.

public void ResizeMainWindow(uint width, uint height)

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

public void SubmitCommands(CommandList 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, Fence 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 SwapBuffers()

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

public void SwapBuffers(Swapchain swapchain)

Swaps the buffers of the given swapchain.

public void Unmap(MappableResource resource)

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, uint subresource)

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

protected abstract void UnmapCore(MappableResource resource, uint subresource)

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

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 : struct

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 : struct

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 : struct

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

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

Updates a DeviceBuffer region with new data.

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)

Updates a portion of a Texture resource with new data.

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

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

public void WaitForFence(Fence fence)

Blocks the calling thread until the given Fence becomes signaled.

public bool WaitForFence(Fence fence, TimeSpan timeout)

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)

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

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

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

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

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)

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 void WaitForIdle()

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