mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 06:38:31 +09:00
[Fix] (DirectVulkan): stop loading and carrying dead default-framebuffer content
- EGL swap semantics make the presented colour buffer's content undefined at its next acquire (EGL_BUFFER_DESTROYED, the implementation default) and every ancillary depth/stencil buffer's content undefined after ANY swap, yet the default-FBO render pass reloaded both with LOAD_OP_LOAD every frame; SwapchainObject now tracks per-image content validity (defined when a pass stores into the attachment, invalidated at present) and the render-pass manager turns an undefined attachment's tile load into LOAD_OP_DONT_CARE with initialLayout=UNDEFINED, keyed into both hashes so the cached LOAD variants cannot be hit by mistake - the default framebuffer's depth attachment is now attached ON DEMAND: a draw with depth test and stencil test both disabled (GL: a disabled test neither reads nor writes its buffer), and no pending depth/stencil clear, resolves to a depth-less pass flavour, dropping the D24S8 tile load AND store outright - MC 26.2 renders its GUI into its own FBO and only ever blits colour to the default framebuffer, so its swapchain pass carried a full-screen depth round-trip for nothing - the flavour only escalates: an active depth-full pass absorbs depth-less draws unchanged, while a depth-using draw against a depth-less pass resolves to an incompatible entry and splits, its depth loading DONT_CARE (the content was undefined all along); the depth-less flavour is folded into ComputeHash and the per-draw fast-path memo so the two flavours can never alias
This commit is contained in:
@@ -52,6 +52,21 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
void SetImageLayout(Uint32 index, VkImageLayout layout);
|
||||
SizeT GetImageCount() const { return m_images.size(); }
|
||||
|
||||
// EGL content-validity tracking for the default framebuffer. A color
|
||||
// buffer's content is undefined once its image has been presented
|
||||
// (EGL_BUFFER_DESTROYED swap behaviour, the implementation default),
|
||||
// and every ancillary (depth/stencil) buffer's content is undefined
|
||||
// after ANY swap regardless of swap behaviour (EGL 1.5 §3.10.1). The
|
||||
// render-pass manager turns an undefined attachment's tile load into
|
||||
// LOAD_OP_DONT_CARE. Flags start false (a fresh swapchain image holds
|
||||
// garbage) and a render pass storing into an attachment sets it back
|
||||
// to defined.
|
||||
Bool IsImageContentDefined(Uint32 index) const;
|
||||
void SetImageContentDefined(Uint32 index, Bool defined);
|
||||
Bool IsDepthStencilContentDefined(Uint32 index) const;
|
||||
void SetDepthStencilContentDefined(Uint32 index, Bool defined);
|
||||
void SetAllDepthStencilContentUndefined();
|
||||
|
||||
private:
|
||||
void CreateImageViews(VkDevice device);
|
||||
void CreateDepthStencilResources(VkDevice device, VkPhysicalDevice physicalDevice);
|
||||
@@ -77,5 +92,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
Vector<VkDeviceMemory> m_depthStencilImageMemories;
|
||||
Vector<VkImageView> m_depthStencilImageViews;
|
||||
Vector<VkImageLayout> m_depthStencilImageLayouts;
|
||||
Vector<Bool> m_imageContentDefined;
|
||||
Vector<Bool> m_depthStencilContentDefined;
|
||||
};
|
||||
} // namespace MobileGL::MG_Backend::DirectVulkan
|
||||
|
||||
Reference in New Issue
Block a user