Characters have black background in Terminal Preview 1.18.1462.0 #20468

Closed
opened 2026-01-31 07:14:43 +00:00 by claunia · 8 comments
Owner

Originally created by @tanc on GitHub (Sep 13, 2023).

Originally assigned to: @lhecker on GitHub.

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.

Originally created by @tanc on GitHub (Sep 13, 2023). Originally assigned to: @lhecker on GitHub. ### 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](https://github.com/microsoft/terminal/assets/76320/b45a552c-562d-4f28-93b7-823e198118ca) Changing the font or font size does not seem to have any effect.
Author
Owner

@lhecker commented on GitHub (Sep 13, 2023):

You do have a very curious GPU. 😅 Questions:

  • Do you use something like MacType?
  • Does it happen if you disable ClearType Anti-Aliasing?
  • When you open regedit and navigate to HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics what keys and values do you see? For instance, I only have DISPLAY1 there and it looks like that:
    image
    If you have multiple displays there, I'd unfortunately need all unique sets of values (= you can skip those displays that have identical registry values like another one; I'm just interested in the possible combinations that you have as they affect the text shader.)
  • Open the settings app and navigate to System > Display > Graphics (it's at the bottom of the page). There should be a "Add an app" dropdown that uses "Desktop apps" by default. Choose "Microsoft store app" instead:
    image
    Click browse (marvel at the Windows 8 dialog) and choose Terminal Preview. Then scroll down, click Terminal Preview and choose Options:
    image
    In that dialog you can pick the default graphics adapter for an application. Do you have multiple GPUs to choose from? If so, please try the various options. (The difference between "power saving" and "high performance" doesn't matter, only the difference between GPUs does.)

Note to self:

  • It can't be the GPU/texture memory, because the burrito emoji has a proper alpha=0 background
  • It can't be the dual blend state, because the burrito emoji works
  • It could be D2D or a mod for D2D, if it where to fill the clip rect with black with alpha=1 when we call ID2D1DeviceContext::DrawGlyphRun. It doesn't do that for other users though so it's unlikely.
  • It could be the DWrite (Avalon) settings, because those are being passed to the shader
  • Asking for a PIX recording would be an option, but it requires installing software and takes a bit to set up.
@lhecker commented on GitHub (Sep 13, 2023): You do have a very curious GPU. 😅 Questions: * Do you use something like MacType? * Does it happen if you disable ClearType Anti-Aliasing? * When you open regedit and navigate to `HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics` what keys and values do you see? For instance, I only have `DISPLAY1` there and it looks like that: ![image](https://github.com/microsoft/terminal/assets/2256941/7d7d6cba-bcda-406b-a471-f466ff971fa6) If you have multiple displays there, I'd unfortunately need all unique sets of values (= you can skip those displays that have identical registry values like another one; I'm just interested in the possible combinations that you have as they affect the text shader.) * Open the settings app and navigate to System > Display > Graphics (it's at the bottom of the page). There should be a "Add an app" dropdown that uses "Desktop apps" by default. Choose "Microsoft store app" instead: ![image](https://github.com/microsoft/terminal/assets/2256941/c8cd8624-ddb7-4251-908f-ed56db1587da) Click browse (marvel at the Windows 8 dialog) and choose Terminal Preview. Then scroll down, click Terminal Preview and choose Options: ![image](https://github.com/microsoft/terminal/assets/2256941/eb9604b4-c551-4890-96b7-9e2b34a79682) In that dialog you can pick the default graphics adapter for an application. Do you have multiple GPUs to choose from? If so, please try the various options. (The difference between "power saving" and "high performance" doesn't matter, only the difference between GPUs does.) Note to self: * It can't be the GPU/texture memory, because the burrito emoji has a proper alpha=0 background * It can't be the dual blend state, because the burrito emoji works * It could be D2D or a mod for D2D, if it where to fill the clip rect with black with alpha=1 when we call `ID2D1DeviceContext::DrawGlyphRun`. It doesn't do that for other users though so it's unlikely. * It could be the DWrite (Avalon) settings, because those are being passed to the shader * Asking for a [PIX](https://devblogs.microsoft.com/pix/download/) recording would be an option, but it requires installing software and takes a bit to set up.
Author
Owner

@tanc commented on GitHub (Sep 13, 2023):

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.

@tanc commented on GitHub (Sep 13, 2023): 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](https://github.com/microsoft/terminal/assets/76320/67398f08-d4da-45e5-abec-25d6b2c68e74) This is the dialog when opening the options: ![image](https://github.com/microsoft/terminal/assets/76320/a604b7f1-652e-4b11-a5cd-fd56f30f3f26) 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.
Author
Owner

@lhecker commented on GitHub (Sep 13, 2023):

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.

  • IA: Input Assembler - All the per-frame data that is being sent to the GPU
  • VS: Vertex Shader - In our case it translates from absolute coordinates in pixels (top left corner is 0,0) to screen space coordinates that range from -1 to +1 in both the X and Y axis.
  • PS: Pixel Shader - The thing that is probably failing right now. Texture 1 is the glyph atlas.

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

@lhecker commented on GitHub (Sep 13, 2023): 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](https://github.com/microsoft/terminal/assets/2256941/54c0ce4f-5b15-4274-b25f-c213d59ddb7d) 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](https://github.com/microsoft/terminal/assets/2256941/275d7a29-b785-4892-b1c3-b0b49b14d059) Back in PIX, press Ctrl+Shift+N. Make sure the green box looks like this: ![image](https://github.com/microsoft/terminal/assets/2256941/04a618ec-ed21-4c11-a2b4-b5e90090af6d) Then press Ctrl+N (or click the camera icon) and then focus the terminal again. It should quickly create a capture like so: ![image](https://github.com/microsoft/terminal/assets/2256941/1b792b7a-d8d5-4dd3-865e-6f3f6f0804fd) 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](https://github.com/microsoft/terminal/assets/2256941/88881c0c-77cd-4a60-a559-4c6641f6ee5a) Then pick graphics queue 1 (WinUI unfortunately uses its own graphics queue = 0): ![image](https://github.com/microsoft/terminal/assets/2256941/6787704e-5d3d-4df8-963f-c42c897e8d87) 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. * IA: Input Assembler - All the per-frame data that is being sent to the GPU * VS: Vertex Shader - In our case it translates from absolute coordinates in pixels (top left corner is 0,0) to screen space coordinates that range from -1 to +1 in both the X and Y axis. * PS: Pixel Shader - The thing that is probably failing right now. Texture 1 is the glyph atlas. `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](https://github.com/microsoft/terminal/assets/2256941/7928bc34-fce8-491e-880b-3a287629b67e)
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Sep 19, 2023):

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.

@microsoft-github-policy-service[bot] commented on GitHub (Sep 19, 2023): 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**.
Author
Owner

@tanc commented on GitHub (Sep 19, 2023):

@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

@tanc commented on GitHub (Sep 19, 2023): @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](https://github.com/microsoft/terminal/assets/76320/c11ba69c-a7c0-417d-aaea-f8591a74751e)
Author
Owner

@lhecker commented on GitHub (Sep 27, 2023):

@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

@lhecker commented on GitHub (Sep 27, 2023): @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](https://github.com/microsoft/terminal/assets/2256941/85fc8196-be06-4416-8e88-38cd2ffa47d6)
Author
Owner

@tanc commented on GitHub (Sep 27, 2023):

@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.

@tanc commented on GitHub (Sep 27, 2023): @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.
Author
Owner

@lhecker commented on GitHub (Sep 27, 2023):

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!)

@lhecker commented on GitHub (Sep 27, 2023): 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!)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20468