microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.58k stars 8.31k forks source link

Characters have black background in Terminal Preview 1.18.1462.0 #15960

Closed tanc closed 1 year ago

tanc commented 1 year ago

Windows Terminal version

1.18.1462.0

Windows build number

10.0.22622.0

Other Software

No response

Steps to reproduce

I'm not sure yet what the reproduction steps but the rendering issue seems to present itself immediately upon opening the terminal application.

Expected Behavior

Rendering of text to be normal

Actual Behavior

Each character has a black background which is very noticeable if using a light colour scheme, for example:

image

Changing the font or font size does not seem to have any effect.

lhecker commented 1 year ago

You do have a very curious GPU. 😅 Questions:

Note to self:

tanc commented 1 year ago

I know right! Why is it always me with the rendering problems? 😬😉

Do you use something like MacType? Nothing like that, just standard Windows rendering

Does it happen if you disable ClearType Anti-Aliasing? Same issue with ClearType disabled

Registry values for this single display: image

This is the dialog when opening the options: image

I then picked Power saving NVIDIA 2070 Super and re-opened Terminal Preview but the black background to the characters is still there.

I also tried adjusting the clear type options until the registry values were the same as yours but the result is the same in Terminal preview.

lhecker commented 1 year ago

Ugh... I was hoping that it's a bug with the Avalon settings. If it's not too much to ask, could you please install PIX? You can find it here: https://devblogs.microsoft.com/pix/download/ It'll ask you a couple questions on the first launch and it doesn't really matter what you pick. It's just for their user/market research.

You then need to launch it as Admin (it'll allow you to launch as non-Admin but silently won't record any GPU metrics). Quit all instances of Windows Terminal Preview. Then, do this (the important bits are "Launch UWP" and "Launch for GPU capture"): image

After clicking "Launch", it'd be nice if you could choose a light theme like you did before, insert an emoji like 🌯, and then press Ctrl+A to select all text. Like so: image

Back in PIX, press Ctrl+Shift+N. Make sure the green box looks like this: image

Then press Ctrl+N (or click the camera icon) and then focus the terminal again. It should quickly create a capture like so: image

Double click the capture and then press Ctrl+S. If you could send this file to <my github username>@microsoft.com, that'd be really helpful! (I hope it works when I analyze it on a different GPU though. I never tried that.)


You can also investigate it yourself if you're curious or just prefer that. To do that, after opening the capture, click on the little start arrow in the top right: image

Then pick graphics queue 1 (WinUI unfortunately uses its own graphics queue = 0): image

Click on the "Pipeline" tab, and click on the blue DrawIndexedInstanced entry in the list. At the bottom you'll see all the GPU stages.

CBV are the Constant Buffer Values, i.e. the values that are constant across one entire shader invocation for all pixels. You won't be able to read the CBV unless you tell PIX its layout (I think this is a limitation due to the use of D3D11on12). To read it, double click on the CBV entry on the left and it'll pop up an Active Resource tab. There, you need to enter the struct definition which in case of the Pixel Shader is:

float4 backgroundColor;
float2 backgroundCellSize;
float2 backgroundCellCount;
float4 gammaRatios;
float enhancedContrast;
float underlineWidth;

Expand item [0] and it'll show you all relevant values. In my case: image

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

tanc commented 1 year ago

@lhecker I've emailed you the wpix file directly. I didn't analyse the file but it here is a screen capture of the pix screenshot next to the actual terminal window. Is the pix screenshot supposed to be black like that?

image

lhecker commented 1 year ago

@tanc The PIX dump and your settings.json file helped me a lot! Quick workaround: Update to the latest Windows Terminal (even non-Preview is fine) and remove the passthrough.hlsl shader from your settings.json (Ctrl+Shift+,). 🙂

I haven't 100% understood yet why it happens but I know what causes this effect. Once I open a PR, I'll comment there what caused this issue.

image

tanc commented 1 year ago

@lhecker ah of course! It was the passthrough.hlsl we added to debug #15199 Removing that has fixed the issue. I'll close this issue as I don't think it'll affect anyone else.

lhecker commented 1 year ago

I'm glad it fixed it! For now I'd like to keep the issue open however, since this shouldn't happen if you use a shader and so I still got something to fix. 😅 (Please feel free to unsubscribe if you'd like!)