-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Expose &Texture to users via RenderGraphDataStore #462
base: trunk
Are you sure you want to change the base?
Expose &Texture to users via RenderGraphDataStore #462
Conversation
This is required to interact with some wgpu APIs (like copy from texture to buffer) that require a texture, not a view.
base_array_layer: region.layer_start, | ||
array_layer_count: Some(NonZeroU32::new(region.layer_end - region.layer_start).unwrap()), | ||
..TextureViewDescriptor::default() | ||
}); | ||
vacant.insert(view); | ||
vacant.insert((view, Arc::clone(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.
I tried to make the change as unintrusive as possible, so now the active_views
stores both a TextureView
and an Arc<Texture>
with the texture it was created from as a tuple.
desc: &RenderPassTargets, | ||
encoder: &'rpass mut CommandEncoder, | ||
node_idx: usize, | ||
pass_end_idx: usize, | ||
resource_spans: &'rpass FastHashMap<GraphResource, ResourceSpan>, | ||
active_views: &'rpass FastHashMap<TextureRegion, TextureView>, | ||
active_views: &'rpass FastHashMap<TextureRegion, (TextureView, 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.
The Arc<Texture>
part of the tuple was unused in this function, so I added a generic parameter with no bounds just to document that the function doesn't really care about this. Hopefully that's not too weird. Let me know if you know a better approach!
GraphSubResource::ImportedTexture(_) => { | ||
panic!("Getting render target as a texture not supported for imported textures"); |
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.
I don't know if there's a good equivalent for ImportedTexture
s we can use here. Since the purpose of imported textures is a bit unclear to me, I decided to leave this as unsupported.
panic!("internal rendergraph error: tried to get a {:?} as a render target", r) | ||
panic!("internal rendergraph error: tried to get a {r:?} as a render target") |
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.
Clippy will soon complain about this, so I took the chance to adapt the new warnings in the files I touched.
Checklist
cargo fmt
has been rancargo clippy
reports no issuescargo test
succeedscargo rend3-doc
has no warningscargo deny check
issues have been fixed or added to deny.tomlAdded new functionality @githubname
.Related Issues
None that I know of, but there's a related discussion on Matrix: https://matrix.to/#/!telLUrJoXXaQkubDie:matrix.org/$yWhwEvotAZGH9WMT1l5lRAOLjzNefA1XIzlicG9RSos?via=matrix.org&via=t2bot.io
Description
I added a way to get a &Texture out of the render graph while inside a node. This is required to interact with some wgpu APIs (like copy from texture to buffer) which require a texture, not a view.