-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
RenderTexture#destroy destroys the depth texture as well. #6561
Conversation
Maybe it would be better to move it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, good enough for a fix. we can refactor it later if someone gets idea how
@ivanpopelyshev Dispose just removes the framebuffer from the GPU. Destroy will destroy the data itself. We shouldn't move this to dispose. |
Nope, that's the point - depthTexture is not disposed on the GPU automatically. Framebuffer disposes itself and renderbuffer if mounted, but not depthTexture.
Oh, I feel that we are missing MSAA case here: |
@ivanpopelyshev Correct, because the depth texture was not added internally by the framebuffer system. This is way you cannot run |
The user might not want to destroy the depth texture and may reuse it after disposing the framebuffer. That is not the case for the stencil renderbuffer, because it is never manually added to the framebuffer. |
Agree. But then it might be user problem to destroy the depth texture when he destroys renderTexture and we dont need this PR. I don't think it matters, we can change it later, lets merge this one. |
@ivanpopelyshev Agreed, it is all semantics. Putting it in render-texture makes more sense for now, as it is a higher-level API and users might face problems like with 6556. The user can still "snatch" the depth texture before it gets destroyed by listening to "dispose" on the base render-texture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. One small request: could you add a simple unit-test check for this? Want to make sure we capture the behavior that destroying a BaseRenderTexture also destroys the depthTexture.
@bigtimebuddy Done! |
Did you forget to commit RenderTexture? |
@bigtimebuddy Yup, I forgot a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @SukantPal!
#6556