55#[ derive( Clone , Copy , Debug ) ]
66pub enum HardwareTier {
77 /// For WebGL and native OpenGL. Maintains strict WebGL capability.
8- Basic ,
8+ Web ,
99
1010 /// Run natively with Vulkan/Metal but don't demand anything that isn't widely available.
1111 Native ,
@@ -17,7 +17,15 @@ impl HardwareTier {
1717 /// Whether the current hardware tier supports sampling from textures with a sample count higher than 1.
1818 pub fn support_sampling_msaa_texture ( & self ) -> bool {
1919 match self {
20- HardwareTier :: Basic => false ,
20+ HardwareTier :: Web => false ,
21+ HardwareTier :: Native => true ,
22+ }
23+ }
24+
25+ /// Whether the current hardware tier supports sampling from textures with a sample count higher than 1.
26+ pub fn support_depth_readback ( & self ) -> bool {
27+ match self {
28+ HardwareTier :: Web => false ,
2129 HardwareTier :: Native => true ,
2230 }
2331 }
@@ -27,7 +35,7 @@ impl Default for HardwareTier {
2735 fn default ( ) -> Self {
2836 // Use "Basic" tier for actual web but also if someone forces the GL backend!
2937 if supported_backends ( ) == wgpu:: Backends :: GL {
30- HardwareTier :: Basic
38+ HardwareTier :: Web
3139 } else {
3240 HardwareTier :: Native
3341 }
@@ -63,7 +71,11 @@ impl HardwareTier {
6371 /// Downlevel features required by the given tier.
6472 pub fn required_downlevel_capabilities ( self ) -> wgpu:: DownlevelCapabilities {
6573 wgpu:: DownlevelCapabilities {
66- flags : wgpu:: DownlevelFlags :: empty ( ) ,
74+ flags : match self {
75+ HardwareTier :: Web => wgpu:: DownlevelFlags :: empty ( ) ,
76+ // Require fully WebGPU compliance for the native tier.
77+ HardwareTier :: Native => wgpu:: DownlevelFlags :: all ( ) ,
78+ } ,
6779 limits : Default :: default ( ) , // unused so far both here and in wgpu
6880 shader_model : wgpu:: ShaderModel :: Sm4 ,
6981 }
0 commit comments