XLE
v0.02.0
|
Represents a hardware device capable of rendering More...
#include <IDevice.h>
Public Member Functions | |
virtual std::unique_ptr< IPresentationChain > | CreatePresentationChain (const void *platformWindowHandle, unsigned width, unsigned height)=0 |
Initialised a window for rendering More... | |
virtual virtual void * | QueryInterface (const GUID &guid)=0 |
Looks for compatibility with another interface More... | |
virtual void | BeginFrame (IPresentationChain *presentationChain)=0 |
Begins rendering of a new frame More... | |
virtual std::shared_ptr< IThreadContext > | GetImmediateContext ()=0 |
virtual std::unique_ptr< IThreadContext > | CreateDeferredContext ()=0 |
virtual std::pair< const char *, const char * > | GetVersionInformation ()=0 |
Returns version information for this device More... | |
Represents a hardware device capable of rendering
IDevice represents a single hardware device that can render. Usually it is the first rendering object created. Most rendering objects are associated with a single device (because the device defines the format and memory location of the object). So a device must be created and selected before anything else is created.
Normally there is only a single device. Multiple devices are only required in very special case situations (for example, if a PC has 2 graphics cards, and you want to render using both cards).
Call CreateDevice() to create a new default with the default parameters.
Normally clients should create a device first, and then create a presentation chain once an output window has been created.
To render a frame, call BeginFrame() on the device first, and then call PresentationChain::Present when the frame is finished.
You can use "QueryInterface" to get extended interfaces for the device. Some platforms might expose special case behaviour. To get access, use QueryInterface to check if the device supports the behaviour you want.
Note that there is no reference counting behaviour built into IDevice (or any RenderCore object). But you can use std::shared_ptr<> to get that behaviour. If necessary, we can add a CreateDeviceShared() that will use std::make_shared<> to create an efficient referenced counted object.
|
pure virtual |
Begins rendering of a new frame
Starts rendering of a new frame. The frame is ended with a call to RenderCore::IPresentationChain::Present(); You must pass a presentationChain. This defines how the frame will be presented to the user. Note that rendering to offscreen surfaces can happen outside of the BeginFrame/Present boundaries.
Implemented in RenderCore::Device.
|
pure virtual |
Initialised a window for rendering
To render to a window, we first need to create a presentation chain. This creates the buffers necessary to render to that window.
platformWindowHandle | A platform specific value representing a window. On windows, this is would be a HWND value |
width | Width of the presentation chain. RenderCore can't call GetClientRect() on the window directly, because that would require adding a linker reference to windows dlls. But normally, with and height are the same size as the window client area. If a different size is used, the behaviour might be different on different platforms (but on windows, the output is stretched. |
height | see width |
Implemented in RenderCore::Device.
|
pure virtual |
Returns version information for this device
Queries build number and build date information. The build number is in a format such as:
Here, X, Y, Z are major, minor and patch version.
The build date format is determined by the OS and locale at compilation time.
Implemented in RenderCore::Device.
|
pure virtual |
Looks for compatibility with another interface
Some implementations of IDevice might provide extension interfaces. to extensions.
Note that reference counting behaviour is not the same as DirectX/COM QueryInterface. RenderCore objects don't have reference counting built it. So we can't increase the reference count on return. So don't delete or deref the returned object. As a result, be careful that another thread doesn't delete the object as you're using it.
Example:
guid | A large random value that is unique to the interface. On the visual studio compiler, use the __uuidof() extension to get the correct guid for a class. For example, To query for the "IDeviceDX11" interface, use __uuid(RenderCore::IDeviceDX11). |
Implemented in RenderCore::DeviceDX11.