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

Seems Redundant loop in CommandList::writeBuffer in Vulkan Backend #52

Closed
BlurryLight opened this issue Mar 29, 2024 · 1 comment
Closed

Comments

@BlurryLight
Copy link
Contributor

while (remaining > 0)
{
// vulkan allows <= 64kb transfers via VkCmdUpdateBuffer
int64_t thisGulpSize = std::min(remaining, int64_t(commandBufferWriteLimit));
// we bloat the read size here past the incoming buffer since the transfer must be a multiple of 4; the extra garbage should never be used anywhere
thisGulpSize = (thisGulpSize + 3) & ~3ll;

thisGulpSize is rounded up to multiple of 4, so it should be greater equal than remaining.
There should be no second loop here.

Line 437 is also redundant, because it won't enter this branch if data size greater than 65536

if (dataSize <= commandBufferWriteLimit)

apanteleev added a commit to apanteleev/nvrhi that referenced this issue Apr 5, 2024
@apanteleev
Copy link
Contributor

Thanks - I've removed the loop. I think it remained from an early implementation when only updateBuffer was used.
Closing.

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

No branches or pull requests

2 participants