> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FindValue

> 在缓存中查找键与所提供键完全匹配的条目。

在缓存中查找键与所提供键完全匹配的条目。

请调用该函数两次。第一次用于检索值的大小，第二次用于检索数据。内存中的临时存储使此调用模式具有良好的性能。

## 语法

```cpp theme={null}
HRESULT FindValue(
    const void  pKey,
    UINT KeySize,
    void  pValue,
    UINT  pValueSize
)
```

### 参数

*pKey*\
类型：const void \*

要查找的条目的键。

*KeySize*\
类型：UINT

键的大小，以字节为单位。

*pValue*\
类型：void \*

指向内存块的指针，用于接收缓存条目。

*pValueSize*\
类型：UINT \*

指向 **UINT** 的指针，用于接收缓存条目的大小（以字节为单位）。

### 返回值

类型：HRESULT

如果函数成功，则返回 **S\_OK**。否则，返回一个 [**HRESULT**](https://learn.microsoft.com/en-us/windows/desktop/com/structure-of-com-error-codes) [错误代码](https://learn.microsoft.com/en-us/windows/win32/com/com-error-codes-10)。

| 返回值                                 | 说明                          |
| ----------------------------------- | --------------------------- |
| DXGI\_ERROR\_CACHE\_HASH\_COLLISION | 存在与所提供键具有相同哈希值的条目，但键并不完全匹配。 |
| DXGI\_ERROR\_NOT\_FOUND             | 该条目不存在。                     |

## 备注

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机和 XBOX One 系列

## 另请参阅

* [D3D12 着色器缓存 API](https://microsoft.github.io/DirectX-Specs/d3d/ShaderCache.html)


## Related topics

- [IGameInput::FindDeviceFromId](/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)
- [PartyNetwork::FindEndpointByUniqueIdentifier](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_findendpointbyuniqueidentifier.md)
- [IGameInput::FindDeviceFromObject](/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromobject.md)
- [IGameInput::FindDeviceFromPlatformString](/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromplatformstring.md)
- [IGameInput::FindDeviceFromPlatformHandle](/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromplatformhandle.md)
