|
Cogs.Core
|
Public Member Functions | |
| void | initialize (GraphicsDeviceWebGPU *graphicsDevice) |
| virtual const FrameStatistics & | getLastFrameStatistics () override |
| virtual const UploadStatistics & | getLastUploadStatistics () override |
| virtual void | frameStatisticsConfigure (bool enable) override |
| virtual void | signal (FenceHandle) override |
| Insert a fence in the command stream that will signal when all commands before the fence are completed. | |
| virtual void | clearRenderTarget (const float *) override |
| Clear the currently set render target to the given value (4 component floating point RGBA). | |
| virtual void | clearRenderTarget (const float **, const int) override |
| Clear the currently set render target, setting the individual render target views to the given values (4 component floating point RGBA). | |
| virtual void | clearDepth (const float=1.0f) override |
| Clear the currently set depth/stencil target to the given depth. | |
| virtual void | pushCommandGroupAnnotation (const StringView &name) override |
| Begin to tag a sequence of commands as a group in graphics debugger. | |
| virtual void | popCommandGroupAnnotation () override |
| End to tag a sequence of commands as a group in graphics debugger. | |
| virtual void | setAnnotationMarker (const StringView &name) override |
| Add a tag in the sequence of commands in graphics debugger. | |
| virtual void | beginRenderPass (const RenderPassInfo &info) override |
| Begin a render pass. | |
| virtual void | endRenderPass () override |
| End a render pass. | |
| virtual void | setRenderTarget (const RenderTargetHandle handle, const DepthStencilHandle depthStencilHandle) override |
| Sets the current render target and an associated depth stencil target. | |
| virtual void | setViewport (const float, const float, const float, const float) override |
| Sets the current viewport to the given location and dimensions. | |
| virtual void | setScissor (const int, const int, const int, const int) override |
| Sets the current scissor rectangle. | |
| virtual void | setDepthStencilState (const DepthStencilStateHandle) override |
| Set the current depth stencil state. | |
| virtual void | setBlendState (const BlendStateHandle, const float *) override |
| Set the current blend state. | |
| virtual void | setRasterizerState (const RasterizerStateHandle) override |
| Set the current rasterizer state. | |
| void | setDefaults () |
| virtual void | setEffect (EffectHandle) override |
| Set the current effect. | |
| virtual void | setTexture (const StringView &, unsigned int, TextureHandle) override |
| Sets the texture slot given by unit with the given name to contain the given texture. | |
| virtual void | setTexture (const TextureBindingHandle, const TextureHandle) override |
| Sets the texture given to the binding given by textureBindingHandle. | |
| virtual void | setTexture (const StringView &, TextureViewHandle) override |
| virtual void | setTexture (const TextureBindingHandle, TextureViewHandle) override |
| virtual void | setSamplerState (const StringView &, unsigned int, SamplerStateHandle) override |
| Sets the sampler slot given by unit with the given name to contain the given sampler state. | |
| virtual void | setSamplerState (const SamplerStateBindingHandle, const SamplerStateHandle) override |
| Sets the sampler state binding given to the given sampler state. | |
| virtual void | setInputLayout (const InputLayoutHandle) override |
| Sets the current input layout. | |
| virtual void | setVertexBuffers (const VertexBufferHandle *, const size_t, const uint32_t *, const uint32_t *) override |
| Sets the current vertex buffers. | |
| virtual void | setVertexBuffers (const VertexBufferHandle *, const size_t) override |
| Overload provided to support transitioning. | |
| virtual void | setIndexBuffer (IndexBufferHandle, uint32_t=4, uint32_t=0) override |
| Sets the current index buffer. | |
| virtual void | setVertexArrayObject (VertexArrayObjectHandle) override |
| Sets vertexBuffers and index buffers using a prevalidated vertex array object. | |
| virtual void | setConstantBuffer (const StringView &, const BufferHandle, const uint32_t=0, const uint32_t=~0u) override |
| Sets a constant buffer to be bound to the given name and slot. | |
| virtual void | setConstantBuffer (const ConstantBufferBindingHandle, const BufferHandle, const uint32_t=0, const uint32_t=~0u) override |
| Sets a constant buffer to the given constant buffer binding. | |
| virtual void | setBuffer (const StringView &, BufferHandle) override |
| Sets the given buffer to the buffer binding slot with the given name. | |
| virtual void | setBuffer (const BufferBindingHandle, BufferHandle) override |
| Sets a buffer to bind to the given binding. | |
| virtual void | setBufferCounter (BufferHandle, uint32_t) override |
| Set the associated counter of a buffer. | |
| virtual void | setBufferCounter (BufferHandle, BufferHandle) override |
| Set the associated counter of a buffer. | |
| virtual void | getBufferCounter (BufferHandle, BufferHandle) override |
| Get the associated counter of a buffer. | |
| virtual uint32_t | getBufferCounter (BufferHandle) override |
| Get the associated counter of a buffer. | |
| virtual void | draw (PrimitiveType, const size_t, const size_t) override |
| Draws non-indexed, non-instanced primitives. | |
| virtual void | drawIndexed (PrimitiveType, const size_t, const size_t, const size_t=0) override |
| Draws indexed, non-instanced primitives. | |
| virtual void | drawInstanced (PrimitiveType, const size_t, const size_t, const size_t, const size_t) override |
| Draws non-indexed, instanced primitives. | |
| virtual void | drawInstancedIndexed (PrimitiveType, const size_t, const size_t, const size_t, const size_t) override |
| Draws indexed, instanced primitives. | |
| virtual void | dispatchCompute (const unsigned int, const unsigned int, const unsigned int) override |
| Dispatch computing work on the graphics device using the desired thread group count. | |
| virtual void | readDepthBuffer (BufferHandle, int, int, int, int, Framebuffer) override |
| Reads data from the current depth target into the given bufferHandle. | |
| virtual void | readColorBuffer (BufferHandle, int, int, int, int, Framebuffer) override |
| Reads data from the current render target into the given bufferHandle. | |
| virtual void * | map (BufferHandle, MapMode::EMapMode, uint32_t *=nullptr) override |
| Maps the given buffer so it can be accessed. | |
| virtual void * | map (TextureHandle, MapMode::EMapMode, uint32_t *, uint32_t *) override |
| Create host mapping of a staging texture. | |
| virtual void | unmap (BufferHandle) override |
| Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memory. | |
| virtual void | unmap (TextureHandle) override |
| Release a host mapping of a staging texture. | |
| virtual void | updateBuffer (BufferHandle, const void *, const size_t) override |
| Replace contents of buffer with new data. | |
| virtual void | updateSubTexture (TextureHandle, const size_t, const void *) override |
| Update the data of a level in the given texture. | |
| virtual void | updateSubBuffer (BufferHandle, const size_t, const size_t, const void *) override |
| Update a region of data in a buffer. | |
| virtual void | resolveResource (TextureHandle, TextureHandle) override |
| Resolves the given source resource target into the given destination texture. | |
| virtual void | copyResource (BufferHandle, BufferHandle) override |
| virtual void | copyResource (TextureHandle, TextureHandle) override |
| virtual void | copyTexture (TextureHandle, unsigned, unsigned, unsigned, unsigned, TextureHandle, unsigned) override |
| virtual void | clearResource (BufferHandle, uint32_t *) override |
| virtual void | clearResource (BufferHandle, float *) override |
| void | beginFrame () |
| void | beginRenderPassInt () |
| void | endRenderPassInt () |
| void | updateRenderPass () |
| bool | updateRenderPipeline (PrimitiveType primitiveType) |
| void | beginComputePass () |
| void | endComputePass () |
| void | updateComputePass () |
| void | updateComputePipeline () |
| void | ClearBindGroups () |
| void | SwapBindGroups () |
Public Member Functions inherited from Cogs::IContext | |
| virtual const Cogs::FrameStatistics & | getLastFrameStatistics ()=0 |
| virtual const Cogs::UploadStatistics & | getLastUploadStatistics ()=0 |
| virtual void | frameStatisticsConfigure (bool enable)=0 |
| virtual void | clearCachedState () |
| Prepare context for external manipulation of graphics device. | |
| virtual void | pushCommandGroupAnnotation (const StringView &name) |
| Begin to tag a sequence of commands as a group in graphics debugger. | |
| virtual void | popCommandGroupAnnotation () |
| End to tag a sequence of commands as a group in graphics debugger. | |
| virtual void | setAnnotationMarker (const StringView &name) |
| Add a tag in the sequence of commands in graphics debugger. | |
| virtual void | beginRenderPass (const RenderPassInfo &info)=0 |
| Begin a render pass. | |
| virtual void | endRenderPass ()=0 |
| End a render pass. | |
| virtual void | setRenderTarget (const RenderTargetHandle handle, const DepthStencilHandle depthStencilHandle)=0 |
| Sets the current render target and an associated depth stencil target. | |
| virtual void | setViewport (const float x, const float y, const float width, const float height)=0 |
| Sets the current viewport to the given location and dimensions. | |
| virtual void | setScissor (const int x, const int y, const int width, const int height)=0 |
| Sets the current scissor rectangle. | |
| virtual void | clearRenderTarget (const float *value)=0 |
| Clear the currently set render target to the given value (4 component floating point RGBA). | |
| virtual void | clearRenderTarget (const float **values, const int numvalues)=0 |
| Clear the currently set render target, setting the individual render target views to the given values (4 component floating point RGBA). | |
| virtual void | clearDepth (const float depth=1.0f)=0 |
| Clear the currently set depth/stencil target to the given depth. | |
| virtual void | setDepthStencilState (const DepthStencilStateHandle handle)=0 |
| Set the current depth stencil state. | |
| virtual void | setBlendState (const BlendStateHandle handle, const float *constant=nullptr)=0 |
| Set the current blend state. | |
| virtual void | setRasterizerState (const RasterizerStateHandle handle)=0 |
| Set the current rasterizer state. | |
| virtual void | setEffect (EffectHandle handle)=0 |
| Set the current effect. | |
| virtual void | setTexture (const StringView &name, unsigned int unit, TextureHandle textureHandle)=0 |
| Sets the texture slot given by unit with the given name to contain the given texture. | |
| virtual void | setTexture (const TextureBindingHandle textureBindingHandle, const TextureHandle textureHandle)=0 |
| Sets the texture given to the binding given by textureBindingHandle. | |
| virtual void | setTexture (const StringView &name, TextureViewHandle textureViewHandle)=0 |
| virtual void | setTexture (const TextureBindingHandle textureBindingHandle, TextureViewHandle textureViewHandle)=0 |
| virtual void | setSamplerState (const StringView &name, unsigned int unit, SamplerStateHandle samplerStateHandle)=0 |
| Sets the sampler slot given by unit with the given name to contain the given sampler state. | |
| virtual void | setSamplerState (const SamplerStateBindingHandle samplerStateBindingHandle, const SamplerStateHandle samplerStateHandle)=0 |
| Sets the sampler state binding given to the given sampler state. | |
| virtual void | setInputLayout (const InputLayoutHandle inputLayoutHandle)=0 |
| Sets the current input layout. | |
| virtual void | setVertexBuffers (const VertexBufferHandle *vertexBufferHandles, const size_t count, const uint32_t *strides, const uint32_t *offsets)=0 |
| Sets the current vertex buffers. | |
| virtual void | setVertexBuffers (const VertexBufferHandle *vertexBufferHandles, const size_t count)=0 |
| Overload provided to support transitioning. | |
| virtual void | setIndexBuffer (IndexBufferHandle bufferHandle, uint32_t stride=4, uint32_t offset=0)=0 |
| Sets the current index buffer. | |
| virtual void | setVertexArrayObject (VertexArrayObjectHandle vertexArrayObject)=0 |
| Sets vertexBuffers and index buffers using a prevalidated vertex array object. | |
| virtual void | setConstantBuffer (const StringView &name, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0 |
| Sets a constant buffer to be bound to the given name and slot. | |
| virtual void | setConstantBuffer (const ConstantBufferBindingHandle bufferBindingHandle, const BufferHandle bufferHandle, const uint32_t offset=0, const uint32_t size=~0u)=0 |
| Sets a constant buffer to the given constant buffer binding. | |
| virtual void | setBuffer (const StringView &name, BufferHandle bufferHandle)=0 |
| Sets the given buffer to the buffer binding slot with the given name. | |
| virtual void | setBuffer (const BufferBindingHandle bufferBindingHandle, BufferHandle bufferHandle)=0 |
| Sets a buffer to bind to the given binding. | |
| virtual void | setBufferCounter (BufferHandle bufferHandle, uint32_t value)=0 |
| Set the associated counter of a buffer. | |
| virtual void | setBufferCounter (BufferHandle bufferHandle, BufferHandle sourceBufferHandle)=0 |
| Set the associated counter of a buffer. | |
| virtual void | getBufferCounter (BufferHandle bufferHandle, BufferHandle destinationBufferHandle)=0 |
| Get the associated counter of a buffer. | |
| virtual uint32_t | getBufferCounter (BufferHandle bufferHandle)=0 |
| Get the associated counter of a buffer. | |
| virtual void | draw (PrimitiveType primitiveType, const size_t startVertex, const size_t numVertexes)=0 |
| Draws non-indexed, non-instanced primitives. | |
| virtual void | drawIndexed (PrimitiveType primitiveType, const size_t startIndex, const size_t numIndexes, const size_t startVertex=0)=0 |
| Draws indexed, non-instanced primitives. | |
| virtual void | drawInstanced (PrimitiveType primitiveType, const size_t startVertex, const size_t numVertexes, const size_t startInstance, const size_t numInstances)=0 |
| Draws non-indexed, instanced primitives. | |
| virtual void | drawInstancedIndexed (PrimitiveType primitiveType, const size_t startInstance, const size_t numInstances, const size_t startIndex, const size_t numIndexes)=0 |
| Draws indexed, instanced primitives. | |
| virtual void | dispatchCompute (const unsigned int threadGroupsX, const unsigned int threadGroupsY, const unsigned int threadGroupsZ)=0 |
| Dispatch computing work on the graphics device using the desired thread group count. | |
| virtual void | resolveResource (TextureHandle source, TextureHandle destination)=0 |
| Resolves the given source resource target into the given destination texture. | |
| virtual void | readDepthBuffer (BufferHandle bufferHandle, int x, int y, int width, int height, Framebuffer framebuffer)=0 |
| Reads data from the current depth target into the given bufferHandle. | |
| virtual void | readColorBuffer (BufferHandle bufferHandle, int x, int y, int width, int height, Framebuffer framebuffer)=0 |
| Reads data from the current render target into the given bufferHandle. | |
| virtual void * | map (BufferHandle bufferHandle, MapMode::EMapMode mapMode, uint32_t *stride=nullptr)=0 |
| Maps the given buffer so it can be accessed. | |
| virtual void | unmap (BufferHandle bufferHandle)=0 |
| Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memory. | |
| virtual void | updateBuffer (BufferHandle bufferHandle, const void *data, size_t size)=0 |
| Replace contents of buffer with new data. | |
| virtual void * | map (TextureHandle textureHandle, MapMode::EMapMode accessMode, uint32_t *rowPitch, uint32_t *depthPitch)=0 |
| Create host mapping of a staging texture. | |
| virtual void | unmap (TextureHandle textureHandle)=0 |
| Release a host mapping of a staging texture. | |
| virtual void | signal (FenceHandle fenceHandle)=0 |
| Insert a fence in the command stream that will signal when all commands before the fence are completed. | |
| virtual void | updateSubTexture (TextureHandle textureHandle, const size_t level, const void *data)=0 |
| Update the data of a level in the given texture. | |
| virtual void | updateSubBuffer (BufferHandle bufferHandle, const size_t offset, const size_t size, const void *data)=0 |
| Update a region of data in a buffer. | |
| virtual void | copyResource (BufferHandle destinationHandle, BufferHandle sourceHandle)=0 |
| virtual void | copyResource (TextureHandle destinationHandle, TextureHandle sourceHandle)=0 |
| virtual void | copyTexture (TextureHandle dstHandle, unsigned dstSub, unsigned dstX, unsigned dstY, unsigned dstZ, TextureHandle sourceHandle, unsigned srcSub)=0 |
| virtual void | clearResource (BufferHandle destinationHandle, uint32_t *Values)=0 |
| virtual void | clearResource (BufferHandle destinationHandle, float *Values)=0 |
| virtual void | reset () |
| Resets all state changes made to the GPU since the last call to beginFrame. | |
Public Attributes | |
| GraphicsDeviceWebGPU * | graphicsDevice = nullptr |
| WGPURenderPassEncoder | renderPassEncoder = 0 |
| WGPUComputePassEncoder | computePassEncoder = 0 |
| EffectHandle | effect = {} |
| InputLayoutHandle | inputLayoutHandle = {} |
| RasterizerStateHandle | rasterizeStateHandle = {} |
| DepthStencilStateHandle | depthStencilStateHandle = {} |
| BlendStateHandle | blendStateHandle = {} |
| RenderPipelineHandle | currentRenderPipeline = {} |
| ComputePipelineHandle | currentComputePipeline = {} |
| WGPUIndexFormat | currentIndexFormat = WGPUIndexFormat_Uint32 |
| bool | inRenderPass = false |
| RenderTargetHandle | renderTargetHandle = {} |
| DepthStencilHandle | depthStencilHandle = {} |
| WGPUColor | clearColor [8] = {} |
| float | clearDepthVal = 1.0f |
| bool | do_clear_render_target = false |
| bool | do_clear_depth = false |
| bool | update_render_target = true |
| WGPUBindGroup | current_bind_group = {} |
| bool | update_descriptors = false |
| std::map< uint32_t, WGPUBindGroupEntry > | descriptors |
| std::vector< WGPUBindGroup > | bind_groups |
| std::vector< WGPUBindGroup > | last_bind_groups |
Private Member Functions | |
| void | frameStatisticsAccountDrawCall (size_t count, bool indexed) |
| void | uploadStatisticsBufferUpload (size_t size) |
| void | uploadStatisticsTextureUpload (size_t size) |
| EffectHandle | getCurrentEffect () |
| EffectsWebGPU * | getEffects () |
Private Attributes | |
| FrameStatistics | prevStats {} |
| FrameStatistics | currStats {} |
| UploadStatistics | prevUploadStats {} |
| UploadStatistics | currUploadStats {} |
| bool | frameStatisticsEnabled = false |
| bool | uploadStatisticsEnabled = true |
Definition at line 22 of file ContextWebGPU.h.
| void Cogs::ContextWebGPU::beginComputePass | ( | ) |
Definition at line 855 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::beginFrame | ( | ) |
Definition at line 1193 of file ContextWebGPU.cpp.
|
overridevirtual |
Begin a render pass.
Render passes encapsulate binding render targets, multisample resolve and load and store operations.
While in a render pass do NOT use setRenderTarget(), clearRenderTarget(), clearDepth().
Check GraphicsDeviceCapabilities::RenderPass for support.
Implements Cogs::IContext.
Definition at line 168 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::beginRenderPassInt | ( | ) |
Definition at line 630 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::ClearBindGroups | ( | ) |
Definition at line 1249 of file ContextWebGPU.cpp.
|
overridevirtual |
Clear the currently set depth/stencil target to the given depth.
Implements Cogs::IContext.
Definition at line 95 of file ContextWebGPU.cpp.
|
overridevirtual |
Clear the currently set render target to the given value (4 component floating point RGBA).
If the render target has less than 4 components, only the first n components need to be intended values.
Implements Cogs::IContext.
Definition at line 66 of file ContextWebGPU.cpp.
|
overridevirtual |
Clear the currently set render target, setting the individual render target views to the given values (4 component floating point RGBA).
Implements Cogs::IContext.
Definition at line 79 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1188 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1183 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1139 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1144 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1149 of file ContextWebGPU.cpp.
|
overridevirtual |
Dispatch computing work on the graphics device using the desired thread group count.
| threadGroupsX | Number of work groups spawned in the X dimension. |
| threadGroupsY | Number of work groups spawned in the Y dimension. |
| threadGroupsZ | Number of work groups spawned in the Z dimension. |
Implements Cogs::IContext.
Definition at line 848 of file ContextWebGPU.cpp.
|
overridevirtual |
Draws non-indexed, non-instanced primitives.
| primitiveType | Primitive type to assemble from the bound vertex buffers. |
| startVertex | Index of the first vertex in the bound vertex buffers to start at when drawing. |
| numVertexes | Number of vertexes to draw. |
Implements Cogs::IContext.
Definition at line 582 of file ContextWebGPU.cpp.
References drawInstanced().
|
overridevirtual |
Draws indexed, non-instanced primitives.
| primitiveType | Primitive type to assemble from the bound vertex buffers. |
| startIndex | Index of the first item in the index buffer to start at when drawing. |
| numIndexes | Number of indexes to draw. |
| startVertex | Index of the base vertex in the vertex buffer to index from. |
Implements Cogs::IContext.
Definition at line 594 of file ContextWebGPU.cpp.
|
overridevirtual |
Draws non-indexed, instanced primitives.
| primitiveType | Primitive type to assemble from the bound vertex buffers. |
| startVertex | Index of the first vertex in the bound vertex buffers to start at when drawing each instance. |
| numVertexes | Number of vertexes to draw per instance. |
| startInstance | Index of the first instance to start drawing at. |
| numInstances | Number of instances to draw. |
Implements Cogs::IContext.
Definition at line 606 of file ContextWebGPU.cpp.
Referenced by draw().
|
overridevirtual |
Draws indexed, instanced primitives.
| primitiveType | Primitive type to assemble from the bound vertex buffers. |
| startInstance | Index of the first instance to start drawing at. |
| numInstances | Number of instances to draw. |
| startIndex | Index of the first item in the index buffer to start at when drawing each instance. |
| numIndexes | Number of indexes to draw per instance. |
Implements Cogs::IContext.
Definition at line 618 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::endComputePass | ( | ) |
Definition at line 866 of file ContextWebGPU.cpp.
|
overridevirtual |
| void Cogs::ContextWebGPU::endRenderPassInt | ( | ) |
Definition at line 721 of file ContextWebGPU.cpp.
|
private |
Definition at line 1201 of file ContextWebGPU.cpp.
|
inlineoverridevirtual |
Implements Cogs::IContext.
Definition at line 29 of file ContextWebGPU.h.
|
inlineoverridevirtual |
Get the associated counter of a buffer.
Implements Cogs::IContext.
Definition at line 78 of file ContextWebGPU.h.
|
overridevirtual |
Get the associated counter of a buffer.
| bufferHandle | Handle to the buffer to get the counter from. This buffer must have been created with the StructuredBufferWithCounter bind flag. |
| destinationBufferHandle | Handle to a buffer to copy the counter value to. |
Implements Cogs::IContext.
Definition at line 577 of file ContextWebGPU.cpp.
|
private |
Definition at line 1239 of file ContextWebGPU.cpp.
|
private |
Definition at line 1244 of file ContextWebGPU.cpp.
|
inlineoverridevirtual |
Implements Cogs::IContext.
Definition at line 26 of file ContextWebGPU.h.
|
inlineoverridevirtual |
Implements Cogs::IContext.
Definition at line 27 of file ContextWebGPU.h.
| void Cogs::ContextWebGPU::initialize | ( | GraphicsDeviceWebGPU * | graphicsDevice | ) |
Definition at line 56 of file ContextWebGPU.cpp.
|
overridevirtual |
Maps the given buffer so it can be accessed.
| bufferHandle | Valid handle to a buffer containing data to be read. |
| mapMode | Mapping mode to apply when mapping the buffer. |
| stride | Optional pointer to a stride value. Must be set for aliased buffer texture resources. |
Implements Cogs::IContext.
Definition at line 1003 of file ContextWebGPU.cpp.
References Cogs::MapMode::Read, and Cogs::MapMode::WriteDiscard.
|
overridevirtual |
Create host mapping of a staging texture.
| textureHandle | Staging texture. | |
| accessMode | MapMode::Write (requires TextureFlags::UsageWriteStaging) or MapMode::Read (requires TextureFlags::UsageReadStaging). | |
| [out] | rowPitch | Number of bytes between successive rows in the mapping. |
| [out] | depthPitch | Number of bytes between successive slices in the mapping. |
Implements Cogs::IContext.
Definition at line 1042 of file ContextWebGPU.cpp.
|
overridevirtual |
End to tag a sequence of commands as a group in graphics debugger.
Reimplemented from Cogs::IContext.
Definition at line 128 of file ContextWebGPU.cpp.
|
overridevirtual |
Begin to tag a sequence of commands as a group in graphics debugger.
Groups can be strictly nested, and a push must always be paired with a pop.
Reimplemented from Cogs::IContext.
Definition at line 103 of file ContextWebGPU.cpp.
|
overridevirtual |
Reads data from the current render target into the given bufferHandle.
| bufferHandle | Buffer to read the data into. Must be at least of size (width * height * sizeof(ColorFormat)). |
| x | Address of the first pixel on the x-axis to read from. |
| y | Address of the first pixel on the y-axis to read from. |
| width | Width of the data to read in pixels. |
| height | Height of the data to read in pixels. |
| framebuffer | Frame buffer to read from. Applicable when e.g reading from the default double-buffered render target. |
Implements Cogs::IContext.
Definition at line 964 of file ContextWebGPU.cpp.
|
overridevirtual |
Reads data from the current depth target into the given bufferHandle.
| bufferHandle | Buffer to read the data into. Must be at least of size (width * height * sizeof(DepthFormat)). |
| x | Address of the first pixel on the x-axis to read from. |
| y | Address of the first pixel on the y-axis to read from. |
| width | Width of the data to read in pixels. |
| height | Height of the data to read in pixels. |
| framebuffer | Frame buffer to read from. Applicable when e.g reading from the default double-buffered depth target. |
Implements Cogs::IContext.
Definition at line 930 of file ContextWebGPU.cpp.
|
overridevirtual |
Resolves the given source resource target into the given destination texture.
The source texture is assumed to be a multisample format handled by the GPU internally. This method can be used to resolve such a texture so that it may later be used as a regular texture data (multisampled textures cannot be read by standard samplers).
If using multisample samplers in shaders, this step is not necessary to perform.
Implements Cogs::IContext.
Definition at line 1134 of file ContextWebGPU.cpp.
|
overridevirtual |
Add a tag in the sequence of commands in graphics debugger.
Reimplemented from Cogs::IContext.
Definition at line 151 of file ContextWebGPU.cpp.
References Cogs::StringView::data(), and Cogs::StringView::length().
|
overridevirtual |
Set the current blend state.
Implements Cogs::IContext.
Definition at line 340 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets a buffer to bind to the given binding.
| bufferBindingHandle | Handle to a buffer binding. |
| bufferHandle | Handle to a buffer to set. |
Implements Cogs::IContext.
Definition at line 562 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the given buffer to the buffer binding slot with the given name.
| name | Name of the buffer binding in the effect. |
| bufferHandle | Handle to a buffer to set. |
Implements Cogs::IContext.
Definition at line 555 of file ContextWebGPU.cpp.
References Cogs::EffectsWebGPU::getBufferBinding(), Cogs::EffectsWebGPU::releaseBufferBinding(), and setBuffer().
Referenced by setBuffer().
|
overridevirtual |
Set the associated counter of a buffer.
| bufferHandle | Handle to the buffer to set the counter for. This buffer must have been created with the StructuredBufferWithCounter bind flag. |
| sourceBufferHandle | Handle to a buffer to copy the counter value from. |
Implements Cogs::IContext.
Definition at line 572 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the associated counter of a buffer.
| bufferHandle | Handle to the buffer to set the counter for. This buffer must have been created with the StructuredBufferWithCounter bind flag. |
| value | The new value of the counter. |
Implements Cogs::IContext.
Definition at line 567 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets a constant buffer to the given constant buffer binding.
| bufferBindingHandle | Valid handle to a buffer binding previously created. |
| bufferHandle | Handle to a buffer created with the BindFlags::ConstantBuffer flag, or NoHandle to remove any existing buffer from the binding. |
Implements Cogs::IContext.
Definition at line 529 of file ContextWebGPU.cpp.
References Cogs::Handle_t< Type, Convertible >::handle.
|
overridevirtual |
Sets a constant buffer to be bound to the given name and slot.
| name | Name of the constant buffer as defined in the shaders. |
| bufferHandle | Handle to a buffer created with the BindFlags::ConstantBuffer flag, or NoHandle to remove any existing buffer bound. |
Implements Cogs::IContext.
Definition at line 524 of file ContextWebGPU.cpp.
References setConstantBuffer().
Referenced by setConstantBuffer().
| void Cogs::ContextWebGPU::setDefaults | ( | ) |
Definition at line 371 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current depth stencil state.
Implements Cogs::IContext.
Definition at line 332 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current effect.
This sets up all shader stages included in the effect (e.g if the effect contains VS and PS shaders both the VS stage and PS stage is set up.
Implements Cogs::IContext.
Definition at line 377 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the current index buffer.
| bufferHandle | Valid handle to an index buffer. |
| stride | Byte stride of the index data. Currently only supports 2 and 4. Setting stride to zero defaults to the buffers natural stride, if any. If no natural stride is set, no buffer will be bound. |
| offset | Offset in bytes from the start of the buffer to the first index to use. |
Implements Cogs::IContext.
Definition at line 506 of file ContextWebGPU.cpp.
References Cogs::Handle_t< Type, Convertible >::handle, and Cogs::Handle_t< BufferTag, BufferHandle >::NoHandle.
|
overridevirtual |
Sets the current input layout.
| inputLayoutHandle | Valid handle to a previously created input layout. |
Implements Cogs::IContext.
Definition at line 481 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current rasterizer state.
Implements Cogs::IContext.
Definition at line 363 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the current render target and an associated depth stencil target.
Implements Cogs::IContext.
Definition at line 293 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the sampler state binding given to the given sampler state.
If the sampler state is set to NoHandle the default sampler state is set for the binding.
| samplerStateBindingHandle | Valid handle to a previously created sampler state binding object. |
| samplerStateHandle | Handle to a valid sampler state, or NoHandle to set the default sampler state. |
Implements Cogs::IContext.
Definition at line 450 of file ContextWebGPU.cpp.
References Cogs::Handle_t< Type, Convertible >::handle.
|
overridevirtual |
Sets the sampler slot given by unit with the given name to contain the given sampler state.
If the sampler state is set to NoHandle the default sampler state is set.
| name | Name of the sampler state object as used in shaders (only used where applicable). |
| unit | Texture unit to bind the sampler state to. The sampler state object is used to sample textures bound to this unit. |
| samplerStateHandle | Handle to a valid sampler state, or NoHandle to set the default sampler state for the given unit. |
Implements Cogs::IContext.
Definition at line 445 of file ContextWebGPU.cpp.
References setSamplerState().
Referenced by setSamplerState().
|
overridevirtual |
Sets the current scissor rectangle.
Only used if the current rasterizer state enabled scissor testing.
Implements Cogs::IContext.
Definition at line 320 of file ContextWebGPU.cpp.
References Cogs::GraphicsDeviceWebGPU::getSize().
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 418 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the texture slot given by unit with the given name to contain the given texture.
If the texture is set to NoHandle the texture slot is cleared.
| name | Name of the texture object as used in shaders. |
| unit | Texture unit to bind the texture to. |
| textureHandle | Handle to a valid texture, or NoHandle to set the default texture binding for the given unit. |
Implements Cogs::IContext.
Definition at line 388 of file ContextWebGPU.cpp.
References setTexture().
Referenced by setTexture().
|
overridevirtual |
Sets the texture given to the binding given by textureBindingHandle.
| textureBindingHandle | Valid handle to a previously created texture binding. |
| textureHandle | Handle to a texture object, or NoHandle to set the default texture to the given binding. |
Implements Cogs::IContext.
Definition at line 393 of file ContextWebGPU.cpp.
References Cogs::Handle_t< Type, Convertible >::handle.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 423 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets vertexBuffers and index buffers using a prevalidated vertex array object.
Implements Cogs::IContext.
Definition at line 519 of file ContextWebGPU.cpp.
|
overridevirtual |
Overload provided to support transitioning.
Only supports vertex buffers created with legacy loadVertexBuffer API.
Implements Cogs::IContext.
Definition at line 501 of file ContextWebGPU.cpp.
References setVertexBuffers().
|
overridevirtual |
Sets the current vertex buffers.
| vertexBufferHandles | Pointer to an array of vertex buffer handles of size at least count. |
| count | Number of vertex buffers to bind. |
| strides | Pointer to array of stride values. Must be non-null and at least of size count. |
| offsets | Optional pointer to array of offset values. If non-null, must be at least of size count. |
Implements Cogs::IContext.
Definition at line 489 of file ContextWebGPU.cpp.
Referenced by setVertexBuffers().
|
overridevirtual |
Sets the current viewport to the given location and dimensions.
Implements Cogs::IContext.
Definition at line 312 of file ContextWebGPU.cpp.
|
overridevirtual |
Insert a fence in the command stream that will signal when all commands before the fence are completed.
| fenceHandle | The fence to signal. |
Implements Cogs::IContext.
Definition at line 61 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::SwapBindGroups | ( | ) |
Definition at line 1258 of file ContextWebGPU.cpp.
|
overridevirtual |
Unmaps the given buffer, applying any synchronization necessary to reflect changes in the mapped memory.
| bufferHandle | Valid handle to a buffer that is currently mapped. |
Implements Cogs::IContext.
Definition at line 1048 of file ContextWebGPU.cpp.
|
overridevirtual |
Release a host mapping of a staging texture.
| textureHandle | Staging texture that is currently mapped. |
Implements Cogs::IContext.
Definition at line 1068 of file ContextWebGPU.cpp.
|
overridevirtual |
Replace contents of buffer with new data.
This will typically map the buffer + memcpy where this is fast, otherwise it will call buffer update function in underlying api.
The existing contents of the buffer will be invalidated: If provided data is smaller than buffer size, the rest of the buffer is undefined.
Implements Cogs::IContext.
Definition at line 1073 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateComputePass | ( | ) |
Definition at line 873 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateComputePipeline | ( | ) |
Definition at line 883 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateRenderPass | ( | ) |
Definition at line 741 of file ContextWebGPU.cpp.
| bool Cogs::ContextWebGPU::updateRenderPipeline | ( | PrimitiveType | primitiveType | ) |
Definition at line 751 of file ContextWebGPU.cpp.
|
overridevirtual |
Update a region of data in a buffer.
| bufferHandle | Valid handle to a buffer to update data in. |
| offset | Offset in bytes from the start of the buffer to where the new data should be written. |
| size | Size of the data given. Offset + size must be inside the allocated size of the buffer. |
| data | Pointer to the data to store at the given offset in the buffer. |
| invalidate | Invalidate existing buffer contents before updating buffer, i.e. no need to maintain old values. |
Implements Cogs::IContext.
Definition at line 1120 of file ContextWebGPU.cpp.
|
overridevirtual |
Update the data of a level in the given texture.
| textureHandle | Valid handle to a texture to update data in. |
| level | Index of the mip level to update. |
| data | Pointer to the data to store in the indicated mip level. Must be sized according to the dimensions, format and mip level. |
Implements Cogs::IContext.
Definition at line 1086 of file ContextWebGPU.cpp.
References Cogs::FormatInfo::blockExtent, and Cogs::FormatInfo::blockSize.
|
private |
Definition at line 1227 of file ContextWebGPU.cpp.
|
private |
Definition at line 1233 of file ContextWebGPU.cpp.
| std::vector<WGPUBindGroup> Cogs::ContextWebGPU::bind_groups |
Definition at line 174 of file ContextWebGPU.h.
| BlendStateHandle Cogs::ContextWebGPU::blendStateHandle = {} |
Definition at line 152 of file ContextWebGPU.h.
| WGPUColor Cogs::ContextWebGPU::clearColor[8] = {} |
Definition at line 161 of file ContextWebGPU.h.
| float Cogs::ContextWebGPU::clearDepthVal = 1.0f |
Definition at line 162 of file ContextWebGPU.h.
| WGPUComputePassEncoder Cogs::ContextWebGPU::computePassEncoder = 0 |
Definition at line 146 of file ContextWebGPU.h.
| WGPUBindGroup Cogs::ContextWebGPU::current_bind_group = {} |
Definition at line 167 of file ContextWebGPU.h.
| ComputePipelineHandle Cogs::ContextWebGPU::currentComputePipeline = {} |
Definition at line 155 of file ContextWebGPU.h.
| WGPUIndexFormat Cogs::ContextWebGPU::currentIndexFormat = WGPUIndexFormat_Uint32 |
Definition at line 156 of file ContextWebGPU.h.
| RenderPipelineHandle Cogs::ContextWebGPU::currentRenderPipeline = {} |
Definition at line 154 of file ContextWebGPU.h.
|
private |
Definition at line 109 of file ContextWebGPU.h.
|
private |
Definition at line 112 of file ContextWebGPU.h.
| DepthStencilHandle Cogs::ContextWebGPU::depthStencilHandle = {} |
Definition at line 160 of file ContextWebGPU.h.
| DepthStencilStateHandle Cogs::ContextWebGPU::depthStencilStateHandle = {} |
Definition at line 151 of file ContextWebGPU.h.
| std::map<uint32_t, WGPUBindGroupEntry> Cogs::ContextWebGPU::descriptors |
Definition at line 170 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::do_clear_depth = false |
Definition at line 164 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::do_clear_render_target = false |
Definition at line 163 of file ContextWebGPU.h.
| EffectHandle Cogs::ContextWebGPU::effect = {} |
Definition at line 148 of file ContextWebGPU.h.
|
private |
Definition at line 115 of file ContextWebGPU.h.
| GraphicsDeviceWebGPU* Cogs::ContextWebGPU::graphicsDevice = nullptr |
Definition at line 143 of file ContextWebGPU.h.
| InputLayoutHandle Cogs::ContextWebGPU::inputLayoutHandle = {} |
Definition at line 149 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::inRenderPass = false |
Definition at line 158 of file ContextWebGPU.h.
| std::vector<WGPUBindGroup> Cogs::ContextWebGPU::last_bind_groups |
Definition at line 175 of file ContextWebGPU.h.
|
private |
Definition at line 108 of file ContextWebGPU.h.
|
private |
Definition at line 111 of file ContextWebGPU.h.
| RasterizerStateHandle Cogs::ContextWebGPU::rasterizeStateHandle = {} |
Definition at line 150 of file ContextWebGPU.h.
| WGPURenderPassEncoder Cogs::ContextWebGPU::renderPassEncoder = 0 |
Definition at line 145 of file ContextWebGPU.h.
| RenderTargetHandle Cogs::ContextWebGPU::renderTargetHandle = {} |
Definition at line 159 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::update_descriptors = false |
Definition at line 169 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::update_render_target = true |
Definition at line 165 of file ContextWebGPU.h.
|
private |
Definition at line 116 of file ContextWebGPU.h.