Stephen Gutekanst
2981e5e352
gpu: begin translating ComputePassEncoder methods
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
05b3920775
gpu: begin translating CommandEncoder methods
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
2af05b4446
gpu: begin translating Device methods
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
054b9e95a5
gpu: implement RenderPassEncoder.writeTimestamp
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
d707d7e2e2
gpu: implement RenderPassEncoder.setViewport
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
1db208d2df
gpu: implement RenderPassEncoder.setVertexBuffer
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
ec59227eb8
gpu: implement RenderPassEncoder.setStencilReference
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
67f77d5a8c
gpu: implement RenderPassEncoder.setScissorRect
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
2c319d628a
gpu: implement RenderPassEncoder.setIndexBuffer
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
f8c40b0aa9
gpu: implement RenderPassEncoder.setBlendConstant
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
5ca189005d
gpu: implement RenderPassEncoder.setBindGroup
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
b24512b6cf
gpu: implement RenderPassEncoder.pushDebugGroup
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9c5cd8b006
gpu: implement RenderPassEncoder.insertDebugMarker
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
8615f346dd
gpu: implement RenderPassEncoder.executeBundles
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
45d27fdbb2
gpu: remove invalid TODOs
...
* wgpuRenderPassEncoderEndPass has been removed in latest Dawn.
* wgpuRenderPassEncoderSetPipeline is already implemented.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
af4a6be85c
gpu: implement RenderPassEncoder.endOcclusionQuery
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
2d04fb91bc
gpu: use unnamed tests for inclusion
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9e7d37a9ea
gpu: cleanup RenderPassEncoder
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
d767b7d6f4
gpu: implement RenderPassEncoder.drawIndirect
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
34907b1f22
gpu: implement RenderPassEncoder.drawIndexedIndirect
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
660a0334dd
gpu: implement RenderPassEncoder.drawIndexed
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
3b4c07ce63
gpu: implement RenderPassEncoder.beginOcclusionQuery
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
cad271345a
gpu: implement ComputePipeline.getBindGroupLayout
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
7e54d9b4ae
gpu: implement RenderPipeline.getBindGroupLayout
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
856c98c4c1
gpu: implement Texture.createView
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9fae887555
gpu: implement Device.createRenderPipelineAsync
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
c90fb09de1
gpu: implement Device.createComputePipeline
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
38535c7b5f
gpu: implement Device.createComputePipelineAsync
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
3ce0e1258a
gpu: implement ShaderModule.getCompilationInfo
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
77b2210587
gpu: implement Buffer.mapAsync
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
3ffc1ca5d8
gpu: Queue: OnSubmittedWorkDone -> WorkDoneCallback, consistent w/other callbacks
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
356e4102cd
gpu: make requestAdapter callback-based, add waitForAdapter helper
...
Same rationale as 2c3e13ff4b90886d7f03adb3103abc9dee70b407
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
aab99b5474
gpu: make requestDevice callback-based, add waitForDevice helper
...
Previously we were attempting to turn WebGPU async functions, which are
exposed by `webgpu.h` as callbacks, into Zig async functions.
This in practice turns out harder than expected. For example, `Buffer.mapAsync`
/ `wgpuBufferMapAsync` cannot easily be exposed as a Zig async function for a few
reasons:
1. The callback is merely guaranteed to be called once the buffer's content is ready to
be accessed via `wgpuBufferGetMappedRange` - but there is no strict guarantee about
when that is. It could be 1-3 frames later, in theory, I believe.
2. The non-deterministic timing means that one would wish to poll "has the async function
returned?" but this isn't trivial without our own scheduler.
3. Zig has a fair amount of async rework in the future that is coming, and I imagine it
will be one of the later things that is fully supported by the WebAssembly backend
(but I am speculating) - so it seems wise to punt on this until later.
Instead, we are now retaining async functions as callback-based ones, with a helper in
this case to wait for the callback to be invoked. For `wgpuBufferMapAsync` we will just
have the callback approach.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
34ac711d2f
gpu: implement Buffer.unmap
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
1c5c23f101
gpu: fix Queue.submit commands parameter
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
143567e1c0
gpu: implement CommandEncoder.finish
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
198b642078
gpu: implement RenderPassEncoder.end
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a5f6483c62
gpu: implement RenderPassEncoder.draw
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
70211c9d38
gpu: implement RenderPassEncoder.setPipeline
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
f5a5c7eaa7
gpu: implement RenderPassColorAttachment
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
510c7de9f2
gpu: implement CommandEncoder.beginRenderPass
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
e0c850fd9c
gpu: allow null descriptor param for Device.createCommandEncoder
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9c7aa55273
gpu: implement Device.createCommandEncoder
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
ef3eed7afb
gpu: implement SwapChain.present, SwapChain.getCurrentTextureView
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
4e31e015a4
gpu: correctly handle null RenderPipeline.Descriptor transitive values
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
f5e6976937
gpu: make ConstantEntry & ColorTargetState C ABI compatible
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
36afd39945
gpu: correct RenderPipelineDescriptor stack conversions
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
1fafce595a
gpu: partial Device.createRenderPipeline implementation
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
40f92dd9d9
gpu: use PowerPreference
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9c2fc82fa3
gpu: note that copyTextureForBrowser may be Dawn-specific
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00