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

View File

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