mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
Merge #1017
1017: Rename output attachment usage r=grovesNL a=yzsolt **Connections** Implements #1001 **Description** Rename OUTPUT_ATTACHMENT texture usage to RENDER_ATTACHMENT to match the WebGPU spec **Testing** Ensure that `wgpu-rs` and `wgpu-native` build after the rename **TODO** - [ ] Update `wgpu-rs` - [ ] Update `wgpu-native` Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
This commit is contained in:
3 files changed
+20
-20
No files matched your search
@@ -466,13 +466,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
// instead of the special read-only one, which would be `None`.
|
||||
let mut is_ds_read_only = false;
|
||||
|
||||
struct OutputAttachment<'a> {
|
||||
struct RenderAttachment<'a> {
|
||||
texture_id: &'a Stored<id::TextureId>,
|
||||
selector: &'a TextureSelector,
|
||||
previous_use: Option<TextureUse>,
|
||||
new_use: TextureUse,
|
||||
}
|
||||
let mut output_attachments = AttachmentDataVec::<OutputAttachment>::new();
|
||||
let mut render_attachments = AttachmentDataVec::<RenderAttachment>::new();
|
||||
|
||||
let mut attachment_width = None;
|
||||
let mut attachment_height = None;
|
||||
@@ -542,7 +542,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
} else {
|
||||
TextureUse::ATTACHMENT_WRITE
|
||||
};
|
||||
output_attachments.push(OutputAttachment {
|
||||
render_attachments.push(RenderAttachment {
|
||||
texture_id: source_id,
|
||||
selector: &view.selector,
|
||||
previous_use,
|
||||
@@ -591,7 +591,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
.textures
|
||||
.query(source_id.value, view.selector.clone());
|
||||
let new_use = TextureUse::ATTACHMENT_WRITE;
|
||||
output_attachments.push(OutputAttachment {
|
||||
render_attachments.push(RenderAttachment {
|
||||
texture_id: source_id,
|
||||
selector: &view.selector,
|
||||
previous_use,
|
||||
@@ -668,7 +668,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
.textures
|
||||
.query(source_id.value, view.selector.clone());
|
||||
let new_use = TextureUse::ATTACHMENT_WRITE;
|
||||
output_attachments.push(OutputAttachment {
|
||||
render_attachments.push(RenderAttachment {
|
||||
texture_id: source_id,
|
||||
selector: &view.selector,
|
||||
previous_use,
|
||||
@@ -1587,31 +1587,31 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
raw.end_render_pass();
|
||||
}
|
||||
|
||||
for ot in output_attachments {
|
||||
let texture = &texture_guard[ot.texture_id.value];
|
||||
check_texture_usage(texture.usage, TextureUsage::OUTPUT_ATTACHMENT)?;
|
||||
for ra in render_attachments {
|
||||
let texture = &texture_guard[ra.texture_id.value];
|
||||
check_texture_usage(texture.usage, TextureUsage::RENDER_ATTACHMENT)?;
|
||||
|
||||
// the tracker set of the pass is always in "extend" mode
|
||||
trackers
|
||||
.textures
|
||||
.change_extend(
|
||||
ot.texture_id.value,
|
||||
&ot.texture_id.ref_count,
|
||||
ot.selector.clone(),
|
||||
ot.new_use,
|
||||
ra.texture_id.value,
|
||||
&ra.texture_id.ref_count,
|
||||
ra.selector.clone(),
|
||||
ra.new_use,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
if let Some(usage) = ot.previous_use {
|
||||
if let Some(usage) = ra.previous_use {
|
||||
// Make the attachment tracks to be aware of the internal
|
||||
// transition done by the render pass, by registering the
|
||||
// previous usage as the initial state.
|
||||
trackers
|
||||
.textures
|
||||
.prepend(
|
||||
ot.texture_id.value,
|
||||
&ot.texture_id.ref_count,
|
||||
ot.selector.clone(),
|
||||
ra.texture_id.value,
|
||||
&ra.texture_id.ref_count,
|
||||
ra.selector.clone(),
|
||||
usage,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -68,7 +68,7 @@ pub fn map_texture_usage(
|
||||
if usage.contains(W::STORAGE) {
|
||||
value |= U::STORAGE;
|
||||
}
|
||||
if usage.contains(W::OUTPUT_ATTACHMENT) {
|
||||
if usage.contains(W::RENDER_ATTACHMENT) {
|
||||
if aspects.intersects(hal::format::Aspects::DEPTH | hal::format::Aspects::STENCIL) {
|
||||
value |= U::DEPTH_STENCIL_ATTACHMENT;
|
||||
} else {
|
||||
|
||||
@@ -1315,8 +1315,8 @@ bitflags::bitflags! {
|
||||
const SAMPLED = 4;
|
||||
/// Allows a texture to be a [`BindingType::StorageTexture`] in a bind group.
|
||||
const STORAGE = 8;
|
||||
/// Allows a texture to be a output attachment of a renderpass.
|
||||
const OUTPUT_ATTACHMENT = 16;
|
||||
/// Allows a texture to be an output attachment of a renderpass.
|
||||
const RENDER_ATTACHMENT = 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1326,7 +1326,7 @@ bitflags::bitflags! {
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct SwapChainDescriptor {
|
||||
/// The usage of the swap chain. The only supported usage is OUTPUT_ATTACHMENT
|
||||
/// The usage of the swap chain. The only supported usage is `RENDER_ATTACHMENT`.
|
||||
pub usage: TextureUsage,
|
||||
/// The texture format of the swap chain. The only formats that are guaranteed are
|
||||
/// `Bgra8Unorm` and `Bgra8UnormSrgb`
|
||||
|
||||
Reference in new issue
Block a user