-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Improve render asset #8149
Improve render asset #8149
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Do you have a specific use case in mind for "Allow to have multiple GPU representations for the same "main world" asset"?. I'm exploring ideas for reducing copies of render assets in memory by deleting them from RAM once they're on the GPU's VRAM. |
That One could always just duplicate the original asset, if it needs to be uploaded to the gpu twice. Wrote some feedback if you'll find it useful 8132 |
After some further experimentation with meshlets and ray tracing, I'm in favor of something like this PR. |
@vallrand - could you update this PR? I have long disliked the split between RenderAssets and RenderMaterials and wanted materials to be just another asset. |
I've adopted this in #12827 as it was a great idea, ahead of its time. :) |
# Objective - Replace `RenderMaterials` / `RenderMaterials2d` / `RenderUiMaterials` with `RenderAssets` to enable implementing changes to one thing, `RenderAssets`, that applies to all use cases rather than duplicating changes everywhere for multiple things that should be one thing. - Adopts #8149 ## Solution - Make RenderAsset generic over the destination type rather than the source type as in #8149 - Use `RenderAssets<PreparedMaterial<M>>` etc for render materials --- ## Changelog - Changed: - The `RenderAsset` trait is now implemented on the destination type. Its `SourceAsset` associated type refers to the type of the source asset. - `RenderMaterials`, `RenderMaterials2d`, and `RenderUiMaterials` have been replaced by `RenderAssets<PreparedMaterial<M>>` and similar. ## Migration Guide - `RenderAsset` is now implemented for the destination type rather that the source asset type. The source asset type is now the `RenderAsset` trait's `SourceAsset` associated type.
Objective
Solution
Remove one to one correlation between "main world" asset and GPU asset, by swapping base type that implements
RenderAsset
to be the GPU asset type. That would makeRenderAssetPlugin
more flexible, being able to prepare different data based on same source asset (example: effect plugin could preprocess mesh buffer data for specialized rendering, without affecting main render flow).That also makes
RenderAssets<GPUType>
more explicit.Changelog
Changed
RenderAsset
trait definitionMaterial
andMaterial2d
now useRenderAssetPlugin
RenderMaterials
andRenderMaterials2d
were replaced with more genericRenderAssets
Migration Guide
RenderMaterials<M>
can now be accesed asRenderAssets<PreparedMaterial<M>>
RenderMaterials2d<M>
can now be accesed asRenderAssets<PreparedMaterial2d<M>>
RenderAssets<Image>
is nowRenderAssets<GpuImage>
RenderAssets<Mesh>
is nowRenderAssets<GpuMesh>
RenderAsset
trait should now be implemented on prevRenderAsset::PreparedAsset
type, while source asset type is defined asRenderAsset::SourceAsset
Before
After