|
Cogs.Core
|
Public Member Functions | |
| void | initialize (GraphicsDeviceWebGPU *graphicsDevice) |
| virtual const FrameStatistics & | getLastFrameStatistics () override |
| virtual const UploadStatistics & | getLastUploadStatistics () override |
| virtual void | frameStatisticsConfigure (bool) 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 | 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 | beginRenderPassInt () |
| void | endRenderPassInt () |
| void | updateRenderPass () |
| bool | updateRenderPipeline (PrimitiveType primitiveType) |
| void | beginComputePass () |
| void | endComputePass () |
| void | updateComputePass () |
| void | updateComputePipeline () |
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 = {} |
| 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 |
Private Member Functions | |
| EffectHandle | getCurrentEffect () |
| EffectsWebGPU * | getEffects () |
Private Attributes | |
| FrameStatistics | frameStatistics |
| UploadStatistics | uploadStatistics |
Definition at line 14 of file ContextWebGPU.h.
| void Cogs::ContextWebGPU::beginComputePass | ( | ) |
Definition at line 728 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 91 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::beginRenderPassInt | ( | ) |
Definition at line 522 of file ContextWebGPU.cpp.
|
overridevirtual |
Clear the currently set depth/stencil target to the given depth.
Implements Cogs::IContext.
Definition at line 83 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 54 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 67 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1040 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1035 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 991 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 996 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 1001 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 721 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 490 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 498 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 506 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 514 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::endComputePass | ( | ) |
Definition at line 739 of file ContextWebGPU.cpp.
|
overridevirtual |
| void Cogs::ContextWebGPU::endRenderPassInt | ( | ) |
Definition at line 609 of file ContextWebGPU.cpp.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 44 of file ContextWebGPU.cpp.
|
inlineoverridevirtual |
Get the associated counter of a buffer.
Implements Cogs::IContext.
Definition at line 64 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 485 of file ContextWebGPU.cpp.
|
private |
Definition at line 1045 of file ContextWebGPU.cpp.
|
private |
Definition at line 1050 of file ContextWebGPU.cpp.
|
inlineoverridevirtual |
Implements Cogs::IContext.
Definition at line 18 of file ContextWebGPU.h.
|
inlineoverridevirtual |
Implements Cogs::IContext.
Definition at line 19 of file ContextWebGPU.h.
| void Cogs::ContextWebGPU::initialize | ( | GraphicsDeviceWebGPU * | graphicsDevice | ) |
Definition at line 39 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 873 of file ContextWebGPU.cpp.
|
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 911 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 834 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 800 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 986 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current blend state.
Implements Cogs::IContext.
Definition at line 249 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 470 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 463 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 480 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 475 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 437 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 432 of file ContextWebGPU.cpp.
References setConstantBuffer().
Referenced by setConstantBuffer().
| void Cogs::ContextWebGPU::setDefaults | ( | ) |
Definition at line 280 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current depth stencil state.
Implements Cogs::IContext.
Definition at line 241 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 286 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 415 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 390 of file ContextWebGPU.cpp.
|
overridevirtual |
Set the current rasterizer state.
Implements Cogs::IContext.
Definition at line 272 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets the current render target and an associated depth stencil target.
Implements Cogs::IContext.
Definition at line 202 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 359 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 354 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 229 of file ContextWebGPU.cpp.
References Cogs::GraphicsDeviceWebGPU::getSize().
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 327 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 297 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 302 of file ContextWebGPU.cpp.
References Cogs::Handle_t< Type, Convertible >::handle.
|
overridevirtual |
Implements Cogs::IContext.
Definition at line 332 of file ContextWebGPU.cpp.
|
overridevirtual |
Sets vertexBuffers and index buffers using a prevalidated vertex array object.
Implements Cogs::IContext.
Definition at line 427 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 410 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 398 of file ContextWebGPU.cpp.
Referenced by setVertexBuffers().
|
overridevirtual |
Sets the current viewport to the given location and dimensions.
Implements Cogs::IContext.
Definition at line 221 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 49 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 917 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 934 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 939 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateComputePass | ( | ) |
Definition at line 746 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateComputePipeline | ( | ) |
Definition at line 756 of file ContextWebGPU.cpp.
| void Cogs::ContextWebGPU::updateRenderPass | ( | ) |
Definition at line 619 of file ContextWebGPU.cpp.
| bool Cogs::ContextWebGPU::updateRenderPipeline | ( | PrimitiveType | primitiveType | ) |
Definition at line 629 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 978 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 946 of file ContextWebGPU.cpp.
References Cogs::FormatInfo::blockExtent, and Cogs::FormatInfo::blockSize.
| BlendStateHandle Cogs::ContextWebGPU::blendStateHandle = {} |
Definition at line 119 of file ContextWebGPU.h.
| WGPUColor Cogs::ContextWebGPU::clearColor[8] = {} |
Definition at line 127 of file ContextWebGPU.h.
| float Cogs::ContextWebGPU::clearDepthVal = 1.0f |
Definition at line 128 of file ContextWebGPU.h.
| WGPUComputePassEncoder Cogs::ContextWebGPU::computePassEncoder = 0 |
Definition at line 113 of file ContextWebGPU.h.
| WGPUBindGroup Cogs::ContextWebGPU::current_bind_group = {} |
Definition at line 133 of file ContextWebGPU.h.
| ComputePipelineHandle Cogs::ContextWebGPU::currentComputePipeline = {} |
Definition at line 122 of file ContextWebGPU.h.
| RenderPipelineHandle Cogs::ContextWebGPU::currentRenderPipeline = {} |
Definition at line 121 of file ContextWebGPU.h.
| DepthStencilHandle Cogs::ContextWebGPU::depthStencilHandle = {} |
Definition at line 126 of file ContextWebGPU.h.
| DepthStencilStateHandle Cogs::ContextWebGPU::depthStencilStateHandle = {} |
Definition at line 118 of file ContextWebGPU.h.
| std::map<uint32_t, WGPUBindGroupEntry> Cogs::ContextWebGPU::descriptors |
Definition at line 136 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::do_clear_depth = false |
Definition at line 130 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::do_clear_render_target = false |
Definition at line 129 of file ContextWebGPU.h.
| EffectHandle Cogs::ContextWebGPU::effect = {} |
Definition at line 115 of file ContextWebGPU.h.
|
private |
Definition at line 94 of file ContextWebGPU.h.
| GraphicsDeviceWebGPU* Cogs::ContextWebGPU::graphicsDevice = nullptr |
Definition at line 110 of file ContextWebGPU.h.
| InputLayoutHandle Cogs::ContextWebGPU::inputLayoutHandle = {} |
Definition at line 116 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::inRenderPass = false |
Definition at line 124 of file ContextWebGPU.h.
| RasterizerStateHandle Cogs::ContextWebGPU::rasterizeStateHandle = {} |
Definition at line 117 of file ContextWebGPU.h.
| WGPURenderPassEncoder Cogs::ContextWebGPU::renderPassEncoder = 0 |
Definition at line 112 of file ContextWebGPU.h.
| RenderTargetHandle Cogs::ContextWebGPU::renderTargetHandle = {} |
Definition at line 125 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::update_descriptors = false |
Definition at line 135 of file ContextWebGPU.h.
| bool Cogs::ContextWebGPU::update_render_target = true |
Definition at line 131 of file ContextWebGPU.h.
|
private |
Definition at line 95 of file ContextWebGPU.h.