7/6/2023 0 Comments Physicseditor on texture atlasIn other words we don't have a way around needing dynamic atlas allocation. WebRender needs to maintain texture atlases into which items are added and removed over time. Dynamic atlas allocation is unfortunately more difficult to implement while keeping good run-time performance. I recommend reading A thousand ways to pack the bin which is a very good survey of various static packing algorithms. There's a lot more literature out there about static than dynamic atlas allocation. I call this "static" atlas allocation as opposed to "dynamic" atlas allocation. In most cases this can be achieved at build time Which means that the texture atlas allocator only needs to find a good layout for a fixed set of rectangles without supporting dynamic deallocation and allocation within the atlas at run time. Many in game and web development are used to packing many images into fewer assets. Another common name for this is rectangle bin packing. This is the job of the texture atlas allocator. When rendering text, WebRender pre-renders the glyphs before compositing them on the screen so this means packing as many pre-rendered glyphs as possible into a single texture, and the same applies for rendering images and various other things.įor a moment let's simplify the case of images and text and assume that it is the same problem: input images (rectangles) of various rectangular sizes that we need to pack into a larger rectangle. So in order to group as many drawing primitives as possible in a single batch we need to place as many drawing parameters as possible in few resources. for example a batch can only reference a fixed set of resources (such as GPU buffers and textures). A batch is submitted to the GPU as a single drawing command and has a few constraints. In order to submit work to the GPU efficiently, WebRender groups as many drawing primitives as it can into what we call batches. In the second part we'll have a look at more recent work building upon what I did with guillotiere, to improve texture memory usage in WebRender/Firefox. The first part is about the making of guillotiere, a crate that I first released in March 2019. In this one I'll go into more details about the process and methodology behind these improvements. This is a longer version of the piece I published in the mozilla gfx team blog where I focus on the atlas allocation algorithms. It isn't an outstanding technical feat, but the journey towards achieving this goal was quite pleasant. Lately I have been working on improving texture atlas allocation in WebRender.
0 Comments
Leave a Reply. |