mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-12 10:32:26 +01:00
Change command buffer flushes to only be called when necessary
This currently breaks sprite draw order, I do not know why
This commit is contained in:
@@ -566,6 +566,7 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint
|
|||||||
bottom += _offsetY;
|
bottom += _offsetY;
|
||||||
|
|
||||||
DrawRectCommand command = {};
|
DrawRectCommand command = {};
|
||||||
|
|
||||||
command.sourceFramebuffer = _fillRectShader->GetSourceFramebuffer();
|
command.sourceFramebuffer = _fillRectShader->GetSourceFramebuffer();
|
||||||
|
|
||||||
vec4f paletteColour[2];
|
vec4f paletteColour[2];
|
||||||
@@ -614,6 +615,8 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint
|
|||||||
command.bounds[3] = bottom + 1;
|
command.bounds[3] = bottom + 1;
|
||||||
|
|
||||||
_commandBuffers.rectangles.push_back(command);
|
_commandBuffers.rectangles.push_back(command);
|
||||||
|
|
||||||
|
// Must be rendered in order, depends on already rendered contents
|
||||||
FlushCommandBuffers();
|
FlushCommandBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,6 +630,7 @@ void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32
|
|||||||
vec4f paletteColour = _engine->GLPalette[colour & 0xFF];
|
vec4f paletteColour = _engine->GLPalette[colour & 0xFF];
|
||||||
|
|
||||||
DrawLineCommand command = {};
|
DrawLineCommand command = {};
|
||||||
|
|
||||||
command.colour = paletteColour;
|
command.colour = paletteColour;
|
||||||
|
|
||||||
command.clip[0] = _clipLeft;
|
command.clip[0] = _clipLeft;
|
||||||
@@ -640,6 +644,8 @@ void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32
|
|||||||
command.pos[3] = y2;
|
command.pos[3] = y2;
|
||||||
|
|
||||||
_commandBuffers.lines.push_back(command);
|
_commandBuffers.lines.push_back(command);
|
||||||
|
|
||||||
|
// Must be rendered in order right now, because it does not yet use depth
|
||||||
FlushCommandBuffers();
|
FlushCommandBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +731,6 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
|
|||||||
command.bounds[3] = bottom;
|
command.bounds[3] = bottom;
|
||||||
|
|
||||||
_commandBuffers.images.push_back(command);
|
_commandBuffers.images.push_back(command);
|
||||||
FlushCommandBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskImage, uint32 colourImage)
|
void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskImage, uint32 colourImage)
|
||||||
@@ -788,7 +793,6 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskIm
|
|||||||
command.bounds[3] = bottom;
|
command.bounds[3] = bottom;
|
||||||
|
|
||||||
_commandBuffers.maskedImages.push_back(command);
|
_commandBuffers.maskedImages.push_back(command);
|
||||||
FlushCommandBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uint8 colour)
|
void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uint8 colour)
|
||||||
@@ -842,7 +846,6 @@ void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uin
|
|||||||
command.bounds[3] = bottom;
|
command.bounds[3] = bottom;
|
||||||
|
|
||||||
_commandBuffers.images.push_back(command);
|
_commandBuffers.images.push_back(command);
|
||||||
FlushCommandBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette)
|
void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette)
|
||||||
@@ -893,12 +896,12 @@ void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * p
|
|||||||
command.bounds[3] = bottom;
|
command.bounds[3] = bottom;
|
||||||
|
|
||||||
_commandBuffers.images.push_back(command);
|
_commandBuffers.images.push_back(command);
|
||||||
FlushCommandBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDrawingContext::FlushCommandBuffers() {
|
void OpenGLDrawingContext::FlushCommandBuffers() {
|
||||||
FlushRectangles();
|
FlushRectangles();
|
||||||
FlushLines();
|
FlushLines();
|
||||||
|
|
||||||
FlushImages();
|
FlushImages();
|
||||||
FlushMaskedImages();
|
FlushMaskedImages();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user