-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cache depth texture based on usage #9565
Cache depth texture based on usage #9565
Conversation
Looks like some cargo fmt is needed? |
yeah, this is caused by rust 1.72.0 now formatting let-else. This PR should fix it #9562 |
@superdump I discussed about this with @Neo-Zhixing and they suggested to just OR all the usages per render target. This would mean we'll only create 1 texture per target like it's done currently. The only unknown is whether or not some of the usage flags could be incompatible with each other. I'm curious if you have any opinions on this. |
Yeah so my recommendation is that we do it over two passes, the first pass collect the usage flags per render target, the second pass creates the textures. That way you create the same number of textures with the flag reflecting what all of the cameras requested. The problem we're trying to solve here is that if multiple cameras specify the same render target but with different flags, it'll just use the flag for the first camera and ignore the rest. I don't think texture usages can conflict with one another. People are generally more concerned about "if this texture usage was supported by the texture format", and usage flags should always be compatible i think. |
I've implemented the two pass suggestion in my latest commit |
@superdump @mockersf this is well-reviewed, but I don't fully understand what's going on here (docs on |
It's been a week, so I'm going to merge this on the basis of your approvals to unblock this fix. |
# Objective - Currently, the depth textures are cached based on the target. If multiple camera have the same target but a different `depth_texture_usage` bevy will just use the same texture and ignore that setting. ## Solution - Add the usage as a cache key
# Objective - Currently, the depth textures are cached based on the target. If multiple camera have the same target but a different `depth_texture_usage` bevy will just use the same texture and ignore that setting. ## Solution - Add the usage as a cache key
Objective
depth_texture_usage
bevy will just use the same texture and ignore that setting.Solution