Skip to content

Commit

Permalink
Added valid check for FP32 sampled attachment
Browse files Browse the repository at this point in the history
Summary: fp32 sampling is supported starting from certain MacOs and iOS versions as part of device capabilities.

Differential Revision: D47618906

fbshipit-source-id: 9f7c347730bbfbf96a573bcbc7d509c43dbfa0a1
  • Loading branch information
rudybear authored and facebook-github-bot committed Jul 20, 2023
1 parent 950a600 commit 2519a06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/igl/metal/DeviceFeatureSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DeviceFeatureSet final {
DeviceFeatureDesc deviceFeatureDesc_;
size_t maxMultisampleCount_;
size_t maxBufferLength_;
bool supports32BitFloatFiltering_ = false;
};

} // namespace metal
Expand Down
8 changes: 7 additions & 1 deletion src/igl/metal/DeviceFeatureSet.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2519a06

Please sign in to comment.