Options for flushing graphics caches.
typedef enum D3D11_FLUSH
{
D3D11_FLUSH_ENSURE_CB0_COHERENCY = 0x00000040L,
D3D11_FLUSH_ENSURE_CB1_COHERENCY = 0x00000080L,
D3D11_FLUSH_ENSURE_CB2_COHERENCY = 0x00000100L,
D3D11_FLUSH_ENSURE_CB3_COHERENCY = 0x00000200L,
D3D11_FLUSH_ENSURE_CB4_COHERENCY = 0x00000400L,
D3D11_FLUSH_ENSURE_CB5_COHERENCY = 0x00000800L,
D3D11_FLUSH_ENSURE_CB6_COHERENCY = 0x00001000L,
D3D11_FLUSH_ENSURE_CB7_COHERENCY = 0x00002000L,
D3D11_FLUSH_ENSURE_DB_COHERENCY = 0x00004000L,
D3D11_FLUSH_ENSURE_BASE_0_COHERENCY = 0x00000001L,
D3D11_FLUSH_ENSURE_BASE_1_COHERENCY = 0x00000002L,
D3D11_FLUSH_ENSURE_BASE_2_COHERENCY = 0x00080000L,
D3D11_FLUSH_ENSURE_BASE_3_COHERENCY = 0x00200000L,
D3D11_FLUSH_TEXTURE_L2_VOLATILE = 0x00010000L,
D3D11_FLUSH_TEXTURE_L2_WRITEBACK = 0x00040000L,
D3D11_FLUSH_TEXTURE_L1_INVALIDATE = 0x00400000L,
D3D11_FLUSH_TEXTURE_L2_INVALIDATE = 0x00800000L,
D3D11_FLUSH_COLOR_BLOCK_INVALIDATE = 0x02000000L,
D3D11_FLUSH_DEPTH_BLOCK_INVALIDATE = 0x04000000L,
D3D11_FLUSH_KCACHE_INVALIDATE = 0x08000000L,
D3D11_FLUSH_KCACHE_VOLATILE_INVALIDATE = 0x10000000L,
D3D11_FLUSH_ICACHE_INVALIDATE = 0x20000000L,
D3D11_FLUSH_ENGINE_PFP = 0x80000000L,
D3D11_FLUSH_DEFAULT = (D3D11_FLUSH_TEXTURE_L1_INVALIDATE|D3D11_FLUSH_TEXTURE_L2_INVALIDATE),
D3D11_FLUSH_DEFAULT_PFP = (D3D11_FLUSH_TEXTURE_L1_INVALIDATE | D3D11_FLUSH_TEXTURE_L2_INVALIDATE | D3D11_FLUSH_ENGINE_PFP)
} D3D11_FLUSH;
| Constant | Description |
|---|---|
| D3D11_FLUSH_ENSURE_CB0_COHERENCY | Ensures color buffer cache coherence. Coherency means the contents in different memory caches are the same. When something is non-coherent, that means values might be different in different caches, which is bad. If the flag D3D11_FLUSH_ENSURE_CB0_COHERENCY is used, the command processor will wait for any rendering via render target 0 (color buffer 0), to the specified address range (specified by pBaseAddress and SizeInBytes), to complete before flushing any caches. There can be up to 8 color buffers. Set the members for CB0-CB7 all together at once (that is, D3D11_FLUSH_ENSURE_CB0_COHERENCY through D3D11_FLUSH_ENSURE_CB7_COHERENCY). These 8 bits (CB0-CB7) get bitwise-OR’d together. |
| D3D11_FLUSH_ENSURE_CB1_COHERENCY | Checks if any in-flight rendering to RenderTarget1 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB2_COHERENCY | Checks if any in-flight rendering to RenderTarget2 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB3_COHERENCY | Checks if any in-flight rendering to RenderTarget3 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB4_COHERENCY | Checks if any in-flight rendering to RenderTarget4 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB5_COHERENCY | Checks if any in-flight rendering to RenderTarget5 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB6_COHERENCY | Checks if any in-flight rendering to RenderTarget6 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_CB7_COHERENCY | Checks if any in-flight rendering to RenderTarget7 is being done within the specified range, before continuing on and flushing the caches. See D3D11_FLUSH_ENSURE_CB0_COHERENCY. |
| D3D11_FLUSH_ENSURE_DB_COHERENCY | Checks whether the depth buffer or HTILE surface are in the specified range, before flushing any caches. This option is only valid for ID3D11DeviceContextX::FlushGpuCacheRange, not for ID3D11ComputeContextX::FlushGpuCachesBottomOfPipe or ID3D11ComputeContextX::FlushGpuCachesTopOfPipe. |
| D3D11_FLUSH_ENSURE_BASE_0_COHERENCY | Does nothing. Do not use. |
| D3D11_FLUSH_ENSURE_BASE_1_COHERENCY | Does nothing. Do not use. |
| D3D11_FLUSH_ENSURE_BASE_2_COHERENCY | Does nothing. Do not use. |
| D3D11_FLUSH_ENSURE_BASE_3_COHERENCY | Does nothing. Do not use. |
| D3D11_FLUSH_TEXTURE_L2_VOLATILE | On Xbox One, this flag does nothing, because nothing is marked as volatile. |
| D3D11_FLUSH_TEXTURE_L2_WRITEBACK | For Writeback or Invalidate, this flag flushes the Level 2 texture cache. Anything that needs to be written back gets written back immediately, but this flag doesn’t necessarily invalidate the cache lines. |
| D3D11_FLUSH_TEXTURE_L1_INVALIDATE | Clears and invalidates all cache lines in the texture Level 1 cache. |
| D3D11_FLUSH_TEXTURE_L2_INVALIDATE | Clears and invalidates all cache lines in the texture Level 2 cache. |
| D3D11_FLUSH_COLOR_BLOCK_INVALIDATE | Clears and invalidates all cache lines in the color cache. |
| D3D11_FLUSH_DEPTH_BLOCK_INVALIDATE | Clears and invalidates all cache lines in the depth cache. Corresponds to the Range field. |
| D3D11_FLUSH_KCACHE_INVALIDATE | Clears and invalides all cache lines in the constant cache. KCACHE is the shader’s scalar vector cache. |
| D3D11_FLUSH_KCACHE_VOLATILE_INVALIDATE | On Xbox One, this flag does nothing, because no constant cache lines are marked as volatile. |
| D3D11_FLUSH_ICACHE_INVALIDATE | Clears and invalidates all cache lines in the shader instruction cache. ICACHE is the shader program cache. |
| D3D11_FLUSH_ENGINE_PFP | Causes the invalidation to occur earlier, in the pre-fetch parser (PFP) engine, instead of the Memory Engine (ME). This flag is used for the Draw…Indirect APIs: ID3D11DeviceContext::DrawInstancedIndirect and ID3D11DeviceContext::DrawIndexedInstancedIndirect. This flag performs the cache flush that is specified by the flags above, by using the pre-fetch parser (PFP) engine instead of the Memory Engine (ME). |
| D3D11_FLUSH_DEFAULT | The default option. This flag is a combination of the most commonly used flags; it is declared as:(D3D11_FLUSH_TEXTURE_L1_INVALIDATE | D3D11_FLUSH_TEXTURE_L2_INVALIDATE)This flag is not sufficient for constant buffers, because it doesn’t have the KCACHE flag. |
| D3D11_FLUSH_DEFAULT_PFP | Equal to a PFP flush of texture L1 invalidate OR texture L2 invalidate. This flag is a combination of the most commonly used flags above; this flag is declared as:(D3D11_FLUSH_TEXTURE_L1_INVALIDATE | D3D11_FLUSH_TEXTURE_L2_INVALIDATE | D3D11_FLUSH_ENGINE_PFP)This flag is used for the Draw…Indirect APIs: ID3D11DeviceContext::DrawInstancedIndirect and ID3D11DeviceContext::DrawIndexedInstancedIndirect. |
Each entry in a cache references a piece of memory. Flushing a cache erases all the entries in the cache and invalidates the cache lines.
Be cautious about inserting extra Texture L2 flushes. Texture L2 flushes do not respect the passed-in memory range, and instead flush the entire cache, which can be expensive.
This enumeration is passed into the following methods:
#define D3D11_FLUSH_GPU_CACHE_RANGE_ALL 0xFFFFFFFF00
Header: Declared in d3d11_x.h (d3d11_1.h on other Windows platforms).