remove parent_id field of TextureInner::Surface

The `parent_id` will always match `surface_id` because we got the texture from the `acquired_texture` field.
This commit is contained in:
teoxoy 2024-10-11 15:29:01 +02:00 committed by Teodor Tanasoaia
parent c38ed8d9fa
commit e86330977b
2 changed files with 6 additions and 19 deletions

View File

@ -194,10 +194,7 @@ impl Global {
let present = presentation.as_mut().unwrap();
let texture = resource::Texture::new(
&device,
resource::TextureInner::Surface {
raw: ast.texture,
parent_id: surface_id,
},
resource::TextureInner::Surface { raw: ast.texture },
hal_usage,
&texture_desc,
format_features,
@ -293,14 +290,9 @@ impl Global {
.snatch(&mut device.snatchable_lock.write())
.unwrap()
{
resource::TextureInner::Surface { raw, parent_id } => {
if surface_id != parent_id {
log::error!("Presented frame is from a different surface");
Err(hal::SurfaceError::Lost)
} else {
unsafe { queue.raw().present(suf, raw) }
}
}
resource::TextureInner::Surface { raw } => unsafe {
queue.raw().present(suf, raw)
},
_ => unreachable!(),
}
} else {
@ -367,12 +359,8 @@ impl Global {
.snatch(&mut device.snatchable_lock.write())
.unwrap()
{
resource::TextureInner::Surface { raw, parent_id } => {
if surface_id == parent_id {
unsafe { suf.unwrap().discard_texture(raw) };
} else {
log::warn!("Surface texture is outdated");
}
resource::TextureInner::Surface { raw } => {
unsafe { suf.unwrap().discard_texture(raw) };
}
_ => unreachable!(),
}

View File

@ -989,7 +989,6 @@ pub(crate) enum TextureInner {
},
Surface {
raw: Box<dyn hal::DynSurfaceTexture>,
parent_id: SurfaceId,
},
}