From 5ff8f2c4da498168b62fc80879d746a081e8737b Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 7 Jun 2022 22:22:02 +0100 Subject: [PATCH] Fix state inheritance properly for library pipelines --- renderdoc/driver/vulkan/vk_info.cpp | 22 +++++++++++++-------- renderdoc/driver/vulkan/vk_shader_cache.cpp | 2 ++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index cd12c4056..0b5011581 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -898,7 +898,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, renderpass = pipeInfo.renderpass; subpass = pipeInfo.subpass; - for(uint32_t i = 0; i < 5; i++) + for(uint32_t i = 0; i < 4; i++) shaders[i] = pipeInfo.shaders[i]; vertLayout = pipeInfo.vertLayout; @@ -933,6 +933,8 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, discardRectangles = pipeInfo.discardRectangles; discardMode = pipeInfo.discardMode; + + flags |= pipeInfo.flags; } if(pipeInfo.libraryFlags & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT) @@ -944,13 +946,6 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, fragLayout = pipeInfo.fragLayout; - rasterizationSamples = pipeInfo.rasterizationSamples; - sampleShadingEnable = pipeInfo.sampleShadingEnable; - minSampleShading = pipeInfo.minSampleShading; - sampleMask = pipeInfo.sampleMask; - alphaToCoverageEnable = pipeInfo.alphaToCoverageEnable; - alphaToOneEnable = pipeInfo.alphaToOneEnable; - sampleLocations = pipeInfo.sampleLocations; depthTestEnable = pipeInfo.depthTestEnable; @@ -962,6 +957,12 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, back = pipeInfo.back; minDepthBounds = pipeInfo.minDepthBounds; maxDepthBounds = pipeInfo.maxDepthBounds; + + shadingRate = pipeInfo.shadingRate; + shadingRateCombiners[0] = pipeInfo.shadingRateCombiners[0]; + shadingRateCombiners[1] = pipeInfo.shadingRateCombiners[1]; + + flags |= pipeInfo.flags; } if(pipeInfo.libraryFlags & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT) @@ -969,6 +970,9 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, renderpass = pipeInfo.renderpass; subpass = pipeInfo.subpass; + // this is duplicated in the fragment shader interface "if sample shading is enabled or + // renderpass is not VK_NULL_HANDLE", but since it must be identical in both places we just + // treat this as canonical so we don't have to figure out if that condition is satisfied. rasterizationSamples = pipeInfo.rasterizationSamples; sampleShadingEnable = pipeInfo.sampleShadingEnable; minSampleShading = pipeInfo.minSampleShading; @@ -986,6 +990,8 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, colorFormats = pipeInfo.colorFormats; depthFormat = pipeInfo.depthFormat; stencilFormat = pipeInfo.stencilFormat; + + flags |= pipeInfo.flags; } } } diff --git a/renderdoc/driver/vulkan/vk_shader_cache.cpp b/renderdoc/driver/vulkan/vk_shader_cache.cpp index 39ffd5cc2..25f9de36b 100644 --- a/renderdoc/driver/vulkan/vk_shader_cache.cpp +++ b/renderdoc/driver/vulkan/vk_shader_cache.cpp @@ -963,6 +963,8 @@ void VulkanShaderCache::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &p // never create derivatives ret.flags &= ~VK_PIPELINE_CREATE_DERIVATIVE_BIT; + ret.flags &= ~VK_PIPELINE_CREATE_LIBRARY_BIT_KHR; + pipeCreateInfo = ret; }