File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed
Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,8 @@ class UTILS_PUBLIC View : public FilamentAPI {
318318 /* *
319319 * Sets how many samples are to be used for MSAA in the post-process stage.
320320 * Default is 1 and disables MSAA.
321+ * Note that post-processing is disabled at FL0. If the feature level is
322+ * set to 0, values passed to this function are ignored.
321323 *
322324 * @param count number of samples to use for multi-sampled anti-aliasing.\n
323325 * 0: treated as 1
@@ -408,7 +410,9 @@ class UTILS_PUBLIC View : public FilamentAPI {
408410
409411 /* *
410412 * Enables or disable multi-sample anti-aliasing (MSAA). Disabled by default.
411- *
413+ * Note that MSAA is a post-processing effect, and post-processing is disabled at FL0.
414+ * If the feature level is set to 0, values passed to this function are ignored.
415+ *
412416 * @param options multi-sample anti-aliasing options
413417 */
414418 void setMultiSampleAntiAliasingOptions (MultiSampleAntiAliasingOptions options) noexcept ;
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ FView::FView(FEngine& engine)
106106{
107107 DriverApi& driver = engine.getDriverApi ();
108108
109+ mFeatureLevel = engine.getSupportedFeatureLevel ();
110+
109111 auto const & layout = engine.getPerRenderableDescriptorSetLayout ();
110112
111113 // initialize the common descriptor set with dummy descriptors
@@ -1438,9 +1440,12 @@ void FView::setTemporalAntiAliasingOptions(TemporalAntiAliasingOptions options)
14381440}
14391441
14401442void FView::setMultiSampleAntiAliasingOptions (MultiSampleAntiAliasingOptions options) noexcept {
1441- options.sampleCount = uint8_t (options.sampleCount < 1u ? 1u : options.sampleCount );
1442- mMultiSampleAntiAliasingOptions = options;
1443- assert_invariant (!options.enabled || !mRenderTarget || !mRenderTarget ->hasSampleableDepth ());
1443+ // MSAA is a post-process effect, and post-processing is disabled at FL0
1444+ if (mFeatureLevel >= backend::FeatureLevel::FEATURE_LEVEL_1) {
1445+ options.sampleCount = uint8_t (options.sampleCount < 1u ? 1u : options.sampleCount );
1446+ mMultiSampleAntiAliasingOptions = options;
1447+ assert_invariant (!options.enabled || !mRenderTarget || !mRenderTarget ->hasSampleableDepth ());
1448+ }
14441449}
14451450
14461451void FView::setScreenSpaceReflectionsOptions (ScreenSpaceReflectionsOptions options) noexcept {
Original file line number Diff line number Diff line change @@ -262,9 +262,12 @@ class FView : public View {
262262 }
263263
264264 void setSampleCount (uint8_t count) noexcept {
265- count = uint8_t (count < 1u ? 1u : count);
266- mMultiSampleAntiAliasingOptions .sampleCount = count;
267- mMultiSampleAntiAliasingOptions .enabled = count > 1u ;
265+ // MSAA is a post-process effect, and post-processing is disabled at FL0
266+ if (mFeatureLevel >= backend::FeatureLevel::FEATURE_LEVEL_1) {
267+ count = uint8_t (count < 1u ? 1u : count);
268+ mMultiSampleAntiAliasingOptions .sampleCount = count;
269+ mMultiSampleAntiAliasingOptions .enabled = count > 1u ;
270+ }
268271 }
269272
270273 uint8_t getSampleCount () const noexcept {
@@ -629,6 +632,8 @@ class FView : public View {
629632
630633 utils::CString mName ;
631634
635+ backend::FeatureLevel mFeatureLevel = backend::FeatureLevel::FEATURE_LEVEL_1;
636+
632637 // the following values are set by prepare()
633638 Range mVisibleRenderables ;
634639 Range mVisibleDirectionalShadowCasters ;
You can’t perform that action at this time.
0 commit comments