Skip to content

Use variableDescriptorCount to avoid the pipeline recreation. #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2025

Conversation

stripe2933
Copy link
Owner

Instead of create the graphics pipelines with fixed amount of texture descriptor sets, use variable descriptor count to create pipelines only once and only re-allocate the descriptor set. This can make the asset loading time faster.

@stripe2933
Copy link
Owner Author

Looks like MoltenVK cannot handle this.

[mvk-error] SPIR-V to MSL conversion error: Argument buffer resource base type could not be determined. When padding argument buffer elements, all descriptor set resources must be supplied with a base type by the app.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Fragment shader function could not be compiled into pipeline. See previous logged error.
libc++abi: terminating due to uncaught exception of type vk::InvalidShaderNVError: Device::createGraphicsPipeline: ErrorInvalidShaderNV

This error does not occur when Metal Argument Buffer is disabled. For this case, the binding count must be set to ≤ 14, since maxPerStageDescriptorSamplers is 16 and 2 slots are already bound.

Related upstream issue

@stripe2933 stripe2933 force-pushed the variable-descriptor-count branch 2 times, most recently from 9ef3682 to cfeaed0 Compare January 22, 2025 15:04
@stripe2933 stripe2933 force-pushed the variable-descriptor-count branch 3 times, most recently from 35954f8 to 61751b4 Compare February 4, 2025 09:42
@stripe2933 stripe2933 force-pushed the variable-descriptor-count branch 2 times, most recently from 48f0067 to 65df954 Compare February 20, 2025 15:56
@stripe2933 stripe2933 force-pushed the variable-descriptor-count branch from 65df954 to 69d7c2b Compare February 23, 2025 07:02
@stripe2933
Copy link
Owner Author

Resolved by disabling the variable descriptor count feature in macOS.

@stripe2933 stripe2933 merged commit bcefb3d into master Feb 23, 2025
4 checks passed
@stripe2933 stripe2933 deleted the variable-descriptor-count branch February 23, 2025 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant