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
Render via an intermediate framebuffer #16996
Conversation
f538925
to
d7b3fdd
Compare
This is going to need a fairly significant rework to behave properly wrt HiDPI - hold off reviewing until this is fixed. |
d7b3fdd
to
14caf0f
Compare
Updated. |
14caf0f
to
62abc76
Compare
-depthScale * zoom / screen.Height); | ||
shader.SetVec("r2", -1, 1, 1 - depthOffset); | ||
shader.SetVec("r2", -1, -1, 1 - depthOffset); |
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.
Before anyone asks: this change and the EnableScissor
rename are removing the hardcoded y coordinate flip that used to be baked in to the rendering to work around OpenGL's origin being the bottom left of the window. We now preserve coordinates through the frame buffer(s) and do the flip at the end by rendering the screen quad upside down.
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.
OK.
62abc76
to
a5612d7
Compare
8327a3a
to
95b79ee
Compare
Fixed + fixed another issue that caused the framebuffer to be recreated each frame. |
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.
95b79ee
to
af11e64
Compare
Fixed. |
af11e64
to
013e7bc
Compare
Fixed. |
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 good, cant comment on the opengl details. Tested on the same systems as before. no regression what i could detect.
-depthScale * zoom / screen.Height); | ||
shader.SetVec("r2", -1, 1, 1 - depthOffset); | ||
shader.SetVec("r2", -1, -1, 1 - depthOffset); |
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.
OK.
// Render the compositor buffer to the screen | ||
// HACK / PERF: Fudge the coordinates to cover the actual window while keeping the buffer viewport parameters | ||
// This saves us two redundant (and expensive) SetViewportParams each frame | ||
RgbaSpriteRenderer.DrawSprite(screenSprite, new float3(0, lastBufferSize.Height, 0), new float3(lastBufferSize.Width, -lastBufferSize.Height, 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.
You could use BlitFramebuffer here to avoid the viewport nonsense
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.
glBlitNamedFramebuffer
doesn't seem to be available from EXT_framebuffer_object
, so this will have to wait until/after #17010
013e7bc
to
853a338
Compare
853a338
to
1ffbb8e
Compare
Still looks good, tested after the updates. |
I have several more PRs now being squeezed between this and my next overseas travel. Can we please prioritize getting this merged ASAP before my momentum screeches to a complete halt? |
Not sure why this is still here.
This PR kicks off the next set of renderer changes, which I'm hoping to complete during the Next + 1 cycle. This sets up a frame buffer to render everything into, which is then displayed as a quad over the game window. The screenshot code has been rewritten (removing the legacy GL2-only code) to fetch the texture data from the frame buffer.
This sets the foundation for two sets of future PRs: