Hi and thanks for your work with wgpu-text.
I want to use wgpu-text to draw text into several different views within a render pass (using RenderPass::set_viewport). The options I have considered so far are:
- For each viewport within the render pass, queue the text for the viewport and then render it immediately. Repeat this for each call to
set_viewport. This seems innefficient since the cache in glyph_brush is flushed on each draw call, retaining only the data in the most recent render.
- Use separate
TextBrush instances for each viewport. This enables queueing of the text before rendering and each viewport will have its own cache. The downside of this approach is that we also end up with a separate wgpu::RenderPipeline for each instance and multiple invocations of shader compilation each time the number of viewports change.
One way to overcome this limitation is to allow the creation of a TextBrush with a 'shared' wgpu::RenderPipeline. The idea would be that multiple instances of TextBrush could share a RenderPipeline while still maintaining seprarate vertext buffers and caches. I'm thinking this could be exposed via something like BrushBuilder::with_shared_pipeline().
What do you think, is this something you would like me to implement?
Hi and thanks for your work with
wgpu-text.I want to use
wgpu-textto draw text into several different views within a render pass (usingRenderPass::set_viewport). The options I have considered so far are:set_viewport. This seems innefficient since the cache inglyph_brushis flushed on each draw call, retaining only the data in the most recent render.TextBrushinstances for each viewport. This enables queueing of the text before rendering and each viewport will have its own cache. The downside of this approach is that we also end up with a separatewgpu::RenderPipelinefor each instance and multiple invocations of shader compilation each time the number of viewports change.One way to overcome this limitation is to allow the creation of a
TextBrushwith a 'shared'wgpu::RenderPipeline. The idea would be that multiple instances ofTextBrushcould share aRenderPipelinewhile still maintaining seprarate vertext buffers and caches. I'm thinking this could be exposed via something likeBrushBuilder::with_shared_pipeline().What do you think, is this something you would like me to implement?