Cache expanded views from large immutable D3D12 descriptor heaps

* The principle here is that on D3D12 it's common to have huge descriptor heaps
  in which only a handful of descriptors are changed. By caching the expanded
  D3D12Pipe::View results from these unchanging descriptors we don't have to do
  that over and over. Any descriptors written in the captured frame may have
  different contents depending on where we've replayed up to, so we don't cache
  them to keep things simple rather than invalidating the cache.
This commit is contained in:
baldurk
2022-11-08 17:42:18 +00:00
parent ffe09f1cb0
commit 742e3de252
7 changed files with 169 additions and 77 deletions
+12 -15
View File
@@ -269,6 +269,10 @@ struct View
DOCUMENT("The :class:`ResourceId` of the underlying resource the view refers to.");
ResourceId resourceId;
DOCUMENT("The :class:`ResourceId` of the resource where the hidden buffer counter is stored.");
ResourceId counterResourceId;
DOCUMENT("The byte offset in :data:`counterResourceId` where the counter is stored.");
uint32_t counterByteOffset = 0;
DOCUMENT("The :class:`TextureType` of the view type.");
TextureType type;
DOCUMENT(R"(The format cast that the view uses.
@@ -293,6 +297,14 @@ since single descriptors may only be dynamically skipped by control flow.
bool dynamicallyUsed = true;
DOCUMENT("The :class:`D3DBufferViewFlags` set for the buffer.");
D3DBufferViewFlags bufferFlags = D3DBufferViewFlags::NoFlags;
DOCUMENT("Valid for textures - the highest mip that is available through the view.");
uint8_t firstMip = 0;
DOCUMENT("Valid for textures - the number of mip levels in the view.");
uint8_t numMips = 1;
DOCUMENT("Valid for texture arrays or 3D textures - the first slice available through the view.");
uint16_t firstSlice = 0;
DOCUMENT("Valid for texture arrays or 3D textures - the number of slices in the view.");
uint16_t numSlices = 1;
DOCUMENT("If the view has a hidden counter, this stores the current value of the counter.");
uint32_t bufferStructCount = 0;
DOCUMENT(R"(The byte size of a single element in the view. Either the byte size of
@@ -304,21 +316,6 @@ since single descriptors may only be dynamically skipped by control flow.
DOCUMENT("Valid for buffers - the number of elements to be used in the view.");
uint32_t numElements = 1;
DOCUMENT("The :class:`ResourceId` of the resource where the hidden buffer counter is stored.");
ResourceId counterResourceId;
DOCUMENT("The byte offset in :data:`counterResourceId` where the counter is stored.");
uint64_t counterByteOffset = 0;
DOCUMENT("Valid for textures - the highest mip that is available through the view.");
uint32_t firstMip = 0;
DOCUMENT("Valid for textures - the number of mip levels in the view.");
uint32_t numMips = 1;
DOCUMENT("Valid for texture arrays or 3D textures - the first slice available through the view.");
uint32_t firstSlice = 0;
DOCUMENT("Valid for texture arrays or 3D textures - the number of slices in the view.");
uint32_t numSlices = 1;
DOCUMENT("The minimum mip-level clamp applied when sampling this texture.");
float minLODClamp = 0.0f;
};
+1 -1
View File
@@ -734,7 +734,7 @@ DOCUMENT(R"(The dimensionality of a texture binding.
A Cubemap texture array.
)");
enum class TextureType : uint32_t
enum class TextureType : uint16_t
{
Unknown,
First = Unknown,