mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-28 00:59:12 +01:00
feat(deno): accept GPUBuffer as GPUBindingResource
This commit is contained in:
1 parent
ce96254f4f
commit
375095f789
3 files changed
+21
No files matched your search
@@ -3,6 +3,7 @@
|
||||
// cargo xtask cts -- --list <selector>
|
||||
// ```
|
||||
unittests:*
|
||||
webgpu:api,operation,buffers,createBindGroup:buffer_binding_resource:*
|
||||
webgpu:api,operation,command_buffer,basic:*
|
||||
webgpu:api,operation,command_buffer,copyBufferToBuffer:*
|
||||
fails-if(vulkan) webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth24plus"
|
||||
@@ -23,6 +24,8 @@ fails-if(vulkan) webgpu:api,operation,vertex_state,correctness:array_stride_zero
|
||||
fails-if(metal) webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:*
|
||||
fails-if(dx12) webgpu:api,validation,capability_checks,limits,maxBindGroups:setBindGroup,*
|
||||
webgpu:api,validation,createBindGroup:buffer,effective_buffer_binding_size:*
|
||||
// Fails because we coerce a size of 0 in `GPUDevice.createBindGroup(…)` to `buffer.size - offset`.
|
||||
// FAIL webgpu:api,validation,createBindGroup:buffer_offset_and_size_for_bind_groups_match:*
|
||||
webgpu:api,validation,encoding,beginComputePass:*
|
||||
webgpu:api,validation,encoding,beginRenderPass:*
|
||||
webgpu:api,validation,encoding,cmds,clearBuffer:*
|
||||
|
||||
@@ -94,6 +94,7 @@ pub(crate) struct GPUBufferBinding {
|
||||
pub(crate) enum GPUBindingResource {
|
||||
Sampler(Ptr<GPUSampler>),
|
||||
TextureView(Ptr<GPUTextureView>),
|
||||
Buffer(Ptr<GPUBuffer>),
|
||||
BufferBinding(GPUBufferBinding),
|
||||
}
|
||||
|
||||
@@ -125,6 +126,16 @@ impl<'a> WebIdlConverter<'a> for GPUBindingResource {
|
||||
)
|
||||
.map(Self::TextureView)
|
||||
})
|
||||
.or_else(|_| {
|
||||
<Ptr<GPUBuffer>>::convert(
|
||||
scope,
|
||||
value,
|
||||
prefix.clone(),
|
||||
context.borrowed(),
|
||||
options,
|
||||
)
|
||||
.map(Self::Buffer)
|
||||
})
|
||||
.or_else(|_| {
|
||||
GPUBufferBinding::convert(scope, value, prefix, context, options)
|
||||
.map(Self::BufferBinding)
|
||||
|
||||
@@ -406,6 +406,13 @@ impl GPUDevice {
|
||||
GPUBindingResource::TextureView(texture_view) => {
|
||||
BindingResource::TextureView(texture_view.id)
|
||||
}
|
||||
GPUBindingResource::Buffer(buffer) => {
|
||||
BindingResource::Buffer(wgpu_core::binding_model::BufferBinding {
|
||||
buffer: buffer.id,
|
||||
offset: 0,
|
||||
size: NonZeroU64::new(buffer.size),
|
||||
})
|
||||
}
|
||||
GPUBindingResource::BufferBinding(buffer_binding) => {
|
||||
BindingResource::Buffer(wgpu_core::binding_model::BufferBinding {
|
||||
buffer: buffer_binding.buffer.id,
|
||||
|
||||
Reference in new issue
Block a user