3#include "../IGraphicsDevice.h"
7#include "../Base/SyncObjectsCommon.h"
9#include "CommonD3D12.h"
11#include "CapabilitiesD3D12.h"
12#include "BuffersD3D12.h"
13#include "TexturesD3D12.h"
14#include "EffectsD3D12.h"
15#include "RenderTargetsD3D12.h"
16#include "SyncObjectsD3D12.h"
17#include "ContextD3D12.h"
35 void waitForPreviousFrame();
39 void setSize(
int width,
int height)
override;
40 bool getSize(
int& w,
int& h)
const override;
41 void setVerticalSync(
bool enabled) { this->verticalSync = enabled; }
55 void * getNativeDevice()
override {
return device; }
58 HRESULT initializeDevice();
59 HRESULT initializeDeviceShared();
60 HRESULT initializeDeviceAndSwapChain();
62 HRESULT resizeSharedSurfaces();
64 HRESULT createRenderTargetView();
65 HRESULT createDepthStencilView();
67 int indexLastSwapBuf = 0;
68 const static int numSwapBufs = 2;
69 ResourcePointer<ID3D12Fence> deviceFence;
70 UINT64 currentFence = 0;
71 HANDLE eventHandle =
nullptr;
73 ResourcePointer<ID3D12Device> device;
74 ResourcePointer<IDXGISwapChain> swapChain;
75 ResourcePointer<ID3D12CommandQueue> commandQueue;
77 RenderTargetHandle renderTarget[numSwapBufs];
78 DepthStencilHandle depthTarget;
79 TextureHandle depthTexture;
81 ResourcePointer<ID3D12Resource> multisampleBackBuffer;
84 CapabilitiesD3D12 capabilities;
86 TexturesD3D12 textures;
88 RenderTargetsD3D12 renderTargets;
89 SyncObjectsD3D12 syncObjects;
93 bool fullscreenMode =
false;
94 bool verticalSync =
true;
Represents a graphics device used to manage graphics resources and issue drawing commands.
Contains all Cogs related functionality.
GraphicsDeviceType
Contains types of graphics devices that may be supported.
@ Direct3D12
Graphics device using the Direct3D 12 API.
void waitForCommandSync() override
Wait for any GPU commands on the current device to finish before returning.
IBuffers * getBuffers() override
Get a pointer to the buffer management interface.
ICapabilities * getCapabilities() override
Get a pointer to the capability management interface used to query the graphics device capability fla...
IPipelineStates * getPipelineStates()
Get a pointer to the pipeline state management interface.
ISwapChain * getDefaultSwapChain() override
Get a pointer to the default swap chain for this graphics device.
std::string getIdentifier() const override
Get the graphics device identifier.
void beginFrame() override
Signal the beginning of a new frame to the graphics device.
IRenderTargets * getRenderTargets() override
Get a pointer to the render target management interface.
IContext * getImmediateContext() override
Get a pointer to the immediate context used to issue commands to the graphics device.
bool initialize()
Initializes the graphics device with the settings previous set through calling setSettings.
void releaseResources() override
Release all resources allocated.
void endFrame(uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override
Signal the end of a frame to the graphics device.
void setSize(int width, int height) override
Set the size of the main drawing buffer used by the graphics device in pixels.
ISyncObjects * getSyncObjects() override
Get a pointer to the sync object management interface.
bool getSize(int &w, int &h) const override
Retrieve the size previously set by setSize.
GraphicsDeviceType getType() const override
Get the type of the graphics device.
ITextures * getTextures() override
Get a pointer to the texture management interface.
IEffects * getEffects() override
Get a pointer to the effect management interface.
Provides buffer management functionality.
Provides capability query functionality.
Represents a graphics device context which can receive rendering commands.
Provides effects and shader management functionality.
Provides render target management functionality.
Provides sync object management.
Provides texture management functionality.