Skip to content

Commit 8e943e8

Browse files
sagudevcwfitzgerald
authored andcommitted
Unify ResolvedSurfaceOutput into SurfaceOutput
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent c0688b6 commit 8e943e8

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

deno_webgpu/surface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn op_webgpu_surface_get_current_texture(
9696

9797
match output.status {
9898
wgpu_types::SurfaceStatus::Good | wgpu_types::SurfaceStatus::Suboptimal => {
99-
let id = output.texture_id.unwrap();
99+
let id = output.texture.unwrap();
100100
let rid = state.resource_table.add(crate::texture::WebGpuTexture {
101101
instance: instance.clone(),
102102
id,

player/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl GlobalPlay for wgc::global::Global {
289289
Action::GetSurfaceTexture { id, parent_id } => {
290290
self.surface_get_current_texture(parent_id, Some(id))
291291
.unwrap()
292-
.texture_id
292+
.texture
293293
.unwrap();
294294
}
295295
Action::CreateBindGroupLayout(id, desc) => {

wgpu-core/src/present.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,13 @@ impl From<WaitIdleError> for ConfigureSurfaceError {
103103
}
104104
}
105105

106-
#[derive(Debug)]
107-
pub struct ResolvedSurfaceOutput {
108-
pub status: Status,
109-
pub texture: Option<Arc<resource::Texture>>,
110-
}
106+
pub type ResolvedSurfaceOutput = SurfaceOutput<Arc<resource::Texture>>;
111107

112108
#[repr(C)]
113109
#[derive(Debug)]
114-
pub struct SurfaceOutput {
110+
pub struct SurfaceOutput<T = id::TextureId> {
115111
pub status: Status,
116-
pub texture_id: Option<id::TextureId>,
112+
pub texture: Option<T>,
117113
}
118114

119115
impl Surface {
@@ -337,7 +333,10 @@ impl Global {
337333
.texture
338334
.map(|texture| fid.assign(resource::Fallible::Valid(texture)));
339335

340-
Ok(SurfaceOutput { status, texture_id })
336+
Ok(SurfaceOutput {
337+
status,
338+
texture: texture_id,
339+
})
341340
}
342341

343342
pub fn surface_present(&self, surface_id: id::SurfaceId) -> Result<Status, SurfaceError> {

wgpu/src/backend/wgpu_core.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,10 @@ impl dispatch::SurfaceInterface for CoreSurface {
34843484
.into();
34853485

34863486
match self.context.0.surface_get_current_texture(self.id, None) {
3487-
Ok(wgc::present::SurfaceOutput { status, texture_id }) => {
3487+
Ok(wgc::present::SurfaceOutput {
3488+
status,
3489+
texture: texture_id,
3490+
}) => {
34883491
let data = texture_id
34893492
.map(|id| CoreTexture {
34903493
context: self.context.clone(),

0 commit comments

Comments
 (0)