pub struct Gpu { /* private fields */ }
Expand description
A struct that wraps over Rc<Gpu>
which can be passed around by clone.
Because this is a Rc
, it will automatically be freed when there are no
more references to it. It follows that any struct with a GpuHandle
will be
always be guaranteed a valid reference to the Gpu
.
Implementations§
Source§impl Gpu
impl Gpu
Sourcepub fn new_viewport(&self, window: Window) -> ViewportBuilder
pub fn new_viewport(&self, window: Window) -> ViewportBuilder
Create a Viewport for displaying to the given window.
pub fn create_viewport(&self, window: Window) -> Viewport
pub fn new_buffer<'a>(&self, label: &'a str) -> BufferBuilder<'a>
pub fn new_pipeline<'a>(&self, label: &'a str) -> PipelineBuilder<'a>
pub fn create_command_encoder(&self, label: &str) -> CommandEncoder
pub fn total_statistics(&self) -> Result<[u64; 5], GpuError>
pub fn timestamp_report(&self) -> Vec<(String, f32)>
pub fn builder<'a>() -> GpuBuilder<'a>
Source§impl Gpu
impl Gpu
pub fn new_sampler<'a, 'gpu>( &'gpu self, label: &'a str, ) -> SamplerBuilder<'a, 'gpu>
Source§impl Gpu
impl Gpu
pub fn new_texture<'a>(&self, label: &'a str) -> TextureBuilder<'a>
Source§impl Gpu
impl Gpu
pub fn new_compute(&self) -> ComputePipelineBuilder<'_>
Methods from Deref<Target = Device>§
Sourcepub fn poll(&self, maintain: Maintain)
pub fn poll(&self, maintain: Maintain)
Check for resource cleanups and mapping callbacks.
no-op on the web, device is automatically polled.
Sourcepub fn features(&self) -> Features
pub fn features(&self) -> Features
List all features that may be used with this device.
Functions may panic if you use unsupported features.
Sourcepub fn limits(&self) -> Limits
pub fn limits(&self) -> Limits
List all limits that were requested of this device.
If any of these limits are exceeded, functions may panic.
Sourcepub fn create_shader_module(
&self,
desc: &ShaderModuleDescriptor<'_>,
) -> ShaderModule
pub fn create_shader_module( &self, desc: &ShaderModuleDescriptor<'_>, ) -> ShaderModule
Creates a shader module from either SPIR-V or WGSL source code.
Sourcepub unsafe fn create_shader_module_unchecked(
&self,
desc: &ShaderModuleDescriptor<'_>,
) -> ShaderModule
pub unsafe fn create_shader_module_unchecked( &self, desc: &ShaderModuleDescriptor<'_>, ) -> ShaderModule
Creates a shader module from either SPIR-V or WGSL source code without runtime checks.
§Safety
In contrast with create_shader_module
this function
creates a shader module without runtime checks which allows shaders to perform
operations which can lead to undefined behavior like indexing out of bounds, thus it’s
the caller responsibility to pass a shader which doesn’t perform any of this
operations.
This has no effect on web.
Sourcepub unsafe fn create_shader_module_spirv(
&self,
desc: &ShaderModuleDescriptorSpirV<'_>,
) -> ShaderModule
pub unsafe fn create_shader_module_spirv( &self, desc: &ShaderModuleDescriptorSpirV<'_>, ) -> ShaderModule
Creates a shader module from SPIR-V binary directly.
§Safety
This function passes binary data to the backend as-is and can potentially result in a driver crash or bogus behaviour. No attempt is made to ensure that data is valid SPIR-V.
See also include_spirv_raw!
and util::make_spirv_raw
.
Sourcepub fn create_command_encoder(
&self,
desc: &CommandEncoderDescriptor<Option<&str>>,
) -> CommandEncoder
pub fn create_command_encoder( &self, desc: &CommandEncoderDescriptor<Option<&str>>, ) -> CommandEncoder
Creates an empty CommandEncoder
.
Sourcepub fn create_render_bundle_encoder(
&self,
desc: &RenderBundleEncoderDescriptor<'_>,
) -> RenderBundleEncoder<'_>
pub fn create_render_bundle_encoder( &self, desc: &RenderBundleEncoderDescriptor<'_>, ) -> RenderBundleEncoder<'_>
Creates an empty RenderBundleEncoder
.
Sourcepub fn create_bind_group(&self, desc: &BindGroupDescriptor<'_>) -> BindGroup
pub fn create_bind_group(&self, desc: &BindGroupDescriptor<'_>) -> BindGroup
Creates a new BindGroup
.
Sourcepub fn create_bind_group_layout(
&self,
desc: &BindGroupLayoutDescriptor<'_>,
) -> BindGroupLayout
pub fn create_bind_group_layout( &self, desc: &BindGroupLayoutDescriptor<'_>, ) -> BindGroupLayout
Creates a BindGroupLayout
.
Sourcepub fn create_pipeline_layout(
&self,
desc: &PipelineLayoutDescriptor<'_>,
) -> PipelineLayout
pub fn create_pipeline_layout( &self, desc: &PipelineLayoutDescriptor<'_>, ) -> PipelineLayout
Creates a PipelineLayout
.
Sourcepub fn create_render_pipeline(
&self,
desc: &RenderPipelineDescriptor<'_>,
) -> RenderPipeline
pub fn create_render_pipeline( &self, desc: &RenderPipelineDescriptor<'_>, ) -> RenderPipeline
Creates a RenderPipeline
.
Sourcepub fn create_compute_pipeline(
&self,
desc: &ComputePipelineDescriptor<'_>,
) -> ComputePipeline
pub fn create_compute_pipeline( &self, desc: &ComputePipelineDescriptor<'_>, ) -> ComputePipeline
Creates a ComputePipeline
.
Sourcepub fn create_buffer(&self, desc: &BufferDescriptor<Option<&str>>) -> Buffer
pub fn create_buffer(&self, desc: &BufferDescriptor<Option<&str>>) -> Buffer
Creates a Buffer
.
Sourcepub fn create_texture(&self, desc: &TextureDescriptor<Option<&str>>) -> Texture
pub fn create_texture(&self, desc: &TextureDescriptor<Option<&str>>) -> Texture
Creates a new Texture
.
desc
specifies the general format of the texture.
Sourcepub unsafe fn create_texture_from_hal<A>(
&self,
hal_texture: <A as Api>::Texture,
desc: &TextureDescriptor<Option<&str>>,
) -> Texturewhere
A: HalApi,
pub unsafe fn create_texture_from_hal<A>(
&self,
hal_texture: <A as Api>::Texture,
desc: &TextureDescriptor<Option<&str>>,
) -> Texturewhere
A: HalApi,
Sourcepub fn create_sampler(&self, desc: &SamplerDescriptor<'_>) -> Sampler
pub fn create_sampler(&self, desc: &SamplerDescriptor<'_>) -> Sampler
Creates a new Sampler
.
desc
specifies the behavior of the sampler.
Sourcepub fn create_query_set(
&self,
desc: &QuerySetDescriptor<Option<&str>>,
) -> QuerySet
pub fn create_query_set( &self, desc: &QuerySetDescriptor<Option<&str>>, ) -> QuerySet
Creates a new QuerySet
.
Sourcepub fn on_uncaptured_error(&self, handler: impl UncapturedErrorHandler)
pub fn on_uncaptured_error(&self, handler: impl UncapturedErrorHandler)
Set a callback for errors that are not handled in error scopes.
Sourcepub fn push_error_scope(&self, filter: ErrorFilter)
pub fn push_error_scope(&self, filter: ErrorFilter)
Push an error scope.
Sourcepub fn pop_error_scope(&self) -> impl Future<Output = Option<Error>> + Send
pub fn pop_error_scope(&self) -> impl Future<Output = Option<Error>> + Send
Pop an error scope.
Sourcepub fn start_capture(&self)
pub fn start_capture(&self)
Starts frame capture.
Sourcepub fn stop_capture(&self)
pub fn stop_capture(&self)
Stops frame capture.