InoxRenderer trait maintenance & updates#115
Open
ArcturusEmrys wants to merge 5 commits intoInochi2D:mainfrom
Open
InoxRenderer trait maintenance & updates#115ArcturusEmrys wants to merge 5 commits intoInochi2D:mainfrom
ArcturusEmrys wants to merge 5 commits intoInochi2D:mainfrom
Conversation
This ensures that: * The renderer does not have to hold empty space for temporaries that are only used during the draw process * `on_begin_draw` is always called before any drawing operations can occur * Drawing is always cleaned up, either in `on_end_draw` or `Drop` (our impls currently use `on_end_draw`)
457e58f to
c368e65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains various rendering trait improvements that are necessary for other PRs I've filed, notably the wgpu renderer in #112 and disabled node hiding in #114.
InoxRenderermethods now always take&mut self, so renderers don't have to use interior mutability.GlCacheas it caused borrow checker issues in the OpenGL renderer.on_begin_drawandon_end_drawhave been promoted to proper trait methods.InoxRendererExtnow calls these methods correctly indraw, so the OpenGL example app doesn't have to.on_begin_drawnow returns aDrawSession<'_>struct that can own its own resources.if let Some()blocks from the wgpu renderer.DrawSessionis a trait with an associated lifetime so that the draw session can also reference renderer resources.InoxRendererimpls provide a generic associated type calledDrawwhich theiron_begin_drawis supposed to call.on_end_drawis used to signal the end of drawing and request presentation to the screen. We specifically do not useDropfor this, in keeping with the convention that dropping aFuturecancels the associated work.&Puppetparameter to allDrawSessionExtmethods (needed for Don't render disabled nodes #114)