mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
webgpu: renovate gpucanvascontext and webgpu presentation to match the spec (#33521)
* Reimpl gpucanvascontext Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * ValidateTextureDescriptorAndCreateSwapChain Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * reconfigure Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * resize Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * work around deadlocks in wgpu core Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * match spec even more by moving all swapchain operations into one updatecontext Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * error handling Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * enable one test Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * label dummy texture Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * update expect Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * clean some expectation (they are not flaky anymore) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * one more Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * change for configuration change in update_wr_image Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * DEFAULT_IMAGE_FORMAT Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * introduce WebGPUImageDescriptor Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
0b2549f4cb
commit
05ecb8eddb
30 changed files with 795 additions and 483 deletions
|
@ -10,7 +10,7 @@ use base::id::PipelineId;
|
|||
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use webrender_api::units::DeviceIntSize;
|
||||
use webrender_api::{ImageFormat, ImageKey};
|
||||
use webrender_api::ImageKey;
|
||||
use wgc::binding_model::{
|
||||
BindGroupDescriptor, BindGroupLayoutDescriptor, PipelineLayoutDescriptor,
|
||||
};
|
||||
|
@ -34,6 +34,14 @@ use crate::render_commands::RenderCommand;
|
|||
use crate::swapchain::WebGPUContextId;
|
||||
use crate::{Error, ErrorFilter, WebGPUResponse, PRESENTATION_BUFFER_COUNT};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
pub struct ContextConfiguration {
|
||||
pub device_id: id::DeviceId,
|
||||
pub queue_id: id::QueueId,
|
||||
pub format: wgt::TextureFormat,
|
||||
pub is_opaque: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum WebGPURequest {
|
||||
BufferMapAsync {
|
||||
|
@ -103,7 +111,6 @@ pub enum WebGPURequest {
|
|||
/// present only on ASYNC versions
|
||||
async_sender: Option<IpcSender<WebGPUResponse>>,
|
||||
},
|
||||
CreateContext(IpcSender<(WebGPUContextId, ImageKey)>),
|
||||
CreatePipelineLayout {
|
||||
device_id: id::DeviceId,
|
||||
pipeline_layout_id: id::PipelineLayoutId,
|
||||
|
@ -129,14 +136,31 @@ pub enum WebGPURequest {
|
|||
label: Option<String>,
|
||||
sender: IpcSender<WebGPUResponse>,
|
||||
},
|
||||
CreateSwapChain {
|
||||
device_id: id::DeviceId,
|
||||
queue_id: id::QueueId,
|
||||
/// Creates context
|
||||
CreateContext {
|
||||
buffer_ids: ArrayVec<id::BufferId, PRESENTATION_BUFFER_COUNT>,
|
||||
context_id: WebGPUContextId,
|
||||
image_key: ImageKey,
|
||||
format: ImageFormat,
|
||||
size: DeviceIntSize,
|
||||
sender: IpcSender<(WebGPUContextId, ImageKey)>,
|
||||
},
|
||||
/// Recreates swapchain (if needed)
|
||||
UpdateContext {
|
||||
context_id: WebGPUContextId,
|
||||
size: DeviceIntSize,
|
||||
configuration: Option<ContextConfiguration>,
|
||||
},
|
||||
/// Reads texture to swapchains buffer and maps it
|
||||
SwapChainPresent {
|
||||
context_id: WebGPUContextId,
|
||||
texture_id: id::TextureId,
|
||||
encoder_id: id::CommandEncoderId,
|
||||
},
|
||||
ValidateTextureDescriptor {
|
||||
device_id: id::DeviceId,
|
||||
texture_id: id::TextureId,
|
||||
descriptor: TextureDescriptor<'static>,
|
||||
},
|
||||
DestroyContext {
|
||||
context_id: WebGPUContextId,
|
||||
},
|
||||
CreateTexture {
|
||||
device_id: id::DeviceId,
|
||||
|
@ -152,10 +176,6 @@ pub enum WebGPURequest {
|
|||
DestroyBuffer(id::BufferId),
|
||||
DestroyDevice(id::DeviceId),
|
||||
DestroyTexture(id::TextureId),
|
||||
DestroySwapChain {
|
||||
context_id: WebGPUContextId,
|
||||
image_key: ImageKey,
|
||||
},
|
||||
DropTexture(id::TextureId),
|
||||
DropAdapter(id::AdapterId),
|
||||
DropDevice(id::DeviceId),
|
||||
|
@ -254,11 +274,6 @@ pub enum WebGPURequest {
|
|||
queue_id: id::QueueId,
|
||||
command_buffers: Vec<id::CommandBufferId>,
|
||||
},
|
||||
SwapChainPresent {
|
||||
context_id: WebGPUContextId,
|
||||
texture_id: id::TextureId,
|
||||
encoder_id: id::CommandEncoderId,
|
||||
},
|
||||
UnmapBuffer {
|
||||
buffer_id: id::BufferId,
|
||||
array_buffer: IpcSharedMemory,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue