Skip to content

Commit d956ce4

Browse files
committed
Store pointers instead of IDs when tracing (1/2)
This updates pass operations.
1 parent 475c6ec commit d956ce4

24 files changed

+955
-1286
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pp-rs = "0.2.1"
170170
profiling = { version = "1.0.1", default-features = false }
171171
quote = "1.0.38"
172172
raw-window-handle = { version = "0.6.2", default-features = false }
173-
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
173+
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
174174
rayon = "1.3"
175175
regex-lite = "0.1"
176176
renderdoc-sys = "1"

player/src/lib.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait GlobalPlay {
1818
fn encode_commands(
1919
&self,
2020
encoder: wgc::id::CommandEncoderId,
21-
commands: Vec<Command>,
21+
commands: Vec<Command<IdReferences>>,
2222
command_buffer_id_manager: &mut IdentityManager<wgc::id::markers::CommandBuffer>,
2323
) -> wgc::id::CommandBufferId;
2424
fn process(
@@ -36,7 +36,7 @@ impl GlobalPlay for wgc::global::Global {
3636
fn encode_commands(
3737
&self,
3838
encoder: wgc::id::CommandEncoderId,
39-
commands: Vec<Command>,
39+
commands: Vec<Command<IdReferences>>,
4040
command_buffer_id_manager: &mut IdentityManager<wgc::id::markers::CommandBuffer>,
4141
) -> wgc::id::CommandBufferId {
4242
for command in commands {
@@ -71,21 +71,21 @@ impl GlobalPlay for wgc::global::Global {
7171
.command_encoder_clear_texture(encoder, dst, &subresource_range)
7272
.unwrap(),
7373
Command::WriteTimestamp {
74-
query_set_id,
74+
query_set,
7575
query_index,
7676
} => self
77-
.command_encoder_write_timestamp(encoder, query_set_id, query_index)
77+
.command_encoder_write_timestamp(encoder, query_set, query_index)
7878
.unwrap(),
7979
Command::ResolveQuerySet {
80-
query_set_id,
80+
query_set,
8181
start_query,
8282
query_count,
8383
destination,
8484
destination_offset,
8585
} => self
8686
.command_encoder_resolve_query_set(
8787
encoder,
88-
query_set_id,
88+
query_set,
8989
start_query,
9090
query_count,
9191
destination,
@@ -100,29 +100,29 @@ impl GlobalPlay for wgc::global::Global {
100100
.command_encoder_insert_debug_marker(encoder, &marker)
101101
.unwrap(),
102102
Command::RunComputePass {
103-
base,
103+
pass,
104104
timestamp_writes,
105105
} => {
106106
self.compute_pass_end_with_unresolved_commands(
107107
encoder,
108-
base,
108+
pass,
109109
timestamp_writes.as_ref(),
110110
);
111111
}
112112
Command::RunRenderPass {
113-
base,
114-
target_colors,
115-
target_depth_stencil,
113+
pass,
114+
color_attachments,
115+
depth_stencil_attachment,
116116
timestamp_writes,
117-
occlusion_query_set_id,
117+
occlusion_query_set,
118118
} => {
119119
self.render_pass_end_with_unresolved_commands(
120120
encoder,
121-
base,
122-
&target_colors,
123-
target_depth_stencil.as_ref(),
121+
pass,
122+
&color_attachments,
123+
depth_stencil_attachment.as_ref(),
124124
timestamp_writes.as_ref(),
125-
occlusion_query_set_id,
125+
occlusion_query_set,
126126
);
127127
}
128128
Command::BuildAccelerationStructures { blas, tlas } => {
@@ -175,6 +175,7 @@ impl GlobalPlay for wgc::global::Global {
175175
)
176176
.unwrap();
177177
}
178+
Command::TransitionResources { .. } => unimplemented!("not supported in a trace"),
178179
}
179180
}
180181
let (cmd_buf, error) = self.command_encoder_finish(
@@ -233,12 +234,8 @@ impl GlobalPlay for wgc::global::Global {
233234
Action::DestroyTexture(id) => {
234235
self.texture_drop(id);
235236
}
236-
Action::CreateTextureView {
237-
id,
238-
parent_id,
239-
desc,
240-
} => {
241-
let (_, error) = self.texture_create_view(parent_id, &desc, Some(id));
237+
Action::CreateTextureView { id, parent, desc } => {
238+
let (_, error) = self.texture_create_view(parent, &desc, Some(id));
242239
if let Some(e) = error {
243240
panic!("{e}");
244241
}
@@ -268,8 +265,8 @@ impl GlobalPlay for wgc::global::Global {
268265
Action::DestroySampler(id) => {
269266
self.sampler_drop(id);
270267
}
271-
Action::GetSurfaceTexture { id, parent_id } => {
272-
self.surface_get_current_texture(parent_id, Some(id))
268+
Action::GetSurfaceTexture { id, parent } => {
269+
self.surface_get_current_texture(parent, Some(id))
273270
.unwrap()
274271
.texture
275272
.unwrap();

wgpu-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ observe_locks = ["std", "dep:ron", "serde/serde_derive"]
6969
# --------------------------------------------------------------------
7070

7171
## Enables serialization via `serde` on common wgpu types.
72-
serde = ["dep:serde", "wgpu-types/serde", "arrayvec/serde", "hashbrown/serde"]
72+
serde = ["dep:serde", "wgpu-types/serde", "arrayvec/serde", "hashbrown/serde", "smallvec/serde"]
7373

7474
## Enable API tracing.
7575
trace = ["serde", "std", "dep:ron", "naga/serialize", "wgpu-types/trace"]

0 commit comments

Comments
 (0)