Class GPUDevice
Graphics device object for rendering on GPU.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class GPUDevice : Object
Constructors
GPUDevice()
Properties
Adapter
Gets the adapter device.
Declaration
[Unmanaged]
public GPUAdapter Adapter { get; }
Property Value
|
FlaxEngine.GPUAdapter
|
DefaultBlackTexture
Gets the default solid black texture.
Declaration
[Unmanaged]
public GPUTexture DefaultBlackTexture { get; }
Property Value
|
GPUTexture
|
DefaultMaterial
Gets the default material.
Declaration
[Unmanaged]
public MaterialBase DefaultMaterial { get; }
Property Value
|
MaterialBase
|
DefaultWhiteTexture
Gets the default solid white texture.
Declaration
[Unmanaged]
public GPUTexture DefaultWhiteTexture { get; }
Property Value
|
GPUTexture
|
FeatureLevel
Gets device feature level type.
Declaration
[Unmanaged]
public FeatureLevel FeatureLevel { get; }
Property Value
|
FeatureLevel
|
Instance
The singleton instance of the graphics device.
Declaration
[Unmanaged]
public static GPUDevice Instance { get; }
Property Value
|
GPUDevice
|
IsDebugToolAttached
Indicates that debug tool is profiling device (eg. RenderDoc).
Declaration
[Unmanaged]
public bool IsDebugToolAttached { get; }
Property Value
|
System.Boolean
|
IsRendering
Returns true if device is during rendering state, otherwise false.
Declaration
[Unmanaged]
public bool IsRendering { get; }
Property Value
|
System.Boolean
|
Limits
MainContext
Gets the main GPU context.
Declaration
[Unmanaged]
public GPUContext MainContext { get; }
Property Value
|
GPUContext
|
MemoryStats
Gets the current GPU memory stats.
Declaration
[Unmanaged]
public GPUMemoryStats MemoryStats { get; }
Property Value
|
GPUMemoryStats
|
MemoryUsage
Gets the amount of memory usage by all the GPU resources (in bytes). Returned value is estimated based on resources created by the engine and might not be accurate. Use GPUMemoryStats for more detailed memory budget usage.
Declaration
[Unmanaged]
public ulong MemoryUsage { get; }
Property Value
|
System.UInt64
|
NativePtr
Gets the native pointer to the underlying graphics device. It's a low-level platform-specific handle.
Declaration
[Unmanaged]
public IntPtr NativePtr { get; }
Property Value
|
System.IntPtr
|
QuadShader
Quad rendering shader
Declaration
[Unmanaged]
public GPUShader QuadShader { get; }
Property Value
|
GPUShader
|
RendererType
Gets the device renderer type.
Declaration
[Unmanaged]
public RendererType RendererType { get; }
Property Value
|
RendererType
|
Resources
Gets the list with all active GPU resources.
Declaration
public GPUResource[] Resources { get; }
Property Value
|
GPUResource[]
|
ShaderProfile
Gets device shader profile type.
Declaration
[Unmanaged]
public ShaderProfile ShaderProfile { get; }
Property Value
|
ShaderProfile
|
TotalGraphicsMemory
The total amount of graphics memory in bytes.
Declaration
[Unmanaged]
public ulong TotalGraphicsMemory { get; }
Property Value
|
System.UInt64
|
VideoOutputModes
The available video output modes.
Declaration
[Unmanaged]
public GPUDevice.VideoOutputMode[] VideoOutputModes { get; }
Property Value
|
GPUDevice.VideoOutputMode[]
|
VideoOutputs
The available video outputs (monitors).
Declaration
[Unmanaged]
public GPUDevice.VideoOutput[] VideoOutputs { get; }
Property Value
|
GPUDevice.VideoOutput[]
|
Methods
CreateBuffer(String)
Creates the buffer.
Declaration
[Unmanaged]
public GPUBuffer CreateBuffer(string name = null)
Parameters
|
System.String
name
The resource name. |
Returns
|
GPUBuffer
The buffer. |
CreateSampler()
Creates the texture sampler.
Declaration
[Unmanaged]
public GPUSampler CreateSampler()
Returns
|
GPUSampler
The sampler. |
CreateTexture(String)
Creates the texture.
Declaration
[Unmanaged]
public GPUTexture CreateTexture(string name = null)
Parameters
|
System.String
name
The resource name. |
Returns
|
GPUTexture
The texture. |
CreateVertexLayout(VertexElement[], Boolean)
Creates the vertex buffer layout.
Declaration
[Unmanaged]
public GPUVertexLayout CreateVertexLayout(VertexElement[] elements, bool explicitOffsets = false)
Parameters
|
VertexElement[]
elements
|
|
System.Boolean
explicitOffsets
|
Returns
|
GPUVertexLayout
The vertex buffer layout. |
DumpResources()
Dumps all GPU resources information to the log.
Declaration
[DebugCommand]
[Unmanaged]
public static void DumpResources()
GetFormatFeatures(PixelFormat)
Gets the supported features for the specified format (index is the pixel format value).
Declaration
[Unmanaged]
public FormatFeatures GetFormatFeatures(PixelFormat format)
Parameters
|
PixelFormat
format
The format. |
Returns
|
FormatFeatures
The format features flags. |
GetResources(ref GPUResource[], out Int32)
Gets the list with all active GPU resources.
Declaration
public void GetResources(ref GPUResource[] buffer, out int count)
Parameters
|
GPUResource[]
buffer
Output buffer to fill with resource pointers. Can be provided by a user to avoid memory allocation. Buffer might be larger than actual list size. Use |
|
System.Int32
count
Amount of valid items inside |