Not pretty, but with this, you can switch MSAA level at runtime.

This commit is contained in:
Henrik Rydgård committed 2022-12-01 23:41:31 +01:00
1 parent 28e1b532bd
commit 8a3e92aa38
12 files changed
+40 -15

No files matched your search

+5 -2
View File
@@ -130,10 +130,13 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
return success;
}
void VKRGraphicsPipeline::DestroyAllVariants(VulkanContext *vulkan) {
void VKRGraphicsPipeline::DestroyVariants(VulkanContext *vulkan, bool msaaOnly) {
for (size_t i = 0; i < (size_t)RenderPassType::TYPE_COUNT; i++) {
if (!this->pipeline[i])
continue;
if (msaaOnly && (i & (int)RenderPassType::MULTISAMPLE) == 0)
continue;
VkPipeline pipeline = this->pipeline[i]->BlockUntilReady();
// pipeline can be nullptr here, if it failed to compile before.
if (pipeline) {
@@ -145,7 +148,7 @@ void VKRGraphicsPipeline::DestroyAllVariants(VulkanContext *vulkan) {
}
void VKRGraphicsPipeline::QueueForDeletion(VulkanContext *vulkan) {
DestroyAllVariants(vulkan);
DestroyVariants(vulkan, false);
vulkan->Delete().QueueCallback([](void *p) {
VKRGraphicsPipeline *pipeline = (VKRGraphicsPipeline *)p;
delete pipeline;