public interface IWebGpuBindingHow WebGPU is reached.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
WebGPU is one API with two entirely unrelated ways in. Silk.NET.WebGPU binds webgpu.h, which Dawn and wgpu-native implement and which a browser does not expose at all; a browser reaches WebGPU through navigator.gpu and JavaScript. So docs/plan/05 asks for two surface implementations behind one backend, and this is the seam between them.
Called a binding rather than a surface only because SurfaceHandle already means "a window to present to" everywhere else in this engine, and a type named IWebGpuSurface that was not about windows would be read wrongly by everyone.
Everything above this line is shared. Translation, validation, handle lifetime, deferred destruction, the recorded command stream and its replay are all written against this interface, which is what makes the browser surface a few hundred lines of interop rather than a second backend — and what makes the whole translation layer testable against a fake, on a machine with no GPU. The implementations own marshalling and nothing else: not one of these methods decides anything.
The methods are fine-grained because replay is shared. In a browser each call crosses the interop boundary, which is not free; the recorded stream is a flat array of blittable structs precisely so a future bulk path can hand the whole thing over at once without disturbing anything above.
Fields and properties (4)
WebGpuAdapterInfo AdapterInfoWhat the implementation says about the adapter.
WebGpuLimits LimitsWhat the device reports it can do.
bool HasSurfaceWhether there is a surface to present to.
WgpuTextureFormat PreferredSurfaceFormatThe format the surface prefers, or Undefined when there is no surface.
Methods (54)
bool HasFeature(WgpuFeatureName feature)Whether the device was created with an optional feature enabled.
WebGpuObject CreateBuffer(in WgpuBufferDescriptor descriptor)Creates a buffer.
WebGpuObject CreateTexture(in WgpuTextureDescriptor descriptor)Creates a texture.
WebGpuObject CreateTextureView(WebGpuObject texture, in WgpuTextureViewDescriptor descriptor)Creates a view of a texture.
WebGpuObject CreateSampler(in WgpuSamplerDescriptor descriptor)Creates a sampler.
WebGpuObject CreateShaderModule(in WgpuShaderModuleDescriptor descriptor)Creates a shader module.
WebGpuObject CreateBindGroupLayout(in WgpuBindGroupLayoutDescriptor descriptor)Creates a bind group layout.
WebGpuObject CreatePipelineLayout(in WgpuPipelineLayoutDescriptor descriptor)Creates a pipeline layout.
WebGpuObject CreateBindGroup(in WgpuBindGroupDescriptor descriptor)Creates a bind group.
WebGpuObject CreateRenderPipeline(in WgpuRenderPipelineDescriptor descriptor)Compiles a render pipeline.
WebGpuObject CreateComputePipeline(in WgpuComputePipelineDescriptor descriptor)Compiles a compute pipeline.
void Release(WebGpuObjectKind kind, WebGpuObject handle)Releases an object this binding created.
void WriteBuffer(WebGpuObject buffer, long offset, ReadOnlySpan<byte> data)Writes into a buffer through the queue.
bool ReadBuffer(WebGpuObject buffer, long offset, Span<byte> destination)Maps a buffer, copies out of it and unmaps it.
void Submit(ReadOnlySpan<WebGpuObject> commands)Submits finished command buffers, in order.
bool WaitIdle()Blocks until everything submitted has finished.
void Tick()Lets the implementation run its callbacks.
WebGpuObject CreateCommandEncoder(string label)Takes a command encoder.
WebGpuObject FinishCommandEncoder(WebGpuObject encoder, string label)Finishes an encoder into a command buffer.
void CopyBufferToBuffer(WebGpuObject encoder, WebGpuObject source, long sourceOffset, WebGpuObject destination, long destinationOffset, long size)Copies between buffers.
void CopyBufferToTexture(WebGpuObject encoder, in WgpuImageCopyBuffer source, in WgpuImageCopyTexture destination, int width, int height, int depthOrLayers)Copies from a buffer into a texture.
void CopyTextureToBuffer(WebGpuObject encoder, in WgpuImageCopyTexture source, in WgpuImageCopyBuffer destination, int width, int height, int depthOrLayers)Copies from a texture into a buffer.
void CopyTextureToTexture(WebGpuObject encoder, in WgpuImageCopyTexture source, in WgpuImageCopyTexture destination, int width, int height, int depthOrLayers)Copies between textures.
void EncoderPushDebugGroup(WebGpuObject encoder, string name)Opens a named group on an encoder.
void EncoderPopDebugGroup(WebGpuObject encoder)Closes the innermost group on an encoder.
void EncoderInsertDebugMarker(WebGpuObject encoder, string name)Marks a point on an encoder.
WebGpuObject BeginRenderPass(WebGpuObject encoder, in WgpuRenderPassDescriptor descriptor)Begins a render pass.
void EndRenderPass(WebGpuObject pass)Ends a render pass and releases its encoder.
void RenderPassSetPipeline(WebGpuObject pass, WebGpuObject pipeline)Binds a pipeline in a render pass.
void RenderPassSetBindGroup(WebGpuObject pass, uint group, WebGpuObject bindGroup, ReadOnlySpan<uint> dynamicOffsets)Binds a bind group in a render pass.
void RenderPassSetVertexBuffer(WebGpuObject pass, uint slot, WebGpuObject buffer, long offset, long size)Binds a vertex buffer in a render pass.
void RenderPassSetIndexBuffer(WebGpuObject pass, WebGpuObject buffer, WgpuIndexFormat format, long offset, long size)Binds the index buffer in a render pass.
void RenderPassSetViewport(WebGpuObject pass, float x, float y, float width, float height, float minDepth, float maxDepth)Sets the viewport.
void RenderPassSetScissorRect(WebGpuObject pass, uint x, uint y, uint width, uint height)Sets the scissor rectangle.
void RenderPassSetBlendConstant(WebGpuObject pass, double r, double g, double b, double a)Sets the blend constant.
void RenderPassSetStencilReference(WebGpuObject pass, uint reference)Sets the stencil reference value.
void RenderPassDraw(WebGpuObject pass, uint vertexCount, uint instanceCount, uint firstVertex, uint firstInstance)Draws without indices.
void RenderPassDrawIndexed(WebGpuObject pass, uint indexCount, uint instanceCount, uint firstIndex, int baseVertex, uint firstInstance)Draws with indices.
void RenderPassDrawIndexedIndirect(WebGpuObject pass, WebGpuObject arguments, long offset)Draws with arguments the GPU wrote.
void RenderPassPushDebugGroup(WebGpuObject pass, string name)Opens a named group in a render pass.
void RenderPassPopDebugGroup(WebGpuObject pass)Closes the innermost group in a render pass.
void RenderPassInsertDebugMarker(WebGpuObject pass, string name)Marks a point in a render pass.
WebGpuObject BeginComputePass(WebGpuObject encoder, string label)Begins a compute pass.
void EndComputePass(WebGpuObject pass)Ends a compute pass and releases its encoder.
void ComputePassSetPipeline(WebGpuObject pass, WebGpuObject pipeline)Binds a pipeline in a compute pass.
void ComputePassSetBindGroup(WebGpuObject pass, uint group, WebGpuObject bindGroup, ReadOnlySpan<uint> dynamicOffsets)Binds a bind group in a compute pass.
void ComputePassDispatch(WebGpuObject pass, uint groupsX, uint groupsY, uint groupsZ)Runs a compute shader.
void ComputePassDispatchIndirect(WebGpuObject pass, WebGpuObject arguments, long offset)Runs a compute shader with a group count the GPU wrote.
void ComputePassPushDebugGroup(WebGpuObject pass, string name)Opens a named group in a compute pass.
void ComputePassPopDebugGroup(WebGpuObject pass)Closes the innermost group in a compute pass.
void ComputePassInsertDebugMarker(WebGpuObject pass, string name)Marks a point in a compute pass.
void ConfigureSurface(in WgpuSurfaceConfiguration configuration)Configures the surface for presentation.
WgpuSurfaceStatus AcquireSurfaceTexture(out WebGpuObject texture)Takes the surface's next texture.
void PresentSurface()Presents the acquired texture.
Used by (5)
- FakeWebGpuBindingVixen.Graphics.WebGPU.Tests
- NativeWebGpuBindingVixen.Graphics.WebGPU
- PushConstantRingVixen.Graphics.WebGPU
- WebGpuDeviceVixen.Graphics.WebGPU
- WebGpuSwapChainVixen.Graphics.WebGPU