allow shaders to be reloaded with a pair of toggleShaderEffects actions

This commit is contained in:
Mike Griese 2021-07-26 15:38:45 -05:00
parent 3a8c8830e8
commit 54db2c2c3b
2 changed files with 7 additions and 1 deletions

View file

@ -31,7 +31,7 @@ float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
float4 color = shaderTexture.Sample(samplerState, tex);
// Inverts the rgb values (xyz) but don't touch the alpha (w)
// color.xyz = 1.0 - color.xyz;
color.xyz = 1.0 - color.xyz;
float2 relativeCursorPos = CursorPosition / BufferSize;
if (tex.y >= relativeCursorPos.y) {

View file

@ -246,6 +246,12 @@ bool DxEngine::_HasTerminalEffects() const noexcept
void DxEngine::ToggleShaderEffects()
{
_terminalEffectsEnabled = !_terminalEffectsEnabled;
// If we're enabling the shader, try reloading it.
// It's not as good as hot reloading the hlsl file itself, but it's good enough.
if (_terminalEffectsEnabled)
{
_SetupTerminalEffects();
}
LOG_IF_FAILED(InvalidateAll());
}