mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 06:50:59 +01:00
refactor(core)!: ArcCommand::WriteBuffer: serialize offset and size instead of start..end
This commit is contained in:
1 parent
7d27b2f1e4
commit
3e4f439b0b
9 files changed
+25
-24
No files matched your search
@@ -112,6 +112,7 @@ By @cwfitzgerald in [#8999](https://github.com/gfx-rs/wgpu/pull/8999).
|
||||
- Allow using a shader that defines I/O for dual-source blending in a pipeline that does not make use of it. By @andyleiserson in [#8856](https://github.com/gfx-rs/wgpu/pull/8856).
|
||||
- Validate `strip_index_format` isn't None and equals index buffer format for indexed drawing with strip topology. By @beicause in [#8850](https://github.com/gfx-rs/wgpu/pull/8850).
|
||||
- Renamed `EXPERIMENTAL_PASSTHROUGH_SHADERS` to `PASSTHROUGH_SHADERS` and made this no longer an experimental feature. by @inner-daemons in [#9054](https://github.com/gfx-rs/wgpu/pull/9054).
|
||||
- BREAKING: End offsets in trace and `player` commands are now represented using `offset` + `size` instead. By @ErichDonGubler in [9073](https://github.com/gfx-rs/wgpu/pull/9073).
|
||||
|
||||
#### naga
|
||||
|
||||
|
||||
+4
-4
@@ -377,19 +377,19 @@ impl Player {
|
||||
Action::WriteBuffer {
|
||||
id,
|
||||
data,
|
||||
range,
|
||||
offset,
|
||||
size,
|
||||
queued,
|
||||
} => {
|
||||
let buffer = self.resolve_buffer_id(id);
|
||||
let bin = loader.load(&data);
|
||||
let size = (range.end - range.start) as usize;
|
||||
if queued {
|
||||
queue
|
||||
.write_buffer(buffer, range.start, &bin)
|
||||
.write_buffer(buffer, offset, &bin)
|
||||
.expect("Queue::write_buffer error");
|
||||
} else {
|
||||
device
|
||||
.set_buffer_data(&buffer, range.start, &bin[..size])
|
||||
.set_buffer_data(&buffer, offset, &bin[..size.try_into().unwrap()])
|
||||
.expect("Device::set_buffer_data error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@
|
||||
WriteBuffer(
|
||||
id: PointerId(0x10),
|
||||
data: File("data1.bin"),
|
||||
range: (
|
||||
start: 0,
|
||||
end: 16,
|
||||
),
|
||||
offset: 0,
|
||||
size: 16,
|
||||
queued: true,
|
||||
),
|
||||
Submit(1, []),
|
||||
|
||||
@@ -74,10 +74,8 @@
|
||||
WriteBuffer(
|
||||
id: PointerId(0x110),
|
||||
data: File("data1.bin"),
|
||||
range: (
|
||||
start: 0,
|
||||
end: 16,
|
||||
),
|
||||
offset: 0,
|
||||
size: 16,
|
||||
queued: true,
|
||||
),
|
||||
Submit(1, [
|
||||
|
||||
@@ -68,10 +68,8 @@
|
||||
WriteBuffer(
|
||||
id: PointerId(0x120),
|
||||
data: File("data1.bin"),
|
||||
range: (
|
||||
start: 4,
|
||||
end: 20,
|
||||
),
|
||||
offset: 4,
|
||||
size: 16,
|
||||
queued: true,
|
||||
),
|
||||
CreateShaderModule(
|
||||
|
||||
@@ -1613,12 +1613,13 @@ impl Global {
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut trace) = *queue.device.trace.lock() {
|
||||
use crate::device::trace::DataKind;
|
||||
let range = buffer_offset..buffer_offset + data.len() as u64;
|
||||
let size = data.len() as u64;
|
||||
let data = trace.make_binary(DataKind::Bin, data);
|
||||
trace.add(Action::WriteBuffer {
|
||||
id: buffer.to_trace(),
|
||||
data,
|
||||
range,
|
||||
offset: buffer_offset,
|
||||
size,
|
||||
queued: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ mod record;
|
||||
#[cfg(feature = "replay")]
|
||||
mod replay;
|
||||
|
||||
use core::{convert::Infallible, ops::Range};
|
||||
use core::convert::Infallible;
|
||||
|
||||
use alloc::{string::String, vec::Vec};
|
||||
use macro_rules_attribute::apply;
|
||||
@@ -221,7 +221,8 @@ pub enum Action<'a, R: ReferenceType> {
|
||||
WriteBuffer {
|
||||
id: R::Buffer,
|
||||
data: Data,
|
||||
range: Range<wgt::BufferAddress>,
|
||||
offset: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
queued: bool,
|
||||
},
|
||||
WriteTexture {
|
||||
|
||||
@@ -893,12 +893,14 @@ fn action_to_owned(action: Action<'_, PointerReferences>) -> Action<'static, Poi
|
||||
A::WriteBuffer {
|
||||
id,
|
||||
data,
|
||||
range,
|
||||
offset,
|
||||
size,
|
||||
queued,
|
||||
} => A::WriteBuffer {
|
||||
id,
|
||||
data,
|
||||
range,
|
||||
offset,
|
||||
size,
|
||||
queued,
|
||||
},
|
||||
A::WriteTexture {
|
||||
|
||||
@@ -823,7 +823,8 @@ impl Buffer {
|
||||
trace.add(trace::Action::WriteBuffer {
|
||||
id: self.to_trace(),
|
||||
data,
|
||||
range: 0..self.size,
|
||||
offset: 0,
|
||||
size: self.size,
|
||||
queued: true,
|
||||
});
|
||||
}
|
||||
@@ -889,7 +890,8 @@ impl Buffer {
|
||||
trace.add(trace::Action::WriteBuffer {
|
||||
id: self.to_trace(),
|
||||
data,
|
||||
range: range.clone(),
|
||||
offset: range.start,
|
||||
size,
|
||||
queued: false,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user