mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Add WebGPU identity management
Issue: https://github.com/servo/servo/issues/24706#issuecomment-557891841
This commit is contained in:
parent
ea32495504
commit
b26598d470
6 changed files with 72 additions and 13 deletions
|
@ -13,7 +13,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
|||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use servo_config::pref;
|
||||
use wgpu::adapter_get_info;
|
||||
use wgpu::TypedId;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum WebGPUResponse {
|
||||
|
@ -25,7 +24,11 @@ pub type WebGPUResponseResult = Result<WebGPUResponse, String>;
|
|||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum WebGPURequest {
|
||||
RequestAdapter(IpcSender<WebGPUResponseResult>, wgpu::RequestAdapterOptions),
|
||||
RequestAdapter(
|
||||
IpcSender<WebGPUResponseResult>,
|
||||
wgpu::RequestAdapterOptions,
|
||||
wgpu::AdapterId,
|
||||
),
|
||||
RequestDevice,
|
||||
Exit(IpcSender<()>),
|
||||
}
|
||||
|
@ -93,17 +96,8 @@ impl WGPU {
|
|||
fn run(mut self) {
|
||||
while let Ok(msg) = self.receiver.recv() {
|
||||
match msg {
|
||||
WebGPURequest::RequestAdapter(sender, options) => {
|
||||
let adapter_id = match wgpu::request_adapter(
|
||||
&self.global,
|
||||
&options,
|
||||
// TODO: The ids we pass here should be generated by the client
|
||||
&[
|
||||
wgpu::Id::zip(0, 0, wgpu::Backend::Vulkan),
|
||||
wgpu::Id::zip(0, 0, wgpu::Backend::Metal),
|
||||
wgpu::Id::zip(0, 0, wgpu::Backend::Dx12),
|
||||
],
|
||||
) {
|
||||
WebGPURequest::RequestAdapter(sender, options, id) => {
|
||||
let adapter_id = match wgpu::request_adapter(&self.global, &options, &[id]) {
|
||||
Some(id) => id,
|
||||
None => {
|
||||
if let Err(e) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue