pub mod compute;
pub mod gpu_power_level;
pub mod memory_flush;
pub mod native_debug;
pub mod shader_storage_buffer_object;
pub mod webgpu_init;
pub mod webgpu_init_from_window;
#[cfg(feature = "surface_extension")]
pub mod surface;
#[cfg(feature = "naga_translation")]
pub mod naga_translation;
pub use compute::{
CompileComputePassExt, ComputePass, ComputePassSubmitData, Dispatch, DispatchType,
NewComputeProgramExt,
};
pub use gpu_power_level::GpuPowerLevel;
pub use native_debug::NativeDebugConfiguration;
pub use shader_storage_buffer_object::{
NewShaderStorageBufferExt, ReadSyncedShaderStorageBufferExt, ShaderStorageBufferId,
};
pub use webgpu_init::WebGpuInit;
pub use webgpu_init_from_window::WebGpuInitFromWindow;
#[cfg(feature = "surface_extension")]
pub use surface::*;
#[cfg(feature = "naga_translation")]
pub use naga_translation::*;
use super::*;
#[derive(Default, Debug, Clone)]
pub struct Extensions {
pub(crate) extensions: Vec<Extension>,
}
impl Extensions {
pub fn new() -> Self {
Self::default()
}
pub fn flight_frames_count(&mut self, count: usize) -> &mut Self {
self.extensions.push(Extension::FlightFramesCount(count));
self
}
pub fn gpu_power_level(&mut self, power_level: GpuPowerLevel) -> &mut Self {
self.extensions.push(Extension::GpuPowerLevel(power_level));
self
}
pub fn native_debug(&mut self, cfg: NativeDebugConfiguration) -> &mut Self {
self.extensions.push(Extension::NativeDebug(cfg));
self
}
pub fn memory_flush(&mut self) -> &mut Self {
self.extensions.push(Extension::MemoryFlush);
self
}
#[cfg(feature = "naga_translation")]
pub fn naga_translation(&mut self) -> &mut Self {
self.extensions.push(Extension::NagaTranslation);
self
}
pub fn webgpu_init(&mut self, init: WebGpuInit) -> &mut Self {
self.extensions.push(Extension::WebGpuInit(init));
self
}
pub fn webgpu_init_from_window(&mut self, init: WebGpuInitFromWindow) -> &mut Self {
self.extensions.push(Extension::WebGpuInitFromWindow(init));
self
}
#[cfg(feature = "surface_extension")]
pub fn surface_extension(&mut self, cfg: SurfaceConfiguration) -> &mut Self {
self.extensions.push(Extension::Surface(cfg));
self
}
pub fn compute(&mut self) -> &mut Self {
self.extensions.push(Extension::Compute);
self
}
pub fn shader_storage_buffer_object(&mut self) -> &mut Self {
self.extensions.push(Extension::ShaderStorageBufferObject);
self
}
}
#[derive(Debug, Clone)]
pub enum Extension {
FlightFramesCount(usize),
GpuPowerLevel(GpuPowerLevel),
NativeDebug(NativeDebugConfiguration),
MemoryFlush,
NagaTranslation,
WebGpuInitFromWindow(WebGpuInitFromWindow),
WebGpuInit(WebGpuInit),
Surface(SurfaceConfiguration),
Compute,
ShaderStorageBufferObject,
}