update synchronization, fix last errors in wgc

This commit is contained in:
Dzmitry Malyshau
2021-06-08 01:19:18 -04:00
parent 0a82c232ba
commit ff2a3e84fc
16 changed files with 253 additions and 255 deletions

View File

@@ -15,6 +15,7 @@ license = "MPL-2.0"
[dependencies]
bitflags = "1.0"
raw-window-handle = "0.3"
smallvec = "1"
thiserror = "1"
wgt = { package = "wgpu-types", path = "../wgpu-types" }

View File

@@ -37,6 +37,12 @@ impl crate::Api for Api {
}
impl crate::Instance<Api> for Context {
unsafe fn create_surface(
&self,
rwh: &impl raw_window_handle::HasRawWindowHandle,
) -> Result<Context, crate::UnsupportedWindow> {
Ok(Context)
}
unsafe fn enumerate_adapters(&self) -> Vec<crate::ExposedAdapter<Api>> {
Vec::new()
}
@@ -266,10 +272,10 @@ impl crate::CommandBuffer<Api> for Encoder {
) {
}
// render
unsafe fn begin_render_pass(&mut self, desc: &crate::RenderPassDescriptor<Api>) {}
unsafe fn end_render_pass(&mut self) {}
unsafe fn begin_compute_pass(&mut self) {}
unsafe fn end_compute_pass(&mut self) {}
unsafe fn set_bind_group(
&mut self,
@@ -357,6 +363,11 @@ impl crate::CommandBuffer<Api> for Encoder {
) {
}
// compute
unsafe fn begin_compute_pass(&mut self) {}
unsafe fn end_compute_pass(&mut self) {}
unsafe fn set_compute_pipeline(&mut self, pipeline: &Resource) {}
unsafe fn dispatch(&mut self, count: [u32; 3]) {}

View File

@@ -96,6 +96,10 @@ pub enum SurfaceError {
Other(&'static str),
}
#[derive(Clone, Debug, PartialEq, Error)]
#[error("Window handle is not supported")]
pub struct UnsupportedWindow;
pub trait Api: Clone + Sized {
type Instance: Instance<Self>;
type Surface: Surface<Self>;
@@ -121,6 +125,10 @@ pub trait Api: Clone + Sized {
}
pub trait Instance<A: Api> {
unsafe fn create_surface(
&self,
rwh: &impl raw_window_handle::HasRawWindowHandle,
) -> Result<A::Surface, UnsupportedWindow>;
unsafe fn enumerate_adapters(&self) -> Vec<ExposedAdapter<A>>;
}