diff --git a/src/igl/metal/DeviceFeatureSet.h b/src/igl/metal/DeviceFeatureSet.h index 8409b9c2ec..350adf3caa 100644 --- a/src/igl/metal/DeviceFeatureSet.h +++ b/src/igl/metal/DeviceFeatureSet.h @@ -49,6 +49,7 @@ class DeviceFeatureSet final { DeviceFeatureDesc deviceFeatureDesc_; size_t maxMultisampleCount_; size_t maxBufferLength_; + bool supports32BitFloatFiltering_ = false; }; } // namespace metal diff --git a/src/igl/metal/DeviceFeatureSet.mm b/src/igl/metal/DeviceFeatureSet.mm index d0e783612e..d59632effd 100644 --- a/src/igl/metal/DeviceFeatureSet.mm +++ b/src/igl/metal/DeviceFeatureSet.mm @@ -94,6 +94,11 @@ // get max buffer length maxBufferLength_ = [device maxBufferLength]; + + if (@available(macOS 11.0, iOS 14.0, *)) { + // this API became available as of iOS 14 and macOS 11 + supports32BitFloatFiltering_ = device.supports32BitFloatFiltering; + } } bool DeviceFeatureSet::hasFeature(DeviceFeatures feature) const { @@ -342,7 +347,8 @@ case TextureFormat::RGBA_UInt32: return sampled | storage | attachment | sampledAttachment; case TextureFormat::RGBA_F32: - return sampled | storage | attachment | sampledAttachment; + return sampled | storage | attachment | sampledAttachment | + (supports32BitFloatFiltering_ ? sampledFiltered : 0); // Compressed formats case TextureFormat::RGBA_ASTC_4x4: