Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudo async Create*PipelineAsync methods #31695

Merged
merged 3 commits into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/script/dom/bindings/codegen/Bindings.conf
Expand Up @@ -161,7 +161,7 @@ DOMInterfaces = {
},

'GPUDevice': {
'inRealms': ['PopErrorScope', 'GetLost'],
'inRealms': ['PopErrorScope', 'GetLost', 'CreateComputePipelineAsync', 'CreateRenderPipelineAsync'],
}

}
37 changes: 23 additions & 14 deletions components/script/dom/gpudevice.rs
Expand Up @@ -737,7 +737,18 @@ impl GPUDeviceMethods for GPUDevice {
)
}

/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder>
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipelineasync>
fn CreateComputePipelineAsync(
&self,
descriptor: &GPUComputePipelineDescriptor,
comp: InRealm,
) -> Rc<Promise> {
let promise = Promise::new_in_current_realm(comp);
promise.resolve_native(&self.CreateComputePipeline(descriptor));
promise
}

/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder
fn CreateCommandEncoder(
&self,
descriptor: &GPUCommandEncoderDescriptor,
Expand Down Expand Up @@ -1040,6 +1051,17 @@ impl GPUDeviceMethods for GPUDevice {
)
}

/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipelineasync>
fn CreateRenderPipelineAsync(
&self,
descriptor: &GPURenderPipelineDescriptor,
comp: InRealm,
) -> Rc<Promise> {
let promise = Promise::new_in_current_realm(comp);
promise.resolve_native(&self.CreateRenderPipeline(descriptor));
promise
}

/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderbundleencoder>
fn CreateRenderBundleEncoder(
&self,
Expand Down Expand Up @@ -1148,19 +1170,6 @@ impl GPUDeviceMethods for GPUDevice {
}
}
}

/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipelineasync>
fn CreateComputePipelineAsync(
&self,
_descriptor: &GPUComputePipelineDescriptor,
) -> Rc<Promise> {
todo!()
}

/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipelineasync>
fn CreateRenderPipelineAsync(&self, _descriptor: &GPURenderPipelineDescriptor) -> Rc<Promise> {
todo!()
}
}

impl Drop for GPUDevice {
Expand Down