-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Experimental HLSL shaders - cbuffer Time not bound #8935
Comments
Oh yea, yikes. That TODO definitely should be tracked somewhere, thanks! We probably should have made sure to do that before we shipped the shader out, clearly I forgot 😅 |
This feature got me excited enough to actually learn HLSL and have a go at doing some fancy shader effects for the terminal but I was quite disappointed to see the time input wasn't working because it's essential to basically any passive animated effect. C++ is almost greek to me, but I had a go at fixing it myself and it seems like passing the time in 2021-02-01.11-32-23.mp4I can't figure out if it's that |
Let me just start with a WOW 👀! When we first added these shaders, this is exactly the kind of cool thing I was expecting people to be able to do with them. That looks awesome! You're right in finding that our renderer only paints a frame when the contents of the window have changed. So yea, right now you need to be constantly emitting text or blinking the cursor or whatever to have the effect be "smooth". This is something we did a long time ago to try and save CPU cycles. Obviously though, that optimization doesn't make any sense if we want to let people make smooth graphical effects. If you make the PR to bind /cc @miniksa (our renderer expert) |
That sounds good to me. As I said, I'm not really a C++ guy so I'm not sure I'm getting/setting the time in the most sensible way, but if you folks are willing to entertain my lack of experience with some constructive review I'll happily take a stab at it. |
I'm always happy to help! I'm not sure anyone can confidently call themselves a C++ guy, no matter how much experience they have with the language 😜 |
Yeah no problem. I can do that after the Do note that this will only make the performance characteristics of this even heavier (more CPU, more battery/power, etc.) but I think we're well past caring about that point when using shaders anyway especially given that shaders enabled right now already forces full-screen repaint instead of differential drawing. |
Correctly sets the time input on the pixelShaderSettings struct, which was previously hard-coded to `0.0f`. ## PR Checklist * [x] Closes #8935 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #8935 ## Detailed Description of the Pull Request / Additional comments I added a private field to `DxEngine` to store the timestamp for when a custom shader is first loaded. The field is initialized in `_SetupTerminalEffects()`, and the calculated time value (seconds since the timestamp) passed to the actual shader is set in `_ComputePixelShaderSettings()`. There remains an issue with with jerky animation due to the renderer not repainting when the window contents are not updated (see discussion in the original issue). This is basically my first time writing C++; constructive review is enthusiastically welcomed 🙂 ## Validation Steps Performed I manually tested using a variety of simple shaders that rely on time input for animation.
Correctly sets the time input on the pixelShaderSettings struct, which was previously hard-coded to `0.0f`. ## PR Checklist * [x] Closes #8935 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #8935 ## Detailed Description of the Pull Request / Additional comments I added a private field to `DxEngine` to store the timestamp for when a custom shader is first loaded. The field is initialized in `_SetupTerminalEffects()`, and the calculated time value (seconds since the timestamp) passed to the actual shader is set in `_ComputePixelShaderSettings()`. There remains an issue with with jerky animation due to the renderer not repainting when the window contents are not updated (see discussion in the original issue). This is basically my first time writing C++; constructive review is enthusiastically welcomed 🙂 ## Validation Steps Performed I manually tested using a variety of simple shaders that rely on time input for animation. (cherry picked from commit 9fb4fb2)
🎉This issue was addressed in #8994, which has now been successfully released as Handy links: |
Environment
Steps to reproduce
2, Add it to your profile config
Expected behavior
I am expecting the example shader to scroll vertically. Time is useful for a number of effects.
Actual behavior
Shader is compiling fine, so suspect an error in the binding.
See TODO terminal/blob/main/src/renderer/dx/DxRenderer.cpp, DxEngine::_ComputePixelShaderSettings()
The text was updated successfully, but these errors were encountered: