Thanks for the reply. I don’t use discord much so I somehow missed your message there until now.
It’s my understanding (which may be complexly wrong) that you can’t change constant buffer data after you have submitted a command list that will use it. All the resource data has to be set already. I was hoping to write my frame rendering commands to a single command list so I was thinking it wouldn’t be possible to change constant buffer data while the a list was executing. I have Frank Luna’s book and I’m trying to work though that, although I find DX12 a lot more confusing than DX11 since it seems to give you a lot more ways to do things. I’ve even heard sometimes things run faster in DX11 but I’m guessing that’s because someone made the wrong design decision. I’m hoping to avoid that.
Part of the problem is how the engine works. Everything is organized it a tree, however you start rendering from some point in the tree where the camera is. That’s usually a leaf node and you go up the tree and then back down the various branches from there. The reason is I’m trying to avoid having “world” coordinates. I go straight to view coordinates. This is because I’m using 64 coordinates on the CPU and only converting them to 32 bits before going to the GPU. Therefor I can’t just send my terrain in world coordinates because the accuracy would be lost. So I send everything with an offset (something like model coordinates) and translate it to its real position on the GPU. If it’s far away from the camera the loss of accuracy doesn’t matter. If it’s close, I still have good precision.
In any case, according to how it see it done in Luna’s book, I have to upload the entire set of matrixes before executing the list, and then kind of scroll through them as I go. So I’d have to keep track of the size of my tree and be able to expand buffers on the fly if something changes.
The second problem is the lights are just objects the tree, so I can’t actually render until I’ve gone through the whole tree and figured out how the lights are positioned since they can be attached to moving objects. That’s why I put render commands in a single list. I suppose I could keep a list of command lists and render them all at the end, but that seems like it would get out of hand.
Currently my textures are procedural so there isn’t really anything to upload in that department. At some point that will change. I’m not so much worried about that. All terrain meshes for LOD are generated and sent down in a completely separate thread. A model of the world is built for a given camera position and then I switch models, and work on the next one. The rendering thread only does rendering plus the player and camera controller.
I took a look at your stuff but I’ll have to dig into it more to figure out what’s going on. As I said DX12 is pretty confusing to me. I think I probably should have stuck with DX11 but since I started working on, I want to finish it. As you saw, I kind of have a solution with the root signature constants so maybe I’ll just use that for now and see how it works.
However if there is some way to change (not just scroll through) constant buffer data in a command list, that would also be a possibility but it doesn’t look like that’s the case.