mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -8,10 +8,11 @@ use std::num::NonZeroU64;
|
|||
use webgpu::wgc::binding_model::{BindGroupEntry, BindingResource, BufferBinding};
|
||||
use webgpu::wgc::command as wgpu_com;
|
||||
use webgpu::wgc::pipeline::ProgrammableStageDescriptor;
|
||||
use webgpu::wgc::resource::TextureDescriptor;
|
||||
use webgpu::wgt::{self, AstcBlock, AstcChannel};
|
||||
|
||||
use super::bindings::codegen::Bindings::WebGPUBinding::{
|
||||
GPUProgrammableStage, GPUTextureDimension,
|
||||
GPUProgrammableStage, GPUTextureDescriptor, GPUTextureDimension,
|
||||
};
|
||||
use super::bindings::error::Error;
|
||||
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
|
||||
|
@ -506,6 +507,7 @@ impl<'a> From<&GPUObjectDescriptorBase> for Option<Cow<'a, str>> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn convert_bind_group_layout_entry(
|
||||
bgle: &GPUBindGroupLayoutEntry,
|
||||
device: &GPUDevice,
|
||||
|
@ -581,6 +583,28 @@ pub fn convert_bind_group_layout_entry(
|
|||
}))
|
||||
}
|
||||
|
||||
pub fn convert_texture_descriptor(
|
||||
descriptor: &GPUTextureDescriptor,
|
||||
device: &GPUDevice,
|
||||
) -> Fallible<(TextureDescriptor<'static>, wgt::Extent3d)> {
|
||||
let size = (&descriptor.size).try_into()?;
|
||||
let desc = TextureDescriptor {
|
||||
label: (&descriptor.parent).into(),
|
||||
size,
|
||||
mip_level_count: descriptor.mipLevelCount,
|
||||
sample_count: descriptor.sampleCount,
|
||||
dimension: descriptor.dimension.into(),
|
||||
format: device.validate_texture_format_required_features(&descriptor.format)?,
|
||||
usage: wgt::TextureUsages::from_bits_retain(descriptor.usage),
|
||||
view_formats: descriptor
|
||||
.viewFormats
|
||||
.iter()
|
||||
.map(|tf| device.validate_texture_format_required_features(tf))
|
||||
.collect::<Fallible<_>>()?,
|
||||
};
|
||||
Ok((desc, size))
|
||||
}
|
||||
|
||||
impl TryFrom<&GPUColor> for wgt::Color {
|
||||
type Error = Error;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue