shithub: cstory

Download patch

ref: 771f83d06acfcbddc572615948cc1a8bde23d1e1
parent: 4b2a14167eb95eef34678a6d242759d60a9055cb
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Oct 3 20:37:49 EDT 2020

Fix the 'Studio Pixel Presents' text on Wii U

The vertex buffer was being deleted and recreated *after* it was
binded.

--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -144,6 +144,9 @@
 		vertex_buffer.elemCount = vertex_buffer_size;
 
 		GX2RCreateBuffer(&vertex_buffer);	// We're basically screwed if this fails
+
+		GX2RSetAttributeBuffer(&vertex_buffer, 0, sizeof(Vertex), offsetof(Vertex, position));
+		GX2RSetAttributeBuffer(&vertex_buffer, 1, sizeof(Vertex), offsetof(Vertex, texture));
 	}
 
 	void *vertex_pointer = GX2RLockBufferEx(&vertex_buffer, (GX2RResourceFlags)0);
@@ -225,6 +228,9 @@
 									// Disable depth-test (enabled by default for some reason)
 									GX2SetDepthOnlyControl(FALSE, FALSE, GX2_COMPARE_FUNC_ALWAYS);
 
+									GX2RSetAttributeBuffer(&vertex_buffer, 0, sizeof(Vertex), offsetof(Vertex, position));
+									GX2RSetAttributeBuffer(&vertex_buffer, 1, sizeof(Vertex), offsetof(Vertex, texture));
+
 									return framebuffer_surface;
 								}
 								else
@@ -570,8 +576,6 @@
 		// Bind misc. data
 		GX2SetPixelSampler(&sampler, shader->pixelShader->samplerVars[0].location);
 		GX2SetPixelTexture(&source_surface->texture, shader->pixelShader->samplerVars[0].location);
-		GX2RSetAttributeBuffer(&vertex_buffer, 0, sizeof(Vertex), offsetof(Vertex, position));
-		GX2RSetAttributeBuffer(&vertex_buffer, 1, sizeof(Vertex), offsetof(Vertex, texture));
 
 		// Disable blending
 		GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE);
@@ -648,9 +652,6 @@
 		const float uniform_colours[4] = {red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f};
 		GX2SetPixelUniformReg(shader_group_colour_fill.pixelShader->uniformVars[0].offset, 4, (uint32_t*)&uniform_colours);
 
-		// Bind misc. data
-		GX2RSetAttributeBuffer(&vertex_buffer, 0, sizeof(Vertex), offsetof(Vertex, position));
-
 		// Disable blending
 		GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE);
 	}
@@ -779,8 +780,6 @@
 		// Bind misc. data
 		GX2SetPixelSampler(&sampler, shader_group_glyph.pixelShader->samplerVars[0].location);
 		GX2SetPixelTexture(&atlas->texture, shader_group_glyph.pixelShader->samplerVars[0].location);
-		GX2RSetAttributeBuffer(&vertex_buffer, 0, sizeof(Vertex), offsetof(Vertex, position));
-		GX2RSetAttributeBuffer(&vertex_buffer, 1, sizeof(Vertex), offsetof(Vertex, texture));
 
 		// Enable blending
 		GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);