windows-terminal/samples
Mårten Rånge 0ba680ad53
Added experimental.pixelShaderImagePath (#14073)
I realize I might be one of the few developers that care about custom
shader support in terminal but I thought it's worth proposing it and see
what you think.

This is to support custom shaders with custom textures.

I was thinking of exposing the background image to the shader but that
felt complicated after looking into it.

I have tested exploratively. I think the texture loader is possible to
unit test so that is a possible improvement.

The error reporting (as with other custom pixel shader code) is not very
good. That is also an area that I could improve upon.

I do think the risk of adding this is rather low as the new code is only
executed when experimental.pixelShaderImagePath is set.

### Details

Only added to the Atlas engine.

Instead I load the texture using WIC into a shader resource view. When
binding shader resources I test for presence of custom texture and bind
it to register t1.

The image loading code was found in [the D3D Texture documentation].
It's a mouthful but seems rather robust.


Tested setting: "experimental.pixelShaderImagePath"

1. Tested not specifying it.
2. Tested setting it.
3. Tested changing it (the changes are picked up)
4. Tested invalid path
5. Tested a custom shader that made use of the custom texture.

[the D3D Texture documentation]: https://learn.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-resources-textures-how-to

Co-authored-by: Mike Griese <migrie@microsoft.com>
Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
2024-03-08 18:01:53 +00:00
..
ConPTY Upgrade to Windows SDK 22621 (#14135) 2022-10-07 00:09:27 +00:00
PixelShaders Added experimental.pixelShaderImagePath (#14073) 2024-03-08 18:01:53 +00:00
ReadConsoleInputStream Fix typos found by codespell (#12475) 2022-02-17 17:58:31 +00:00