Skip to content
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

Fix issues with MTL buffer binding optimisation #36

Merged
merged 1 commit into from
Jan 28, 2024

Conversation

smoogipoo
Copy link

Should be pretty obvious.

@@ -956,29 +956,31 @@ private void BindBuffer(DeviceBufferRange range, uint set, uint slot, ShaderStag
? slot + baseBuffer
: slot + _vertexBufferCount + baseBuffer);

if (!_boundVertexBuffers.TryGetValue(index, out var boundBuffer))
if (!_boundVertexBuffers.TryGetValue(index, out var boundBuffer) || boundBuffer.Buffer != range.Buffer)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I mentioned in DM but these dictionary lookups and thrashing are pretty high alloc. For another day but worth mentioning since same line.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think it's these ones that you mentioned. But yes these ones can likely be removed pretty easily; the MTLCommandBuffer one less so.

@peppy peppy merged commit a3642cf into ppy:master Jan 28, 2024
2 checks passed
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.

None yet

2 participants