-
Notifications
You must be signed in to change notification settings - Fork 29
added timing functionality to shaders #573
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
base: main
Are you sure you want to change the base?
Conversation
src/core/Stage.ts
Outdated
@@ -504,6 +510,11 @@ export class Stage { | |||
if (renderRequested === true) { | |||
this.renderRequested = false; | |||
} | |||
|
|||
if (this.timedNodes > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we requesting a new render on timedNodes? would this mean we'd never reach idle if a timed shader is active?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm yeah, I think i'll have to tweak the timednode stuff a bit more. but yeah generally you would have to keep redrawing the screen if an time shader is active , meaning it won't go idle.
src/core/Stage.ts
Outdated
@@ -578,6 +589,9 @@ export class Stage { | |||
// If the node is renderable and has a loaded texture, render it | |||
if (node.isRenderable === true) { | |||
node.renderQuads(this.renderer); | |||
if (node.hasShaderTimeFn === true) { | |||
this.timedNodes++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if a timer is stopped or a timed node removed? will this number ever go down?
or do we need to reset the timedNodes every cycle (might be expensive?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively you can also add the node itself to the timedNodes on create or get/set of the shader? and then remove it on destroy?
that would avoid you need to count every run on the hot path.
You could expose a function on stage that the corenode calls when it has a timed shader
OR
Add it from the shader itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah need to find a better way to keep track of the timedNodes.
src/core/CoreNode.ts
Outdated
@@ -1733,9 +1733,17 @@ export class CoreNode extends EventEmitter { | |||
framebufferDimensions: this.parentHasRenderTexture | |||
? this.parentFramebufferDimensions | |||
: null, | |||
time: this.hasShaderTimeFn === true ? this.getTimerValue() : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks misaligned or is GH acting up? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misaligned
Added time functionality to shaders, these work separate from the props (so props don't have to be recalculated) which should result in better performance overal.