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

Tracking the mapped buffer size for retracing #495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kvark
Copy link

@kvark kvark commented Oct 21, 2016

Fixes #494

Reason it crashes is because the user provided a buffer object smaller than the UBO structure declared in the shader. This is valid for as long as the shader doesn't access the data outside of the provided region.

@@ -419,6 +419,14 @@ dumpUniformBlock(StateWriter &writer,
if (raw_data) {
std::string qualifiedName = resolveUniformName(name, size);

GLuint actual_count = mapping.getSize() / array_stride;
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for looking into this. I agree extra checking is a good thing.

But I fear this check might be a tad too strict, as I'm not sure that the array elements are guaranteed to be contiguous in memory.

Imagine a buffer with 12 bytes, with elements of 4 bytes, and a stride of 8 bytes. There's space for two elements (with 4 bytes of padding.) But merely diving buffer size by stride would say only one element can fit...

Perhaps this can never happen -- it's hard to say if that's legal or not --, but the safest thing to do would be to pass the buffer size down dumpAttribArray and dumpAttrib, and do the checking there.

Another alternative would be to try to compensate for this when computing actual_count.

@jrfonseca jrfonseca added the Further Work Needed For PRs which need more work. label May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Further Work Needed For PRs which need more work. Replaying
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on retracing an incomplete UBO
2 participants