GraphicsDevice Class
Namespace: Stride.GraphicsAssembly: Stride.Graphics.dll
Used for GPU resources creation (buffers, textures, states, shaders), and CommandList manipulations.
public class GraphicsDevice : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Name | Description | |
---|---|---|
Constructors | ||
GraphicsDevice(GraphicsAdapter, GraphicsProfile[], DeviceCreationFlags, WindowHandle) | Initializes a new instance of the GraphicsDevice class. |
|
Fields | ||
Features | Gets the features supported by this graphics device. |
|
FrameDrawCalls | ||
FrameTriangleCount | ||
Properties | ||
Adapter | Gets the adapter this instance is attached to. |
|
BuffersMemory | Gets the GPU memory currently allocated to buffers in bytes. |
|
ColorSpace | Gets the default color space. |
|
GraphicsDeviceStatus | Gets the status of this device. |
|
IsDebugMode | Gets a value indicating whether this instance is in debug mode. |
|
IsDeferred | Indicates wether this device allows for concurrent building and deferred submission of CommandLists |
|
IsProfilingSupported | Gets a value indicating whether this instance supports GPU markers and profiling. |
|
Platform | Gets the type of the platform that graphics device is using. |
|
Presenter | Gets or sets the current presenter used to display the frame. |
|
RendererName | ||
SamplerStates | Gets the SamplerStateFactory factory. |
|
TextureMemory | Gets the GPU memory currently allocated to texture in bytes. |
|
ThreadIndex | Gets the index of the thread. |
|
TimestampFrequency | The tick frquency of timestamp queries in Hertz. |
|
Methods | ||
Begin() | Marks context as active on the current thread. |
|
Destroy() | ||
DestroyPlatformDevice() | ||
EnableProfile(Boolean) | Enables profiling. |
|
End() | Unmarks context as active on the current thread. |
|
ExecuteCommandList(CompiledCommandList) | Executes a deferred command list. |
|
ExecuteCommandLists(Int32, CompiledCommandList[]) | Executes multiple deferred command lists. |
|
GetOrCreateSharedData<T>(Object, GraphicsDevice.CreateSharedData<T>) | Gets a shared data for this device context with a delegate to create the shared data if it is not present. |
|
New(DeviceCreationFlags, GraphicsProfile[]) | Initializes a new instance of the GraphicsDevice class. |
|
New(GraphicsAdapter, DeviceCreationFlags, GraphicsProfile[]) | Initializes a new instance of the GraphicsDevice class. |
|
New(GraphicsAdapter, DeviceCreationFlags, WindowHandle, GraphicsProfile[]) | Initializes a new instance of the GraphicsDevice class. |
|
Recreate(GraphicsAdapter, GraphicsProfile[], DeviceCreationFlags, WindowHandle) | ||
SimulateReset() | ||
Events | ||
Disposing | Occurs while this component is disposing and before it is disposed. |
Constructors
GraphicsDevice(GraphicsAdapter, GraphicsProfile[], DeviceCreationFlags, WindowHandle)
Initializes a new instance of the GraphicsDevice class.
protected GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile[] profile, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle)
Parameters
Type | Name | Description |
---|---|---|
GraphicsAdapter | adapter | The graphics adapter. |
GraphicsProfile[] | profile | The graphics profile. |
DeviceCreationFlags | deviceCreationFlags | The device creation flags. |
WindowHandle | windowHandle | The window handle. |
Fields
Features
Gets the features supported by this graphics device.
public GraphicsDeviceFeatures Features
Field Value
Type | Description |
---|---|
GraphicsDeviceFeatures |
FrameDrawCalls
public uint FrameDrawCalls
Field Value
Type | Description |
---|---|
System.UInt32 |
FrameTriangleCount
public uint FrameTriangleCount
Field Value
Type | Description |
---|---|
System.UInt32 |
Properties
Adapter
Gets the adapter this instance is attached to.
public GraphicsAdapter Adapter { get; }
Property Value
Type | Description |
---|---|
GraphicsAdapter |
BuffersMemory
Gets the GPU memory currently allocated to buffers in bytes.
public long BuffersMemory { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ColorSpace
Gets the default color space.
public ColorSpace ColorSpace { get; set; }
Property Value
Type | Description |
---|---|
ColorSpace | The default color space. |
GraphicsDeviceStatus
Gets the status of this device.
public GraphicsDeviceStatus GraphicsDeviceStatus { get; }
Property Value
Type | Description |
---|---|
GraphicsDeviceStatus | The graphics device status. |
IsDebugMode
Gets a value indicating whether this instance is in debug mode.
public bool IsDebugMode { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsDeferred
Indicates wether this device allows for concurrent building and deferred submission of CommandLists
public bool IsDeferred { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsProfilingSupported
Gets a value indicating whether this instance supports GPU markers and profiling.
public bool IsProfilingSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Platform
Gets the type of the platform that graphics device is using.
public static GraphicsPlatform Platform { get; }
Property Value
Type | Description |
---|---|
GraphicsPlatform |
Presenter
Gets or sets the current presenter used to display the frame.
public virtual GraphicsPresenter Presenter { get; set; }
Property Value
Type | Description |
---|---|
GraphicsPresenter | The current presenter. |
RendererName
public string RendererName { get; }
Property Value
Type | Description |
---|---|
System.String |
SamplerStates
Gets the SamplerStateFactory factory.
public SamplerStateFactory SamplerStates { get; }
Property Value
Type | Description |
---|---|
SamplerStateFactory | The SamplerStateFactory factory. |
TextureMemory
Gets the GPU memory currently allocated to texture in bytes.
public long TextureMemory { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ThreadIndex
Gets the index of the thread.
public int ThreadIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the thread. |
TimestampFrequency
The tick frquency of timestamp queries in Hertz.
public long TimestampFrequency { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
Begin()
Marks context as active on the current thread.
public void Begin()
Destroy()
protected override void Destroy()
Overrides
DestroyPlatformDevice()
protected void DestroyPlatformDevice()
EnableProfile(Boolean)
Enables profiling.
public void EnableProfile(bool enabledFlag)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enabledFlag | if set to |
End()
Unmarks context as active on the current thread.
public void End()
ExecuteCommandList(CompiledCommandList)
Executes a deferred command list.
public void ExecuteCommandList(CompiledCommandList commandList)
Parameters
Type | Name | Description |
---|---|---|
CompiledCommandList | commandList | The deferred command list. |
ExecuteCommandLists(Int32, CompiledCommandList[])
Executes multiple deferred command lists.
public void ExecuteCommandLists(int count, CompiledCommandList[] commandLists)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | |
CompiledCommandList[] | commandLists | The deferred command lists. |
GetOrCreateSharedData<T>(Object, GraphicsDevice.CreateSharedData<T>)
Gets a shared data for this device context with a delegate to create the shared data if it is not present.
public T GetOrCreateSharedData<T>(object key, GraphicsDevice.CreateSharedData<T> sharedDataCreator)
where T : class, IDisposable
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key of the shared data. |
GraphicsDevice.CreateSharedData<T> | sharedDataCreator | The shared data creator. |
Returns
Type | Description |
---|---|
T | An instance of the shared data. The shared data will be disposed by this GraphicsDevice instance. |
Type Parameters
Name | Description |
---|---|
T | Type of the shared data to get/create. |
New(DeviceCreationFlags, GraphicsProfile[])
Initializes a new instance of the GraphicsDevice class.
public static GraphicsDevice New(DeviceCreationFlags creationFlags = DeviceCreationFlags.None, params GraphicsProfile[] graphicsProfiles)
Parameters
Type | Name | Description |
---|---|---|
DeviceCreationFlags | creationFlags | The creation flags. |
GraphicsProfile[] | graphicsProfiles | The graphics profiles. |
Returns
Type | Description |
---|---|
GraphicsDevice | An instance of GraphicsDevice |
New(GraphicsAdapter, DeviceCreationFlags, GraphicsProfile[])
Initializes a new instance of the GraphicsDevice class.
public static GraphicsDevice New(GraphicsAdapter adapter, DeviceCreationFlags creationFlags = DeviceCreationFlags.None, params GraphicsProfile[] graphicsProfiles)
Parameters
Type | Name | Description |
---|---|---|
GraphicsAdapter | adapter | The adapter. |
DeviceCreationFlags | creationFlags | The creation flags. |
GraphicsProfile[] | graphicsProfiles | The graphics profiles. |
Returns
Type | Description |
---|---|
GraphicsDevice | An instance of GraphicsDevice |
New(GraphicsAdapter, DeviceCreationFlags, WindowHandle, GraphicsProfile[])
Initializes a new instance of the GraphicsDevice class.
public static GraphicsDevice New(GraphicsAdapter adapter, DeviceCreationFlags creationFlags = DeviceCreationFlags.None, WindowHandle windowHandle = null, params GraphicsProfile[] graphicsProfiles)
Parameters
Type | Name | Description |
---|---|---|
GraphicsAdapter | adapter | The adapter. |
DeviceCreationFlags | creationFlags | The creation flags. |
WindowHandle | windowHandle | The window handle. |
GraphicsProfile[] | graphicsProfiles | The graphics profiles. |
Returns
Type | Description |
---|---|
GraphicsDevice | An instance of GraphicsDevice |
Recreate(GraphicsAdapter, GraphicsProfile[], DeviceCreationFlags, WindowHandle)
public void Recreate(GraphicsAdapter adapter, GraphicsProfile[] graphicsProfiles, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle)
Parameters
Type | Name | Description |
---|---|---|
GraphicsAdapter | adapter | |
GraphicsProfile[] | graphicsProfiles | |
DeviceCreationFlags | deviceCreationFlags | |
WindowHandle | windowHandle |
SimulateReset()
public void SimulateReset()
Events
Disposing
Occurs while this component is disposing and before it is disposed.
public event EventHandler<EventArgs> Disposing
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |