Skip to content

Commit 9ec9242

Browse files
committed
Better implementation
1 parent 598259c commit 9ec9242

File tree

7 files changed

+8
-15
lines changed

7 files changed

+8
-15
lines changed

wgpu-core/src/device/resource.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4464,6 +4464,10 @@ impl Device {
44644464
{
44654465
format_features.flags.set(tfsc::FILTERABLE, false);
44664466
}
4467+
format_features.allowed_usages.set(
4468+
wgt::TextureUsages::TRANSIENT,
4469+
self.features.contains(wgt::Features::TRANSIENT_ATTACHMENTS),
4470+
);
44674471
format_features
44684472
}
44694473

wgpu-core/src/instance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ impl Adapter {
706706
wgt::TextureUsages::STORAGE_ATOMIC,
707707
caps.contains(Tfc::STORAGE_ATOMIC),
708708
);
709-
allowed_usages.set(wgt::TextureUsages::TRANSIENT, caps.contains(Tfc::TRANSIENT));
710709

711710
let mut flags = wgt::TextureFormatFeatureFlags::empty();
712711
flags.set(

wgpu-hal/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,9 +1675,6 @@ bitflags!(
16751675
const COPY_SRC = 1 << 15;
16761676
/// Format can be copied to.
16771677
const COPY_DST = 1 << 16;
1678-
1679-
/// Format can be created as transient.
1680-
const TRANSIENT = 1 << 17;
16811678
}
16821679
);
16831680

wgpu-hal/src/metal/adapter.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl crate::Adapter for super::Adapter {
149149
| msaa_count
150150
| Tfc::MULTISAMPLE_RESOLVE;
151151

152-
let mut extra = match format {
152+
let extra = match format {
153153
Tf::R8Unorm | Tf::R16Float | Tf::Rgba8Unorm | Tf::Rgba16Float => {
154154
read_write_tier2_if | all_caps
155155
}
@@ -352,11 +352,6 @@ impl crate::Adapter for super::Adapter {
352352
}
353353
};
354354

355-
extra.set(
356-
Tfc::TRANSIENT,
357-
self.shared.private_caps.supports_memoryless_storage,
358-
);
359-
360355
Tfc::COPY_SRC | Tfc::COPY_DST | Tfc::SAMPLED | Tfc::STORAGE_READ_ONLY | extra
361356
}
362357

wgpu-hal/src/metal/device.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,7 @@ impl crate::Device for super::Device {
452452
}
453453
};
454454

455-
let mtl_storage_mode = if desc.usage.contains(wgt::TextureUses::TRANSIENT)
456-
&& self.features.contains(wgt::Features::TRANSIENT_ATTACHMENTS)
457-
{
455+
let mtl_storage_mode = if desc.usage.contains(wgt::TextureUses::TRANSIENT) {
458456
MTLStorageMode::Memoryless
459457
} else {
460458
MTLStorageMode::Private

wgpu-hal/src/vulkan/adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,7 @@ impl crate::Adapter for super::Adapter {
24462446
};
24472447
let features = properties.optimal_tiling_features;
24482448

2449-
let mut flags = Tfc::TRANSIENT;
2449+
let mut flags = Tfc::empty();
24502450
flags.set(
24512451
Tfc::SAMPLED,
24522452
features.contains(vk::FormatFeatureFlags::SAMPLED_IMAGE),

wgpu-types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5666,7 +5666,7 @@ bitflags::bitflags! {
56665666
/// Flag used by the wgpu-core texture tracker to say that the tracker does not know the state of the sub-resource.
56675667
/// This is different from UNINITIALIZED as that says the tracker does know, but the texture has not been initialized.
56685668
const UNKNOWN = 1 << 13;
5669-
/// Transient image
5669+
/// Transient image.
56705670
const TRANSIENT = 1 << 14;
56715671
}
56725672
}

0 commit comments

Comments
 (0)