Skip to content

Commit a0f33a7

Browse files
committed
对 renderPassIndex 进行归一化处理,使格式兼容的渲染通道
1 parent 1dd20a2 commit a0f33a7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/igl/vulkan/RenderPipelineState.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ VkPipeline RenderPipelineState::getVkPipeline(
397397
cacheKey.depthBiasEnable = 0;
398398
}
399399

400+
// Normalize renderPassIndex so that format-compatible render passes
401+
// (same formats/samples, different load/store/layout) share one PSO.
402+
// Per Vulkan spec:https://docs.vulkan.org/spec/latest/chapters/renderpass.html#renderpass-compatibility
403+
// render pass compatibility only depends on format, samples,
404+
// and flags -- NOT on loadOp/storeOp/initialLayout/finalLayout.
405+
// This is safe because desc_.targetDesc already pins the format expectations
406+
// for this RenderPipelineState, so all render passes it encounters are compatible.
407+
cacheKey.renderPassIndex = 0;
408+
400409
const auto it = pipelines_.find(cacheKey);
401410

402411
if (it != pipelines_.end()) {

0 commit comments

Comments
 (0)