mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +02:00
@@ -207,7 +207,7 @@ private:
|
|||||||
void initCapabilities() override;
|
void initCapabilities() override;
|
||||||
void getAPIStats(int &shaderswitches) const override;
|
void getAPIStats(int &shaderswitches) const override;
|
||||||
|
|
||||||
void endPass();
|
void endPass(bool presenting);
|
||||||
|
|
||||||
id<MTLDepthStencilState> getCachedDepthStencilState(const DepthState &depth, const StencilState &stencil);
|
id<MTLDepthStencilState> getCachedDepthStencilState(const DepthState &depth, const StencilState &stencil);
|
||||||
void applyRenderState(id<MTLRenderCommandEncoder> renderEncoder, const VertexAttributes &attributes);
|
void applyRenderState(id<MTLRenderCommandEncoder> renderEncoder, const VertexAttributes &attributes);
|
||||||
|
|||||||
@@ -1358,7 +1358,7 @@ bool Graphics::dispatch(int x, int y, int z)
|
|||||||
|
|
||||||
void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int /*pixelw*/, int /*pixelh*/, bool /*hasSRGBtexture*/)
|
void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int /*pixelw*/, int /*pixelh*/, bool /*hasSRGBtexture*/)
|
||||||
{ @autoreleasepool {
|
{ @autoreleasepool {
|
||||||
endPass();
|
endPass(false);
|
||||||
|
|
||||||
bool isbackbuffer = rts.getFirstTarget().texture == nullptr;
|
bool isbackbuffer = rts.getFirstTarget().texture == nullptr;
|
||||||
|
|
||||||
@@ -1410,7 +1410,7 @@ void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int /*pixelw*/
|
|||||||
dirtyRenderState = STATEBIT_ALL;
|
dirtyRenderState = STATEBIT_ALL;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
void Graphics::endPass()
|
void Graphics::endPass(bool presenting)
|
||||||
{
|
{
|
||||||
// Make sure the encoder gets set up, if nothing else has done it yet.
|
// Make sure the encoder gets set up, if nothing else has done it yet.
|
||||||
useRenderEncoder();
|
useRenderEncoder();
|
||||||
@@ -1421,9 +1421,9 @@ void Graphics::endPass()
|
|||||||
love::graphics::Texture *depthstencil = rts.depthStencil.texture.get();
|
love::graphics::Texture *depthstencil = rts.depthStencil.texture.get();
|
||||||
|
|
||||||
// Discard the depth/stencil buffer if we're using an internal cached one,
|
// Discard the depth/stencil buffer if we're using an internal cached one,
|
||||||
// or if this is the backbuffer.
|
// or if we're presenting the backbuffer to the display.
|
||||||
if ((depthstencil == nullptr && (rts.temporaryRTFlags & (TEMPORARY_RT_DEPTH | TEMPORARY_RT_STENCIL)) != 0)
|
if ((depthstencil == nullptr && (rts.temporaryRTFlags & (TEMPORARY_RT_DEPTH | TEMPORARY_RT_STENCIL)) != 0)
|
||||||
|| !rts.getFirstTarget().texture.get())
|
|| (presenting && !rts.getFirstTarget().texture.get()))
|
||||||
{
|
{
|
||||||
attachmentStoreActions.depth = MTLStoreActionDontCare;
|
attachmentStoreActions.depth = MTLStoreActionDontCare;
|
||||||
attachmentStoreActions.stencil = MTLStoreActionDontCare;
|
attachmentStoreActions.stencil = MTLStoreActionDontCare;
|
||||||
@@ -1562,7 +1562,7 @@ void Graphics::present(void *screenshotCallbackData)
|
|||||||
|
|
||||||
// endPass calls useRenderEncoder, which makes sure activeDrawable is set
|
// endPass calls useRenderEncoder, which makes sure activeDrawable is set
|
||||||
// when possible.
|
// when possible.
|
||||||
endPass();
|
endPass(true);
|
||||||
|
|
||||||
id<MTLBuffer> screenshotbuffer = nil;
|
id<MTLBuffer> screenshotbuffer = nil;
|
||||||
|
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int pixelw, in
|
|||||||
|
|
||||||
OpenGL::TempDebugGroup debuggroup("setRenderTargets");
|
OpenGL::TempDebugGroup debuggroup("setRenderTargets");
|
||||||
|
|
||||||
endPass();
|
endPass(false);
|
||||||
|
|
||||||
bool iswindow = rts.getFirstTarget().texture == nullptr;
|
bool iswindow = rts.getFirstTarget().texture == nullptr;
|
||||||
Winding vertexwinding = state.winding;
|
Winding vertexwinding = state.winding;
|
||||||
@@ -794,16 +794,18 @@ void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int pixelw, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::endPass()
|
void Graphics::endPass(bool presenting)
|
||||||
{
|
{
|
||||||
auto &rts = states.back().renderTargets;
|
auto &rts = states.back().renderTargets;
|
||||||
love::graphics::Texture *depthstencil = rts.depthStencil.texture.get();
|
love::graphics::Texture *depthstencil = rts.depthStencil.texture.get();
|
||||||
|
|
||||||
// Discard the depth/stencil buffer if we're using an internal cached one.
|
// Discard the depth/stencil buffer if we're using an internal cached one,
|
||||||
if (depthstencil == nullptr && (rts.temporaryRTFlags & (TEMPORARY_RT_DEPTH | TEMPORARY_RT_STENCIL)) != 0)
|
// or if we're presenting the backbuffer to the display.
|
||||||
|
if ((depthstencil == nullptr && (rts.temporaryRTFlags & (TEMPORARY_RT_DEPTH | TEMPORARY_RT_STENCIL)) != 0)
|
||||||
|
|| (presenting && !rts.getFirstTarget().texture.get()))
|
||||||
|
{
|
||||||
discard({}, true);
|
discard({}, true);
|
||||||
else if (!rts.getFirstTarget().texture.get())
|
}
|
||||||
discard({}, true); // Backbuffer
|
|
||||||
|
|
||||||
// Resolve MSAA buffers. MSAA is only supported for 2D render targets so we
|
// Resolve MSAA buffers. MSAA is only supported for 2D render targets so we
|
||||||
// don't have to worry about resolving to slices.
|
// don't have to worry about resolving to slices.
|
||||||
@@ -1224,7 +1226,8 @@ void Graphics::present(void *screenshotCallbackData)
|
|||||||
deprecations.draw(this);
|
deprecations.draw(this);
|
||||||
|
|
||||||
flushBatchedDraws();
|
flushBatchedDraws();
|
||||||
endPass();
|
|
||||||
|
endPass(true);
|
||||||
|
|
||||||
int w = getPixelWidth();
|
int w = getPixelWidth();
|
||||||
int h = getPixelHeight();
|
int h = getPixelHeight();
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ private:
|
|||||||
void initCapabilities() override;
|
void initCapabilities() override;
|
||||||
void getAPIStats(int &shaderswitches) const override;
|
void getAPIStats(int &shaderswitches) const override;
|
||||||
|
|
||||||
void endPass();
|
void endPass(bool presenting);
|
||||||
GLuint bindCachedFBO(const RenderTargets &targets);
|
GLuint bindCachedFBO(const RenderTargets &targets);
|
||||||
void discard(OpenGL::FramebufferTarget target, const std::vector<bool> &colorbuffers, bool depthstencil);
|
void discard(OpenGL::FramebufferTarget target, const std::vector<bool> &colorbuffers, bool depthstencil);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user