Flush Wii U vertex buffers when stuff happens
You know, this 50-character commit name limit is really annoying.
This commit is contained in:
parent
e96ee6ed89
commit
27b3980a56
1 changed files with 17 additions and 0 deletions
|
@ -517,6 +517,19 @@ void RenderBackend_FreeSurface(RenderBackend_Surface *surface)
|
||||||
{
|
{
|
||||||
if (surface != NULL)
|
if (surface != NULL)
|
||||||
{
|
{
|
||||||
|
// Flush the vertex buffer if we're about to destroy its texture
|
||||||
|
if (&surface->texture == last_source_texture)
|
||||||
|
{
|
||||||
|
FlushVertexBuffer();
|
||||||
|
last_source_texture = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (&surface->texture == last_destination_texture)
|
||||||
|
{
|
||||||
|
FlushVertexBuffer();
|
||||||
|
last_destination_texture = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (surface->render_target)
|
if (surface->render_target)
|
||||||
GX2RDestroySurfaceEx(&surface->colour_buffer.surface, (GX2RResourceFlags)0);
|
GX2RDestroySurfaceEx(&surface->colour_buffer.surface, (GX2RResourceFlags)0);
|
||||||
|
|
||||||
|
@ -539,6 +552,10 @@ void RenderBackend_RestoreSurface(RenderBackend_Surface *surface)
|
||||||
|
|
||||||
void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned char *pixels, size_t width, size_t height)
|
void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned char *pixels, size_t width, size_t height)
|
||||||
{
|
{
|
||||||
|
// Flush the vertex buffer if we're about to modify its texture
|
||||||
|
if (&surface->texture == last_source_texture || &surface->texture == last_destination_texture)
|
||||||
|
FlushVertexBuffer();
|
||||||
|
|
||||||
// Convert from RGB24 to RGBA32, and upload it to the GPU texture
|
// Convert from RGB24 to RGBA32, and upload it to the GPU texture
|
||||||
unsigned char *buffer = (unsigned char*)GX2RLockSurfaceEx(&surface->texture.surface, 0, (GX2RResourceFlags)0);
|
unsigned char *buffer = (unsigned char*)GX2RLockSurfaceEx(&surface->texture.surface, 0, (GX2RResourceFlags)0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue