mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Optimize] (MG_Backend/DirectVulkan): store textureResources in permanent scratch space rather than temp memory
This commit is contained in:
@@ -116,7 +116,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
Vector<VkAttachmentDescription> attachmentDescriptions(validDrawBufCount);
|
||||
Vector<VkAttachmentReference> colorAttachmentRefs(validDrawBufCount);
|
||||
Vector<PendingClearAttachmentInfo> pendingClearAttachments;
|
||||
Vector<VkTextureManager::TextureResource*> textureResources(validDrawBufCount, nullptr);
|
||||
auto& textureResources = RenderPassEntry::s_textureResourcesScratch;
|
||||
textureResources.clear();
|
||||
textureResources.resize(validDrawBufCount, nullptr);
|
||||
Vector<VkImageView> attachmentViews(validDrawBufCount, VK_NULL_HANDLE);
|
||||
// This should automatically work on default & offscreen FBO
|
||||
// assuming default FBO has the right param
|
||||
@@ -290,7 +292,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
renderPass,
|
||||
framebuffer,
|
||||
compatibilityHash,
|
||||
Move(textureResources),
|
||||
Move(pendingClearAttachments),
|
||||
static_cast<Uint32>(attachmentViews.size()),
|
||||
extent,
|
||||
|
||||
@@ -25,11 +25,10 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
|
||||
struct RenderPassEntry {
|
||||
static inline VkDevice s_device;
|
||||
static inline Vector<VkTextureManager::TextureResource*> s_textureResourcesScratch;
|
||||
VkRenderPass renderPass = VK_NULL_HANDLE;
|
||||
VkFramebuffer framebuffer = VK_NULL_HANDLE;
|
||||
Uint64 compatibilityHash = 0;
|
||||
// Should we hold pointer-to-resource here?
|
||||
Vector<VkTextureManager::TextureResource*> textureResources;
|
||||
Vector<PendingClearAttachmentInfo> pendingClearAttachments;
|
||||
Uint32 attachmentCount = 0;
|
||||
IntVec2 extent = {0, 0};
|
||||
@@ -41,7 +40,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
std::swap(renderPass, that.renderPass);
|
||||
std::swap(framebuffer, that.framebuffer);
|
||||
std::swap(compatibilityHash, that.compatibilityHash);
|
||||
std::swap(textureResources, that.textureResources);
|
||||
std::swap(pendingClearAttachments, that.pendingClearAttachments);
|
||||
std::swap(attachmentCount, that.attachmentCount);
|
||||
std::swap(extent, that.extent);
|
||||
@@ -51,14 +49,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
VkRenderPass renderpass,
|
||||
VkFramebuffer framebuffer,
|
||||
Uint64 compatibilityHash,
|
||||
const std::vector<VkTextureManager::TextureResource*>& textureResources,
|
||||
const Vector<PendingClearAttachmentInfo>& pendingClearAttachments,
|
||||
Uint32 attachmentCount,
|
||||
IntVec2 extent, int subpass):
|
||||
renderPass(renderpass),
|
||||
framebuffer(framebuffer),
|
||||
compatibilityHash(compatibilityHash),
|
||||
textureResources(Move(textureResources)),
|
||||
pendingClearAttachments(Move(pendingClearAttachments)),
|
||||
attachmentCount(attachmentCount),
|
||||
extent(extent),
|
||||
|
||||
Reference in New Issue
Block a user