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: Minor bug fixes #16219

Merged
merged 1 commit into from
Oct 31, 2023
Merged

AtlasEngine: Minor bug fixes #16219

merged 1 commit into from
Oct 31, 2023

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Oct 23, 2023

This commit fixes 4 minor bugs:

  • Forgot to set the maximum swap chain latency. Without it, it defaults
    to up to 3 frames of latency. We don't need this, because our renderer
    is simple and fast and is expected to draw frames within <1ms.
  • ClearType treats the alpha channel as ignored, whereas custom shaders
    can manipulate the alpha channel freely. This meant that using both
    simultaneously would produce weird effects, like text having black
    background. We now force grayscale AA instead.
  • The builtin retro shader should not be effected by the previous point.
  • When the cbuffer is entirely unused in a custom shader, it has so far
    resulted in constant redraws. This happened because the D3D reflection
    GetDesc call will then return E_FAIL in this situation.
    The new code on the other hand will now assume that a failure
    to get the description is equal to the variable being unused.

Closes #15960

Validation Steps Performed

  • A custom passthrough shader works with grayscale and ClearType AA
    while also changing the opacity with Ctrl+Shift+Scroll ✅
  • Same for the builtin retro shader, but ClearType works ✅
  • The passthrough shader doesn't result in constant redrawing ✅

@microsoft-github-policy-service microsoft-github-policy-service bot added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Oct 23, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Area-AtlasEngine Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Oct 23, 2023
src/renderer/atlas/BackendD3D.cpp Show resolved Hide resolved
src/renderer/atlas/BackendD3D.cpp Show resolved Hide resolved
{
// Depending on the version of the d3dcompiler_*.dll, the next two functions either return nullptr
// on failure or an instance of CInvalidSRConstantBuffer or CInvalidSRVariable respectively,
// which cause GetDesc() to return E_FAIL. In other words, we have to assume that any failure in the
Copy link
Member

Choose a reason for hiding this comment

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

That doesn't seem like what this code does?

This code only changes _requiresContinuous... when we successfully get all the buffers, variables, and descriptors.

Therefore, we just use whatever value was previously set. Isn't that worse?

Copy link
Member Author

Choose a reason for hiding this comment

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

My answer to all 3 comments is: If you expand the section above this diff, you'll see that it resets all relevant members before making any further changes (including _requiresContinuousRedraw).

Copy link
Member

Choose a reason for hiding this comment

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

UGH thanks. Sorry for the bad code.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Oct 23, 2023
// If the user asks for ClearType, but also for a transparent background
// (which our ClearType shader doesn't simultaneously support)
// then we need to sneakily force the renderer to grayscale AA.
const auto antialiasingMode = _api.enableTransparentBackground && _api.antialiasingMode == AntialiasingMode::ClearType ? AntialiasingMode::Grayscale : _api.antialiasingMode;
const bool enableTransparentBackground = _api.enableTransparentBackground || !_api.s->misc->customPixelShaderPath.empty() || _api.s->misc->useRetroTerminalEffect;
Copy link
Member

Choose a reason for hiding this comment

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

_api.s->misc->useRetroTerminalEffect is completely gone now. Is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep! It's the 3rd bullet point in the commit message. 😅

@lhecker lhecker merged commit 0289cb0 into main Oct 31, 2023
14 of 16 checks passed
@lhecker lhecker deleted the dev/lhecker/atlasengine-fixup branch October 31, 2023 13:25
@DHowett
Copy link
Member

DHowett commented Oct 31, 2023

image builds failed? wot

@DHowett
Copy link
Member

DHowett commented Oct 31, 2023

oh it was a rebuild. ugh sorry.

DHowett pushed a commit that referenced this pull request Nov 7, 2023
This commit fixes 4 minor bugs:
* Forgot to set the maximum swap chain latency. Without it, it defaults
  to up to 3 frames of latency. We don't need this, because our renderer
  is simple and fast and is expected to draw frames within <1ms.
* ClearType treats the alpha channel as ignored, whereas custom shaders
  can manipulate the alpha channel freely. This meant that using both
  simultaneously would produce weird effects, like text having black
  background. We now force grayscale AA instead.
* The builtin retro shader should not be effected by the previous point.
* When the cbuffer is entirely unused in a custom shader, it has so far
  resulted in constant redraws. This happened because the D3D reflection
  `GetDesc` call will then return `E_FAIL` in this situation.
  The new code on the other hand will now assume that a failure
  to get the description is equal to the variable being unused.

Closes #15960

## Validation Steps Performed
* A custom passthrough shader works with grayscale and ClearType AA
  while also changing the opacity with Ctrl+Shift+Scroll ✅
* Same for the builtin retro shader, but ClearType works ✅
* The passthrough shader doesn't result in constant redrawing ✅

(cherry picked from commit 0289cb0)
Service-Card-Id: 90915276
Service-Version: 1.18
DHowett pushed a commit that referenced this pull request Nov 7, 2023
This commit fixes 4 minor bugs:
* Forgot to set the maximum swap chain latency. Without it, it defaults
  to up to 3 frames of latency. We don't need this, because our renderer
  is simple and fast and is expected to draw frames within <1ms.
* ClearType treats the alpha channel as ignored, whereas custom shaders
  can manipulate the alpha channel freely. This meant that using both
  simultaneously would produce weird effects, like text having black
  background. We now force grayscale AA instead.
* The builtin retro shader should not be effected by the previous point.
* When the cbuffer is entirely unused in a custom shader, it has so far
  resulted in constant redraws. This happened because the D3D reflection
  `GetDesc` call will then return `E_FAIL` in this situation.
  The new code on the other hand will now assume that a failure
  to get the description is equal to the variable being unused.

Closes #15960

## Validation Steps Performed
* A custom passthrough shader works with grayscale and ClearType AA
  while also changing the opacity with Ctrl+Shift+Scroll ✅
* Same for the builtin retro shader, but ClearType works ✅
* The passthrough shader doesn't result in constant redrawing ✅

(cherry picked from commit 0289cb0)
Service-Card-Id: 90915277
Service-Version: 1.19
DHowett pushed a commit that referenced this pull request Nov 7, 2023
This commit fixes 4 minor bugs:
* Forgot to set the maximum swap chain latency. Without it, it defaults
  to up to 3 frames of latency. We don't need this, because our renderer
  is simple and fast and is expected to draw frames within <1ms.
* ClearType treats the alpha channel as ignored, whereas custom shaders
  can manipulate the alpha channel freely. This meant that using both
  simultaneously would produce weird effects, like text having black
  background. We now force grayscale AA instead.
* The builtin retro shader should not be effected by the previous point.
* When the cbuffer is entirely unused in a custom shader, it has so far
  resulted in constant redraws. This happened because the D3D reflection
  `GetDesc` call will then return `E_FAIL` in this situation.
  The new code on the other hand will now assume that a failure
  to get the description is equal to the variable being unused.

Closes #15960

## Validation Steps Performed
* A custom passthrough shader works with grayscale and ClearType AA
  while also changing the opacity with Ctrl+Shift+Scroll ✅
* Same for the builtin retro shader, but ClearType works ✅
* The passthrough shader doesn't result in constant redrawing ✅

(cherry picked from commit 0289cb0)
Service-Card-Id: 90915276
Service-Version: 1.18
DHowett added a commit that referenced this pull request Jan 12, 2024
- AtlasEngine: Minor bug fixes (GH-16219)
- Fix the fix for the fix of nearby font loading (GH-16196)
- Added selectionBackground to light color schemes (GH-16243)
- Another theoretical fix for a crash (GH-16267)
- Fix tabs being printed in cmd.exe prompts (GH-16273)

Related work items: MSFT-47266988
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. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
Development

Successfully merging this pull request may close these issues.

Characters have black background in Terminal Preview 1.18.1462.0
3 participants