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

PushDescriptorWithTemplate has broken size computation #2323

Closed
HansKristian-Work opened this issue Sep 2, 2024 · 4 comments
Closed

PushDescriptorWithTemplate has broken size computation #2323

HansKristian-Work opened this issue Sep 2, 2024 · 4 comments
Labels
Bug Completed Issue has been fixed, or enhancement implemented.

Comments

@HansKristian-Work
Copy link
Contributor

// Work out how big the memory block in pData is.
    const VkDescriptorUpdateTemplateEntry* pEntry =
        _descUpdateTemplate->getEntry(_descUpdateTemplate->getNumberOfEntries()-1);
    size_t size = pEntry->offset;
    // If we were given a stride, use that; otherwise, assume only one info
    // struct of the appropriate type.
    if (pEntry->stride)
        size += pEntry->stride * pEntry->descriptorCount;

This assumes that the last element in the template update maps to the highest address. This is a flawed assumption, and breaks Granite. Granite sorts the updates by descriptor type, and push descriptors segfaults.

Also, there's a worrying malloc every push, which seems very suboptimal.

@billhollings billhollings added Bug Completed Issue has been fixed, or enhancement implemented. labels Sep 5, 2024
@billhollings
Copy link
Contributor

PR #2327 should fix both of these issues. Please retest and close this issue if solved.

@warmenhoven
Copy link
Contributor

Worked for me. Thanks!

@cdavis5e
Copy link
Collaborator

cdavis5e commented Sep 6, 2024

I could've sworn that I had read in the spec that the entries had to be sorted by address.

/me goes to read the spec...

I guess not. I must've been mistaken when I implemented that functionality.

@billhollings
Copy link
Contributor

Worked for me. Thanks!

Great. Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Completed Issue has been fixed, or enhancement implemented.
Projects
None yet
Development

No branches or pull requests

4 participants