Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AtlasEngine: Make Direct2D/3D and Present1 configurable #16939

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Mar 26, 2024

This implements SetForceFullRepaintRendering and adds a new
SetGraphicsAPI function. The former toggles Present1 on and off
and the latter allows users to explicitly request Direct2D/3D.

On top of these changes I did a minor cleanup of the interface,
because now that DxRenderer is gone we don't need all that anymore.

Closes #14254
Closes #16747

Validation Steps Performed

  • Toggling Direct2D on/off changes colored ligature support ✅
  • Toggling Present1 on/off can be observed in a debugger ✅
  • Toggling WARP on/off changes GPU metrics ✅

@lhecker
Copy link
Member Author

lhecker commented Mar 26, 2024

This is what the Rendering page now looks like:
image

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Mar 26, 2024
@@ -397,8 +397,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// GH#11315: Always do this, even if they don't have acrylic on.
_renderEngine->EnableTransparentBackground(_isBackgroundTransparent());

THROW_IF_FAILED(_renderEngine->Enable());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seemed important

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't implemented by AtlasEngine! It initializes itself lazily.

src/cascadia/TerminalSettingsModel/MTSMSettings.h Outdated Show resolved Hide resolved
@@ -9,7 +9,6 @@
<Import Project="..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />

<PropertyGroup Label="Globals">
<CppWinRTHeapEnforcement>AnyValueHereWillDisableTheOptOut</CppWinRTHeapEnforcement>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whooooooooooaaa what

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I wanted to commit this in a separate PR but forgot to split it off first.

I believe we added this to work around a bug in the XAML compiler (no surprises there I'm sure) because it used std::shared_ptr instead of winrt::com_ptr on a WinRT object. This bug seems to have been fixed a while ago so there doesn't seem to be any reason for us to still opt out of these safety checks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YESSS

src/renderer/atlas/AtlasEngine.r.cpp Outdated Show resolved Hide resolved
src/renderer/atlas/AtlasEngine.r.cpp Outdated Show resolved Hide resolved
}
}
else

auto hr = _p.swapChain.swapChain->Present1(1, 0, &params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so wait, how does this disable present1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By leaving params.DirtyRectsCount at 0. That way the Present1 call is identical to a Present call. In fact calling Present nowadays simply calls Present1 with an empty DXGI_PRESENT_PARAMETERS.

@DHowett DHowett enabled auto-merge March 26, 2024 17:58
@zadjii-msft
Copy link
Member

image

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just commenting cause automerge is set up but I'm pretty much a ✅

I don't think I really care about migrating the old settings if you think it's fine.

X(bool, ForceFullRepaintRendering, "experimental.rendering.forceFullRepaint", false) \
X(bool, SoftwareRendering, "experimental.rendering.software", false) \
X(winrt::Microsoft::Terminal::Control::GraphicsAPI, GraphicsAPI, "rendering.graphicsAPI") \
X(bool, DisablePartialInvalidation, "rendering.disablePartialInvalidation", false) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh, IMO "forceFullRepaint" kinda sounded more straightforward IMO, but since it's in the SUI, i'm not sure it really matters

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Partial invalidation" is a more common technical term for Present1 and so I felt it's more fitting. Another one is "dirty rectangles", i.e. disableDirtyRectangles but I wasn't sure whether that's better.

{
// These experimental options should be removed from the settings file if they're at their default value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually... really clever

@@ -24,8 +24,9 @@ Author(s):
X(hstring, WordDelimiters, "wordDelimiters", DEFAULT_WORD_DELIMITERS) \
X(bool, CopyOnSelect, "copyOnSelect", false) \
X(bool, FocusFollowMouse, "focusFollowMouse", false) \
X(bool, ForceFullRepaintRendering, "experimental.rendering.forceFullRepaint", false) \
X(bool, SoftwareRendering, "experimental.rendering.software", false) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think there are some folks that were using these in the past. Should we be migrating them to the roughly equivalent new settings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People who have been using ForceFullRepaintRendering likely have been doing something wrong or accidentally clicked it. SoftwareRendering did have its uses, but I believe that everyone who used it should try the new AtlasEngine again or migrate to using Direct2D. The exact choice here depends on their exact issues.


[[nodiscard]] std::wstring_view AtlasEngine::GetPixelShaderPath() noexcept
{
return _api.s->misc->customPixelShaderPath;
}

[[nodiscard]] std::wstring_view AtlasEngine::GetPixelShaderImagePath() noexcept
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this just entirely disappear?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, it did. But no one was using it. gotcha.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup there's another one, related to DPI, which was used but only in a single place so I just inlined it there.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmk yea I'm cool with that.

@DHowett DHowett added this pull request to the merge queue Mar 26, 2024
Merged via the queue into main with commit a67a132 Mar 26, 2024
20 checks passed
@DHowett DHowett deleted the dev/lhecker/atlas-engine-more-options branch March 26, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AtlasEngine Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to open Windows Terminal any more Windows Terminal crashing when resizing panes
3 participants