Cogs.Core
|
Public Member Functions | |
SwapChainD3D11 (GraphicsDeviceD3D11 *device) | |
bool | initialize (WindowData *windowData) |
virtual void | beginFrame () override |
Signal the beginning of a new frame to the graphics device. | |
virtual void | endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override |
Signal the end of a frame to the graphics device. | |
virtual void | setSize (int newWidth, int newHeight, bool forceIt=false) override |
Set the size of the main drawing buffer used by the graphics device in pixels. | |
virtual void | setFullscreen (bool enabled) override |
Changes this swapchain's fullscreen state if neccessary. | |
virtual bool | isFullscreen () override |
Test whether the current swap chain is fullscreen. | |
virtual int | getWidth () const override |
Returns the pixel width of this swap chain. | |
virtual int | getHeight () const override |
Returns the pixel height of this swap chain. | |
virtual int | getSamples () const override |
Returns the number of samples this swap chain has. | |
virtual const RenderTargetHandle & | getRenderTarget () const override |
Returns the render target managed by this swap chain. | |
virtual const DepthStencilHandle & | getDepthStencil () const override |
Returns the depth stencil managed by this swap chain. | |
ResourcePointer< ID3D11Texture2D > & | getSharedBackBuffer () |
bool | recreateOffscreenBuffers () |
virtual void | setSize (int newWidth, int newHeight, bool forceIt=false)=0 |
Set the size of the main drawing buffer used by the graphics device in pixels. | |
virtual void | setFullscreen (bool enabled)=0 |
Switch this swap chain to fullscreen or windowed depending on the parameter. | |
virtual bool | isFullscreen ()=0 |
Test whether the current swap chain is fullscreen. | |
virtual void | beginFrame ()=0 |
Signal the beginning of a new frame to the graphics device. | |
virtual void | endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None)=0 |
Signal the end of a frame to the graphics device. | |
virtual const RenderTargetHandle & | getRenderTarget () const =0 |
Returns the render target managed by this swap chain. | |
virtual const DepthStencilHandle & | getDepthStencil () const =0 |
Returns the depth stencil managed by this swap chain. | |
virtual int | getWidth () const =0 |
Returns the pixel width of this swap chain. | |
virtual int | getHeight () const =0 |
Returns the pixel height of this swap chain. | |
virtual int | getSamples () const =0 |
Returns the number of samples this swap chain has. | |
Private Member Functions | |
void | resize () |
bool | createRenderTargetView () |
Recreates the render target view used by directx when selecting render targets prior to rendering. | |
bool | createDepthStencilView () |
Recreates the depth/stencil view used by directx when rendering. | |
Private Attributes | |
GraphicsDeviceD3D11 * | graphicsDevice = nullptr |
TextureFormat | colorFormat = TextureFormat::R8G8B8A8_UNORM_SRGB |
TextureFormat | depthFormat = TextureFormat::D32_FLOAT |
int | numSamples = 1 |
int | width = 1280 |
int | height = 720 |
bool | inFrame = false |
bool | needResize = false |
ResourcePointer< IDXGISwapChain > | swapChain |
ResourcePointer< ID3D11Texture2D > | backBuffer |
ResourcePointer< ID3D11Texture2D > | sharedBackBuffer |
RenderTargetHandle | renderTarget |
DepthStencilHandle | depthStencil |
Additional Inherited Members | |
![]() | |
WindowData * | windowData = nullptr |
Definition at line 12 of file SwapChainD3D11.h.
Cogs::SwapChainD3D11::SwapChainD3D11 | ( | GraphicsDeviceD3D11 * | device | ) |
Definition at line 13 of file SwapChainD3D11.cpp.
Cogs::SwapChainD3D11::~SwapChainD3D11 | ( | ) |
Definition at line 16 of file SwapChainD3D11.cpp.
|
overridevirtual |
Signal the beginning of a new frame to the graphics device.
Implements Cogs::ISwapChain.
Definition at line 99 of file SwapChainD3D11.cpp.
|
private |
Recreates the depth/stencil view used by directx when rendering.
*============================================================================================
Definition at line 309 of file SwapChainD3D11.cpp.
References Cogs::RenderTargetsD3D11::createDepthStencilTarget(), and Cogs::RenderTargetsD3D11::releaseDepthStencilTarget().
|
private |
Recreates the render target view used by directx when selecting render targets prior to rendering.
*============================================================================================
Definition at line 280 of file SwapChainD3D11.cpp.
References Cogs::RenderTargetsD3D11::releaseRenderTarget(), and Cogs::UseSwapEffectDiscard.
|
overridevirtual |
Signal the end of a frame to the graphics device.
When the graphics device itself is responsible for managing the device context (e.g in D3D11), and the PresentFlags::NoSwap flag is not set, this will swap the back buffer to make the result of previous drawing visible.
syncInterval | Synchronization interval.
|
presentFlags | A combination of PresentFlags controlling the presentation of the rendered frame. |
Implements Cogs::ISwapChain.
Definition at line 107 of file SwapChainD3D11.cpp.
References Cogs::Direct3D11::Formats, Cogs::PresentFlags::NoSwap, and Cogs::UseSwapEffectDiscard.
|
inlineoverridevirtual |
Returns the depth stencil managed by this swap chain.
Implements Cogs::ISwapChain.
Definition at line 32 of file SwapChainD3D11.h.
Referenced by Cogs::ContextD3D11::setRenderTarget().
|
inlineoverridevirtual |
Returns the pixel height of this swap chain.
Implements Cogs::ISwapChain.
Definition at line 28 of file SwapChainD3D11.h.
|
inlineoverridevirtual |
Returns the render target managed by this swap chain.
Implements Cogs::ISwapChain.
Definition at line 31 of file SwapChainD3D11.h.
Referenced by Cogs::ContextD3D11::setRenderTarget().
|
inlineoverridevirtual |
Returns the number of samples this swap chain has.
Implements Cogs::ISwapChain.
Definition at line 29 of file SwapChainD3D11.h.
|
inline |
Definition at line 33 of file SwapChainD3D11.h.
|
inlineoverridevirtual |
Returns the pixel width of this swap chain.
Implements Cogs::ISwapChain.
Definition at line 27 of file SwapChainD3D11.h.
bool Cogs::SwapChainD3D11::initialize | ( | WindowData * | windowData | ) |
Definition at line 22 of file SwapChainD3D11.cpp.
|
overridevirtual |
Test whether the current swap chain is fullscreen.
Implements Cogs::ISwapChain.
Definition at line 185 of file SwapChainD3D11.cpp.
bool Cogs::SwapChainD3D11::recreateOffscreenBuffers | ( | ) |
Definition at line 222 of file SwapChainD3D11.cpp.
|
private |
Definition at line 194 of file SwapChainD3D11.cpp.
|
overridevirtual |
Changes this swapchain's fullscreen state if neccessary.
*============================================================================================
Implements Cogs::ISwapChain.
Definition at line 169 of file SwapChainD3D11.cpp.
|
overridevirtual |
Set the size of the main drawing buffer used by the graphics device in pixels.
newWidth | Width of the drawing buffer in pixels. |
newHeight | Height of the drawing buffer in pixels. |
forceIt | Force the resize even if the new width and height are identical to the existing values. |
Implements Cogs::ISwapChain.
Definition at line 150 of file SwapChainD3D11.cpp.
|
private |
Definition at line 47 of file SwapChainD3D11.h.
|
private |
Definition at line 39 of file SwapChainD3D11.h.
|
private |
Definition at line 40 of file SwapChainD3D11.h.
|
private |
Definition at line 50 of file SwapChainD3D11.h.
|
private |
Definition at line 38 of file SwapChainD3D11.h.
|
private |
Definition at line 43 of file SwapChainD3D11.h.
|
private |
Definition at line 44 of file SwapChainD3D11.h.
|
private |
Definition at line 45 of file SwapChainD3D11.h.
|
private |
Definition at line 41 of file SwapChainD3D11.h.
|
private |
Definition at line 49 of file SwapChainD3D11.h.
|
private |
Definition at line 48 of file SwapChainD3D11.h.
|
private |
Definition at line 46 of file SwapChainD3D11.h.
|
private |
Definition at line 42 of file SwapChainD3D11.h.