Skip to content

Commit 93029d2

Browse files
authored
vk: clean-up rendertarget msaa setup (#8930)
1 parent c4a3047 commit 93029d2

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

filament/backend/src/vulkan/VulkanHandles.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica
358358
// Constrain the sample count according to both kinds of sample count masks obtained from
359359
// VkPhysicalDeviceProperties. This is consistent with the VulkanTexture constructor.
360360
auto const& limits = context.getPhysicalDeviceLimits();
361-
samples = samples = fvkutils::reduceSampleCount(samples,
361+
samples = fvkutils::reduceSampleCount(samples,
362362
limits.framebufferDepthSampleCounts & limits.framebufferColorSampleCounts);
363363

364364
auto& rpkey = mInfo->rpkey;
@@ -372,7 +372,7 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica
372372
fbkey.samples = samples;
373373

374374
std::vector<VulkanAttachment>& attachments = mInfo->attachments;
375-
std::vector<VulkanAttachment> msaa;
375+
std::vector<VulkanAttachment> msaaAttachments;
376376

377377
for (int index = 0; index < MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT; index++) {
378378
VulkanAttachment& attachment = color[index];
@@ -415,13 +415,13 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica
415415
};
416416
}
417417
fbkey.color[index] = msaaAttachment.getImageView();
418-
msaa.push_back(msaaAttachment);
418+
msaaAttachments.push_back(msaaAttachment);
419419
}
420420
}
421421

422-
if (attachments.size() > 0 && samples > 1 && msaa.size() > 0) {
422+
if (attachments.size() > 0 && samples > 1 && msaaAttachments.size() > 0) {
423423
mInfo->msaaIndex = (uint8_t) attachments.size();
424-
attachments.insert(attachments.end(), msaa.begin(), msaa.end());
424+
attachments.insert(attachments.end(), msaaAttachments.begin(), msaaAttachments.end());
425425
}
426426

427427
if (depth.texture) {
@@ -436,10 +436,15 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica
436436
uint8_t const msLevel = 1;
437437
// Create sidecar MSAA texture for the depth attachment if it does not already
438438
// exist.
439-
auto msaa = initMsaaTexture(depthTexture, device, physicalDevice, context,
439+
auto msaaTexture = initMsaaTexture(depthTexture, device, physicalDevice, context,
440440
allocator, commands, resourceManager, msLevel, samples, stagePool);
441441
mInfo->msaaDepthIndex = (uint8_t) attachments.size();
442-
attachments.push_back({ .texture = msaa, .layerCount = layerCount });
442+
VulkanAttachment msaaAttachment = {
443+
.texture = msaaTexture,
444+
.layerCount = layerCount,
445+
};
446+
attachments.push_back(msaaAttachment);
447+
fbkey.depth = msaaAttachment.getImageView();
443448
}
444449
}
445450
}

0 commit comments

Comments
 (0)