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

# PIXSetMarker 概觀

> PIXSetMarker 概觀

# PIXSetMarker 概觀

當特定使用者定義的事件發生時，在 **PIX System Timing Capture** 視窗的 GPU 時間軸中插入標記。

## 語法

```cpp theme={null}
void PIXSetMarker(  
         void* context,  
         UINT64 color,  
         PCWSTR formatString,  
         ...  
)  
```

### 參數

*context*   \
類型：void\*

事件的內容，接受 **ID3D12GraphicsCommandList\*** 、**ID3D12CommandQueue\*** 和 **ID3D12XboxDmaCommandList\*** (僅限 XBOX)。

*color*   \
類型：UINT64

此事件在 PIX 視窗中發生時，計時圖表中將使用的色彩。

使用 [PIX\_COLOR](/zh-TW/reference/tools/pix3/functions/pix_color) 指定色彩、使用 [PIX\_COLOR\_INDEX](/zh-TW/reference/tools/pix3/functions/pix_color_index) 指定色彩索引，或傳入原始 DWORD (請注意格式為 ARGB，且 Alpha 色板值必須為 0xff)。

*formatString*   \_In\_\
類型：PCWSTR

用來描述事件的名稱，為以 Null 結束之 Unicode 字串的指標。此字串可以指定零個或多個選擇性的字串格式預留位置，與 **sprintf** 格式非常類似。

類型：...

如果在 **formatString** 中使用了預留位置，則必須有對應數目的參數 (最多 16 個)，且其類型必須與預留位置相符。

### 傳回值

類型：void

## 備註

`PIXSetMarker` 函式會儲存格式字串和格式參數，而不是在執行階段格式化字串。格式化會在 PIX 中讀取擷取檔案時進行。搭配 `PIXSetMarker` 使用 16 位元組對齊的字串 (建議) 或 8 位元組對齊的字串，以獲得最佳效能。若要使用 %p 格式規範將 char\* 或 wchar\_t\* 列印為指標，請在將指標傳遞給 `PIXSetMarker` 時，將其轉換為 void\* 或整數或浮點類型的指標。任何對 `PIXSetMarker` 的呼叫都保證至少有 512 位元組的空間來儲存記錄資料。

事件會顯示為沒有持續時間，並在 **PIX System Timing Capture** 視窗中以單一線條 (單一垂直線) 表示。

此函式用於標記 GPU 時間軸中的事件。若要標記 CPU 時間軸中的事件，請呼叫 [PIXSetMarker 函式的第一個多載](/zh-TW/reference/tools/pix3/functions/pixsetmarker)或 [PIXSetMarker 函式的第二個多載](/zh-TW/reference/tools/pix3/functions/pixsetmarker_2)。

對 `PIXSetMarker` 的呼叫可以在任何位置發生，不必在 [PIXBeginEvent](/zh-TW/reference/tools/pix3/functions/pixbeginevent) 呼叫之後。

## 需求

**標頭：** pix3.h

**程式庫：** pixevt.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[PIX 概觀 (NDA 主題)](/zh-TW/tools/tools-console/pix/pix)\
[pix3](/zh-TW/reference/tools/pix3/pix3_members)\
[PIXSetMarker](/zh-TW/reference/tools/pix3/functions/pixsetmarker)\
[PIXSetMarker\_2](/zh-TW/reference/tools/pix3/functions/pixsetmarker_2)\
[PIXSetMarker\_3](/zh-TW/reference/tools/pix3/functions/pixsetmarker_3)\
[PIXBeginEvent](/zh-TW/reference/tools/pix3/functions/pixbeginevent)


## Related topics

- [PIXSetMarker 參考](/zh-TW/reference/tools/pix3/functions/pixsetmarker_2.md)
- [PIXSetMarker](/zh-TW/reference/tools/pix3/functions/pixsetmarker-overloads.md)
- [PIXSetMarker 函式](/zh-TW/reference/tools/pix3/functions/pixsetmarker.md)
- [PIXSetMarker 函式參考](/zh-TW/reference/tools/pix3/functions/pixsetmarker_3.md)
- [PIXSetRetailMarker](/zh-TW/reference/tools/pix3/functions/pixsetretailmarker_2.md)
