> ## 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.

# GetResourceTiling

> 获取有关平铺资源如何分解为平铺的信息。(ID3D12Device.GetResourceTiling)

获取有关平铺资源如何分解为平铺的信息。

## 语法

```cpp theme={null}
void GetResourceTiling(
    ID3D12Resource  pTiledResource,
    UINT  pNumTilesForEntireResource,
    D3D12_PACKED_MIP_INFO  pPackedMipDesc,
    D3D12_TILE_SHAPE  pStandardTileShapeForNonPackedMips,
    UINT  pNumSubresourceTilings,
    UINT FirstSubresourceTilingToGet,
    D3D12_SUBRESOURCE_TILING  pSubresourceTilingsForNonPackedMips
)
```

### 参数

*pTiledResource \[in]*\
类型：ID3D12Resource \*

指定要获取信息的平铺 [ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs)。

*pNumTilesForEntireResource \[out, optional]*\
类型：UINT \*

指向变量的指针，该变量接收存储整个平铺资源所需的平铺数。

*pPackedMipDesc \[out, optional]*\
类型：D3D12\_PACKED\_MIP\_INFO \*

指向 [D3D12\_PACKED\_MIP\_INFO](/reference/graphics/d3d12/structs/d3d12_packed_mip_info_public) 结构体的指针，**GetResourceTiling** 使用有关平铺资源的 mipmap 如何打包的信息填充该结构体。

*pStandardTileShapeForNonPackedMips \[out, optional]*\
类型：D3D12\_TILE\_SHAPE \*

指定 [D3D12\_TILE\_SHAPE](/reference/graphics/d3d12/structs/d3d12_tile_shape_public) 结构体，**GetResourceTiling** 使用有关平铺形状的信息填充该结构体。这是有关像素如何适应平铺的信息，独立于平铺资源的维度，不包括打包的 mipmap。如果整个平铺资源都被打包，则此参数无意义，因为平铺资源没有为打包的 mipmap 定义布局。在这种情况下，**GetResourceTiling** 将 D3D12\_TILE\_SHAPE 的成员设置为零。

*pNumSubresourceTilings \[in, out, optional]*\
类型：UINT \*

指向变量的指针，该变量包含子资源中的平铺数量。输入时，这是要查询平铺的子资源数量；输出时，这是在 <i>pSubresourceTilingsForNonPackedMips</i> 处实际检索到的数量（限制在可用范围内）。

*FirstSubresourceTilingToGet \[in]*\
类型：UINT

要获取的第一个子资源平铺的编号。如果 <i>pNumSubresourceTilings</i> 所指向的数量为 0，则 **GetResourceTiling** 会忽略此参数。

*pSubresourceTilingsForNonPackedMips \[out]*\
类型：D3D12\_SUBRESOURCE\_TILING \*

指定 [D3D12\_SUBRESOURCE\_TILING](/reference/graphics/d3d12/structs/d3d12_subresource_tiling_public) 结构体，**GetResourceTiling** 使用有关子资源平铺的信息填充该结构体。如果子资源平铺是打包 mipmap 的一部分，则 **GetResourceTiling** 将 D3D12\_SUBRESOURCE\_TILING 的成员设置为零，但 <i>StartTileIndexInOverallResource</i> 成员除外，**GetResourceTiling** 将该成员设置为 D3D12\_PACKED\_TILE (0xffffffff)。D3D12\_PACKED\_TILE 常量表示整个 **D3D12\_SUBRESOURCE\_TILING** 结构体在此情况下无意义，并且 <i>pPackedMipDesc</i> 参数指向的信息适用。

### 返回值

类型：void

无。

## 备注

要在计算堆大小和调用 [CreatePlacedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createplacedresource_public) 时估算所需纹理的总资源大小，请使用 [GetResourceAllocationInfo](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getresourceallocationinfo_public) 而不是 **GetResourceTiling**。
**GetResourceTiling** 不能用于此。

有关平铺资源的详细信息，请参阅 [卷平铺资源](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/volume-tiled-resources)。

## 要求

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

## 另请参阅

[ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)

[子资源](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/subresources)


## Related topics

- [D3D12_SUBRESOURCE_TILING](/zh-CN/reference/graphics/d3d12/structs/d3d12_subresource_tiling_public.md)
- [D3D12_TILE_SHAPE](/zh-CN/reference/graphics/d3d12/structs/d3d12_tile_shape_public.md)
- [GetResourceAllocationInfo](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getresourceallocationinfo_public.md)
- [GetResourceAllocationInfo1 (XBOX Series 主机)](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_getresourceallocationinfo1_public.md)
- [NDA 主题目录 - Microsoft Learn 在线链接](/zh-CN/nda/nda-topic-directory.md)
