From fec6cfd4492506d588bcafdf21b9a45fb824d87b Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 28 Feb 2020 23:25:25 -0400 Subject: [PATCH] metal: fix compilation errors --- src/modules/graphics/metal/Graphics.mm | 33 +++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/modules/graphics/metal/Graphics.mm b/src/modules/graphics/metal/Graphics.mm index b06bf643c..b368ac683 100644 --- a/src/modules/graphics/metal/Graphics.mm +++ b/src/modules/graphics/metal/Graphics.mm @@ -290,13 +290,13 @@ bool Graphics::setMode(void *context, int width, int height, int pixelwidth, int created = true; - 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(device, BUFFER_VERTEX, 1024 * 1024 * 1); - streamBufferState.vb[1] = CreateStreamBuffer(device, BUFFER_VERTEX, 256 * 1024 * 1); - streamBufferState.indexBuffer = CreateStreamBuffer(device, BUFFER_INDEX, sizeof(uint16) * LOVE_UINT16_MAX); + batchedDrawState.vb[0] = CreateStreamBuffer(device, BUFFER_VERTEX, 1024 * 1024 * 1); + batchedDrawState.vb[1] = CreateStreamBuffer(device, BUFFER_VERTEX, 256 * 1024 * 1); + batchedDrawState.indexBuffer = CreateStreamBuffer(device, BUFFER_INDEX, sizeof(uint16) * LOVE_UINT16_MAX); } createQuadIndexBuffer(); @@ -330,7 +330,7 @@ void Graphics::unSetMode() if (!isCreated()) return; - flushStreamDraws(); + flushBatchedDraws(); submitCommandBuffer(); @@ -344,7 +344,7 @@ void Graphics::unSetMode() void Graphics::setActive(bool enable) { - flushStreamDraws(); + flushBatchedDraws(); active = enable; } @@ -787,7 +787,7 @@ void Graphics::endPass() void Graphics::clear(OptionalColorf c, OptionalInt stencil, OptionalDouble depth) { if (c.hasValue || stencil.hasValue || depth.hasValue) - flushStreamDraws(); + flushBatchedDraws(); // TODO } @@ -806,14 +806,14 @@ void Graphics::clear(const std::vector &colors, OptionalInt sten return; } - flushStreamDraws(); + flushBatchedDraws(); // TODO } void Graphics::discard(const std::vector &colorbuffers, bool depthstencil) { - flushStreamDraws(); + flushBatchedDraws(); // TODO } @@ -827,7 +827,6 @@ void Graphics::present(void *screenshotCallbackData) deprecations.draw(this); - flushStreamDraws(); endPass(); if (!pendingScreenshotCallbacks.empty()) @@ -888,9 +887,9 @@ void Graphics::present(void *screenshotCallbackData) pendingScreenshotCallbacks.clear(); } - for (StreamBuffer *buffer : streamBufferState.vb) + for (StreamBuffer *buffer : batchedDrawState.vb) buffer->nextFrame(); - streamBufferState.indexBuffer->nextFrame(); + batchedDrawState.indexBuffer->nextFrame(); submitCommandBuffer(); @@ -920,7 +919,7 @@ void Graphics::present(void *screenshotCallbackData) void Graphics::setScissor(const Rect &rect) { - flushStreamDraws(); + flushBatchedDraws(); DisplayState &state = states.back(); state.scissor = true; @@ -933,7 +932,7 @@ void Graphics::setScissor() DisplayState &state = states.back(); if (state.scissor) { - flushStreamDraws(); + flushBatchedDraws(); state.scissor = false; dirtyRenderState |= STATEBIT_SCISSOR; } @@ -949,7 +948,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 Canvas active requires either stencil=true or a custom stencil-type Canvas to be used, in setCanvas."); - flushStreamDraws(); + flushBatchedDraws(); writingToStencil = true; @@ -962,7 +961,7 @@ void Graphics::stopDrawToStencilBuffer() if (!writingToStencil) return; - flushStreamDraws(); + flushBatchedDraws(); writingToStencil = false; @@ -981,7 +980,7 @@ void Graphics::setBlendState(const BlendState &blend) { if (!(blend == states.back().blend)) { - flushStreamDraws(); + flushBatchedDraws(); states.back().blend = blend; dirtyRenderState |= STATEBIT_BLEND; }