From 2f2b61578040cfd0955f995249a7b2eee64a84df Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 14 Sep 2022 21:50:59 +0100 Subject: [PATCH] Add dynamic state support to VK graphics pipeline cache --- .../main/cpp/skyline/gpu/cache/graphics_pipeline_cache.cpp | 4 +++- app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.h | 2 ++ app/src/main/cpp/skyline/gpu/shaders/helper_shaders.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.cpp b/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.cpp index c1fac93d..db682dc5 100644 --- a/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.cpp +++ b/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.cpp @@ -280,6 +280,8 @@ namespace skyline::gpu::cache { KEYNEQ(depthStencilState.maxDepthBounds) ) + RETF(ARREQ(dynamicState.pDynamicStates, dynamicState.dynamicStateCount)) + RETF(KEYNEQ(colorBlendState.flags) || KEYNEQ(colorBlendState.logicOpEnable) || KEYNEQ(colorBlendState.logicOp) || @@ -392,7 +394,7 @@ namespace skyline::gpu::cache { .pMultisampleState = &state.multisampleState, .pDepthStencilState = &state.depthStencilState, .pColorBlendState = &state.colorBlendState, - .pDynamicState = nullptr, + .pDynamicState = &state.dynamicState, .layout = *pipelineLayout, .renderPass = *renderPass, .subpass = 0, diff --git a/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.h b/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.h index fd7c9512..4f81de6b 100644 --- a/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.h +++ b/app/src/main/cpp/skyline/gpu/cache/graphics_pipeline_cache.h @@ -29,6 +29,7 @@ namespace skyline::gpu::cache { const vk::PipelineMultisampleStateCreateInfo &multisampleState; const vk::PipelineDepthStencilStateCreateInfo &depthStencilState; const vk::PipelineColorBlendStateCreateInfo &colorBlendState; + const vk::PipelineDynamicStateCreateInfo &dynamicState; span colorAttachments; //!< All color attachments in the subpass of this pipeline TextureView *depthStencilAttachment; //!< A nullable pointer to the depth/stencil attachment in the subpass of this pipeline @@ -87,6 +88,7 @@ namespace skyline::gpu::cache { vk::PipelineMultisampleStateCreateInfo multisampleState; vk::PipelineDepthStencilStateCreateInfo depthStencilState; vk::PipelineColorBlendStateCreateInfo colorBlendState; + vk::PipelineDynamicStateCreateInfo dynamicState; std::vector colorBlendAttachments; std::vector colorAttachments; diff --git a/app/src/main/cpp/skyline/gpu/shaders/helper_shaders.cpp b/app/src/main/cpp/skyline/gpu/shaders/helper_shaders.cpp index 992d74c5..20930cc5 100644 --- a/app/src/main/cpp/skyline/gpu/shaders/helper_shaders.cpp +++ b/app/src/main/cpp/skyline/gpu/shaders/helper_shaders.cpp @@ -132,6 +132,7 @@ namespace skyline::gpu { .multisampleState = multisampleState, .depthStencilState = depthStencilState, .colorBlendState = blendState, + .dynamicState = {}, .colorAttachments = span{colorAttachment}, .depthStencilAttachment = nullptr, }, layoutBindings, pushConstantRanges);