Unify ResolvedBufferBinding into BufferBinding

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev authored and Connor Fitzgerald committed 2025-02-07 16:16:13 -05:00
1 parent c07fab2c12
commit c0688b6de7
6 files changed
+9 -14

No files matched your search

+1 -1
View File
@@ -284,7 +284,7 @@ pub fn op_webgpu_create_bind_group(
.get::<super::buffer::WebGpuBuffer>(entry.resource)?;
wgpu_core::binding_model::BindingResource::Buffer(
wgpu_core::binding_model::BufferBinding {
buffer_id: buffer_resource.1,
buffer: buffer_resource.1,
offset: entry.offset.unwrap_or(0),
size: std::num::NonZeroU64::new(entry.size.unwrap_or(0)),
},
+1 -1
View File
@@ -27,7 +27,7 @@
(
binding: 0,
resource: Buffer((
buffer_id: Id(0, 1),
buffer: Id(0, 1),
offset: 0,
size: None,
)),
+1 -1
View File
@@ -112,7 +112,7 @@
(
binding: 0,
resource: Buffer((
buffer_id: Id(3, 1),
buffer: Id(3, 1),
offset: 0,
size: Some(16),
)),
+3 -8
View File
@@ -801,18 +801,13 @@ crate::impl_storage_item!(PipelineLayout);
#[repr(C)]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct BufferBinding {
pub buffer_id: BufferId,
pub struct BufferBinding<B = BufferId> {
pub buffer: B,
pub offset: wgt::BufferAddress,
pub size: Option<wgt::BufferSize>,
}
#[derive(Clone, Debug)]
pub struct ResolvedBufferBinding {
pub buffer: Arc<Buffer>,
pub offset: wgt::BufferAddress,
pub size: Option<wgt::BufferSize>,
}
pub type ResolvedBufferBinding = BufferBinding<Arc<Buffer>>;
// Note: Duplicated in `wgpu-rs` as `BindingResource`
// They're different enough that it doesn't make sense to share a common type
+1 -1
View File
@@ -734,7 +734,7 @@ impl Global {
{
let resolve_buffer = |bb: &BufferBinding| {
buffer_storage
.get(bb.buffer_id)
.get(bb.buffer)
.get()
.map(|buffer| ResolvedBufferBinding {
buffer,
+2 -2
View File
@@ -1121,7 +1121,7 @@ impl dispatch::DeviceInterface for CoreDevice {
for entry in desc.entries.iter() {
if let BindingResource::BufferArray(array) = entry.resource {
arrayed_buffer_bindings.extend(array.iter().map(|binding| bm::BufferBinding {
buffer_id: binding.buffer.inner.as_core().id,
buffer: binding.buffer.inner.as_core().id,
offset: binding.offset,
size: binding.size,
}));
@@ -1141,7 +1141,7 @@ impl dispatch::DeviceInterface for CoreDevice {
offset,
size,
}) => bm::BindingResource::Buffer(bm::BufferBinding {
buffer_id: buffer.inner.as_core().id,
buffer: buffer.inner.as_core().id,
offset,
size,
}),