mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Use common types from wgpu-types
This commit is contained in:
@@ -27,14 +27,14 @@ vulkan = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "8a038ba66e70f47dac87ae767588d433eb22d0d0"
|
||||
rev = "d7ee89018bed6b2e050b8160b2bd837d89f598a6"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "8a038ba66e70f47dac87ae767588d433eb22d0d0"
|
||||
rev = "d7ee89018bed6b2e050b8160b2bd837d89f598a6"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -193,16 +193,16 @@ impl framework::Example for Example {
|
||||
for i in 0..2 {
|
||||
particle_bind_groups.push(device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &compute_bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(sim_param_buffer.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::Buffer(particle_buffers[i].slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::Buffer(
|
||||
particle_buffers[(i + 1) % 2].slice(..), // bind to opposite buffer
|
||||
|
||||
@@ -216,16 +216,16 @@ impl framework::Example for Example {
|
||||
// Create bind group
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
label: None,
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(storage_buffer.slice(..)),
|
||||
}],
|
||||
|
||||
@@ -169,12 +169,12 @@ impl Example {
|
||||
for target_mip in 1..mip_count as usize {
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::TextureView(&views[target_mip - 1]),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
@@ -314,16 +314,16 @@ impl framework::Example for Example {
|
||||
// Create bind group
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
|
||||
@@ -260,7 +260,7 @@ impl framework::Example for Example {
|
||||
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &local_bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(plane_uniform_buf.slice(..)),
|
||||
}],
|
||||
@@ -334,7 +334,7 @@ impl framework::Example for Example {
|
||||
index_count: cube_index_data.len(),
|
||||
bind_group: device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &local_bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
}],
|
||||
@@ -454,7 +454,7 @@ impl framework::Example for Example {
|
||||
// Create bind group
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
}],
|
||||
@@ -568,20 +568,20 @@ impl framework::Example for Example {
|
||||
// Create bind group
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::Buffer(light_uniform_buf.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::TextureView(&shadow_view),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 3,
|
||||
resource: wgpu::BindingResource::Sampler(&shadow_sampler),
|
||||
},
|
||||
|
||||
@@ -214,16 +214,16 @@ impl framework::Example for Skybox {
|
||||
});
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
|
||||
@@ -156,7 +156,7 @@ impl framework::Example for Example {
|
||||
|
||||
let bind_group0 = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(buffer0.slice(..)),
|
||||
}],
|
||||
@@ -165,7 +165,7 @@ impl framework::Example for Example {
|
||||
|
||||
let bind_group1 = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(buffer1.slice(..)),
|
||||
}],
|
||||
@@ -272,15 +272,15 @@ impl framework::Example for Example {
|
||||
});
|
||||
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::TextureViewArray(&[
|
||||
red_texture_view,
|
||||
green_texture_view,
|
||||
]),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
|
||||
@@ -231,24 +231,24 @@ impl Example {
|
||||
|
||||
let water_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: water_bind_group_layout,
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
entries: &[
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(water_uniforms.slice(..)),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(
|
||||
&reflection_texture.create_default_view(),
|
||||
),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::TextureView(
|
||||
&draw_depth_buffer.create_default_view(),
|
||||
),
|
||||
},
|
||||
wgpu::Binding {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 3,
|
||||
resource: wgpu::BindingResource::Sampler(&sampler),
|
||||
},
|
||||
@@ -457,7 +457,7 @@ impl framework::Example for Example {
|
||||
|
||||
let terrain_normal_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &terrain_bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(terrain_normal_uniform_buf.slice(..)),
|
||||
}],
|
||||
@@ -465,7 +465,7 @@ impl framework::Example for Example {
|
||||
});
|
||||
let terrain_flipped_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &terrain_bind_group_layout,
|
||||
bindings: &[wgpu::Binding {
|
||||
entries: &[wgpu::BindGroupEntry {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::Buffer(terrain_flipped_uniform_buf.slice(..)),
|
||||
}],
|
||||
|
||||
@@ -455,7 +455,7 @@ impl crate::Context for Context {
|
||||
|
||||
fn instance_request_adapter(
|
||||
&self,
|
||||
options: &crate::RequestAdapterOptions<'_>,
|
||||
options: &crate::RequestAdapterOptions,
|
||||
) -> Self::RequestAdapterFuture {
|
||||
let id = self.pick_adapter(
|
||||
&wgc::instance::RequestAdapterOptions {
|
||||
@@ -536,12 +536,12 @@ impl crate::Context for Context {
|
||||
use wgc::binding_model as bm;
|
||||
|
||||
let texture_view_arena: Arena<wgc::id::TextureViewId> = Arena::new();
|
||||
let bindings = desc
|
||||
.bindings
|
||||
let entries = desc
|
||||
.entries
|
||||
.iter()
|
||||
.map(|binding| bm::BindGroupEntry {
|
||||
binding: binding.binding,
|
||||
resource: match binding.resource {
|
||||
.map(|entry| bm::BindGroupEntry {
|
||||
binding: entry.binding,
|
||||
resource: match entry.resource {
|
||||
BindingResource::Buffer(ref buffer_slice) => {
|
||||
bm::BindingResource::Buffer(bm::BufferBinding {
|
||||
buffer_id: buffer_slice.buffer.id,
|
||||
@@ -570,7 +570,7 @@ impl crate::Context for Context {
|
||||
&bm::BindGroupDescriptor {
|
||||
label: desc.label,
|
||||
layout: desc.layout.id,
|
||||
entries: &bindings,
|
||||
entries: &entries,
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
@@ -593,8 +593,7 @@ impl crate::Context for Context {
|
||||
gfx_select!(*device => self.device_create_pipeline_layout(
|
||||
*device,
|
||||
&wgc::binding_model::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: temp_layouts.as_ptr(),
|
||||
bind_group_layouts_length: temp_layouts.len(),
|
||||
bind_group_layouts: &temp_layouts,
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
|
||||
@@ -843,7 +843,6 @@ impl crate::Context for Context {
|
||||
bt::ReadonlyStorageTexture
|
||||
}
|
||||
BindingType::StorageTexture { .. } => bt::WriteonlyStorageTexture,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
assert!(
|
||||
@@ -904,7 +903,7 @@ impl crate::Context for Context {
|
||||
desc: &BindGroupDescriptor,
|
||||
) -> Self::BindGroupId {
|
||||
let mapped_entries = desc
|
||||
.bindings
|
||||
.entries
|
||||
.iter()
|
||||
.map(|binding| {
|
||||
let mapped_resource = match &binding.resource {
|
||||
|
||||
191
wgpu/src/lib.rs
191
wgpu/src/lib.rs
@@ -395,16 +395,6 @@ pub struct Adapter {
|
||||
id: <C as Context>::AdapterId,
|
||||
}
|
||||
|
||||
/// Options for requesting adapter.
|
||||
#[derive(Clone)]
|
||||
pub struct RequestAdapterOptions<'a> {
|
||||
/// Power preference for the adapter.
|
||||
pub power_preference: PowerPreference,
|
||||
/// Surface that is required to be presentable with the requested adapter. This does not
|
||||
/// create the surface, only guarantees that the adapter can present to said surface.
|
||||
pub compatible_surface: Option<&'a Surface>,
|
||||
}
|
||||
|
||||
/// Open connection to a graphics and/or compute device.
|
||||
///
|
||||
/// Responsible for the creation of most rendering and compute resources.
|
||||
@@ -801,104 +791,6 @@ pub enum BindingResource<'a> {
|
||||
TextureViewArray(&'a [TextureView]),
|
||||
}
|
||||
|
||||
/// Bindable resource and the slot to bind it to.
|
||||
pub struct Binding<'a> {
|
||||
/// Slot for which binding provides resource. Corresponds to an entry of the same
|
||||
/// binding index in the [`BindGroupLayoutDescriptor`].
|
||||
pub binding: u32,
|
||||
/// Resource to attach to the binding
|
||||
pub resource: BindingResource<'a>,
|
||||
}
|
||||
|
||||
/// Describes a group of bindings and the resources to be bound.
|
||||
#[derive(Clone)]
|
||||
pub struct BindGroupDescriptor<'a> {
|
||||
/// The [`BindGroupLayout`] that corresponds to this bind group.
|
||||
pub layout: &'a BindGroupLayout,
|
||||
|
||||
/// The resources to bind to this bind group.
|
||||
pub bindings: &'a [Binding<'a>],
|
||||
|
||||
/// Debug label of the bind group. This will show up in graphics debuggers for easy identification.
|
||||
pub label: Option<&'a str>,
|
||||
}
|
||||
|
||||
/// Describes a pipeline layout.
|
||||
///
|
||||
/// A `PipelineLayoutDescriptor` can be passed to [`Device::create_pipeline_layout`] to obtain a
|
||||
/// [`PipelineLayout`].
|
||||
#[derive(Clone)]
|
||||
pub struct PipelineLayoutDescriptor<'a> {
|
||||
/// Bind groups that this pipeline uses. The first entry will provide all the bindings for
|
||||
/// "set = 0", second entry will provide all the bindings for "set = 1" etc.
|
||||
pub bind_group_layouts: &'a [&'a BindGroupLayout],
|
||||
}
|
||||
|
||||
/// Describes a programmable pipeline stage.
|
||||
#[derive(Clone)]
|
||||
pub struct ProgrammableStageDescriptor<'a> {
|
||||
/// The compiled shader module for this stage.
|
||||
pub module: &'a ShaderModule,
|
||||
|
||||
/// The name of the entry point in the compiled shader. There must be a function that returns
|
||||
/// void with this name in the shader.
|
||||
pub entry_point: &'a str,
|
||||
}
|
||||
|
||||
/// Describes a render (graphics) pipeline.
|
||||
#[derive(Clone)]
|
||||
pub struct RenderPipelineDescriptor<'a> {
|
||||
/// The layout of bind groups for this pipeline.
|
||||
pub layout: &'a PipelineLayout,
|
||||
|
||||
/// The compiled vertex stage and its entry point.
|
||||
pub vertex_stage: ProgrammableStageDescriptor<'a>,
|
||||
|
||||
/// The compiled fragment stage and its entry point, if any.
|
||||
pub fragment_stage: Option<ProgrammableStageDescriptor<'a>>,
|
||||
|
||||
/// The rasterization process for this pipeline.
|
||||
pub rasterization_state: Option<RasterizationStateDescriptor>,
|
||||
|
||||
/// The primitive topology used to interpret vertices.
|
||||
pub primitive_topology: PrimitiveTopology,
|
||||
|
||||
/// The effect of draw calls on the color aspect of the output target.
|
||||
pub color_states: &'a [ColorStateDescriptor],
|
||||
|
||||
/// The effect of draw calls on the depth and stencil aspects of the output target, if any.
|
||||
pub depth_stencil_state: Option<DepthStencilStateDescriptor>,
|
||||
|
||||
/// The vertex input state for this pipeline.
|
||||
pub vertex_state: VertexStateDescriptor<'a>,
|
||||
|
||||
/// The number of samples calculated per pixel (for MSAA). For non-multisampled textures,
|
||||
/// this should be `1`
|
||||
pub sample_count: u32,
|
||||
|
||||
/// Bitmask that restricts the samples of a pixel modified by this pipeline. All samples
|
||||
/// can be enabled using the value `!0`
|
||||
pub sample_mask: u32,
|
||||
|
||||
/// When enabled, produces another sample mask per pixel based on the alpha output value, that
|
||||
/// is ANDed with the sample_mask and the primitive coverage to restrict the set of samples
|
||||
/// affected by a primitive.
|
||||
///
|
||||
/// The implicit mask produced for alpha of zero is guaranteed to be zero, and for alpha of one
|
||||
/// is guaranteed to be all 1-s.
|
||||
pub alpha_to_coverage_enabled: bool,
|
||||
}
|
||||
|
||||
/// Describes a compute pipeline.
|
||||
#[derive(Clone)]
|
||||
pub struct ComputePipelineDescriptor<'a> {
|
||||
/// The layout of bind groups for this pipeline.
|
||||
pub layout: &'a PipelineLayout,
|
||||
|
||||
/// The compiled compute stage and its entry point.
|
||||
pub compute_stage: ProgrammableStageDescriptor<'a>,
|
||||
}
|
||||
|
||||
/// Operation to perform to the output attachment at the start of a renderpass.
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq)]
|
||||
pub enum LoadOp<V> {
|
||||
@@ -927,6 +819,7 @@ pub struct RenderPassColorAttachmentDescriptor<'a> {
|
||||
/// What operations will be performed on this color attachment.
|
||||
pub ops: Operations<Color>,
|
||||
}
|
||||
|
||||
/// Describes a depth/stencil attachment to a [`RenderPass`].
|
||||
#[derive(Clone)]
|
||||
pub struct RenderPassDepthStencilAttachmentDescriptor<'a> {
|
||||
@@ -938,18 +831,12 @@ pub struct RenderPassDepthStencilAttachmentDescriptor<'a> {
|
||||
pub stencil_ops: Option<Operations<u32>>,
|
||||
}
|
||||
|
||||
/// Describes the attachments of a [`RenderPass`].
|
||||
#[derive(Clone)]
|
||||
pub struct RenderPassDescriptor<'a, 'b> {
|
||||
/// The color attachments of the render pass.
|
||||
pub color_attachments: &'b [RenderPassColorAttachmentDescriptor<'a>],
|
||||
|
||||
/// The depth and stencil attachment of the render pass, if any.
|
||||
pub depth_stencil_attachment: Option<RenderPassDepthStencilAttachmentDescriptor<'a>>,
|
||||
}
|
||||
|
||||
// The underlying types are also exported so that documentation shows up for them
|
||||
|
||||
pub use wgt::RequestAdapterOptions as RequestAdapterOptionsBase;
|
||||
/// Additional information required when requesting an adapter.
|
||||
pub type RequestAdapterOptions<'a> = RequestAdapterOptionsBase<&'a Surface>;
|
||||
|
||||
pub use wgt::BufferDescriptor as BufferDescriptorBase;
|
||||
/// Describes a [`Buffer`].
|
||||
pub type BufferDescriptor<'a> = BufferDescriptorBase<Option<&'a str>>;
|
||||
@@ -974,6 +861,49 @@ pub use wgt::SamplerDescriptor as SamplerDescriptorBase;
|
||||
/// Describes a [`Sampler`].
|
||||
pub type SamplerDescriptor<'a> = SamplerDescriptorBase<Option<&'a str>>;
|
||||
|
||||
pub use wgt::BindGroupEntry as BindGroupEntryBase;
|
||||
/// Bindable resource and the slot to bind it to.
|
||||
pub type BindGroupEntry<'a> = BindGroupEntryBase<BindingResource<'a>>;
|
||||
|
||||
pub use wgt::BindGroupDescriptor as BindGroupDescriptorBase;
|
||||
/// Describes a group of bindings and the resources to be bound.
|
||||
pub type BindGroupDescriptor<'a> =
|
||||
BindGroupDescriptorBase<'a, &'a BindGroupLayout, BindGroupEntry<'a>>;
|
||||
|
||||
pub use wgt::PipelineLayoutDescriptor as PipelineLayoutDescriptorBase;
|
||||
/// Describes a pipeline layout.
|
||||
pub type PipelineLayoutDescriptor<'a> = PipelineLayoutDescriptorBase<'a, &'a BindGroupLayout>;
|
||||
|
||||
pub use wgt::ProgrammableStageDescriptor as ProgrammableStageDescriptorBase;
|
||||
/// Describes a programmable pipeline stage.
|
||||
pub type ProgrammableStageDescriptor<'a> = wgt::ProgrammableStageDescriptor<'a, &'a ShaderModule>;
|
||||
|
||||
pub use wgt::RenderPassDescriptor as RenderPassDescriptorBase;
|
||||
/// Describes the attachments of a [`RenderPass`];
|
||||
pub type RenderPassDescriptor<'a, 'b> = RenderPassDescriptorBase<
|
||||
'b,
|
||||
RenderPassColorAttachmentDescriptor<'a>,
|
||||
RenderPassDepthStencilAttachmentDescriptor<'a>,
|
||||
>;
|
||||
|
||||
pub use wgt::RenderPipelineDescriptor as RenderPipelineDescriptorBase;
|
||||
/// Describes a render (graphics) pipeline.
|
||||
pub type RenderPipelineDescriptor<'a> =
|
||||
RenderPipelineDescriptorBase<'a, &'a PipelineLayout, ProgrammableStageDescriptor<'a>>;
|
||||
|
||||
pub use ComputePipelineDescriptor as ComputePipelineDescriptorBase;
|
||||
/// Describes a compute pipeline.
|
||||
pub type ComputePipelineDescriptor<'a> =
|
||||
wgt::ComputePipelineDescriptor<&'a PipelineLayout, ProgrammableStageDescriptor<'a>>;
|
||||
|
||||
pub use wgt::BufferCopyView as BufferCopyViewBase;
|
||||
/// View of a buffer which can be used to copy to/from a texture.
|
||||
pub type BufferCopyView<'a> = BufferCopyViewBase<&'a Buffer>;
|
||||
|
||||
pub use wgt::TextureCopyView as TextureCopyViewBase;
|
||||
/// View of a texture which can be used to copy to/from a buffer/texture.
|
||||
pub type TextureCopyView<'a> = TextureCopyViewBase<&'a Texture>;
|
||||
|
||||
/// Swap chain image that can be rendered to.
|
||||
pub struct SwapChainTexture {
|
||||
/// Accessible view of the frame.
|
||||
@@ -1003,29 +933,6 @@ pub enum SwapChainError {
|
||||
OutOfMemory,
|
||||
}
|
||||
|
||||
/// View of a buffer which can be used to copy to/from a texture.
|
||||
#[derive(Clone)]
|
||||
pub struct BufferCopyView<'a> {
|
||||
/// The buffer to be copied to/from.
|
||||
pub buffer: &'a Buffer,
|
||||
|
||||
/// The layout of the texture data in this buffer.
|
||||
pub layout: TextureDataLayout,
|
||||
}
|
||||
|
||||
/// View of a texture which can be used to copy to/from a buffer/texture.
|
||||
#[derive(Clone)]
|
||||
pub struct TextureCopyView<'a> {
|
||||
/// The texture to be copied to/from.
|
||||
pub texture: &'a Texture,
|
||||
|
||||
/// The target mip level of the texture.
|
||||
pub mip_level: u32,
|
||||
|
||||
/// The base texel of the texture in the selected `mip_level`.
|
||||
pub origin: Origin3d,
|
||||
}
|
||||
|
||||
impl Instance {
|
||||
/// Create an new instance of wgpu.
|
||||
///
|
||||
@@ -1065,7 +972,7 @@ impl Instance {
|
||||
/// If no adapters are found that suffice all the "hard" options, `None` is returned.
|
||||
pub fn request_adapter(
|
||||
&self,
|
||||
options: &RequestAdapterOptions<'_>,
|
||||
options: &RequestAdapterOptions,
|
||||
) -> impl Future<Output = Option<Adapter>> + Send {
|
||||
let context = Arc::clone(&self.context);
|
||||
self.context
|
||||
|
||||
Reference in New Issue
Block a user