mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 12:48:32 +09:00
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
// MobileGL - MobileGL/MG_Backend/DirectVulkan/Renderer/VkClearManager.h
|
|
// Copyright (c) 2025-2026 MobileGL-Dev
|
|
// Licensed under the GNU Lesser General Public License v3.0:
|
|
// https://www.gnu.org/licenses/gpl-3.0.txt
|
|
// https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
// End of Source File Header
|
|
|
|
#pragma once
|
|
|
|
#include "../VkIncludes.h"
|
|
#include "../VulkanRendererConfig.h"
|
|
#include "MG_State/GLState/FramebufferState/FramebufferObject.h"
|
|
#include "MG_Util/Math/VectorTypes.h"
|
|
|
|
#include <Includes.h>
|
|
|
|
namespace MobileGL::MG_Backend::DirectVulkan {
|
|
struct ClearFramebufferPayload {
|
|
FloatVec4 color;
|
|
Float depth{};
|
|
Uint32 stencil{};
|
|
};
|
|
|
|
struct ClearAttachmentPayload {
|
|
union {
|
|
FloatVec4 color;
|
|
Float depth{};
|
|
Uint32 stencil;
|
|
};
|
|
FramebufferAttachmentType attachmentType = FramebufferAttachmentType::Color0;
|
|
};
|
|
|
|
class VkClearManager {
|
|
public:
|
|
Bool Initialize();
|
|
void Shutdown();
|
|
|
|
void QueueClear(GLbitfield mask, const ClearFramebufferPayload& clearPayload, MG_State::GLState::FramebufferObject& drawFbo);
|
|
void QueueClear(
|
|
const ClearAttachmentPayload& clearPayload,
|
|
const SharedPtr<MG_State::GLState::ITextureObject>& texture);
|
|
Bool DequeueClear(MG_State::GLState::ITextureObject* texture, ClearAttachmentPayload& outPayload);
|
|
SizeT CollectGarbage();
|
|
private:
|
|
UnorderedMap<MG_State::GLState::ITextureObject*, ClearAttachmentPayload> m_pendingClears;
|
|
UnorderedMap<MG_State::GLState::ITextureObject*, WeakPtr<MG_State::GLState::ITextureObject>> m_aliveObjects;
|
|
};
|
|
} // namespace MobileGL::MG_Backend::DirectVulkan
|