shithub: cstory

Download patch

ref: 0aba8888bb88fec40271083275e0fb68ba3eea96
parent: 90f729158aef0f3e7ecba2cd3d7f30b0c8ba0471
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Apr 21 08:58:31 EDT 2020

Wii U: Update colour in PrepareToDrawGlyphs

--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -55,7 +55,6 @@
 static GX2ContextState *gx2_context;
 
 static RenderBackend_Surface *glyph_destination_surface;
-static const unsigned char *glyph_colour_channels;
 
 RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, bool fullscreen)
 {
@@ -582,8 +581,11 @@
 		return;
 
 	glyph_destination_surface = destination_surface;
-	glyph_colour_channels = colour_channels;
 
+	// Set the colour
+	const float uniform_colours[4] = {colour_channels[0] / 255.0f, colour_channels[1] / 255.0f, colour_channels[2] / 255.0f, 1.0f};
+	GX2SetPixelUniformReg(glyph_shader.pixelShader->uniformVars[0].offset, 4, (uint32_t*)&uniform_colours);
+
 	// Enable blending
 	GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);
 }
@@ -655,10 +657,6 @@
 	GX2SetPixelTexture(&glyph->texture, shader->pixelShader->samplerVars[0].location);
 	GX2RSetAttributeBuffer(&vertex_position_buffer, 0, vertex_position_buffer.elemSize, 0);
 	GX2RSetAttributeBuffer(&texture_coordinate_buffer, 1, texture_coordinate_buffer.elemSize, 0);
-
-	// Set the colour
-	const float uniform_colours[4] = {glyph_colour_channels[0] / 255.0f, glyph_colour_channels[1] / 255.0f, glyph_colour_channels[2] / 255.0f, 1.0f};
-	GX2SetPixelUniformReg(glyph_shader.pixelShader->uniformVars[0].offset, 4, (uint32_t*)&uniform_colours);
 
 	// Draw
 	GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);