Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::SwapChainWebGPU Class Reference
Inheritance diagram for Cogs::SwapChainWebGPU:
Cogs::ISwapChain

Public Member Functions

void initialize (WGPUDevice device, WGPUSurface surface)
 
void destroy ()
 
void create ()
 
virtual void beginFrame () override
 Signal the beginning of a new frame to the graphics device.
 
virtual void endFrame (uint32_t syncInterval=0, PresentFlags 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
 Switch this swap chain to fullscreen or windowed depending on the parameter.
 
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 RenderTargetHandlegetRenderTarget () const
 Returns the render target managed by this swap chain.
 
virtual const DepthStencilHandlegetDepthStencil () const
 Returns the depth stencil managed by this swap chain.
 
WGPUSurfaceTexture getTextureData ()
 
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, PresentFlags presentFlags=PresentFlags::None)=0
 Signal the end of a frame to the graphics device.
 
virtual const RenderTargetHandlegetRenderTarget () const =0
 Returns the render target managed by this swap chain.
 
virtual const DepthStencilHandlegetDepthStencil () 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.
 

Public Attributes

WGPUDevice device = {}
 
WGPUSurface surface = {}
 
WGPUTexture colorBufferTexture = {}
 
WGPUTextureView colorBufferView = {}
 
WGPUTexture depthBufferTexture = {}
 
WGPUTextureView depthBufferView = {}
 
WGPUTexture resolveTexture = {}
 
WGPUTextureView resolveView = {}
 
int set_width = 1920
 
int set_height = 1080
 
int samples = 4
 
bool resize = false
 
WGPUTextureFormat swap_chain_format = WGPUTextureFormat_BGRA8Unorm
 
WGPUTextureFormat color_format = WGPUTextureFormat_BGRA8UnormSrgb
 
WGPUTextureFormat depth_format = WGPUTextureFormat_Depth32Float
 

Additional Inherited Members

- Protected Attributes inherited from Cogs::ISwapChain
WindowDatawindowData = nullptr
 

Detailed Description

Definition at line 8 of file SwapChainWebGPU.h.

Constructor & Destructor Documentation

◆ SwapChainWebGPU()

Cogs::SwapChainWebGPU::SwapChainWebGPU ( )

Definition at line 11 of file SwapChainWebGPU.cpp.

◆ ~SwapChainWebGPU()

Cogs::SwapChainWebGPU::~SwapChainWebGPU ( )

Definition at line 15 of file SwapChainWebGPU.cpp.

Member Function Documentation

◆ beginFrame()

void Cogs::SwapChainWebGPU::beginFrame ( )
overridevirtual

Signal the beginning of a new frame to the graphics device.

Implements Cogs::ISwapChain.

Definition at line 156 of file SwapChainWebGPU.cpp.

Referenced by Cogs::GraphicsDeviceWebGPU::beginFrame().

◆ create()

void Cogs::SwapChainWebGPU::create ( )

Definition at line 27 of file SwapChainWebGPU.cpp.

◆ destroy()

void Cogs::SwapChainWebGPU::destroy ( )

Definition at line 137 of file SwapChainWebGPU.cpp.

◆ endFrame()

void Cogs::SwapChainWebGPU::endFrame ( uint32_t  syncInterval = 0,
PresentFlags  presentFlags = PresentFlags::None 
)
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.

Parameters
syncIntervalSynchronization interval.
  • 0 - No synchronization, presentation occurs immediately.
  • 1 - Synchronize presentation after 1 vertical blank.
presentFlagsA combination of PresentFlags controlling the presentation of the rendered frame.
See also
PresentFlags

Implements Cogs::ISwapChain.

Definition at line 178 of file SwapChainWebGPU.cpp.

Referenced by Cogs::GraphicsDeviceWebGPU::endFrame().

◆ getDepthStencil()

const DepthStencilHandle & Cogs::SwapChainWebGPU::getDepthStencil ( ) const
virtual

Returns the depth stencil managed by this swap chain.

Implements Cogs::ISwapChain.

Definition at line 209 of file SwapChainWebGPU.cpp.

References Cogs::Handle_t< DepthStencilTag >::InvalidHandle.

◆ getHeight()

virtual int Cogs::SwapChainWebGPU::getHeight ( ) const
inlineoverridevirtual

Returns the pixel height of this swap chain.

Implements Cogs::ISwapChain.

Definition at line 27 of file SwapChainWebGPU.h.

Referenced by Cogs::GraphicsDeviceWebGPU::getSize().

◆ getRenderTarget()

const RenderTargetHandle & Cogs::SwapChainWebGPU::getRenderTarget ( ) const
virtual

Returns the render target managed by this swap chain.

Implements Cogs::ISwapChain.

Definition at line 204 of file SwapChainWebGPU.cpp.

References Cogs::Handle_t< RenderTargetTag >::InvalidHandle.

◆ getSamples()

virtual int Cogs::SwapChainWebGPU::getSamples ( ) const
inlineoverridevirtual

Returns the number of samples this swap chain has.

Implements Cogs::ISwapChain.

Definition at line 28 of file SwapChainWebGPU.h.

◆ getTextureData()

WGPUSurfaceTexture Cogs::SwapChainWebGPU::getTextureData ( )

Definition at line 214 of file SwapChainWebGPU.cpp.

◆ getWidth()

virtual int Cogs::SwapChainWebGPU::getWidth ( ) const
inlineoverridevirtual

Returns the pixel width of this swap chain.

Implements Cogs::ISwapChain.

Definition at line 26 of file SwapChainWebGPU.h.

Referenced by Cogs::GraphicsDeviceWebGPU::getSize().

◆ initialize()

void Cogs::SwapChainWebGPU::initialize ( WGPUDevice  device,
WGPUSurface  surface 
)

Definition at line 20 of file SwapChainWebGPU.cpp.

◆ isFullscreen()

bool Cogs::SwapChainWebGPU::isFullscreen ( )
overridevirtual

Test whether the current swap chain is fullscreen.

Implements Cogs::ISwapChain.

Definition at line 199 of file SwapChainWebGPU.cpp.

◆ setFullscreen()

void Cogs::SwapChainWebGPU::setFullscreen ( bool  enabled)
overridevirtual

Switch this swap chain to fullscreen or windowed depending on the parameter.

Implements Cogs::ISwapChain.

Definition at line 195 of file SwapChainWebGPU.cpp.

◆ setSize()

void Cogs::SwapChainWebGPU::setSize ( int  newWidth,
int  newHeight,
bool  forceIt = false 
)
overridevirtual

Set the size of the main drawing buffer used by the graphics device in pixels.

Parameters
newWidthWidth of the drawing buffer in pixels.
newHeightHeight of the drawing buffer in pixels.
forceItForce the resize even if the new width and height are identical to the existing values.

Implements Cogs::ISwapChain.

Definition at line 187 of file SwapChainWebGPU.cpp.

Referenced by Cogs::GraphicsDeviceWebGPU::setSize().

Member Data Documentation

◆ color_format

WGPUTextureFormat Cogs::SwapChainWebGPU::color_format = WGPUTextureFormat_BGRA8UnormSrgb

Definition at line 55 of file SwapChainWebGPU.h.

◆ colorBufferTexture

WGPUTexture Cogs::SwapChainWebGPU::colorBufferTexture = {}

Definition at line 38 of file SwapChainWebGPU.h.

◆ colorBufferView

WGPUTextureView Cogs::SwapChainWebGPU::colorBufferView = {}

Definition at line 39 of file SwapChainWebGPU.h.

◆ depth_format

WGPUTextureFormat Cogs::SwapChainWebGPU::depth_format = WGPUTextureFormat_Depth32Float

Definition at line 56 of file SwapChainWebGPU.h.

◆ depthBufferTexture

WGPUTexture Cogs::SwapChainWebGPU::depthBufferTexture = {}

Definition at line 41 of file SwapChainWebGPU.h.

◆ depthBufferView

WGPUTextureView Cogs::SwapChainWebGPU::depthBufferView = {}

Definition at line 42 of file SwapChainWebGPU.h.

◆ device

WGPUDevice Cogs::SwapChainWebGPU::device = {}

Definition at line 35 of file SwapChainWebGPU.h.

◆ resize

bool Cogs::SwapChainWebGPU::resize = false

Definition at line 52 of file SwapChainWebGPU.h.

◆ resolveTexture

WGPUTexture Cogs::SwapChainWebGPU::resolveTexture = {}

Definition at line 45 of file SwapChainWebGPU.h.

◆ resolveView

WGPUTextureView Cogs::SwapChainWebGPU::resolveView = {}

Definition at line 47 of file SwapChainWebGPU.h.

◆ samples

int Cogs::SwapChainWebGPU::samples = 4

Definition at line 51 of file SwapChainWebGPU.h.

◆ set_height

int Cogs::SwapChainWebGPU::set_height = 1080

Definition at line 50 of file SwapChainWebGPU.h.

◆ set_width

int Cogs::SwapChainWebGPU::set_width = 1920

Definition at line 49 of file SwapChainWebGPU.h.

◆ surface

WGPUSurface Cogs::SwapChainWebGPU::surface = {}

Definition at line 36 of file SwapChainWebGPU.h.

◆ swap_chain_format

WGPUTextureFormat Cogs::SwapChainWebGPU::swap_chain_format = WGPUTextureFormat_BGRA8Unorm

Definition at line 54 of file SwapChainWebGPU.h.


The documentation for this class was generated from the following files: