Table of Contents

Class GraphicsDevice

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Used for GPU resources creation (buffers, textures, states, shaders), and CommandList manipulations.

public class GraphicsDevice : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
GraphicsDevice
Implements
Inherited Members
Extension Methods

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

adapter GraphicsAdapter

The graphics adapter.

profile GraphicsProfile[]

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

GraphicsDeviceFeatures

FrameDrawCalls

public uint FrameDrawCalls

Field Value

uint

FrameTriangleCount

public uint FrameTriangleCount

Field Value

uint

Properties

Adapter

Gets the adapter this instance is attached to.

public GraphicsAdapter Adapter { get; }

Property Value

GraphicsAdapter

BuffersMemory

Gets the GPU memory currently allocated to buffers in bytes.

public long BuffersMemory { get; }

Property Value

long

ColorSpace

Gets the default color space.

public ColorSpace ColorSpace { get; set; }

Property Value

ColorSpace

The default color space.

GraphicsDeviceStatus

Gets the status of this device.

public GraphicsDeviceStatus GraphicsDeviceStatus { get; }

Property Value

GraphicsDeviceStatus

The graphics device status.

IsDebugMode

Gets a value indicating whether this instance is in debug mode.

public bool IsDebugMode { get; }

Property Value

bool

true if this instance is debug; otherwise, false.

IsDeferred

Indicates wether this device allows for concurrent building and deferred submission of CommandLists

public bool IsDeferred { get; }

Property Value

bool

true if this instance is deferred; otherwise, false.

IsProfilingSupported

Gets a value indicating whether this instance supports GPU markers and profiling.

public bool IsProfilingSupported { get; }

Property Value

bool

Platform

Gets the type of the platform that graphics device is using.

public static GraphicsPlatform Platform { get; }

Property Value

GraphicsPlatform

Presenter

Gets or sets the current presenter used to display the frame.

public virtual GraphicsPresenter Presenter { get; set; }

Property Value

GraphicsPresenter

The current presenter.

RendererName

public string RendererName { get; }

Property Value

string

SamplerStates

Gets the SamplerStateFactory factory.

public SamplerStateFactory SamplerStates { get; }

Property Value

SamplerStateFactory

The SamplerStateFactory factory.

TextureMemory

Gets the GPU memory currently allocated to texture in bytes.

public long TextureMemory { get; }

Property Value

long

ThreadIndex

Gets the index of the thread.

public int ThreadIndex { get; }

Property Value

int

The index of the thread.

TimestampFrequency

The tick frquency of timestamp queries in Hertz.

public long TimestampFrequency { get; }

Property Value

long

Methods

Begin()

Marks context as active on the current thread.

public void Begin()

Destroy()

Disposes of object resources.

protected override void Destroy()

DestroyPlatformDevice()

protected void DestroyPlatformDevice()

EnableProfile(bool)

Enables profiling.

public void EnableProfile(bool enabledFlag)

Parameters

enabledFlag bool

if set to true [enabled flag].

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

commandList CompiledCommandList

The deferred command list.

ExecuteCommandLists(int, CompiledCommandList[])

Executes multiple deferred command lists.

public void ExecuteCommandLists(int count, CompiledCommandList[] commandLists)

Parameters

count int
commandLists CompiledCommandList[]

The deferred command lists.

GetOrCreateSharedData<T>(object, 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

key object

The key of the shared data.

sharedDataCreator GraphicsDevice.CreateSharedData<T>

The shared data creator.

Returns

T

An instance of the shared data. The shared data will be disposed by this GraphicsDevice instance.

Type Parameters

T

Type of the shared data to get/create.

New(DeviceCreationFlags, params GraphicsProfile[])

Initializes a new instance of the GraphicsDevice class.

public static GraphicsDevice New(DeviceCreationFlags creationFlags = DeviceCreationFlags.None, params GraphicsProfile[] graphicsProfiles)

Parameters

creationFlags DeviceCreationFlags

The creation flags.

graphicsProfiles GraphicsProfile[]

The graphics profiles.

Returns

GraphicsDevice

An instance of GraphicsDevice

New(GraphicsAdapter, DeviceCreationFlags, params GraphicsProfile[])

Initializes a new instance of the GraphicsDevice class.

public static GraphicsDevice New(GraphicsAdapter adapter, DeviceCreationFlags creationFlags = DeviceCreationFlags.None, params GraphicsProfile[] graphicsProfiles)

Parameters

adapter GraphicsAdapter

The adapter.

creationFlags DeviceCreationFlags

The creation flags.

graphicsProfiles GraphicsProfile[]

The graphics profiles.

Returns

GraphicsDevice

An instance of GraphicsDevice

New(GraphicsAdapter, DeviceCreationFlags, WindowHandle, params 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

adapter GraphicsAdapter

The adapter.

creationFlags DeviceCreationFlags

The creation flags.

windowHandle WindowHandle

The window handle.

graphicsProfiles GraphicsProfile[]

The graphics profiles.

Returns

GraphicsDevice

An instance of GraphicsDevice

Recreate(GraphicsAdapter, GraphicsProfile[], DeviceCreationFlags, WindowHandle)

public void Recreate(GraphicsAdapter adapter, GraphicsProfile[] graphicsProfiles, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle)

Parameters

adapter GraphicsAdapter
graphicsProfiles GraphicsProfile[]
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

EventHandler<EventArgs>