Stephen Gutekanst
821117fb26
gpu: correct TextureView.Descriptor default values
...
Helps hexops/mach#182
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-24 16:07:59 +00:00
Stephen Gutekanst
1717c684de
gpu: expose [Error/Logging]Callback
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
911bb8f4b5
gpu: implement CommandEncoder.beginComputePass
...
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
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
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
c045ce7caa
gpu: add constants
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
85041d6f93
gpu: add ImageCopyBuffer; ImageCopyTexture
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
d1bad15add
gpu: add ColorTargetState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
4aeea00409
gpu: add FragmentState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
ec300679a0
gpu: add VertexState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
48a3103bb9
gpu: add RenderPassColorAttachment
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
b505c5aecf
gpu: add RenderPassDepthStencilAttachment
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
58fe1b12f7
gpu: add RenderPassTimestampWrite
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
628f3d59c2
gpu: add ComputePassTimestampWrite
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
79e80467ca
gpu: add ConstantEntry
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
5a8585faa1
gpu: add ProgrammableStageDescriptor
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
3ec84f516a
gpu: add DepthStencilState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
bf3cf08e1e
gpu: add CompilationInfo
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
da4edf6e1d
gpu: add StorageTextureBindingLayout
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
50e1151a72
gpu: fix syntax test inclusion
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
7271df966e
gpu: move TextureSampleType -> Texture.SampleType
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a34646e78d
gpu: move TextureDimension -> Texture.Dimension
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
23aad28093
gpu: move TextureComponentType -> Texture.ComponentType
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
b02dbb2f03
gpu: move TextureAspect -> Texture.Aspect
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
3b2dff540d
gpu: move DeviceLostReason -> Device.LostReason
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
84c532156e
gpu: move BufferBindingType -> Buffer.BindingType
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
2e68792f0d
gpu: move TextureFormat -> Texture.Format
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
281d6a2016
gpu: move TextureUsage -> Texture.Usage
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
58c27b41a8
gpu: add Sampler.BindingLayout
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
e2ed25babc
gpu: add PrimitiveState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a6be646b94
gpu: add MultisampleState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
0fd769923c
gpu: add exports
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a541bf4fa1
gpu: add BindGroupEntry
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
fd48c830e1
gpu: rename structs.zig -> data.zig
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
04378a8ff7
gpu: add VertexBufferLayout
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
d70f5695b6
gpu: add BlendState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
1069889ea6
gpu: add VertexAttribute
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
ad03565ff5
gpu: add StencilFaceState
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
9b08741970
gpu: add Origin3D
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a7b0a50dd4
gpu: add Color
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
5bce559ce4
gpu: add BlendComponent
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
a463a0c7cd
gpu: unify data structs in single structs.zig
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
41fa8908d4
gpu: document resource handling semantics
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
ce46b2a652
gpu: implement ComputePipeline
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
056e46ec39
gpu: implement ComputePassEncoder
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00
Stephen Gutekanst
080aa950bb
gpu: implement CommandEncoder
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00