-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add ExtractableAsset trait for accessing extractable data
#22128
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
base: main
Are you sure you want to change the base?
Conversation
|
i've not been through in depth, but i think this approach is probably cleaner than the user code may now panic if it accesses mesh data directly, but there is a way to handle it if that user code (or engine code like mesh picking) chooses to. we don't force users to handle errors that they know can't occur on existing meshes and don't require use of a separate "builder" struct ( as written we would lose the ability to rewrite render-world-only images (previously setting |
This can work in this PR after changing the |
|
right, i guess it's ok to require every modification of render-world-only assets to also unset that flag. i guess the key question is, do we intend to make render-world-only the default in future? |
|
Request: For any change to extraction, please think about Solari BLAS building. It shouldn't ever be a problem, Solari operates post extract, but let's be careful. |
is it possible to add an example or tests? it's the only reliable way to ensure that prs don't break stuff. |
Objective
Follow-up to #21732. This attempts to provide a unified interface for extractable data. Additionally, this attempts to simplify the Mesh interface.
Solution
Adds
ExtractableAssettrait and implements it forMesh,Image,ShaderStorageBuffer. Addsis_extracted_to_render_worldfield toImage,ShaderStorageBufferso thattake_gpu_datadoesn't needprevious_gpu_asset.Moves all
try_xxxmethods of Mesh to MeshExtractableData, andtry_xxx_optionis removed, the corresponding methods always return Option if them can. The methods on Mesh may panic. To handle panics, useextractable_data_ref/extractable_data_mutand get the MeshExtractableData interface for access.The benefit of accessing data through the
ExtractableAssettrait is you can more clearly known if the data is extractable, and you only need to check once for continuous access.Methods accept a Mesh parameter can be changed to accept MeshExtractableData to avoid unwrap. I also added topology field to MeshExtractableData (though it won’t be extracted) and implemented
Into<Mesh>for it. This makes it possible to construct a Mesh from MeshExtractableData, similar to InfallibleMesh but I’m unsure if this is a viable replacement for InfallibleMesh.Testing
CI