Skip to content

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

Open

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)

Activity

  1. added
    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.
    on Mar 12, 2021
  2. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Mar 12, 2021
  3. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Mar 12, 2021
  4. skyline75489 commented on Mar 16, 2021

    @skyline75489
    Collaborator

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

  5. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Mar 30, 2021
  6. removed
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Apr 13, 2021
  7. groutoutlook commented on Jun 3, 2025

    @groutoutlook

    bump... maybe? Would love to see this so I can some arbitrary data to shader for cool visual effect.

  8. mjvh80 commented on Sep 29, 2026

    @mjvh80

    Instead of proposing a feature just for this, I would like to have a random number added so I can render things a little differently in different buffers/windows if I have multiple open, I'm not aware I can do so currently. Maybe some sort of identifier is enough to seed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions