-
-
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
[Merged by Bors] - Compute Pipeline Specialization #3979
Conversation
Clippy complains, that the newly introduced |
That means each |
So I guess we should try |
Ok, will do that later. 😃 |
I did something wrong while rebasing. ...again |
be2b972
to
65ec025
Compare
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.
This looks generally in the right ballpark. I wonder if there is a way to duplicate less of the code for render vs compute. I have a mild wonder about whether it impacts performance of render stuff in any way. Does it affect bevymark performance at all?
Yup I like the general direction of a consolidated RenderPipeline type, although I think we might want to have separate CachedRenderPipelineId and CachedComputePipelineId (and internally remove and "switching" on compute and render pipelines). That would eliminate a class of user error where they pass a "render pipeline" CachedPipelineId into |
I will test performance and experiment with the distinct IDs tomorrow. 👍 |
I have done some form of a split, but I don't really think it is much of an improvement. I still believe there is some way to make all of this pretty with some rust magic, but I am not experienced enough to see how. |
I think your changes made a good compromise between code reuse and "separate code paths". Splitting out the remaining enums would start bleeding in to the shader caching logic, which would make things pretty nasty. I removed specialization from the game of life example as I think it hindered legibility. Imo specialization should only be used if you really need it. In this case it added over 30 lines of code / extra type complexity for no real benefit. |
bors r+ |
# Objective - Fixes #3970 - To support Bevy's shader abstraction(shader defs, shader imports and hot shader reloading) for compute shaders, I have followed carts advice and change the `PipelinenCache` to accommodate both compute and render pipelines. ## Solution - renamed `RenderPipelineCache` to `PipelineCache` - Cached Pipelines are now represented by an enum (render, compute) - split the `SpecializedPipelines` into `SpecializedRenderPipelines` and `SpecializedComputePipelines` - updated the game of life example ## Open Questions - should `SpecializedRenderPipelines` and `SpecializedComputePipelines` be merged and how would we do that? - should the `get_render_pipeline` and `get_compute_pipeline` methods be merged? - is pipeline specialization for different entry points a good pattern Co-authored-by: Kurt Kühnert <51823519+Ku95@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
- [x] `GpuImage` requires `texture_format` now. - [ ] `ActiveCameras` was removed - bevyengine/bevy@bf6de89 - [x] `CachedPipelineId` is now `CachedRenderPipelineId` and renamed `RenderPipelineCache` to `PipelineCache` - bevyengine/bevy#3979
- [x] `GpuImage` requires `texture_format` now. - [ ] `ActiveCameras` was removed - bevyengine/bevy@bf6de89 - [x] `CachedPipelineId` is now `CachedRenderPipelineId` and renamed `RenderPipelineCache` to `PipelineCache` - bevyengine/bevy#3979
# Objective - Fixes bevyengine#3970 - To support Bevy's shader abstraction(shader defs, shader imports and hot shader reloading) for compute shaders, I have followed carts advice and change the `PipelinenCache` to accommodate both compute and render pipelines. ## Solution - renamed `RenderPipelineCache` to `PipelineCache` - Cached Pipelines are now represented by an enum (render, compute) - split the `SpecializedPipelines` into `SpecializedRenderPipelines` and `SpecializedComputePipelines` - updated the game of life example ## Open Questions - should `SpecializedRenderPipelines` and `SpecializedComputePipelines` be merged and how would we do that? - should the `get_render_pipeline` and `get_compute_pipeline` methods be merged? - is pipeline specialization for different entry points a good pattern Co-authored-by: Kurt Kühnert <51823519+Ku95@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
# Objective - Fixes bevyengine#3970 - To support Bevy's shader abstraction(shader defs, shader imports and hot shader reloading) for compute shaders, I have followed carts advice and change the `PipelinenCache` to accommodate both compute and render pipelines. ## Solution - renamed `RenderPipelineCache` to `PipelineCache` - Cached Pipelines are now represented by an enum (render, compute) - split the `SpecializedPipelines` into `SpecializedRenderPipelines` and `SpecializedComputePipelines` - updated the game of life example ## Open Questions - should `SpecializedRenderPipelines` and `SpecializedComputePipelines` be merged and how would we do that? - should the `get_render_pipeline` and `get_compute_pipeline` methods be merged? - is pipeline specialization for different entry points a good pattern Co-authored-by: Kurt Kühnert <51823519+Ku95@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Objective
PipelinenCache
to accommodate both compute and render pipelines.Solution
RenderPipelineCache
toPipelineCache
SpecializedPipelines
intoSpecializedRenderPipelines
andSpecializedComputePipelines
Open Questions
SpecializedRenderPipelines
andSpecializedComputePipelines
be merged and how would we do that?get_render_pipeline
andget_compute_pipeline
methods be merged?