diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index 8ad5dc37b4..f525c90ebb 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -168,7 +168,7 @@ impl RenderBundleEncoder { parent_id, context: RenderPassContext { attachments: AttachmentData { - colors: if desc.color_formats.len() > hal::MAX_COLOR_TARGETS { + colors: if desc.color_formats.len() > hal::MAX_COLOR_ATTACHMENTS { return Err(CreateRenderBundleError::TooManyColorAttachments); } else { desc.color_formats.iter().cloned().collect() diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 76cdeb0b64..ae54a1202f 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -182,7 +182,7 @@ pub struct RenderPassDescriptor<'a> { pub struct RenderPass { base: BasePass, parent_id: id::CommandEncoderId, - color_targets: ArrayVec, + color_targets: ArrayVec, depth_stencil_target: Option, // Resource binding dedupe state. @@ -589,7 +589,7 @@ impl TextureView { } } -const MAX_TOTAL_ATTACHMENTS: usize = hal::MAX_COLOR_TARGETS + hal::MAX_COLOR_TARGETS + 1; +const MAX_TOTAL_ATTACHMENTS: usize = hal::MAX_COLOR_ATTACHMENTS + hal::MAX_COLOR_ATTACHMENTS + 1; type AttachmentDataVec = ArrayVec; struct RenderPassInfo<'a, A: HalApi> { @@ -726,7 +726,7 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> { Ok(()) }; - let mut colors = ArrayVec::, { hal::MAX_COLOR_TARGETS }>::new(); + let mut colors = ArrayVec::, { hal::MAX_COLOR_ATTACHMENTS }>::new(); let mut depth_stencil = None; if let Some(at) = depth_stencil_attachment { diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 55c9697151..7fe2b7b482 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -52,8 +52,8 @@ pub enum HostMap { #[derive(Clone, Debug, Hash, PartialEq)] #[cfg_attr(feature = "serial-pass", derive(serde::Deserialize, serde::Serialize))] pub(crate) struct AttachmentData { - pub colors: ArrayVec, - pub resolves: ArrayVec, + pub colors: ArrayVec, + pub resolves: ArrayVec, pub depth_stencil: Option, } impl Eq for AttachmentData {} @@ -78,8 +78,8 @@ pub(crate) struct RenderPassContext { pub enum RenderPassCompatibilityError { #[error("Incompatible color attachment: the renderpass expected {0:?} but was given {1:?}")] IncompatibleColorAttachment( - ArrayVec, - ArrayVec, + ArrayVec, + ArrayVec, ), #[error( "Incompatible depth-stencil attachment: the renderpass expected {0:?} but was given {1:?}" diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index ced62e09a6..be3c4c3368 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -48,7 +48,7 @@ pub mod resource; mod track; mod validation; -pub use hal::{api, MAX_BIND_GROUPS, MAX_COLOR_TARGETS, MAX_VERTEX_BUFFERS}; +pub use hal::{api, MAX_BIND_GROUPS, MAX_COLOR_ATTACHMENTS, MAX_VERTEX_BUFFERS}; use atomic::{AtomicUsize, Ordering}; diff --git a/wgpu-hal/src/dx12/command.rs b/wgpu-hal/src/dx12/command.rs index dc653911c5..8d1c5e1735 100644 --- a/wgpu-hal/src/dx12/command.rs +++ b/wgpu-hal/src/dx12/command.rs @@ -580,7 +580,7 @@ impl crate::CommandEncoder for super::CommandEncoder { unsafe fn begin_render_pass(&mut self, desc: &crate::RenderPassDescriptor) { self.begin_pass(super::PassKind::Render, desc.label); - let mut color_views = [native::CpuDescriptor { ptr: 0 }; crate::MAX_COLOR_TARGETS]; + let mut color_views = [native::CpuDescriptor { ptr: 0 }; crate::MAX_COLOR_ATTACHMENTS]; for (rtv, cat) in color_views.iter_mut().zip(desc.color_attachments.iter()) { *rtv = cat.target.view.handle_rtv.unwrap().raw; } diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index 089f8c9f43..e5358cf05d 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -287,7 +287,7 @@ enum PassKind { struct PassState { has_label: bool, - resolves: ArrayVec, + resolves: ArrayVec, layout: PipelineLayoutShared, root_elements: [RootElement; MAX_ROOT_ELEMENTS], dirty_root_elements: u64, diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 857945377b..8916fac681 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -17,14 +17,14 @@ pub(super) struct State { vertex_buffers: [(super::VertexBufferDesc, Option); crate::MAX_VERTEX_BUFFERS], vertex_attributes: ArrayVec, - color_targets: ArrayVec, + color_targets: ArrayVec, stencil: super::StencilState, depth_bias: wgt::DepthBiasState, samplers: [Option; super::MAX_SAMPLERS], texture_slots: [TextureSlotDesc; super::MAX_TEXTURE_SLOTS], render_size: wgt::Extent3d, - resolve_attachments: ArrayVec<(u32, super::TextureView), { crate::MAX_COLOR_TARGETS }>, - invalidate_attachments: ArrayVec, + resolve_attachments: ArrayVec<(u32, super::TextureView), { crate::MAX_COLOR_ATTACHMENTS }>, + invalidate_attachments: ArrayVec, has_pass_label: bool, instance_vbuf_mask: usize, dirty_vbuf_mask: usize, diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index 469213752d..ec0d39fc19 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -567,7 +567,7 @@ struct PrimitiveState { unclipped_depth: bool, } -type InvalidatedAttachments = ArrayVec; +type InvalidatedAttachments = ArrayVec; #[derive(Debug)] enum Command { diff --git a/wgpu-hal/src/gles/queue.rs b/wgpu-hal/src/gles/queue.rs index 619710b6fd..2bac960184 100644 --- a/wgpu-hal/src/gles/queue.rs +++ b/wgpu-hal/src/gles/queue.rs @@ -50,7 +50,7 @@ impl super::Queue { // Reset the draw buffers to what they were before the clear let indices = (0..self.draw_buffer_count as u32) .map(|i| glow::COLOR_ATTACHMENT0 + i) - .collect::>(); + .collect::>(); gl.draw_buffers(&indices); } #[cfg(not(target_arch = "wasm32"))] @@ -693,7 +693,7 @@ impl super::Queue { None, 0, ); - for i in 0..crate::MAX_COLOR_TARGETS { + for i in 0..crate::MAX_COLOR_ATTACHMENTS { let target = glow::COLOR_ATTACHMENT0 + i as u32; gl.framebuffer_texture_2d( glow::DRAW_FRAMEBUFFER, @@ -748,7 +748,7 @@ impl super::Queue { self.draw_buffer_count = count; let indices = (0..count as u32) .map(|i| glow::COLOR_ATTACHMENT0 + i) - .collect::>(); + .collect::>(); gl.draw_buffers(&indices); if self diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index e6b5fc9b80..cf43d7d453 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -97,7 +97,7 @@ use thiserror::Error; pub const MAX_ANISOTROPY: u8 = 16; pub const MAX_BIND_GROUPS: usize = 8; pub const MAX_VERTEX_BUFFERS: usize = 16; -pub const MAX_COLOR_TARGETS: usize = 8; +pub const MAX_COLOR_ATTACHMENTS: usize = 8; pub const MAX_MIP_LEVELS: u32 = 16; /// Size of a single occlusion/timestamp query, when copied into a buffer, in bytes. pub const QUERY_SIZE: wgt::BufferAddress = 8; diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index e7a7eb23e6..29ca466a6f 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -41,7 +41,7 @@ use ash::{ use parking_lot::Mutex; const MILLIS_TO_NANOS: u64 = 1_000_000; -const MAX_TOTAL_ATTACHMENTS: usize = crate::MAX_COLOR_TARGETS * 2 + 1; +const MAX_TOTAL_ATTACHMENTS: usize = crate::MAX_COLOR_ATTACHMENTS * 2 + 1; pub type DropGuard = Box; @@ -212,7 +212,7 @@ struct DepthStencilAttachmentKey { #[derive(Clone, Eq, Default, Hash, PartialEq)] struct RenderPassKey { - colors: ArrayVec, + colors: ArrayVec, depth_stencil: Option, sample_count: u32, multiview: Option, diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 1d9a32d9a6..fcac1d53ed 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -2027,7 +2027,7 @@ impl crate::Context for Context { resolve_target: ca.resolve_target.map(|rt| rt.id), channel: map_pass_channel(Some(&ca.ops)), }) - .collect::>(); + .collect::>(); let depth_stencil = desc.depth_stencil_attachment.as_ref().map(|dsa| { wgc::command::RenderPassDepthStencilAttachment {