mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 17:01:15 +01:00
[core] Replace id transmute method with explicit functions. (#5509)
Replace the `wgpu_core::id::Id::transmute` method, the `transmute` private module, and the `Transmute` sealed trait with some associated functions with obvious names.
This commit is contained in:
1 parent
17ef6cac90
commit
03db77cb8c
10 files changed
+54
-49
No files matched your search
@@ -253,7 +253,7 @@ impl<A: HalApi> CommandBuffer<A> {
|
||||
id: id::CommandEncoderId,
|
||||
) -> Result<Arc<Self>, CommandEncoderError> {
|
||||
let storage = hub.command_buffers.read();
|
||||
match storage.get(id.transmute()) {
|
||||
match storage.get(id.into_command_buffer_id()) {
|
||||
Ok(cmd_buf) => match cmd_buf.data.lock().as_ref().unwrap().status {
|
||||
CommandEncoderStatus::Recording => Ok(cmd_buf.clone()),
|
||||
CommandEncoderStatus::Finished => Err(CommandEncoderError::NotRecording),
|
||||
@@ -418,7 +418,7 @@ impl Global {
|
||||
|
||||
let hub = A::hub(self);
|
||||
|
||||
let error = match hub.command_buffers.get(encoder_id.transmute()) {
|
||||
let error = match hub.command_buffers.get(encoder_id.into_command_buffer_id()) {
|
||||
Ok(cmd_buf) => {
|
||||
let mut cmd_buf_data = cmd_buf.data.lock();
|
||||
let cmd_buf_data = cmd_buf_data.as_mut().unwrap();
|
||||
@@ -444,7 +444,7 @@ impl Global {
|
||||
Err(_) => Some(CommandEncoderError::Invalid),
|
||||
};
|
||||
|
||||
(encoder_id.transmute(), error)
|
||||
(encoder_id.into_command_buffer_id(), error)
|
||||
}
|
||||
|
||||
pub fn command_encoder_push_debug_group<A: HalApi>(
|
||||
@@ -700,7 +700,7 @@ impl PrettyError for PassErrorScope {
|
||||
// This error is not in the error chain, only notes are needed
|
||||
match *self {
|
||||
Self::Pass(id) => {
|
||||
fmt.command_buffer_label(&id.transmute());
|
||||
fmt.command_buffer_label(&id.into_command_buffer_id());
|
||||
}
|
||||
Self::SetBindGroup(id) => {
|
||||
fmt.bind_group_label(&id);
|
||||
|
||||
@@ -2409,7 +2409,10 @@ impl Global {
|
||||
(trackers, pending_discard_init_fixups)
|
||||
};
|
||||
|
||||
let cmd_buf = hub.command_buffers.get(encoder_id.transmute()).unwrap();
|
||||
let cmd_buf = hub
|
||||
.command_buffers
|
||||
.get(encoder_id.into_command_buffer_id())
|
||||
.unwrap();
|
||||
let mut cmd_buf_data = cmd_buf.data.lock();
|
||||
let cmd_buf_data = cmd_buf_data.as_mut().unwrap();
|
||||
|
||||
|
||||
Reference in new issue
Block a user