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

Expose time, date, mouse, ideally CPU / GPU / memory utilization to custom HLSL shaders #9468

Open
nincode opened this issue Mar 12, 2021 · 1 comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@nincode
Copy link

nincode commented Mar 12, 2021

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)

@nincode nincode added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Mar 12, 2021
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 12, 2021
@skyline75489
Copy link
Collaborator

Funny that, even though not quite related, the first thought I had about this is #3459, which also requires time, date, etc.

@zadjii-msft zadjii-msft added this to the Icebox ❄ milestone Mar 30, 2021
@zadjii-msft zadjii-msft added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Product-Terminal The new Windows Terminal. labels Mar 30, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Mar 30, 2021
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants