GraphicsDeviceManager Class
Namespace: Stride.GamesAssembly: Stride.Games.dll
Manages the GraphicsDevice lifecycle.
public class GraphicsDeviceManager : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder, IGraphicsDeviceManager, IGraphicsDeviceService
Name | Description | |
---|---|---|
Fields | ||
DefaultBackBufferHeight | Default height for the back buffer. |
|
DefaultBackBufferWidth | Default width for the back buffer. |
|
Properties | ||
DeviceCreationFlags | Gets or sets the device creation flags that will be used to create the GraphicsDevice |
|
GraphicsDevice | ||
IsFullScreen | Gets or sets a value indicating whether this instance is full screen. |
|
PreferredBackBufferFormat | Gets or sets the preferred back buffer format. |
|
PreferredBackBufferHeight | Gets or sets the height of the preferred back buffer. |
|
PreferredBackBufferWidth | Gets or sets the width of the preferred back buffer. |
|
PreferredColorSpace | Gets or sets the default color space. |
|
PreferredDepthStencilFormat | Gets or sets the preferred depth stencil format. |
|
PreferredFullScreenOutputIndex | The output (monitor) index to use when switching to fullscreen mode. Doesn't have any effect when windowed mode is used. |
|
PreferredGraphicsProfile | Gets or sets the list of graphics profile to select from the best feature to the lower feature. See remarks. |
|
PreferredMultisampleCount | Gets or sets a value indicating whether [prefer multi sampling]. |
|
PreferredRefreshRate | Gets or sets the preferred refresh rate. |
|
RequiredAdapterUid | If populated the engine will try to initialize the device with the same unique id |
|
ShaderProfile | Gets or sets the shader graphics profile that will be used to compile shaders. See remarks. |
|
SupportedOrientations | Gets or sets the supported orientations. |
|
SynchronizeWithVerticalRetrace | Gets or sets a value indicating whether [synchronize with vertical retrace]. |
|
Methods | ||
ApplyChanges() | Applies the changes from this instance and change or create the GraphicsDevice according to the new values. |
|
CanResetDevice(GraphicsDeviceInformation) | Determines whether this instance is compatible with the the specified new GraphicsDeviceInformation. |
|
Destroy() | ||
FindBestDevice(Boolean) | Finds the best device that is compatible with the preferences defined in this instance. |
|
IsPreferredProfileAvailable(GraphicsProfile[], out GraphicsProfile) | ||
OnDeviceCreated(Object, EventArgs) | ||
OnDeviceDisposing(Object, EventArgs) | ||
OnDeviceReset(Object, EventArgs) | ||
OnDeviceResetting(Object, EventArgs) | ||
OnPreparingDeviceSettings(Object, PreparingDeviceSettingsEventArgs) | ||
RankDevices(List<GraphicsDeviceInformation>) | Ranks a list of GraphicsDeviceInformation before creating a new device. |
|
SelectOrientation(DisplayOrientation, Int32, Int32, Boolean) | ||
SetPreferredGraphicsProfile(GraphicsProfile[]) | Sets the preferred graphics profile. |
|
Events | ||
DeviceCreated | ||
DeviceDisposing | ||
DeviceReset | ||
DeviceResetting | ||
PreparingDeviceSettings | ||
Explicit Interface Implementations | ||
IGraphicsDeviceManager.BeginDraw() | ||
IGraphicsDeviceManager.CreateDevice() | ||
IGraphicsDeviceManager.EndDraw(Boolean) |
Fields
DefaultBackBufferHeight
Default height for the back buffer.
public static readonly int DefaultBackBufferHeight
Field Value
Type | Description |
---|---|
System.Int32 |
DefaultBackBufferWidth
Default width for the back buffer.
public static readonly int DefaultBackBufferWidth
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
DeviceCreationFlags
Gets or sets the device creation flags that will be used to create the GraphicsDevice
public DeviceCreationFlags DeviceCreationFlags { get; set; }
Property Value
Type | Description |
---|---|
DeviceCreationFlags | The device creation flags. |
GraphicsDevice
public GraphicsDevice GraphicsDevice { get; }
Property Value
Type | Description |
---|---|
GraphicsDevice |
IsFullScreen
Gets or sets a value indicating whether this instance is full screen.
public bool IsFullScreen { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
PreferredBackBufferFormat
Gets or sets the preferred back buffer format.
public PixelFormat PreferredBackBufferFormat { get; set; }
Property Value
Type | Description |
---|---|
PixelFormat | The preferred back buffer format. |
PreferredBackBufferHeight
Gets or sets the height of the preferred back buffer.
public int PreferredBackBufferHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The height of the preferred back buffer. |
PreferredBackBufferWidth
Gets or sets the width of the preferred back buffer.
public int PreferredBackBufferWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The width of the preferred back buffer. |
PreferredColorSpace
Gets or sets the default color space.
public ColorSpace PreferredColorSpace { get; set; }
Property Value
Type | Description |
---|---|
ColorSpace | The default color space. |
PreferredDepthStencilFormat
Gets or sets the preferred depth stencil format.
public PixelFormat PreferredDepthStencilFormat { get; set; }
Property Value
Type | Description |
---|---|
PixelFormat | The preferred depth stencil format. |
PreferredFullScreenOutputIndex
The output (monitor) index to use when switching to fullscreen mode. Doesn't have any effect when windowed mode is used.
public int PreferredFullScreenOutputIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PreferredGraphicsProfile
Gets or sets the list of graphics profile to select from the best feature to the lower feature. See remarks.
public GraphicsProfile[] PreferredGraphicsProfile { get; set; }
Property Value
Type | Description |
---|---|
GraphicsProfile[] | The graphics profile. |
Remarks
By default, the PreferredGraphicsProfile is set to { Level_11_1, Level_11_0, Level_10_1, Level_10_0, Level_9_3, Level_9_2, Level_9_1}
PreferredMultisampleCount
Gets or sets a value indicating whether [prefer multi sampling].
public MultisampleCount PreferredMultisampleCount { get; set; }
Property Value
Type | Description |
---|---|
MultisampleCount |
|
PreferredRefreshRate
Gets or sets the preferred refresh rate.
public Rational PreferredRefreshRate { get; set; }
Property Value
Type | Description |
---|---|
Rational | The preferred refresh rate. |
RequiredAdapterUid
If populated the engine will try to initialize the device with the same unique id
public string RequiredAdapterUid { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ShaderProfile
Gets or sets the shader graphics profile that will be used to compile shaders. See remarks.
public GraphicsProfile? ShaderProfile { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<GraphicsProfile> | The shader graphics profile. |
Remarks
If this property is not set, the profile used to compile the shader will be taken from the GraphicsDevice based on the list provided by PreferredGraphicsProfile
SupportedOrientations
Gets or sets the supported orientations.
public DisplayOrientation SupportedOrientations { get; set; }
Property Value
Type | Description |
---|---|
DisplayOrientation | The supported orientations. |
SynchronizeWithVerticalRetrace
Gets or sets a value indicating whether [synchronize with vertical retrace].
public bool SynchronizeWithVerticalRetrace { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
ApplyChanges()
Applies the changes from this instance and change or create the GraphicsDevice according to the new values.
public void ApplyChanges()
CanResetDevice(GraphicsDeviceInformation)
Determines whether this instance is compatible with the the specified new GraphicsDeviceInformation.
protected virtual bool CanResetDevice(GraphicsDeviceInformation newDeviceInfo)
Parameters
Type | Name | Description |
---|---|---|
GraphicsDeviceInformation | newDeviceInfo | The new device info. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Destroy()
protected override void Destroy()
Overrides
FindBestDevice(Boolean)
Finds the best device that is compatible with the preferences defined in this instance.
protected virtual GraphicsDeviceInformation FindBestDevice(bool anySuitableDevice)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | anySuitableDevice | if set to |
Returns
Type | Description |
---|---|
GraphicsDeviceInformation | The graphics device information. |
IsPreferredProfileAvailable(GraphicsProfile[], out GraphicsProfile)
protected virtual bool IsPreferredProfileAvailable(GraphicsProfile[] preferredProfiles, out GraphicsProfile availableProfile)
Parameters
Type | Name | Description |
---|---|---|
GraphicsProfile[] | preferredProfiles | |
GraphicsProfile | availableProfile |
Returns
Type | Description |
---|---|
System.Boolean |
OnDeviceCreated(Object, EventArgs)
protected virtual void OnDeviceCreated(object sender, EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | args |
OnDeviceDisposing(Object, EventArgs)
protected virtual void OnDeviceDisposing(object sender, EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | args |
OnDeviceReset(Object, EventArgs)
protected virtual void OnDeviceReset(object sender, EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | args |
OnDeviceResetting(Object, EventArgs)
protected virtual void OnDeviceResetting(object sender, EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | args |
OnPreparingDeviceSettings(Object, PreparingDeviceSettingsEventArgs)
protected virtual void OnPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
PreparingDeviceSettingsEventArgs | args |
RankDevices(List<GraphicsDeviceInformation>)
Ranks a list of GraphicsDeviceInformation before creating a new device.
protected virtual void RankDevices(List<GraphicsDeviceInformation> foundDevices)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<GraphicsDeviceInformation> | foundDevices | The list of devices that can be reorder. |
SelectOrientation(DisplayOrientation, Int32, Int32, Boolean)
protected static DisplayOrientation SelectOrientation(DisplayOrientation orientation, int width, int height, bool allowLandscapeLeftAndRight)
Parameters
Type | Name | Description |
---|---|---|
DisplayOrientation | orientation | |
System.Int32 | width | |
System.Int32 | height | |
System.Boolean | allowLandscapeLeftAndRight |
Returns
Type | Description |
---|---|
DisplayOrientation |
SetPreferredGraphicsProfile(GraphicsProfile[])
Sets the preferred graphics profile.
public void SetPreferredGraphicsProfile(params GraphicsProfile[] levels)
Parameters
Type | Name | Description |
---|---|---|
GraphicsProfile[] | levels | The levels. |
See Also
| Improve this Doc View SourceEvents
DeviceCreated
public event EventHandler<EventArgs> DeviceCreated
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
DeviceDisposing
public event EventHandler<EventArgs> DeviceDisposing
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
DeviceReset
public event EventHandler<EventArgs> DeviceReset
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
DeviceResetting
public event EventHandler<EventArgs> DeviceResetting
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
PreparingDeviceSettings
public event EventHandler<PreparingDeviceSettingsEventArgs> PreparingDeviceSettings
Event Type
Type | Description |
---|---|
System.EventHandler<PreparingDeviceSettingsEventArgs> |
Explicit Interface Implementations
IGraphicsDeviceManager.BeginDraw()
bool IGraphicsDeviceManager.BeginDraw()
Returns
Type | Description |
---|---|
System.Boolean |
IGraphicsDeviceManager.CreateDevice()
void IGraphicsDeviceManager.CreateDevice()
IGraphicsDeviceManager.EndDraw(Boolean)
void IGraphicsDeviceManager.EndDraw(bool present)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | present |