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

Implemented support for user provided pixel shaders #7058

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/spell-check/dictionary/apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CLASSNOTAVAILABLE
environstrings
EXPCMDFLAGS
EXPCMDSTATE
frac
fullkbd
futex
Hashtable
Expand All @@ -23,8 +24,8 @@ IExplorer
IMap
IObject
IStorage
llabs
LCID
llabs
lround
LSHIFT
NCHITTEST
Expand All @@ -44,6 +45,7 @@ RSHIFT
rx
serializer
SIZENS
smoothstep
spsc
STDCPP
syscall
Expand Down
9 changes: 8 additions & 1 deletion .github/actions/spell-check/dictionary/names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ duhowett
ethanschoonover
Firefox
Gatta
glsl
Grie
Griese
Hernan
Howett
Illhardt
iquilezles
jantari
jerrysh
Kaiyu
kimwalisch
KMehrain
KODELIFE
Kodelife
Kourosh
kowalczyk
leonmsft
Expand All @@ -29,6 +33,7 @@ lukesampson
Manandhar
mbadolato
Mehrain
menger
mgravell
michaelniksa
migrie
Expand All @@ -38,6 +43,7 @@ miniksa
niksa
oising
oldnewthing
opengl
osgwiki
paulcam
pauldotknopf
Expand All @@ -46,6 +52,7 @@ Pham
Rincewind
rprichard
Schoonover
shadertoy
Somuah
sonph
sonpham
Expand All @@ -55,8 +62,8 @@ Wirt
Wojciech
zadjii
Zamor
Zamora
zamora
Zamora
Zoey
zorio
Zverovich
29 changes: 27 additions & 2 deletions .github/actions/spell-check/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ ADDREF
addressof
ADDSTRING
ADDTOOL
AEnd
aef
AEnd
AFew
AFill
AFX
Expand Down Expand Up @@ -633,6 +633,7 @@ doskey
dotnet
doubleclick
downlevel
DOWNSCALE
dpg
dpi
DPIAPI
Expand Down Expand Up @@ -838,6 +839,7 @@ fuzzwrapper
fwdecl
fwe
fwlink
GAUSSIAN
gb
gci
gcx
Expand Down Expand Up @@ -914,6 +916,7 @@ Goldmine
gonce
Google
goutput
GPUs
Gravell's
grayscale
GREENSCROLL
Expand Down Expand Up @@ -1111,6 +1114,7 @@ INTERCEPTCOPYPASTE
INTERNALNAME
interop
interoperability
intersectors
inthread
intptr
intsafe
Expand Down Expand Up @@ -1211,6 +1215,7 @@ KJ
KLF
KLMNOPQRST
KLMNOPQRSTQQQQQ
Kode
KU
KVM
KX
Expand Down Expand Up @@ -1594,6 +1599,7 @@ OACR
oauth
objbase
ocf
ocolor
odl
oem
oemcp
Expand Down Expand Up @@ -1793,6 +1799,7 @@ pragma
prc
prealigned
prebuilt
precendence
precomp
prect
prefast
Expand Down Expand Up @@ -1837,6 +1844,7 @@ pshn
PSHNOTIFY
PSHORT
pshpack
psin
PSINGLE
psl
psldl
Expand Down Expand Up @@ -1885,10 +1893,12 @@ QWER
qzmp
RAII
RALT
rasterbar
rasterfont
rasterization
rawinput
RAWPATH
raytracers
razzlerc
rbar
rbegin
Expand Down Expand Up @@ -1959,10 +1969,12 @@ RESETCONTENT
resheader
resizable
resmimetype
reso
restrictedcapabilities
restrictederrorinfo
resw
resx
RETROII
retval
rfa
rfc
Expand Down Expand Up @@ -2034,11 +2046,14 @@ SBCSDBCS
sbi
sbiex
sbold
sbri
scanbri
scancode
scanline
schemename
SCL
scm
scol
scprintf
SCRBUF
SCRBUFSIZE
Expand Down Expand Up @@ -2173,6 +2188,9 @@ SOURCESDIRECTORY
SPACEBAR
spammy
spand
spe
sph
spherefunctions
splashscreen
sprintf
sqlproj
Expand Down Expand Up @@ -2303,6 +2321,7 @@ telnet
telnetd
telnetpp
templated
teraflop
terminalcore
TERMINALSCROLLING
terminfo
Expand Down Expand Up @@ -2550,6 +2569,7 @@ vga
vgaoem
viewkind
viewports
Viginetting
Virt
VIRTTERM
Virtualizing
Expand Down Expand Up @@ -2767,6 +2787,7 @@ wwaproj
WWith
wx
wxh
wz
xa
xact
xamarin
Expand Down Expand Up @@ -2811,7 +2832,10 @@ xutr
xvalue
XVIRTUALSCREEN
XWalk
XWV
xy
xyw
Xzn
yact
YAML
YCast
Expand All @@ -2827,6 +2851,7 @@ YVIRTUALSCREEN
Yw
YWalk
yx
yzx
Zc
ZCmd
ZCtrl
Expand All @@ -2836,4 +2861,4 @@ ZM
zsh
zu
zxcvbnm
zy
zy
1 change: 1 addition & 0 deletions doc/cascadia/SettingsSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Properties listed below are specific to each unique profile.
| `tabTitle` | Optional | String | | If set, will replace the `name` as the title to pass to the shell on startup. Some shells (like `bash`) may choose to ignore this initial value, while others (`cmd`, `powershell`) may use this value over the lifetime of the application. |
| `useAcrylic` | Optional | Boolean | `false` | When set to `true`, the window will have an acrylic background. When set to `false`, the window will have a plain, untextured background. The transparency only applies to focused windows due to OS limitation. |
| `experimental.retroTerminalEffect` | Optional | Boolean | `false` | When set to `true`, enable retro terminal effects. This is an experimental feature, and its continued existence is not guaranteed. |
| `experimental.pixelShaderEffect` | Optional | String | | If set to a file name or preset, compiles the pixel shader effect and applies it the terminal view. Currently 2 presets are supported `RETRO` and `RETROII`. This is an experimental feature, and its continued existence is not guaranteed. |
mrange marked this conversation as resolved.
Show resolved Hide resolved

## Schemes

Expand Down
4 changes: 4 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@
"description": "When set to true, enable retro terminal effects. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "boolean"
},
"experimental.pixelShaderEffect": {
"description": "If set to a file name or preset, compiles the pixel shader effect and applies it the terminal view. Currently 2 presets are supported `RETRO` and `RETROII`. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "string"
},
"fontFace": {
"default": "Cascadia Mono",
"description": "Name of the font face used in the profile.",
Expand Down
18 changes: 18 additions & 0 deletions samples/PixelShaders/Broken.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Broken, can be used for explorative testing of pixel shader error handling
Texture2D shaderTexture;
SamplerState samplerState;

cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};

float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
// OOPS; vec4 is not a hlsl but a glsl datatype!
vec4 color = shaderTexture.Sample(samplerState, tex);

return color;
}
18 changes: 18 additions & 0 deletions samples/PixelShaders/Error.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Shader used to indicate something went wrong during shader loading
Texture2D shaderTexture;
SamplerState samplerState;

cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};

float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
float4 color = shaderTexture.Sample(samplerState, tex);
float bars = 0.5+0.5*sin(tex.y*100);
color.x += pow(bars, 20.0);
return color;
}
32 changes: 32 additions & 0 deletions samples/PixelShaders/Invert.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// A minimal pixel shader that inverts the colors

// The terminal graphics as a texture
Texture2D shaderTexture;
SamplerState samplerState;

// Terminal settings such as the resolution of the texture
cbuffer PixelShaderSettings {
// Time since pixel shader was enabled
float Time;
// UI Scale
float Scale;
// Resolution of the shaderTexture
float2 Resolution;
// Background color as rgba
float4 Background;
};

// A pixel shader is a program that given a texture coordinate (tex) produces a color
// Just ignore the pos parameter
float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
// Read the color value at the current texture coordinate (tex)
// float4 is tuple of 4 floats, rgba
float4 color = shaderTexture.Sample(samplerState, tex);

// Inverts the rgb values (xyz) but don't touch the alpha (w)
color.xyz = 1.0 - color.xyz;

// Return the final color
return color;
}
17 changes: 17 additions & 0 deletions samples/PixelShaders/Nop.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Does nothing, serves as an example of a minimal pixel shader
Texture2D shaderTexture;
SamplerState samplerState;

cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};

float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
float4 color = shaderTexture.Sample(samplerState, tex);

return color;
}
Loading