microsoft / microsoft/terminal
Expose time, date, mouse, ideally CPU / GPU / memory utilization to custom HLSL shaders
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
Description of the new feature/enhancement
Custom shaders rock, but they would rock even more if they were interactive. They simply don't know what's happening outside of the shader. I would love to have my shaders respond to what's happening on the system: for example, have them change color by time of day, or have them act up and be all energetic when CPU utilization is high, and calm down when CPU utilization is low. That would be a totally sweet command prompt.
Proposed technical implementation details (optional)
On the HLSL side, expose additional state in the cbuffer. I don't think this would break existing shaders if we just add items to the end of the cbuffer, but even if it does, hey, it's an experimental feature as someone said. :)
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
// Additional proposed constants
float4 TimeOfDay; // .x = hours; .y = minutes; .z = seconds; .w = msecs
float4 Date; // .x = year; .y = month; .z = day
float CpuUtilization;
float MemoryUtilization;
float GpuUtilization; // ok, may be a long shot, but would be nice to have
float2 Mouse; // Mouse coordinates if mouse is over the window! Interactive pixel shader backgrounds! :)
};
Minor tech note: if fetching cpu / memory / gpu utilization is costly, it's ok to do them every 500ms or so. They don't need to be per-frame.
maintainer notes:
#15837 is another feature that might be a good thing to plumb through here. Consider: swapchainPosition, so that you can use the offset relative to the desktop origin. (we would of course have to plumb the desktop image into the shader, ala #14073)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies the HLSL PixelShaderSettings cbuffer as the integration point; begin by tracing where that cbuffer is defined and populated. Determine how the requested time, date, mouse, and utilization state should be exposed, then verify custom shaders receive it without breaking existing shaders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100