Class GraphicsDevice
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
GraphicsAdapterThe graphics adapter.
profile
GraphicsProfile[]The graphics profile.
deviceCreationFlags
DeviceCreationFlagsThe device creation flags.
windowHandle
WindowHandleThe window handle.
Fields
Features
Gets the features supported by this graphics device.
public GraphicsDeviceFeatures Features
Field Value
FrameDrawCalls
public uint FrameDrawCalls
Field Value
FrameTriangleCount
public uint FrameTriangleCount
Field Value
Properties
Adapter
Gets the adapter this instance is attached to.
public GraphicsAdapter Adapter { get; }
Property Value
BuffersMemory
Gets the GPU memory currently allocated to buffers in bytes.
public long BuffersMemory { get; }
Property Value
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
Platform
Gets the type of the platform that graphics device is using.
public static GraphicsPlatform Platform { get; }
Property Value
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
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
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
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
boolif 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
CompiledCommandListThe deferred command list.
ExecuteCommandLists(int, CompiledCommandList[])
Executes multiple deferred command lists.
public void ExecuteCommandLists(int count, CompiledCommandList[] commandLists)
Parameters
count
intcommandLists
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
objectThe 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
DeviceCreationFlagsThe 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
GraphicsAdapterThe adapter.
creationFlags
DeviceCreationFlagsThe 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
GraphicsAdapterThe adapter.
creationFlags
DeviceCreationFlagsThe creation flags.
windowHandle
WindowHandleThe 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
GraphicsAdaptergraphicsProfiles
GraphicsProfile[]deviceCreationFlags
DeviceCreationFlagswindowHandle
WindowHandle
SimulateReset()
public void SimulateReset()
Events
Disposing
Occurs while this component is disposing and before it is disposed.
public event EventHandler<EventArgs> Disposing