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

Rendering optimizations #7

Open
impworks opened this issue Feb 2, 2017 · 0 comments
Open

Rendering optimizations #7

impworks opened this issue Feb 2, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@impworks
Copy link
Owner

impworks commented Feb 2, 2017

Rendering performance depends on the order of rendering object. Less spritebatches and render target switches is always better. Therefore, the engine should have an ability to reorder object graph for rendering.

Here's an example scene graph:

image

Naive rendering order causes many render target switches:

  1. RT = 0
  2. RT = 1
  3. Render 1
  4. Render 2
  5. RT = 0
  6. Render RT 1
  7. RT = 2
  8. Render 3
  9. Render 4
  10. RT = 3
  11. Render 5
  12. Render 6
  13. RT = 2
  14. Render RT 3
  15. Render 7
  16. RT = 0
  17. Render RT 2
  18. Render 8

The optimal order would be:

  1. RT = 1
  2. Render 1
  3. Render 2
  4. RT = 3
  5. Render 5
  6. Render 6
  7. RT = 2
  8. Render 3
  9. Render 4
  10. Render RT 3
  11. Render 7
  12. RT = 0
  13. Render RT 1
  14. Render RT 2
  15. Render 8

Benefits: each 4 RT switches instead of one. Each RT is used exactly once, which means default RenderTargetUsage can be used instead of the slow RenderTargetUsage.PreserveContents.

@impworks impworks added the insane label Feb 2, 2017
@impworks impworks added this to the Backlog milestone Feb 2, 2017
@impworks impworks self-assigned this Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant