-
Notifications
You must be signed in to change notification settings - Fork 492
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
Replaying glGetTexImage crashes: wrong buffer size #853
Comments
Thanks for the detailed diagnostic. The ideal would be option 4, but it would be a fair amount of work, especially as one needs to be careful about supported GL version/extensions to get it right. As short term gap I suggest option 3 plus 2 as fallback. That is:
Skipping the call would make performance profiling results severely biased, therefore best to avoid. Wanna post a PR? |
Yes, I think I can do a PR with p.3 + p.2. I must admit I never used profiling in apitrace. Would it make sense to cache the buffer into global variable and not reallocate/refill it on second/third/etc. calls? As for p.4, webpage says:
So:
Looks like a lot of trouble for a feature which is bad for performance anyway. |
I created two different PRs:
To be honest, I like the second PR more. |
With this repro code (full code: bug_repro.zip):
I record a trace, then try to replay it.
On some GL implementations, it replays normally, but on NVIDIA it crashes inside glGetTexImage.
Here is the place which causes the problem (
retrace_glGetTexImage
):Here max_tex_size is usually some power-of-two greater than 2K (e.g. 16K on AMD and 32K on NVIDIA), so a cube of it overflows GLint and becomes zero. Hence, the buffer is resized to zero size. Then we pass its pointer (which is most likely NULL, but not necessarily) to glGetTexImage. Drivers are not required to check for this case, and apparently NVIDIA implementation does not check.
So the question is: how this should be fixed?
min(S^3, 1GB)
.The text was updated successfully, but these errors were encountered: