diff --git a/3rdparty/dxsdk/include/PIXEventsCommon.h b/3rdparty/dxsdk/include/PIXEventsCommon.h new file mode 100644 index 000000000..515d17434 --- /dev/null +++ b/3rdparty/dxsdk/include/PIXEventsCommon.h @@ -0,0 +1,483 @@ +/*==========================================================================; +* +* Copyright (C) Microsoft Corporation. All Rights Reserved. +* +* File: PIXEventsCommon.h +* Content: PIX include file +* Don't include this file directly - use pix3.h +* +****************************************************************************/ +#pragma once + +#ifndef _PIXEventsCommon_H_ +#define _PIXEventsCommon_H_ + +#if defined(_AMD64_) || defined(_X86_) +#include +#endif // _AMD64_ || _X86_ + +enum PIXEventType +{ + PIXEvent_EndEvent = 0x000, + PIXEvent_BeginEvent_VarArgs = 0x001, + PIXEvent_BeginEvent_NoArgs = 0x002, + PIXEvent_SetMarker_VarArgs = 0x007, + PIXEvent_SetMarker_NoArgs = 0x008, + + PIXEvent_EndEvent_OnContext = 0x010, + PIXEvent_BeginEvent_OnContext_VarArgs = 0x011, + PIXEvent_BeginEvent_OnContext_NoArgs = 0x012, + PIXEvent_SetMarker_OnContext_VarArgs = 0x017, + PIXEvent_SetMarker_OnContext_NoArgs = 0x018, +}; + +static const UINT64 PIXEventsReservedRecordSpaceQwords = 64; +//this is used to make sure SSE string copy always will end 16-byte write in the current block +//this way only a check if destination < limit can be performed, instead of destination < limit - 1 +//since both these are UINT64* and SSE writes in 16 byte chunks, 8 bytes are kept in reserve +//so even if SSE overwrites 8 extra bytes, those will still belong to the correct block +//on next iteration check destination will be greater than limit +//this is used as well for fixed size UMD events and PIXEndEvent since these require less space +//than other variable length user events and do not need big reserved space +static const UINT64 PIXEventsReservedTailSpaceQwords = 2; +static const UINT64 PIXEventsSafeFastCopySpaceQwords = PIXEventsReservedRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; +static const UINT64 PIXEventsGraphicsRecordSpaceQwords = 64; + +//Bits 7-19 (13 bits) +static const UINT64 PIXEventsBlockEndMarker = 0x00000000000FFF80; + +//Bits 10-19 (10 bits) +static const UINT64 PIXEventsTypeReadMask = 0x00000000000FFC00; +static const UINT64 PIXEventsTypeWriteMask = 0x00000000000003FF; +static const UINT64 PIXEventsTypeBitShift = 10; + +//Bits 20-63 (44 bits) +static const UINT64 PIXEventsTimestampReadMask = 0xFFFFFFFFFFF00000; +static const UINT64 PIXEventsTimestampWriteMask = 0x00000FFFFFFFFFFF; +static const UINT64 PIXEventsTimestampBitShift = 20; + +inline UINT64 PIXEncodeEventInfo(UINT64 timestamp, PIXEventType eventType) +{ + return ((timestamp & PIXEventsTimestampWriteMask) << PIXEventsTimestampBitShift) | + (((UINT64)eventType & PIXEventsTypeWriteMask) << PIXEventsTypeBitShift); +} + +//Bits 60-63 (4) +static const UINT64 PIXEventsStringAlignmentWriteMask = 0x000000000000000F; +static const UINT64 PIXEventsStringAlignmentReadMask = 0xF000000000000000; +static const UINT64 PIXEventsStringAlignmentBitShift = 60; + +//Bits 55-59 (5) +static const UINT64 PIXEventsStringCopyChunkSizeWriteMask = 0x000000000000001F; +static const UINT64 PIXEventsStringCopyChunkSizeReadMask = 0x0F80000000000000; +static const UINT64 PIXEventsStringCopyChunkSizeBitShift = 55; + +//Bit 54 +static const UINT64 PIXEventsStringIsANSIWriteMask = 0x0000000000000001; +static const UINT64 PIXEventsStringIsANSIReadMask = 0x0040000000000000; +static const UINT64 PIXEventsStringIsANSIBitShift = 54; + +//Bit 53 +static const UINT64 PIXEventsStringIsShortcutWriteMask = 0x0000000000000001; +static const UINT64 PIXEventsStringIsShortcutReadMask = 0x0020000000000000; +static const UINT64 PIXEventsStringIsShortcutBitShift = 53; + +inline UINT64 PIXEncodeStringInfo(UINT64 alignment, UINT64 copyChunkSize, BOOL isANSI, BOOL isShortcut) +{ + return ((alignment & PIXEventsStringAlignmentWriteMask) << PIXEventsStringAlignmentBitShift) | + ((copyChunkSize & PIXEventsStringCopyChunkSizeWriteMask) << PIXEventsStringCopyChunkSizeBitShift) | + (((UINT64)isANSI & PIXEventsStringIsANSIWriteMask) << PIXEventsStringIsANSIBitShift) | + (((UINT64)isShortcut & PIXEventsStringIsShortcutWriteMask) << PIXEventsStringIsShortcutBitShift); +} + +template +inline bool PIXIsPointerAligned(T* pointer) +{ + return !(((UINT64)pointer) & (alignment - 1)); +} + +template +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, T argument) +{ + if (destination < limit) + { + *((T*)destination) = argument; + ++destination; + } +} + +//floats must be cast to double during writing the data to be properly printed later when reading the data +//this is needed because when float is passed to varargs function it's cast to double +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, float argument) +{ + if (destination < limit) + { + *((double*)destination) = (double)(argument); + ++destination; + } +} + +//char has to be cast to a longer signed integer type +//this is due to printf not ignoring correctly the upper bits of unsigned long long for a char format specifier +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, char argument) +{ + if (destination < limit) + { + *((INT64*)destination) = (INT64)(argument); + ++destination; + } +} + +//unsigned char has to be cast to a longer unsigned integer type +//this is due to printf not ignoring correctly the upper bits of unsigned long long for a char format specifier +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, unsigned char argument) +{ + if (destination < limit) + { + *destination = (UINT64)(argument); + ++destination; + } +} + +//bool has to be cast to an integer since it's not explicitly supported by string format routines +//there's no format specifier for bool type, but it should work with integer format specifiers +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, bool argument) +{ + if (destination < limit) + { + *destination = (UINT64)(argument); + ++destination; + } +} + +inline void PIXCopyEventArgumentSlowest(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + *destination++ = PIXEncodeStringInfo(0, 8, TRUE, FALSE); + while (destination < limit) + { + UINT64 c = argument[0]; + if (!c) + { + *destination++ = 0; + return; + } + UINT64 x = c; + c = argument[1]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 8; + c = argument[2]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 16; + c = argument[3]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 24; + c = argument[4]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 32; + c = argument[5]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 40; + c = argument[6]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 48; + c = argument[7]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 56; + *destination++ = x; + argument += 8; + } +} + +inline void PIXCopyEventArgumentSlow(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + if (PIXIsPointerAligned<8>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 8, TRUE, FALSE); + UINT64* source = (UINT64*)argument; + while (destination < limit) + { + UINT64 qword = *source++; + *destination++ = qword; + //check if any of the characters is a terminating zero + if (!((qword & 0xFF00000000000000) && + (qword & 0xFF000000000000) && + (qword & 0xFF0000000000) && + (qword & 0xFF00000000) && + (qword & 0xFF000000) && + (qword & 0xFF0000) && + (qword & 0xFF00) && + (qword & 0xFF))) + { + break; + } + } + } + else + { + PIXCopyEventArgumentSlowest(destination, limit, argument); + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + if (destination < limit) + { + if (argument != nullptr) + { +#if defined(_AMD64_) || defined(_X86_) + if (PIXIsPointerAligned<16>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 16, TRUE, FALSE); + __m128i zero = _mm_setzero_si128(); + if (PIXIsPointerAligned<16>(destination)) + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_store_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi8(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 16; + } + } + else + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_storeu_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi8(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 16; + } + } + } + else +#endif // _AMD64_ || _X86_ + { + PIXCopyEventArgumentSlow(destination, limit, argument); + } + } + else + { + *destination++ = 0ull; + } + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PSTR argument) +{ + PIXCopyEventArgument(destination, limit, (PCSTR)argument); +} + +inline void PIXCopyEventArgumentSlowest(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + *destination++ = PIXEncodeStringInfo(0, 8, FALSE, FALSE); + while (destination < limit) + { + UINT64 c = argument[0]; + if (!c) + { + *destination++ = 0; + return; + } + UINT64 x = c; + c = argument[1]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 16; + c = argument[2]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 32; + c = argument[3]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 48; + *destination++ = x; + argument += 4; + } +} + +inline void PIXCopyEventArgumentSlow(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + if (PIXIsPointerAligned<8>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 8, FALSE, FALSE); + UINT64* source = (UINT64*)argument; + while (destination < limit) + { + UINT64 qword = *source++; + *destination++ = qword; + //check if any of the characters is a terminating zero + //TODO: check if reversed condition is faster + if (!((qword & 0xFFFF000000000000) && + (qword & 0xFFFF00000000) && + (qword & 0xFFFF0000) && + (qword & 0xFFFF))) + { + break; + } + } + } + else + { + PIXCopyEventArgumentSlowest(destination, limit, argument); + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + if (destination < limit) + { + if (argument != nullptr) + { +#if defined(_AMD64_) || defined(_X86_) + if (PIXIsPointerAligned<16>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 16, FALSE, FALSE); + __m128i zero = _mm_setzero_si128(); + if (PIXIsPointerAligned<16>(destination)) + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_store_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi16(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 8; + } + } + else + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_storeu_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi16(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 8; + } + } + } + else +#endif // _AMD64_ || _X86_ + { + PIXCopyEventArgumentSlow(destination, limit, argument); + } + } + else + { + *destination++ = 0ull; + } + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PWSTR argument) +{ + PIXCopyEventArgument(destination, limit, (PCWSTR)argument); +}; + +#if defined(__d3d12_x_h__) || defined(__d3d12_h__) + +inline void PIXSetMarkerOnContext(_In_ ID3D12GraphicsCommandList* commandList, _In_reads_bytes_(size) void* data, UINT size) +{ + commandList->SetMarker(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXSetMarkerOnContext(_In_ ID3D12CommandQueue* commandQueue, _In_reads_bytes_(size) void* data, UINT size) +{ + commandQueue->SetMarker(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXBeginEventOnContext(_In_ ID3D12GraphicsCommandList* commandList, _In_reads_bytes_(size) void* data, UINT size) +{ + commandList->BeginEvent(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXBeginEventOnContext(_In_ ID3D12CommandQueue* commandQueue, _In_reads_bytes_(size) void* data, UINT size) +{ + commandQueue->BeginEvent(D3D12_EVENT_METADATA, data, size); +} +inline void PIXEndEventOnContext(_In_ ID3D12GraphicsCommandList* commandList) +{ + commandList->EndEvent(); +} + +inline void PIXEndEventOnContext(_In_ ID3D12CommandQueue* commandQueue) +{ + commandQueue->EndEvent(); +} + +#endif //__d3d12_x_h__ + +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +#endif //_PIXEventsCommon_H_ diff --git a/3rdparty/dxsdk/include/PIXEventsGenerated.h b/3rdparty/dxsdk/include/PIXEventsGenerated.h new file mode 100644 index 000000000..e9fab2b63 --- /dev/null +++ b/3rdparty/dxsdk/include/PIXEventsGenerated.h @@ -0,0 +1,10748 @@ +//This is a generated file. +#pragma once + +#ifndef _PIXEventsGenerated_H_ +#define _PIXEventsGenerated_H_ + +#ifndef _PIX3_H_ +#error Don't include this file directly - use pix3.h +#endif + +#include "PIXEventsCommon.h" + +//__declspec(noinline) is specified to stop compiler from making bad inlining decisions +//inline has to be specified for functions fully defined in header due to one definition rule +//supported context types for TContext are ID3D11DeviceContextX, ID3D11ComputeContextX and ID3D11DmaEngineContextX + +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString) +{ + PIXBeginCPUEventOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString) +{ + PIXBeginCPUEventOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString) +{ + PIXSetCPUMarkerOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString) +{ + PIXSetCPUMarkerOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + + +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + + +__declspec(noinline) inline void PIXEndEventAllocate() +{ + UINT64 time = PIXEventsReplaceBlock(true); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXEndEvent() +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXEndEventAllocate(); + } +} + +__declspec(noinline) inline void MakeCPUEndEventForContextAllocate(PVOID context) +{ + UINT64 time = PIXEventsReplaceBlock(true); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent_OnContext); + PIXCopyEventArgument(destination, limit, context); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUEndEventForContext(PVOID context) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent_OnContext); + PIXCopyEventArgument(destination, limit, context); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUEndEventForContextAllocate(context); + } +} + +template +inline void PIXEndEvent(TContext* context) +{ + PIXEndCPUEventOnContext(context); + PIXEndEventOnContext(context); +} + +template +class PIXScopedEventObject +{ +private: + TContext* m_context; + +public: + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString) + : m_context(context) + { + PIXBeginEvent(context, color, formatString); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString) + : m_context(context) + { + PIXBeginEvent(context, color, formatString); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + ~PIXScopedEventObject() + { + PIXEndEvent(m_context); + } +}; + +template<> +class PIXScopedEventObject +{ +public: + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString) + { + PIXBeginEvent(color, formatString); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1) + { + PIXBeginEvent(color, formatString, a1); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) + { + PIXBeginEvent(color, formatString, a1, a2); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) + { + PIXBeginEvent(color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString) + { + PIXBeginEvent(color, formatString); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1) + { + PIXBeginEvent(color, formatString, a1); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) + { + PIXBeginEvent(color, formatString, a1, a2); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) + { + PIXBeginEvent(color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + ~PIXScopedEventObject() + { + PIXEndEvent(); + } +}; + +#define PIXConcatenate(a, b) a ## b +#define PIXGetScopedEventVariableName(a, b) PIXConcatenate(a, b) +#define PIXScopedEvent(context, ...) PIXScopedEventObject::Type> PIXGetScopedEventVariableName(pixEvent, __LINE__)(context, __VA_ARGS__) + +#endif diff --git a/3rdparty/dxsdk/include/pix3.h b/3rdparty/dxsdk/include/pix3.h new file mode 100644 index 000000000..b69062e66 --- /dev/null +++ b/3rdparty/dxsdk/include/pix3.h @@ -0,0 +1,120 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: pix3.h + * Content: PIX include file + * + ****************************************************************************/ +#pragma once + +#ifndef _PIX3_H_ +#define _PIX3_H_ + +#include + +#ifndef __cplusplus +#error "Only C++ files can include pix.h. C is not supported." +#endif + +#if defined(XBOX) || defined(_XBOX_ONE) || defined(_DURANGO) +#include "pix3_xbox.h" +#else +#include "pix3_win.h" +#endif + +// +// The PIX event/marker APIs compile to nothing on retail builds and on x86 builds +// +#if (!defined(USE_PIX)) && ((defined(_DEBUG) || DBG || (defined(PROFILE) && !defined(FASTCAP)) || defined(PROFILE_BUILD)) && !defined(i386) && defined(_AMD64_) && !defined(_PREFAST_)) +#define USE_PIX +#endif + +#if defined(USE_PIX) && !defined(_AMD64_) && !defined(USE_PIX_ON_ALL_ARCHITECTURES) +#pragma message("Warning: Pix markers are only supported on AMD64") +#endif + +// These flags are used by both PIXBeginCapture and PIXGetCaptureState +#define PIX_CAPTURE_TIMING (1 << 0) +#define PIX_CAPTURE_GPU (1 << 1) +#define PIX_CAPTURE_FUNCTION_SUMMARY (1 << 2) +#define PIX_CAPTURE_FUNCTION_DETAILS (1 << 3) +#define PIX_CAPTURE_CALLGRAPH (1 << 4) +#define PIX_CAPTURE_INSTRUCTION_TRACE (1 << 5) +#define PIX_CAPTURE_SYSTEM_MONITOR_COUNTERS (1 << 6) +#define PIX_CAPTURE_VIDEO (1 << 7) +#define PIX_CAPTURE_AUDIO (1 << 8) + +typedef union PIXCaptureParameters +{ + struct GpuCaptureParameters + { + PVOID reserved; + } GpuCaptureParameters; + + struct TimingCaptureParameters + { + BOOL CaptureCallstacks; + PWSTR FileName; + } TimingCaptureParameters; + +} PIXCaptureParameters, *PPIXCaptureParameters; + + + +#if defined (USE_PIX) && (defined(_AMD64_) || defined(USE_PIX_ON_ALL_ARCHITECTURES)) + +#include "PIXEventsCommon.h" +#include "PIXEventsGenerated.h" + +// Starts a programmatically controlled capture. +// captureFlags uses the PIX_CAPTURE_* family of flags to specify the type of capture to take +extern "C" HRESULT WINAPI PIXBeginCapture(DWORD captureFlags, _In_opt_ const PPIXCaptureParameters captureParameters); + +// Stops a programmatically controlled capture +// If discard == TRUE, the captured data is discarded +// If discard == FALSE, the captured data is saved +extern "C" HRESULT WINAPI PIXEndCapture(BOOL discard); + +extern "C" DWORD WINAPI PIXGetCaptureState(); + +extern "C" void WINAPI PIXReportCounter(_In_ PCWSTR name, float value); + +#else + +// Eliminate these APIs when not using PIX +inline HRESULT PIXBeginCapture(DWORD, _In_opt_ const PIXCaptureParameters*) { return S_OK; } +inline HRESULT PIXEndCapture(BOOL) { return S_OK; } +inline DWORD PIXGetCaptureState() { return 0; } +inline void PIXReportCounter(_In_ PCWSTR, float) {} + +inline void PIXBeginEvent(UINT64, _In_ PCSTR, ...) {} +inline void PIXBeginEvent(UINT64, _In_ PCWSTR, ...) {} +inline void PIXBeginEvent(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXBeginEvent(void*, UINT64, _In_ PCWSTR, ...) {} +inline void PIXEndEvent() {} +inline void PIXEndEvent(void*) {} +inline void PIXSetMarker(UINT64, _In_ PCSTR, ...) {} +inline void PIXSetMarker(UINT64, _In_ PCWSTR, ...) {} +inline void PIXSetMarker(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXSetMarker(void*, UINT64, _In_ PCWSTR, ...) {} +inline void PIXScopedEvent(UINT64, _In_ PCSTR, ...) {} +inline void PIXScopedEvent(UINT64, _In_ PCWSTR, ...) {} +inline void PIXScopedEvent(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXScopedEvent(void*, UINT64, _In_ PCWSTR, ...) {} + +// don't show warnings about expressions with no effect +#pragma warning(disable:4548) +#pragma warning(disable:4555) + +#endif // USE_PIX + +// Use these functions to specify colors to pass as metadata to a PIX event/marker API. +// Use PIX_COLOR() to specify a particular color for an event. +// Or, use PIX_COLOR_INDEX() to specify a set of unique event categories, and let PIX choose +// the colors to represent each category. +inline UINT PIX_COLOR(BYTE r, BYTE g, BYTE b) { return 0xff000000 | (r << 16) | (g << 8) | b; } +inline UINT PIX_COLOR_INDEX(BYTE i) { return i; } +const UINT PIX_COLOR_DEFAULT = PIX_COLOR_INDEX(0); + +#endif // _PIX3_H_ diff --git a/3rdparty/dxsdk/include/pix3_win.h b/3rdparty/dxsdk/include/pix3_win.h new file mode 100644 index 000000000..b3d4d4cb0 --- /dev/null +++ b/3rdparty/dxsdk/include/pix3_win.h @@ -0,0 +1,53 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: PIX3_win.h + * Content: PIX include file + * Don't include this file directly - use pix3.h + * + ****************************************************************************/ + +#pragma once + +#ifndef _PIX3_H_ +#error Don't include this file directly - use pix3.h +#endif + +#ifndef _PIX3_WIN_H_ +#define _PIX3_WIN_H_ + +struct PIXEventsBlockInfo +{ +}; + +struct PIXEventsThreadInfo +{ + PIXEventsBlockInfo* block; + UINT64* biasedLimit; + UINT64* destination; + UINT64* limit; + UINT64 id; +}; + +// The following defines denote the different metadata values that have been used +// by tools to denote how to parse pix marker event data. The first two values +// are legacy values. +#define WINPIX_EVENT_UNICODE_VERSION 0 +#define WINPIX_EVENT_ANSI_VERSION 1 +#define WINPIX_EVENT_PIX3BLOB_VERSION 2 + +#define D3D12_EVENT_METADATA WINPIX_EVENT_PIX3BLOB_VERSION + +__forceinline UINT64 PIXGetTimestampCounter() +{ + LARGE_INTEGER time = {}; + QueryPerformanceCounter(&time); + return time.QuadPart; +} + +#define PIXSetCPUMarkerOnContext(context, metadata, ...) MakeCPUSetMarkerForContext(metadata, context, __VA_ARGS__) +#define PIXBeginCPUEventOnContext(context, metadata, ...) MakeCPUBeginEventForContext(metadata, context, __VA_ARGS__) +#define PIXEndCPUEventOnContext(context) MakeCPUEndEventForContext(context) + +#endif //_PIX3_WIN_H_ diff --git a/src/renderer_d3d.h b/src/renderer_d3d.h index a654ab073..0aa8d6eb7 100644 --- a/src/renderer_d3d.h +++ b/src/renderer_d3d.h @@ -19,6 +19,14 @@ # define DX_CHECK_EXTRA_ARGS #endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9 +#ifndef D3DCOLOR_ARGB +# define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) ) +#endif // D3DCOLOR_ARGB + +#ifndef D3DCOLOR_RGBA +# define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b) +#endif // D3DCOLOR_RGBA + namespace bgfx { #if BX_PLATFORM_XBOXONE @@ -82,14 +90,14 @@ namespace bgfx typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE)(REFIID _riid, void** _debug); typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE1)(UINT _flags, REFIID _riid, void** _debug); -#define _PIX_SETMARKER(_col, _name) D3DPERF_SetMarker(_col, _name) +#define _PIX_SETMARKER(_col, _name) D3DPERF_SetMarker(_col, _name) #define _PIX_BEGINEVENT(_col, _name) D3DPERF_BeginEvent(_col, _name) -#define _PIX_ENDEVENT() D3DPERF_EndEvent() +#define _PIX_ENDEVENT() D3DPERF_EndEvent() #if BGFX_CONFIG_DEBUG_PIX # define PIX_SETMARKER(_color, _name) _PIX_SETMARKER(_color, _name) # define PIX_BEGINEVENT(_color, _name) _PIX_BEGINEVENT(_color, _name) -# define PIX_ENDEVENT() _PIX_ENDEVENT() +# define PIX_ENDEVENT() _PIX_ENDEVENT() #else # define PIX_SETMARKER(_color, _name) BX_UNUSED(_name) # define PIX_BEGINEVENT(_color, _name) BX_UNUSED(_name) diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index ef7bed286..ea1a7fa85 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -39,14 +39,6 @@ BX_PRAGMA_DIAGNOSTIC_POP() #include "debug_renderdoc.h" #include "nvapi.h" -#ifndef D3DCOLOR_ARGB -# define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) ) -#endif // D3DCOLOR_ARGB - -#ifndef D3DCOLOR_RGBA -# define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b) -#endif // D3DCOLOR_RGBA - #define BGFX_D3D11_BLEND_STATE_MASK (0 \ | BGFX_STATE_BLEND_MASK \ | BGFX_STATE_BLEND_EQUATION_MASK \ diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index f22c8e518..424fb4ed4 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -15,9 +15,11 @@ # endif // BX_PLATFORM_WINRT #endif // !BX_PLATFORM_WINDOWS +PFN_PIX_GET_THREAD_INFO bgfx_PIXGetThreadInfo; +PFN_PIX_EVENTS_REPLACE_BLOCK bgfx_PIXEventsReplaceBlock; + namespace bgfx { namespace d3d12 { - static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; struct PrimInfo @@ -572,12 +574,26 @@ namespace bgfx { namespace d3d12 #endif // BX_COMPILER_MSVC } + static PIXEventsThreadInfo temp; + + PIXEventsThreadInfo* WINAPI stubPIXGetThreadInfo() + { + return &temp; + } + + uint64_t WINAPI stubPIXEventsReplaceBlock(bool _getEarliestTime) + { + BX_UNUSED(_getEarliestTime); + return 0; + } + struct RendererContextD3D12 : public RendererContextI { RendererContextD3D12() : m_d3d12dll(NULL) , m_dxgidll(NULL) , m_renderdocdll(NULL) + , m_winPixEvent(NULL) , m_featureLevel(D3D_FEATURE_LEVEL(0) ) , m_wireframe(false) , m_lost(false) @@ -612,8 +628,23 @@ namespace bgfx { namespace d3d12 ErrorState::Enum errorState = ErrorState::Default; LUID luid; + m_winPixEvent = bx::dlopen("WinPixEventRuntime.dll"); + + if (NULL != m_winPixEvent) + { + bgfx_PIXGetThreadInfo = (PFN_PIX_GET_THREAD_INFO )bx::dlsym(m_winPixEvent, "PIXGetThreadInfo"); + bgfx_PIXEventsReplaceBlock = (PFN_PIX_EVENTS_REPLACE_BLOCK)bx::dlsym(m_winPixEvent, "PIXEventsReplaceBlock"); + } + + if (NULL == bgfx_PIXGetThreadInfo + || NULL == bgfx_PIXEventsReplaceBlock) + { + bgfx_PIXGetThreadInfo = stubPIXGetThreadInfo; + bgfx_PIXEventsReplaceBlock = stubPIXEventsReplaceBlock; + } + m_renderdocdll = loadRenderDoc(); - setGraphicsDebuggerPresent(NULL != m_renderdocdll); + setGraphicsDebuggerPresent(NULL != m_renderdocdll || NULL != m_winPixEvent); m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); @@ -1304,7 +1335,6 @@ namespace bgfx { namespace d3d12 for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + 1, "%3d ", ii); - mbstowcs(s_viewNameW[ii], s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED); } postReset(); @@ -1337,6 +1367,8 @@ namespace bgfx { namespace d3d12 case ErrorState::Default: default: unloadRenderDoc(m_renderdocdll); + bx::dlclose(m_winPixEvent); + m_winPixEvent = NULL; break; } @@ -1397,6 +1429,9 @@ namespace bgfx { namespace d3d12 unloadRenderDoc(m_renderdocdll); + bx::dlclose(m_winPixEvent); + m_winPixEvent = NULL; + #if USE_D3D12_DYNAMIC_LIB bx::dlclose(m_dxgidll); bx::dlclose(m_d3d12dll); @@ -1777,14 +1812,6 @@ namespace bgfx { namespace d3d12 void updateViewName(ViewId _id, const char* _name) override { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) - { - mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name - , BX_COUNTOF(s_viewNameW[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED - ); - } - bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED , _name @@ -2750,6 +2777,9 @@ data.NumQualityLevels = 0; , (void**)&pso ) ); } + + BGFX_FATAL(NULL != pso, Fatal::InvalidShader, "Failed to create PSO!"); + m_pipelineStateCache.add(hash, pso); release(temp); @@ -3033,6 +3063,7 @@ data.NumQualityLevels = 0; void* m_d3d12dll; void* m_dxgidll; void* m_renderdocdll; + void* m_winPixEvent; D3D_FEATURE_LEVEL m_featureLevel; @@ -3160,7 +3191,8 @@ data.NumQualityLevels = 0; m_upload = createCommittedResource(device, HeapProperty::Upload, desc.NumDescriptors * 1024); m_gpuVA = m_upload->GetGPUVirtualAddress(); - m_upload->Map(0, NULL, (void**)&m_data); + D3D12_RANGE range = { 0, 0 }; + m_upload->Map(0, &range, (void**)&m_data); reset(m_gpuHandle); } @@ -3188,15 +3220,15 @@ data.NumQualityLevels = 0; m_pos += BX_ALIGN_256(_size); -// D3D12_CONSTANT_BUFFER_VIEW_DESC desc; -// desc.BufferLocation = _gpuAddress; -// desc.SizeInBytes = _size; -// ID3D12Device* device = s_renderD3D12->m_device; -// device->CreateConstantBufferView(&desc -// , m_cpuHandle -// ); -// m_cpuHandle.ptr += m_incrementSize; -// m_gpuHandle.ptr += m_incrementSize; +// D3D12_CONSTANT_BUFFER_VIEW_DESC desc; +// desc.BufferLocation = _gpuAddress; +// desc.SizeInBytes = _size; +// ID3D12Device* device = s_renderD3D12->m_device; +// device->CreateConstantBufferView(&desc +// , m_cpuHandle +// ); +// m_cpuHandle.ptr += m_incrementSize; +// m_gpuHandle.ptr += m_incrementSize; return data; } @@ -4070,7 +4102,9 @@ data.NumQualityLevels = 0; { ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, _size); uint8_t* data; - DX_CHECK(staging->Map(0, NULL, (void**)&data) ); + + D3D12_RANGE range = { 0, 0 }; + DX_CHECK(staging->Map(0, &range, (void**)&data) ); bx::memCopy(data, _data, _size); staging->Unmap(0, NULL); @@ -4695,7 +4729,8 @@ data.NumQualityLevels = 0; ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, totalBytes); uint8_t* data; - DX_CHECK(staging->Map(0, NULL, (void**)&data) ); + D3D12_RANGE range = { 0, 0 }; + DX_CHECK(staging->Map(0, &range, (void**)&data) ); for (uint32_t ii = 0, height = _rect.m_height; ii < height; ++ii) { bx::memCopy(&data[ii*rowPitch], &_mem->data[ii*srcpitch], srcpitch); @@ -5226,7 +5261,7 @@ data.NumQualityLevels = 0; void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "rendererSubmit"); if (m_lost || updateResolution(_render->m_resolution) ) @@ -5424,6 +5459,14 @@ data.NumQualityLevels = 0; { wasCompute = true; + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + char* viewName = s_viewName[view]; + viewName[3] = L'C'; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_COMPUTE, viewName); + } + m_commandList->SetComputeRootSignature(m_rootSignature); ID3D12DescriptorHeap* heaps[] = { m_samplerAllocator.getHeap(), @@ -5611,11 +5654,11 @@ data.NumQualityLevels = 0; if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { - BX_UNUSED(s_viewNameW); -// wchar_t* viewNameW = s_viewNameW[view]; -// viewNameW[3] = L' '; -// PIX_ENDEVENT(); -// PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW); + BX_UNUSED(s_viewName); + char* viewName = s_viewName[view]; + viewName[3] = ' '; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_DRAW, viewName); } commandListChanged = true; @@ -5649,10 +5692,9 @@ data.NumQualityLevels = 0; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); } + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); -// bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw); - if (0 != draw.m_streamMask) { currentState.m_streamMask = draw.m_streamMask; @@ -5883,8 +5925,7 @@ data.NumQualityLevels = 0; m_commandList->SetPipelineState(pso); } - bool constantsChanged = false; - if (draw.m_uniformBegin < draw.m_uniformEnd + if (constantsChanged || currentProgramIdx != key.m_program || BGFX_STATE_ALPHA_REF_MASK & changedFlags) { @@ -5938,6 +5979,17 @@ data.NumQualityLevels = 0; m_batch.end(m_commandList); kick(); + if (wasCompute) + { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + char* viewName = s_viewName[view]; + viewName[3] = L'C'; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_DRAW, viewName); + } + } + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); if (0 < _render->m_numRenderItems) @@ -5955,6 +6007,8 @@ data.NumQualityLevels = 0; } } + PIX3_ENDEVENT(m_commandList); + int64_t timeEnd = bx::getHPCounter(); int64_t frameTime = timeEnd - timeBegin; @@ -6013,7 +6067,7 @@ data.NumQualityLevels = 0; if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugstats"); // m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; @@ -6180,15 +6234,15 @@ data.NumQualityLevels = 0; blit(this, _textVideoMemBlitter, tvm); -// PIX_ENDEVENT(); + PIX3_ENDEVENT(m_commandList); } else if (_render->m_debug & BGFX_DEBUG_TEXT) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugtext"); blit(this, _textVideoMemBlitter, _render->m_textVideoMem); -// PIX_ENDEVENT(); + PIX3_ENDEVENT(m_commandList); } setResourceBarrier(m_commandList diff --git a/src/renderer_d3d12.h b/src/renderer_d3d12.h index 42243c72e..d575eb1ef 100644 --- a/src/renderer_d3d12.h +++ b/src/renderer_d3d12.h @@ -52,6 +52,30 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #include "shader_dxbc.h" #include "debug_renderdoc.h" +typedef struct PIXEventsThreadInfo* (WINAPI* PFN_PIX_GET_THREAD_INFO)(); +typedef uint64_t (WINAPI* PFN_PIX_EVENTS_REPLACE_BLOCK)(bool _getEarliestTime); + +extern PFN_PIX_GET_THREAD_INFO bgfx_PIXGetThreadInfo; +extern PFN_PIX_EVENTS_REPLACE_BLOCK bgfx_PIXEventsReplaceBlock; + +#define PIXGetThreadInfo bgfx_PIXGetThreadInfo +#define PIXEventsReplaceBlock bgfx_PIXEventsReplaceBlock +#include + +#define _PIX3_BEGINEVENT(_commandList, _color, _name) PIXBeginEvent(_commandList, _color, _name) +#define _PIX3_SETMARKER(_commandList, _color, _name) PIXSetMarker(_commandList, _color, _name) +#define _PIX3_ENDEVENT(_commandList) PIXEndEvent(_commandList) + +#if BGFX_CONFIG_DEBUG_PIX +# define PIX3_BEGINEVENT(_commandList, _color, _name) _PIX3_BEGINEVENT(_commandList, _color, _name) +# define PIX3_SETMARKER(_commandList, _color, _name) _PIX3_SETMARKER(_commandList, _color, _name) +# define PIX3_ENDEVENT(_commandList) _PIX3_ENDEVENT(_commandList) +#else +# define PIX3_BEGINEVENT(_commandList, _color, _name) BX_UNUSED(_commandList, _color, _name) +# define PIX3_SETMARKER(_commandList, _color, _name) BX_UNUSED(_commandList, _color, _name) +# define PIX3_ENDEVENT(_commandList) BX_UNUSED(_commandList) +#endif // BGFX_CONFIG_DEBUG_PIX + namespace bgfx { namespace d3d12 { struct Rdt diff --git a/src/shader_dxbc.cpp b/src/shader_dxbc.cpp index 7dc3eb337..cc3fbe731 100644 --- a/src/shader_dxbc.cpp +++ b/src/shader_dxbc.cpp @@ -1072,12 +1072,12 @@ namespace bgfx { case DxbcOpcode::CUSTOMDATA: { -// uint32_t dataClass; + _instruction.numOperands = 0; size += bx::read(_reader, _instruction.length); - for (uint32_t ii = 0, num = (_instruction.length-2)/4; ii < num; ++ii) + for (uint32_t ii = 0, num = (_instruction.length-2); ii < num; ++ii) { - char temp[16]; - size += bx::read(_reader, temp, 16, _err); + char temp[4]; + size += bx::read(_reader, temp, 4, _err); } } @@ -1317,8 +1317,8 @@ namespace bgfx switch (_instruction.opcode) { -// case DxbcOpcode::CUSTOMDATA: -// return size; + case DxbcOpcode::CUSTOMDATA: + return 0; case DxbcOpcode::DCL_CONSTANT_BUFFER: token |= _instruction.allowRefactoring ? UINT32_C(0x00000800) : 0;