On Wed, 4 Mar 2020 at 20:48, Zebediah Figura z.figura12@gmail.com wrote:
Broadly, though, I'm curious how this approach is more performant (or otherwise preferable) to just copying something like wined3d_rasterizer_state_desc as a flat structure. The only advantage I see is that it takes up less space in the CS; is that important enough to outweigh the overhead of allocation and rbtree lookup, or is there something else I'm missing?
For something like sampler objects, it means you can create the GL object at the same time the corresponding d3d11 object is created, instead of in the middle of a draw. The advantage is perhaps less obvious for something like the rasteriser state object with the GL backend, although it still allows you to e.g. translate D3D fill mode to GL fill mode once during state object creation instead of at draw time. However, in the case of Vulkan, where a bunch of state is combined together into a single pipeline object, having unique state objects means you can compare state objects by their pointer values instead of their contents. I.e., potentially cheaper lookup of Vulkan pipeline objects.