But yes, keeping track of the resource state might ultimately be nicer.
Not sure if what I did is what you intended: what do you think of the version I just pushed?
I think that works, yeah. An alternative could be to store the "current" resource state in struct d3d12_resource, and then transition to the desired state as needed before draws, dispatches, readbacks, etc.