Fix the 'Studio Pixel Presents' text on Wii U

The vertex buffer was being deleted and recreated *after* it was
binded.
This commit is contained in:
Clownacy 2020-10-04 00:37:49 +01:00
parent 4b2a14167e
commit 771f83d06a

View file

@ -144,6 +144,9 @@ static void FlushVertexBuffer(void)
vertex_buffer.elemCount = vertex_buffer_size; vertex_buffer.elemCount = vertex_buffer_size;
GX2RCreateBuffer(&vertex_buffer); // We're basically screwed if this fails 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); void *vertex_pointer = GX2RLockBufferEx(&vertex_buffer, (GX2RResourceFlags)0);
@ -225,6 +228,9 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, size_t scree
// Disable depth-test (enabled by default for some reason) // Disable depth-test (enabled by default for some reason)
GX2SetDepthOnlyControl(FALSE, FALSE, GX2_COMPARE_FUNC_ALWAYS); 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; return framebuffer_surface;
} }
else else
@ -570,8 +576,6 @@ void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RenderBacke
// Bind misc. data // Bind misc. data
GX2SetPixelSampler(&sampler, shader->pixelShader->samplerVars[0].location); GX2SetPixelSampler(&sampler, shader->pixelShader->samplerVars[0].location);
GX2SetPixelTexture(&source_surface->texture, 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 // Disable blending
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE); GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE);
@ -648,9 +652,6 @@ void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RenderBacken
const float uniform_colours[4] = {red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f}; 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); 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 // Disable blending
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE); GX2SetColorControl(GX2_LOGIC_OP_COPY, 0, FALSE, TRUE);
} }
@ -779,8 +780,6 @@ void RenderBackend_PrepareToDrawGlyphs(RenderBackend_GlyphAtlas *atlas, RenderBa
// Bind misc. data // Bind misc. data
GX2SetPixelSampler(&sampler, shader_group_glyph.pixelShader->samplerVars[0].location); GX2SetPixelSampler(&sampler, shader_group_glyph.pixelShader->samplerVars[0].location);
GX2SetPixelTexture(&atlas->texture, 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 // Enable blending
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE); GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);