-
Notifications
You must be signed in to change notification settings - Fork 24
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
Perf: Skip nodes that have no renderable props. #100
Perf: Skip nodes that have no renderable props. #100
Conversation
What does this solve? Are frameworks creating many nodes that shouldn't be rendered? How many are being skipped? |
@chiefcll if the node has no renderable properties it will be skipped by the render step. This will allow SolidJS / JSX to add nodes (e.g. div tags) that do have X / Y / zIndex positioning for its children, but have no "renderable properties" that require to be drawn on the screen. For example:
It allows you to freely manipulate the ParentsNode world position/width/etc. without it getting actually rendered. Prior to this change even ParentNode would get a GPU Render Pass, just have an empty instruction so the GPU gets the upload but then figures out it doesn't need to draw anything. By forcing ParentNode to be color=0 from the App Framework like Solid or Blits, you can have the render still do the positioning but skip the rendering portion. For added clarity, that render step is 80% of the resources spent to render that node. Thus increasing FPS. This helps a lot by avoiding render steps on nested nodes that do not require to be rendered, but are part of the tree for positioning / zIndex / alpha / container-ish logic. |
Thanks for the details. That makes sense. Right now solid is defaulting to transparent for the color. I assume with this change we should remove setting the color? Or set the color to 0? I’ll play around 🙂 |
I think you’re already setting it to 0x0 in Solid by default if there is no image/texture and if color isnt present. Should be plug and play 😃 |
Probably best to make this calculated during update(). As this PR stands I think there are different types of property assignment that will not trigger the calculation to be done. |
What different properties do you anticipate other then And I don't mind changing it to be part of the |
As it stands if the |
e810b76
to
4500a26
Compare
Added a new update:
Small note on updates vs renderability: Also the |
4500a26
to
03bf123
Compare
If the node has no renderable properties it will be skipped by the render step. Saving an otherwise expensive step in the render pipeline. This will allow application / application frameworks to add nodes that do have X / Y / zIndex positioning for its children, but have no "renderable properties" that require to be drawn on the screen. For example: ``` <ParentNode x=100 y=200 width=500 height=500 zIndex=2> <ChildNode x=10 y=10 src="..image"> <ChildNode ...> </ParentNode> ``` It allows you to freely manipulate the ParentsNode world position/width/etc. without it getting actually rendered. Prior to this change even ParentNode would get a GPU Render Pass, just have an empty instruction so the GPU gets the upload but then figures out it doesn't need to draw anything. By forcing ParentNode to be color=0 from the App Framework like Solid or Blits, you can have the render still do the positioning but skip the rendering portion. For added clarity, that render step is 80% of the resources spent to render that node. Thus increasing overall FPS. This helps a lot by avoiding render steps on nested nodes that do not require to be rendered, but are part of the tree for positioning / zIndex / alpha / container-ish logic.
03bf123
to
f661e9c
Compare
Testing this one along with my latest experimental changes. Should be ready to merge this soon. |
@wouterlucas I just noticed that one optimization that would be useful here is to also check if the width or height of the Node is 0. In that case it should be not renderable no matter what. |
@frank-weindel agree! I’ll add that in about an hour or so. |
@frank-weindel adding a check that checks for width and height per: if (!this.props.width || !this.props.height) {
return (this.isRenderable = false);
} actually makes the alpha blending 2 test fail, the rocko figure isn't rendered: Which is think would be correct, seeing its attributes in renderer
.createNode({
x: curX,
y: curY,
src: rocko,
alpha: 1.0,
parent: sideContainer,
})
.once('loaded', sizeToTexture); However it does mean the behavior changes over previous and the test will need to be adjusted. If you're okay with that I'll gladly push the change, otherwise let me know what would be a better route. |
I'll make a note to revisit it. I think its an important optimization but the texture/image should still load even if the Node is 0x0. |
Add color: 0 to the node and don't provide any texture/image properties and it will be skipped in the render step.