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

# SampleCountersX (XBOX One 系列)

> 將 GPU 硬體計數器的值寫入使用者提供的緩衝區中使用者提供的位移處。

將 GPU 硬體計數器的值寫入使用者提供的緩衝區中使用者提供的位移處。

## 語法

```cpp theme={null}
void SampleCountersX(  
         ID3D12GraphicsCommandList* pCommandList,  
         ID3D12Resource* pDestinationBuffer,  
         UINT64 AlignedDestinationBufferOffset  
)  
```

### 參數

*pDestinationBuffer*   \_In\_\
類型：[ID3D12Resource\*](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12resource/id3d12resource)

接收計數器值的使用者提供緩衝區。

*AlignedDestinationBufferOffset*   \_In\_\
類型：UINT64

緩衝區中寫入計數器值的位移 (以位元組為單位)。

### 傳回值

類型：void

## 備註

此函式必須在 [ID3D12GraphicsCommandList::StartCountersX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_startcountersx) 與 [ID3D12GraphicsCommandList::StopCountersX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_stopcountersx) 之間呼叫。ID3D12GraphicsCommandList::StartCountersX 呼叫會決定擷取哪些計數器。呼叫 [ID3D12XboxCounterSet::GetCounterDataSizeX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12xboxcounterset/methods/id3d12xboxcounterset_getcounterdatasizex) 以判斷所需的輸出緩衝區空間。取樣要求到達 GPU 之後，呼叫 [ID3D12XboxCounterSet::RetrieveCounterDataX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12xboxcounterset/methods/id3d12xboxcounterset_retrievecounterdatax) 將資料從緩衝區擷取回 [D3D12XBOX\_COUNTER\_DATA](/zh-TW/reference/graphics/d3d12_x/structs/d3d12xbox_counter_data) 結構。

## 需求

**標頭：** d3d12\_x.h

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

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

## 另請參閱

[D3D12XBOX\_COUNTER\_DATA](/zh-TW/reference/graphics/d3d12_x/structs/d3d12xbox_counter_data)

[ID3D12GraphicsCommandList](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12graphicscommandlist/id3d12graphicscommandlist)

[ID3D12GraphicsCommandList::StartCountersX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_startcountersx)

[ID3D12GraphicsCommandList::StopCountersX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_stopcountersx)

[ID3D12XboxCounterSet](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12xboxcounterset/id3d12xboxcounterset)

[ID3D12XboxCounterSet::GetCounterDataSizeX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12xboxcounterset/methods/id3d12xboxcounterset_getcounterdatasizex)

[ID3D12XboxCounterSet::RetrieveCounterDataX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12xboxcounterset/methods/id3d12xboxcounterset_retrievecounterdatax)


## Related topics

- [PIXReportCounter](/zh-CN/reference/tools/pix3/functions/pixreportcounter.md)
- [SHAPE_XMA_SAMPLE_RATE](/zh-CN/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md)
- [SetSamplePositions](/zh-CN/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist1/methods/id3d12graphicscommandlist1_setsamplepositions_public.md)
- [GetXmaSampleRate](/zh-CN/reference/audio/xma2defs/functions/getxmasamplerate.md)
- [XBOX Godot NetRumble Sample v0.1.0 Release](/build/gdk-and-engines/godot-release-notes/godot-netrumble-release-notes-0-1-0.md)
