shithub: cstory

Download patch

ref: eac417cdc1c1b8a3cc0cde5b09d74d6492dc5d2d
parent: 1eb1e522c8b7491265677192059a50e5bb3248fe
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Sep 23 12:52:42 EDT 2020

I guess I figured out what the GX2 context is for

--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -240,8 +240,9 @@
 
 						if (framebuffer_surface != NULL)
 						{
-							// Create a 'context' (this voodoo magic can be used to undo `GX2SetColorBuffer`,
-							// allowing us to draw to the screen once again)
+							// From what I can tell, there isn't a 'global context' in GX2: instead there are context objects.
+							// wut internally uses (and *switches to*) its own contexts, so we need to maintain one too,
+							// and make sure we're always switching back to it when wut is done doing what it's doing.
 							gx2_context = (GX2ContextState*)aligned_alloc(GX2_CONTEXT_STATE_ALIGNMENT, sizeof(GX2ContextState));
 
 							if (gx2_context != NULL)
@@ -445,7 +446,7 @@
 
 	WHBGfxFinishRender();
 
-	// Do this or else the screen will never update. I wish I understood why.
+	// Switch back to our context
 	GX2SetContextState(gx2_context);
 }