Conversation
A case just those don't cover is deferred offscreen rendering. Currently if you want to render some
Subframes let you do this. Idk if they are the simplest way to do it. Maybe some way to switch the frame's target temporarily? Though I guess that also kind of goes against what a frame is supposed to represent. |
|
New approach! (Needs a bit of cleanup for CI, but compiles with standard feature sets.) |
9c96a51 to
b029ece
Compare
|
Based on #1816 because that made the whole mess of the new This is ready for testing & review. :) |
970a93a to
fa80878
Compare
cmeissl
left a comment
There was a problem hiding this comment.
I am not 100% sure this should really require a new abstraction instead of generalizing it.
But I also have no better idea and the approach is clean, so imo this is good solution for now.
Description
Alternative to #1935.
Old PR
This PR implements
Rendererfor theGlesFrame. This allows "sub"-frames to be created, which temporarily borrow the originalGlesFrameto render to a different framebuffer, before restoring the previous framebuffer. Additionally this allows other traits such asImport*to be implemented for theGlesFrameeasily.There is a few things missing before this PR could be considered for merge:
make_current-calls. Though even an activeGlesFrameis technically no guarantee, that there isn't anotherGlesFramefrom a different context...GlesRendererLike-trait, so thatRenderElements, such as theTextureShaderElementor thePixelShaderElementcan be implemented generically across bothGlesRenderers andGlesFrames.GlowFrames just the same.PixmanRenderer,MultiRendererandTestRendereras well.GlesFrames even though we need to borrow the internalGlesTargetas well to be able to restore it.Last but not least, there might be options to implement this in a more straight-forward manner:
GlesRendererfrom aGlesFramewith some kind ofGuard-struct that restores thetargetagain on drop. This would require fewerimpl-blocks and adjusted implementations.Import*orOffscreen(as renderer/gles: Expose create_texture() on GlesFrame #1935 suggests), we could also change those to only depend onRendererSuperand implement that forFrameinstead ofRenderer-itself.Feedback is very much wanted. (Ping @YaLTeR, @cmeissl, @ids1024)
EDIT: New Approach
A new
Frame-trait (please bikeshed on the name) to allow borrowing the old renderer and then restore the current frame on drop.Implemented for all renderers, but needs testing.
Checklist