terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Accelerating Terminal rendering with D3D12 mesh shaders

Open Andarwinux opened this issue 1 year ago • 1 comments

Description of the new feature/enhancement

Accelerating Terminal rendering with D3D12 mesh shaders

Proposed technical implementation details (optional)

https://gpuopen.com/learn/mesh_shaders/mesh_shaders-font_and_vector_art_rendering_with_mesh_shaders/

Andarwinux avatar May 11 '24 08:05 Andarwinux

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar May 11 '24 08:05 github-actions[bot]

I'm aware about this technique but my understanding is that it's significantly slower than using a glyph atlas. The reason games use mesh shaders (or the more venerable, but patented Slug library) is because games require text to be drawn in a size according to their distance to the camera. Do you disagree? Are mesh shaders actually faster for our use case?

lhecker avatar May 13 '24 13:05 lhecker

I don't know anything about the low-level details of this 😅, you certainly know more about it than I do. But I was extremely impressed with the original WebGL demo of this, zooming and panning without any stuttering. Windows Terminal only achieves the same smoothness when scrolling vertically via trackpad.

Andarwinux avatar May 13 '24 13:05 Andarwinux

Wow yeah that demo is definitely really cool, especially when using Alt+Mouse. The author does note though:

This technique is harder on the GPU than atlas textures but avoids the need to use the CPU to render at runtime when a required glyph size is missing.

Since we mostly scroll text if anything, and don't really zoom or scale a lot, I think atlases may still have the best performance.

Windows Terminal only achieves the same smoothness when scrolling vertically via trackpad.

Do you mean to say that zooming is slow/stuttery for you? If so, I'm assuming this is when you use the newer AtlasEngine text renderer, right?

lhecker avatar May 13 '24 14:05 lhecker

Do you mean to say that zooming is slow/stuttery for you? If so, I'm assuming this is when you use the newer AtlasEngine text renderer, right?

The AtlasEngine option disappeared in WT Canary, I guess Direct3D11 is the AtlasEngine. Yes, I'm using it, and if I switch to Direct2D, the stuttering improves, but there is still a slight stutter.

Andarwinux avatar May 13 '24 14:05 Andarwinux

I'll be closing this issue for now. The good news is that I do have future improvements in mind when it comes to text rendering: In particular, I'm hoping to one day implement a "tiled deferred shading" renderer with a compute shader. The reason I didn't chose this approach for the current AtlasEngine is because this app needs to work reasonably well on some particularly bad hardware. Older Intel iGPUs don't have good support for compute shaders, but I'm worried that this is most of our users.

Yes, I'm using it, and if I switch to Direct2D, the stuttering improves, but there is still a slight stutter.

Do you by any chance use an Intel GPU?

lhecker avatar May 13 '24 15:05 lhecker

Do you by any chance use an Intel GPU?

I'm using RTX3080. Intel UHD750 is laggy running anything on 4K monitors.

Andarwinux avatar May 13 '24 16:05 Andarwinux

Do you use G-SYNC? If so, what happens if you disable that?

lhecker avatar May 13 '24 17:05 lhecker

Do you use G-SYNC? If so, what happens if you disable that?

I disabled GSYNC, enabled it on only makes it worse.

Andarwinux avatar May 14 '24 00:05 Andarwinux