File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ SurfaceConfiguration {
72
72
### Added/New Features
73
73
74
74
- Add ` Buffer::size() ` and ` Buffer::usage() ` ; by @kpreid in [ #2923 ] ( https://github.com/gfx-rs/wgpu/pull/2923 )
75
+ - Split Blendability and Filterability into Two Different TextureFormatFeatureFlags; by @stakka in [ #3012 ] ( https://github.com/gfx-rs/wgpu/pull/3012 )
75
76
- Expose ` alpha_mode ` on SurfaceConfiguration, by @jinleili in [ #2836 ] ( https://github.com/gfx-rs/wgpu/pull/2836 )
76
77
- Introduce fields for driver name and info in ` AdapterInfo ` , by @i509VCB in [ #3037 ] ( https://github.com/gfx-rs/wgpu/pull/3037 )
77
78
Original file line number Diff line number Diff line change @@ -2625,7 +2625,14 @@ impl<A: HalApi> Device<A> {
2625
2625
{
2626
2626
break Some ( pipeline:: ColorStateError :: FormatNotRenderable ( cs. format ) ) ;
2627
2627
}
2628
- if cs. blend . is_some ( ) && !format_features. flags . contains ( Tfff :: FILTERABLE ) {
2628
+ let blendable = format_features. flags . contains ( Tfff :: BLENDABLE ) ;
2629
+ let filterable = format_features. flags . contains ( Tfff :: FILTERABLE ) ;
2630
+ let adapter_specific = self
2631
+ . features
2632
+ . contains ( wgt:: Features :: TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES ) ;
2633
+ // according to WebGPU specifications the texture needs to be [`TextureFormatFeatureFlags::FILTERABLE`]
2634
+ // if blending is set - use [`Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES`] to elude this limitation
2635
+ if cs. blend . is_some ( ) && ( !blendable || ( !filterable && !adapter_specific) ) {
2629
2636
break Some ( pipeline:: ColorStateError :: FormatNotBlendable ( cs. format ) ) ;
2630
2637
}
2631
2638
if !hal:: FormatAspects :: from ( cs. format ) . contains ( hal:: FormatAspects :: COLOR ) {
Original file line number Diff line number Diff line change @@ -249,14 +249,14 @@ impl<A: HalApi> Adapter<A> {
249
249
caps. contains ( Tfc :: STORAGE_READ_WRITE ) ,
250
250
) ;
251
251
252
- // We are currently taking the filtering and blending together,
253
- // but we may reconsider this in the future if there are formats
254
- // in the wild for which these two capabilities do not match.
255
252
flags. set (
256
253
wgt:: TextureFormatFeatureFlags :: FILTERABLE ,
257
- caps. contains ( Tfc :: SAMPLED_LINEAR )
258
- && ( !caps. contains ( Tfc :: COLOR_ATTACHMENT )
259
- || caps. contains ( Tfc :: COLOR_ATTACHMENT_BLEND ) ) ,
254
+ caps. contains ( Tfc :: SAMPLED_LINEAR ) ,
255
+ ) ;
256
+
257
+ flags. set (
258
+ wgt:: TextureFormatFeatureFlags :: BLENDABLE ,
259
+ caps. contains ( Tfc :: COLOR_ATTACHMENT_BLEND ) ,
260
260
) ;
261
261
262
262
flags. set (
Original file line number Diff line number Diff line change @@ -1662,6 +1662,8 @@ bitflags::bitflags! {
1662
1662
/// When used as a STORAGE texture, then a texture with this format can be written to with atomics.
1663
1663
// TODO: No access flag exposed as of writing
1664
1664
const STORAGE_ATOMICS = 1 << 4 ;
1665
+ /// If not present, the texture can't be blended into the render target.
1666
+ const BLENDABLE = 1 << 5 ;
1665
1667
}
1666
1668
}
1667
1669
@@ -2288,10 +2290,12 @@ impl TextureFormat {
2288
2290
} ;
2289
2291
2290
2292
let mut flags = msaa_flags;
2293
+ let filterable_sample_type = sample_type == TextureSampleType :: Float { filterable : true } ;
2291
2294
flags. set (
2292
2295
TextureFormatFeatureFlags :: FILTERABLE ,
2293
- sample_type == TextureSampleType :: Float { filterable : true } ,
2296
+ filterable_sample_type ,
2294
2297
) ;
2298
+ flags. set ( TextureFormatFeatureFlags :: BLENDABLE , filterable_sample_type) ;
2295
2299
2296
2300
TextureFormatInfo {
2297
2301
required_features,
You can’t perform that action at this time.
0 commit comments