-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Allow custom depth texture usage #6815
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 custom depth texture usage #6815
Conversation
| } | ||
|
|
||
| #[derive(Clone, Copy, Reflect)] | ||
| pub struct Camera3dDepthTextureUsage(u32); |
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.
Creating a custom class to wrap the TextureUsage so that it implements Reflect
kurtkuehnert
left a comment
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.
LGTM.
This only works for 3D cameras not for 2D ones (although 2D is probably less important).
Maybe we can generalize the camera/view target abstraction for both the 2D and 3D cases in the future.
|
@superdump Can you merge this PR? |
|
Bump |
|
Bump :) |
| /// The depth clear operation to perform for the main 3d pass. | ||
| pub depth_load_op: Camera3dDepthLoadOp, | ||
| /// The texture usages for the depth texture created for the main 3d pass. | ||
| pub depth_texture_usages: Camera3dDepthTextureUsage, |
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.
what happens if I set a value without TextureUsages::RENDER_ATTACHMENT here? Should we consider it's present even if the user didn't set it?
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.
imo the user should be allowed to set a value without TextureUsages::RENDER_ATTACHMENT. If they explicitly opted out of the RENDER_ATTACHMENT usage, there's probably a reason for it.
# Objective - Some users want to change the default texture usage of the main camera but they are currently hardcoded ## Solution - Add a component that is used to configure the main texture usage field --- ## Changelog Added `CameraMainTextureUsage` Added `CameraMainTextureUsage` to `Camera3dBundle` and `Camera2dBundle` ## Migration Guide Add `main_texture_usages: Default::default()` to your camera bundle. # Notes Inspired by: #6815
Objective
Sometimes we might want to read from the depth texture in some custom rendering features. We must then add
STORAGE_BINDINGorTEXTURE_BINDINGto the texture usage flags when creating them.Solution
This PR allows one to customize the usage flags in the
Camera3dcomponent.