Skip to content

Commit

Permalink
[Vulkan] Fix pipeline rasterizationSamples mismatch with renderpass
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Sep 18, 2023
1 parent 58a4dd6 commit 21db14c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ivis_opengl/gfx_api_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,7 +2515,7 @@ gfx_api::pipeline_state_object * VkRoot::build_pipeline(gfx_api::pipeline_state_
// build a pipeline, return an indirect VkPSOId (to enable rebuilding pipelines if needed)
VkPSO* pipeline = nullptr;
try {
pipeline = new VkPSO(dev, physDeviceProps.limits, createInfo, currentRenderPass().rp, currentRenderPass().rp_compat_info, msaaSamples, vkDynLoader, *this);
pipeline = new VkPSO(dev, physDeviceProps.limits, createInfo, currentRenderPass().rp, currentRenderPass().rp_compat_info, currentRenderPass().msaaSamples, vkDynLoader, *this);
}
catch (const std::exception& e)
{
Expand Down Expand Up @@ -2576,7 +2576,7 @@ void VkRoot::rebuildPipelinesIfNecessary()
if (!renderPass.rp_compat_info->isCompatibleWith(*pipeline->renderpass_compat))
{
delete pipeline;
pipelineInfo.renderPassPSO[renderPassId] = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, msaaSamples, vkDynLoader, *this);
pipelineInfo.renderPassPSO[renderPassId] = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, renderPass.msaaSamples, vkDynLoader, *this);
}
}
}
Expand Down Expand Up @@ -2777,6 +2777,7 @@ void VkRoot::createDefaultRenderpass(vk::Format swapchainFormat, vk::Format dept

renderPasses[DEFAULT_RENDER_PASS_ID].rp_compat_info = std::make_shared<VkhRenderPassCompat>(createInfo);
renderPasses[DEFAULT_RENDER_PASS_ID].rp = dev.createRenderPass(createInfo, nullptr, vkDynLoader);
renderPasses[DEFAULT_RENDER_PASS_ID].msaaSamples = msaaSamples;

// createFramebuffers for default render pass
ASSERT(!swapchainImageView.empty(), "No swapchain image views?");
Expand Down Expand Up @@ -2953,6 +2954,7 @@ void VkRoot::createDepthPasses(vk::Format depthFormat)

renderPasses[DEPTH_RENDER_PASS_ID].rp_compat_info = std::make_shared<VkhRenderPassCompat>(createInfo);
renderPasses[DEPTH_RENDER_PASS_ID].rp = dev.createRenderPass(createInfo, nullptr, vkDynLoader);
renderPasses[DEPTH_RENDER_PASS_ID].msaaSamples = vk::SampleCountFlagBits::e1;

if (debugUtilsExtEnabled)
{
Expand Down Expand Up @@ -3131,6 +3133,7 @@ void VkRoot::createSceneRenderpass(vk::Format sceneFormat, vk::Format depthForma

renderPasses[SCENE_RENDER_PASS_ID].rp_compat_info = std::make_shared<VkhRenderPassCompat>(createInfo);
renderPasses[SCENE_RENDER_PASS_ID].rp = dev.createRenderPass(createInfo, nullptr, vkDynLoader);
renderPasses[SCENE_RENDER_PASS_ID].msaaSamples = msaaSamples;

if (debugUtilsExtEnabled)
{
Expand Down Expand Up @@ -5402,7 +5405,7 @@ void VkRoot::bind_pipeline(gfx_api::pipeline_state_object* pso, bool /*notexture
{
// Must build this pipeline for a different render pass
auto& renderPass = renderPasses[currentRenderPassId];
newPSO = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, msaaSamples, vkDynLoader, *this);
newPSO = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, renderPass.msaaSamples, vkDynLoader, *this);
pipelineInfo.renderPassPSO[currentRenderPassId] = newPSO;
}
if (currentPSO != newPSO)
Expand Down Expand Up @@ -6031,7 +6034,7 @@ bool VkRoot::setShadowConstants(gfx_api::shadow_constants newValues)
if (pipeline->hasSpecializationConstant_ShadowConstants)
{
buffering_mechanism::get_current_resources().pso_to_delete.emplace_back(pipeline);
pipelineInfo.renderPassPSO[renderPassId] = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, msaaSamples, vkDynLoader, *this);
pipelineInfo.renderPassPSO[renderPassId] = new VkPSO(dev, physDeviceProps.limits, pipelineInfo.createInfo, renderPass.rp, renderPass.rp_compat_info, renderPass.msaaSamples, vkDynLoader, *this);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/ivis_opengl/gfx_api_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ struct VkRoot final : gfx_api::context
vk::RenderPass rp;
std::shared_ptr<VkhRenderPassCompat> rp_compat_info;
std::vector<vk::Framebuffer> fbo;
vk::SampleCountFlagBits msaaSamples = vk::SampleCountFlagBits::e1;
size_t identifier;

RenderPassDetails(size_t _identifier)
Expand Down

1 comment on commit 21db14c

@mirror176
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm that the new release fixed that repeatable crash.

Please sign in to comment.