-
-
Notifications
You must be signed in to change notification settings - Fork 13
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 to tex improvements #70
Render to tex improvements #70
Commits on Apr 19, 2024
-
ogc: reduces number of copies from EFB to texture
Instead of copying at the end of every command queue flush, copy the EFB to the texture only when the texture stops being a render target. Unfortunately SDL invokes the SetRenderTarget() method after having updated the render target pointer, forcing us to keep our own copy of it.
Configuration menu - View commit details
-
Copy full SHA for 5d6a35c - Browse repository at this point
Copy the full SHA 5d6a35cView commit details -
ogc: avoid copying to XFB when clearing with a render target
If we are rendering to a texture, we must avoid writing to the XFB, because the image we are rendering might not be intended to be shown as-is on the XFB. So, when clearing the display, pay attention to whether we are rendering to a texture and, in that case, do not copy the EFB to the XFB. Instead, copy it to the texture itself (not that we care a lot about this copy, since the texture will anyway be overwitten once it stops being a render target; but we do care about this operation causing a full clearing of the EFB).
Configuration menu - View commit details
-
Copy full SHA for a21ac5b - Browse repository at this point
Copy the full SHA a21ac5bView commit details -
ogc: flush the FIFO after executing the command queue
It can happens that the client program immediately calls SDL_DestroyTexture() after draawing it. Luckily for us, SDL is smart enough to realize that the texture has been used in a draw operation and issues a SDL_RenderFlush() so that all the operations get executed. But this means that on our side, we must also make sure that when we return from OGC_RunCommandQueue() the texture data is no longer needed. The call to GX_DrawDone() does exactly this.
Configuration menu - View commit details
-
Copy full SHA for 5b08f93 - Browse repository at this point
Copy the full SHA 5b08f93View commit details -
ogc: save and restore EFB when rendering to a texture starts and stops
Indeed, the situation where a rendering to texture operation begins after the EFB has already been painted can happen. In order not to lose the existing EFB contents, make a copy of them into a texture (using the same size of the render-to-texture target) and then restore them by redrawing the saved texture over the EFB, once the render-to-texture operation has completed. Note that it's important that any calls to GX_SetPixelFmt() happen in the appropriate order: 1. Save the current EFB contents 2. Change the EFB format (by calling GX_SetPixelFmt()) 3. Perform all the render-to-texture drawing operations 4. Save the EFB into the target texture 5. Restore the EFB format 6. Restore the EFB contents by drawing the texture saved in step 1 Swapping the 5th and 6th steps does not cause any visible issues in Dolphin, but causes the EFB to be painted back with wrong colors on a real Wii.
Configuration menu - View commit details
-
Copy full SHA for c1115ad - Browse repository at this point
Copy the full SHA c1115adView commit details -
ogc: invalidate current texture contents before copying the EFB onto it
This is needed to avoid visual artifacts on the saved texture.
Configuration menu - View commit details
-
Copy full SHA for 63cb49e - Browse repository at this point
Copy the full SHA 63cb49eView commit details -
ogc: call GX_PixModeSync() after copying the EFB to a texture
The documentation says that this is needed, though in practice I haven't yet seen any issue with not using it.
Configuration menu - View commit details
-
Copy full SHA for 47e30ca - Browse repository at this point
Copy the full SHA 47e30caView commit details