PFND3D12DDI_SHADERCACHEGETVALUE_CB_0021 callback function (d3d12umddi.h)

The pfnShaderCacheGetValueCb callback function gets a value stored in the shader cache.

Syntax

PFND3D12DDI_SHADERCACHEGETVALUE_CB_0021 Pfnd3d12ddiShadercachegetvalueCb0021;

HRESULT Pfnd3d12ddiShadercachegetvalueCb0021(
  D3D12DDI_HRTDEVICE hRTDevice,
  D3D12DDI_HRTPIPELINESTATE hRTPSO,
  const D3D12DDI_SHADERCACHE_HASH *pPrecomputedHash,
  const void *pKey,
  SIZE_T KeyLen,
  void *pValue,
  SIZE_T *pValueLen
)
{...}

Parameters

hRTDevice

[in] Handle to the runtime's representation of the device.

hRTPSO

[in] Handle to the runtime's representation of a pipeline state object.

pPrecomputedHash

[in] A D3D12DDI_SHADERCACHE_HASH structure that contains the hash value to use for cache lookup.

pKey

[in] A pointer to the key associated with the value to be retrieved from the driver's shader cache. The key uniquely identifies the shader data in the cache.

KeyLen

[in] The length of the key that pKey points to, in bytes.

pValue

[out] A pointer to the compiled shader code or other data associated with the shader identified by pPrecomputedHash and pKey. This parameter can be NULL if pValueLen is zero.

pValueLen

[in/out] Pointer to a variable that specifies the length of the buffer that pValue points to, in bytes. On input, this variable specifies the size of the buffer. On output, it specifies the size of the data that was written to the buffer. If pValueLen is set to zero and pValue is NULL, pfnShaderCacheGetValueCb should write the number of bytes needed for the data in a second call to it. Otherwise, if the buffer that pValue points to is too small, the function should fail.

Return value

If this callback function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The pfnShaderCacheStoreValueCb and pfnShaderCacheGetValueCb callbacks are used to store and retrieve compiled shader code or other shader-related data in the driver's shader cache. Caching helps improve performance by reducing the need to recompile shaders that have alread been compiled and cached.

Access this callback by using the D3D12DDI_SHADERCACHE_CALLBACKS_0021 structure.

Requirements

Requirement Value
Target Platform Windows
Header d3d12umddi.h (include D3d12umddi.h)

See also

D3D12DDI_SHADERCACHE_CALLBACKS_0021

pfnShaderCacheStoreValueCb