mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Merge branch '12.0-development' into GraphicsBuffer
This commit is contained in:
@@ -234,13 +234,13 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
||||
|
||||
setDebug(isDebugEnabled());
|
||||
|
||||
if (streamBufferState.vb[0] == nullptr)
|
||||
if (batchedDrawState.vb[0] == nullptr)
|
||||
{
|
||||
// Initial sizes that should be good enough for most cases. It will
|
||||
// resize to fit if needed, later.
|
||||
streamBufferState.vb[0] = CreateStreamBuffer(BUFFERTYPE_VERTEX, 1024 * 1024 * 1);
|
||||
streamBufferState.vb[1] = CreateStreamBuffer(BUFFERTYPE_VERTEX, 256 * 1024 * 1);
|
||||
streamBufferState.indexBuffer = CreateStreamBuffer(BUFFERTYPE_INDEX, sizeof(uint16) * LOVE_UINT16_MAX);
|
||||
batchedDrawState.vb[0] = CreateStreamBuffer(BUFFERTYPE_VERTEX, 1024 * 1024 * 1);
|
||||
batchedDrawState.vb[1] = CreateStreamBuffer(BUFFERTYPE_VERTEX, 256 * 1024 * 1);
|
||||
batchedDrawState.indexBuffer = CreateStreamBuffer(BUFFERTYPE_INDEX, sizeof(uint16) * LOVE_UINT16_MAX);
|
||||
}
|
||||
|
||||
// Reload all volatile objects.
|
||||
@@ -293,7 +293,7 @@ void Graphics::unSetMode()
|
||||
if (!isCreated())
|
||||
return;
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
// Unload all volatile objects. These must be reloaded after the display
|
||||
// mode change.
|
||||
@@ -321,7 +321,7 @@ void Graphics::unSetMode()
|
||||
|
||||
void Graphics::setActive(bool enable)
|
||||
{
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
// Make sure all pending OpenGL commands have fully executed before
|
||||
// returning, when going from active to inactive. This is required on iOS.
|
||||
@@ -505,7 +505,7 @@ void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int w, int h,
|
||||
|
||||
OpenGL::TempDebugGroup debuggroup("setRenderTargets");
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
endPass();
|
||||
|
||||
bool iswindow = rts.getFirstTarget().texture == nullptr;
|
||||
@@ -621,7 +621,7 @@ void Graphics::endPass()
|
||||
void Graphics::clear(OptionalColorf c, OptionalInt stencil, OptionalDouble depth)
|
||||
{
|
||||
if (c.hasValue || stencil.hasValue || depth.hasValue)
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
GLbitfield flags = 0;
|
||||
|
||||
@@ -678,7 +678,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors, OptionalInt sten
|
||||
return;
|
||||
}
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
bool drawbuffersmodified = false;
|
||||
ncolors = std::min(ncolors, ncolorRTs);
|
||||
@@ -754,7 +754,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors, OptionalInt sten
|
||||
|
||||
void Graphics::discard(const std::vector<bool> &colorbuffers, bool depthstencil)
|
||||
{
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
discard(OpenGL::FRAMEBUFFER_ALL, colorbuffers, depthstencil);
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ void Graphics::present(void *screenshotCallbackData)
|
||||
|
||||
deprecations.draw(this);
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
endPass();
|
||||
|
||||
gl.bindFramebuffer(OpenGL::FRAMEBUFFER_ALL, gl.getDefaultFBO());
|
||||
@@ -1038,9 +1038,9 @@ void Graphics::present(void *screenshotCallbackData)
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, info.info.uikit.colorbuffer);
|
||||
#endif
|
||||
|
||||
for (StreamBuffer *buffer : streamBufferState.vb)
|
||||
for (StreamBuffer *buffer : batchedDrawState.vb)
|
||||
buffer->nextFrame();
|
||||
streamBufferState.indexBuffer->nextFrame();
|
||||
batchedDrawState.indexBuffer->nextFrame();
|
||||
|
||||
auto window = getInstance<love::window::Window>(M_WINDOW);
|
||||
if (window != nullptr)
|
||||
@@ -1068,7 +1068,7 @@ void Graphics::present(void *screenshotCallbackData)
|
||||
|
||||
void Graphics::setScissor(const Rect &rect)
|
||||
{
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
DisplayState &state = states.back();
|
||||
|
||||
@@ -1093,7 +1093,7 @@ void Graphics::setScissor(const Rect &rect)
|
||||
void Graphics::setScissor()
|
||||
{
|
||||
if (states.back().scissor)
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
states.back().scissor = false;
|
||||
|
||||
@@ -1111,7 +1111,7 @@ void Graphics::drawToStencilBuffer(StencilAction action, int value)
|
||||
else if (isRenderTargetActive() && (rts.temporaryRTFlags & TEMPORARY_RT_STENCIL) == 0 && (dstexture == nullptr || !isPixelFormatStencil(dstexture->getPixelFormat())))
|
||||
throw love::Exception("Drawing to the stencil buffer with a render target active requires either stencil=true or a custom stencil-type texture to be used, in setRenderTarget.");
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
writingToStencil = true;
|
||||
|
||||
@@ -1156,7 +1156,7 @@ void Graphics::stopDrawToStencilBuffer()
|
||||
if (!writingToStencil)
|
||||
return;
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
writingToStencil = false;
|
||||
|
||||
@@ -1174,7 +1174,7 @@ void Graphics::setStencilTest(CompareMode compare, int value)
|
||||
DisplayState &state = states.back();
|
||||
|
||||
if (state.stencilCompare != compare || state.stencilTestValue != value)
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
state.stencilCompare = compare;
|
||||
state.stencilTestValue = value;
|
||||
@@ -1211,7 +1211,7 @@ void Graphics::setDepthMode(CompareMode compare, bool write)
|
||||
DisplayState &state = states.back();
|
||||
|
||||
if (state.depthTest != compare || state.depthWrite != write)
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
state.depthTest = compare;
|
||||
state.depthWrite = write;
|
||||
@@ -1233,7 +1233,7 @@ void Graphics::setFrontFaceWinding(Winding winding)
|
||||
DisplayState &state = states.back();
|
||||
|
||||
if (state.winding != winding)
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
state.winding = winding;
|
||||
|
||||
@@ -1255,7 +1255,7 @@ void Graphics::setColor(Colorf c)
|
||||
|
||||
void Graphics::setColorMask(ColorChannelMask mask)
|
||||
{
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
glColorMask(mask.r, mask.g, mask.b, mask.a);
|
||||
states.back().colorMask = mask;
|
||||
@@ -1264,7 +1264,7 @@ void Graphics::setColorMask(ColorChannelMask mask)
|
||||
void Graphics::setBlendState(const BlendState &blend)
|
||||
{
|
||||
if (!(blend == states.back().blend))
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
if (blend.operationRGB == BLENDOP_MAX || blend.operationA == BLENDOP_MAX
|
||||
|| blend.operationRGB == BLENDOP_MIN || blend.operationA == BLENDOP_MIN)
|
||||
@@ -1294,8 +1294,8 @@ void Graphics::setBlendState(const BlendState &blend)
|
||||
|
||||
void Graphics::setPointSize(float size)
|
||||
{
|
||||
if (streamBufferState.primitiveMode == PRIMITIVE_POINTS)
|
||||
flushStreamDraws();
|
||||
if (batchedDrawState.primitiveMode == PRIMITIVE_POINTS)
|
||||
flushBatchedDraws();
|
||||
|
||||
gl.setPointSize(size * getCurrentDPIScale());
|
||||
states.back().pointSize = size;
|
||||
@@ -1307,7 +1307,7 @@ void Graphics::setWireframe(bool enable)
|
||||
if (GLAD_ES_VERSION_2_0)
|
||||
return;
|
||||
|
||||
flushStreamDraws();
|
||||
flushBatchedDraws();
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, enable ? GL_LINE : GL_FILL);
|
||||
states.back().wireframe = enable;
|
||||
|
||||
Reference in New Issue
Block a user