framecapture

This commit is contained in:
adamnemecek 2021-04-01 12:51:50 -07:00
parent 45f890c11c
commit d91ad13482
6 changed files with 56 additions and 25 deletions

18
Cargo.lock generated
View File

@ -465,7 +465,7 @@ dependencies = [
[[package]]
name = "gfx-auxil"
version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"fxhash",
"gfx-hal",
@ -475,7 +475,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx11"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"arrayvec",
"bitflags",
@ -496,7 +496,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx12"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"arrayvec",
"bit-set",
@ -517,7 +517,7 @@ dependencies = [
[[package]]
name = "gfx-backend-empty"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"gfx-hal",
"log",
@ -527,7 +527,7 @@ dependencies = [
[[package]]
name = "gfx-backend-gl"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"arrayvec",
"bitflags",
@ -550,7 +550,7 @@ dependencies = [
[[package]]
name = "gfx-backend-metal"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"arrayvec",
"bitflags",
@ -575,7 +575,7 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"arrayvec",
"ash",
@ -595,7 +595,7 @@ dependencies = [
[[package]]
name = "gfx-hal"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
dependencies = [
"bitflags",
"naga",
@ -1171,7 +1171,7 @@ dependencies = [
[[package]]
name = "range-alloc"
version = "0.1.2"
source = "git+https://github.com/gfx-rs/gfx?rev=d002952029facee7aafd52c94230057df6dd298f#d002952029facee7aafd52c94230057df6dd298f"
source = "git+https://github.com/gfx-rs/gfx?rev=3c98acc515c22c8e1d78bbfaf16fc7201326e109#3c98acc515c22c8e1d78bbfaf16fc7201326e109"
[[package]]
name = "raw-window-handle"

View File

@ -40,24 +40,24 @@ thiserror = "1"
gpu-alloc = { git = "https://github.com/zakarumych/gpu-alloc.git", rev = "560ad651aa8f7aefcee8f5bcf41e67a84561bcda" }
gpu-descriptor = { version = "0.1" }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
[target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies]
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
[target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies]
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f", optional = true }
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109", optional = true }
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f", features = ["naga"] }
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109", features = ["naga"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d002952029facee7aafd52c94230057df6dd298f" }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "3c98acc515c22c8e1d78bbfaf16fc7201326e109" }
[dependencies.naga]
git = "https://github.com/gfx-rs/naga"

View File

@ -275,11 +275,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
});
}
if !cmd_buf.downlevel.flags.contains(wgt::DownlevelFlags::COMPUTE_SHADERS) {
if !cmd_buf
.downlevel
.flags
.contains(wgt::DownlevelFlags::COMPUTE_SHADERS)
{
return Err(ComputePassError {
scope: PassErrorScope::Pass(encoder_id),
inner: ComputePassErrorInner::ComputeShadersUnsupported,
})
});
}
if let Some(ref label) = base.label {

View File

@ -825,8 +825,7 @@ impl<'a, B: GfxBackend> RenderPassInfo<'a, B> {
.filter_map(|at| at.resolve_target)
.map(|attachment| view_guard.get(attachment).unwrap())
.collect(),
depth_stencil: depth_stencil_attachment
.map(|at| view_guard.get(at.view).unwrap()),
depth_stencil: depth_stencil_attachment.map(|at| view_guard.get(at.view).unwrap()),
};
let extent = extent.ok_or(RenderPassErrorInner::MissingAttachments)?;
let fb_key = FramebufferKey {

View File

@ -1861,7 +1861,11 @@ impl<B: GfxBackend> Device<B> {
),
pipeline::CreateComputePipelineError,
> {
if !self.downlevel.flags.contains(wgt::DownlevelFlags::COMPUTE_SHADERS) {
if !self
.downlevel
.flags
.contains(wgt::DownlevelFlags::COMPUTE_SHADERS)
{
return Err(pipeline::CreateComputePipelineError::ComputeShadersUnsupported);
}
@ -4763,4 +4767,28 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
//Note: outside inner function so no locks are held when calling the callback
.map(|pending_callback| fire_map_callbacks(pending_callback.into_iter()))
}
pub fn start_capture<B: GfxBackend>(
&self,
device_id: id::DeviceId,
) -> Result<(), InvalidDevice> {
let hub = B::hub(self);
let mut token = Token::root();
let (device_guard, _) = hub.devices.read(&mut token);
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
device.raw.start_capture();
Ok(())
}
pub fn stop_capture<B: GfxBackend>(
&self,
device_id: id::DeviceId,
) -> Result<(), InvalidDevice> {
let hub = B::hub(self);
let mut token = Token::root();
let (device_guard, _) = hub.devices.read(&mut token);
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
device.raw.stop_capture();
Ok(())
}
}

View File

@ -586,7 +586,7 @@ bitflags::bitflags! {
/// Supports samplers with anisotropic filtering
const ANISOTROPIC_FILTERING = 0x0000_0020;
/// All flags are in their compliant state.
const COMPLIANT = 0x0000_003F;
const COMPLIANT = 0x0000_003F;
}
}