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

# XGComputeTileShape (XBOX One 系列)

> 傳回指定格式之單一並排資源圖格的形狀。

傳回指定格式之單一並排資源圖格的形狀。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT XGComputeTileShape(
         XG_RESOURCE_DIMENSION Dimension,
         XG_FORMAT Format,
         UINT32 BytesPerElement,
         UINT32 SampleCount,
         XG_TILE_SHAPE *pTileShapeInTexels,
         XG_TILE_SHAPE_ELEMENTS *pTileShapeInElements
)  
```

<a id="ID4EG" />

### 參數

*Dimension*   \_In\_<br />類型：[XG\_RESOURCE\_DIMENSION](/zh-TW/reference/graphics/xg__NR/enums/xg_resource_dimension)

資源的維度，以 [XG\_RESOURCE\_DIMENSION](/zh-TW/reference/graphics/xg__NR/enums/xg_resource_dimension) 列舉常數表示，例如未知、緩衝區、1D 紋理、2D 紋理或 3D 紋理。

*Format*   \_In\_<br />類型：[XG\_FORMAT](/zh-TW/reference/graphics/xg__NR/enums/xg_format)

格式，以 [XG\_FORMAT](/zh-TW/reference/graphics/xg__NR/enums/xg_format) 列舉常數表示，例如 XG\_FORMAT\_R32G32B32\_UINT。

* 如果 *Format* 為 XG\_FORMAT\_UNKNOWN，則改用 *BytesPerElement* 參數，且 *BytesPerElement* 必須是 1、2、4、8 或 16 個位元組。
* 如果 *Format* 不是 XG\_FORMAT\_UNKNOWN，則會忽略 *BytesPerElement* 的值，並由此函式計算。

*BytesPerElement*   \_In\_<br />類型：UINT32

每個元素的位元組數，以 UINT32 表示。

*SampleCount*   \_In\_<br />類型：UINT32

對於 Texture2D 以外的所有資源維度，*SampleCount* 必須為 1。對於 Texture2D，*SampleCount* 必須為 1、2、4 或 8。

*pTileShapeInTexels*   \_Out\_opt\_<br />類型：[XG\_TILE\_SHAPE\*](/zh-TW/reference/graphics/xg__NR/structs/xg_tile_shape)

圖格形狀 (以紋素為單位)，以指向 [XG\_TILE\_SHAPE](/zh-TW/reference/graphics/xg__NR/structs/xg_tile_shape) 結構的指標表示。如果 *Format* 為 XG\_FORMAT\_UNKNOWN，則 *pTileShapeInTexels* (若存在) 會填入零。

*pTileShapeInElements*   \_Out\_opt\_<br />類型：[XG\_TILE\_SHAPE\_ELEMENTS\*](/zh-TW/reference/graphics/xg__NR/structs/xg_tile_shape_elements)

圖格形狀 (以元素為單位)，以指向 [XG\_TILE\_SHAPE\_ELEMENTS](/zh-TW/reference/graphics/xg__NR/structs/xg_tile_shape_elements) 結構的指標表示。

<a id="ID4EO" />

### 傳回值

類型：[HRESULT](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

如果成功，會傳回 **S\_OK**；否則會傳回錯誤碼。如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

<a id="remarks" />

## 備註

此函式會傳回指定格式之單一並排資源圖格的形狀。圖格形狀會同時以紋素和元素為單位傳回。

<a id="requirements" />

## 需求

**標頭：** xg.h

**程式庫：** xg\_x.lib

**支援的平台：** XBOX One 系列

## 另請參閱

[XG 參考](/zh-TW/reference/graphics/xg__NR/xg_members)


## Related topics

- [NDA 主題目錄 - Microsoft Learn 線上連結](/zh-TW/nda/nda-topic-directory.md)
- [D3D12_TILE_SHAPE](/zh-TW/reference/graphics/d3d12/structs/d3d12_tile_shape_public.md)
- [CopyTiles](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_copytiles_public.md)
- [CopyTileMappings](/zh-TW/reference/graphics/d3d12/interfaces/id3d12commandqueue/methods/id3d12commandqueue_copytilemappings_public.md)
- [LoadComputePipeline](/zh-TW/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary/methods/id3d12pipelinelibrary_loadcomputepipeline_public.md)
