godot
godot copied to clipboard
Direct3D 12: Enhance management of texture data life cycle
-
When available, graphics memory is asked not to be zero-initialized.
That brings better performance since in most cases those bytes will be overwritten anyway.
-
Texture memory initialization is tracked across the limbo, garbage and done states.
- Limbo: resource just allocated, contents are dangerous unless overwritten by certain operations (like a clear), or discarded.
- Garbage: the memory has been discarded (i.e., D3D12 knows it has to ignore previous contents), but it's still not guaranteed to be black, orthogonally to the non-zero-mem feature.
- Done: the texture has known contents, either because it was updated with some image data or because it was cleared, worst case by this code, to black, to ensure garbage data is never used.