Hello, I should say I'm new to DX12 and I have the following use case.
I'm making a "simple" font rendering library that caches glyphs from DirectWrite into 2D textures/atlases as they're being requested by the user on the fly.
I create multiple textures with fixed sizes so that I don't have to resize them if there's not enough space for a font's glyphs. A new texture is created if there's not enough space.
Now, the problem is that there can be a command list being executed that is sampling these textures (because of a previous text render) while I need to insert some glyph to the atlas(es) (write to a texture region).
Obviously, it is guaranteed that the texture data read by the previous render will not be modified since the glyph insert process only writes to free space.
So my question is, is it possible to write to a texture while it's being read in this case, and how? If not, what's the best way to do what I want (or some good alternatives)?
And another question: using this method I might end up having to use multiple textures for a draw call. How do I make the shader choose which texture to sample from depending on input data? There can be a dynamic number of textures in this case, but they're all the same size.
Or is it better to split this into multiple draw calls and change resources between them?