-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow RenderBuffer::Resolve() to change the size of the image #1236
Allow RenderBuffer::Resolve() to change the size of the image #1236
Conversation
This was actually working before, but it looks like it is possible for this to allocate outputBuffer at the wrong size and write over the end of it.
Thanks for this, @ablev-dwa -- it looks good! We were wondering though if you had a specific scenario when this happened? (Or even better yet a test case!) We're trying to figure out if we need to fix it elsewhere too. Thanks! |
@spitzak found this during his Hydra delegate work, I'll ask him to comment here. |
Two reasons:
|
A good test would be to simulate a "slow" renderer. Modify an existing renderDelegate so after the first render completes, it stops changing the size of the RenderBuffer or the image in it. Then resize the usdview viewport. Ideally the user sees the previous image scaled without distortion to the same position the real render will be. |
Filed as internal issue #USD-6122. |
Thanks @spitzak! Super helpful! This change looks good and we'll merge it, but we think it'll be pretty fragile to rely on this. A better solution might be to have the renderer produce whatever size image but always scale it to the correct HdRenderBuffer size during Resolve – and not change that size. We recognize that the current API makes that a bit confusing though and we may want to tighten that up in the future (e.g., make it super clear where the size is allowed to change). |
I believe it is required that usdview resize images to fit the viewport, otherwise dynamic resizing of the viewport window is impossible without blocking until the renderer returns an image. |
A big issue is that our API doesn't make this at all clear, I hope we'll address this, but the fundamental problem, we think, is that there is a mismatch between what's produced in the HdRenderBuffer and what was asked for. In the case of a progressive renderer, some of our internal tools make a distinction between the render resolution (which stays fixed, at least during a full frame cycle) and the resolution of the presentation buffer -- which dynamically changes with viewport size, for example. At any rate, thank you again for the great feedback on this. We've merged this change, thanks also for that! And like I said, I hope in the future we can make our APIs clearer so that we can make it easier to use it in a robust way by default. |
Description of Change(s)
Moves aov buffer resolve ahead of outputBuffer allocation to ensure correct buffer sizing in the event of image size change
Fixes Issue(s)
This was actually working before, but it looks like it is possible for
this to allocate outputBuffer at the wrong size and write over the end
of it.