Skip to content

Broaden RenderAsset API #24410

Open
larsraph wants to merge 10 commits into
bevyengine:mainfrom
larsraph:render-asset-simplify-api
Open

Broaden RenderAsset API #24410
larsraph wants to merge 10 commits into
bevyengine:mainfrom
larsraph:render-asset-simplify-api

Conversation

@larsraph
Copy link
Copy Markdown
Contributor

Objective

The current RenderAsset API was built with take_gpu_data and render_asset_usages around the fact that initially it handled removing assets from the MAIN_WORLDs Assets, however now that we have changed the API to require internally taking data it doesn't make sense to still automatically handle RenderAssetUsages.

Solution

In order to solve these issues I broadened the API to

  1. Have a configurable Extracted type.
  2. Put the reponsibility on the caller to manually use RenderAssetUsages or just simply Clone into the RenderWorld.

Objective 2 & Solution 2

Also I added a custom Extracted type. This allows two things

  1. Define a subset of data to actually extract.
  2. Make it so that taken types (such as Option) can encode in the type system that they are Some (by omitting the option) without having to unwrap or otherwise deal with it.

@beicause
Copy link
Copy Markdown
Member

I think this seems reasonable for the current API but it needs design considering there are some more important issues such as cleaning up the Mesh API and ErasedRenderAsset API.

There have also been some attempts to improve the RenderAsset API (#23871, #22128), but they are not yet ideal and might need architectural changes, especially considering the direction of #23094.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants