mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix D3D12 BeginEvent/SetMarker to use size in bytes
This commit is contained in:
committed by
Baldur Karlsson
parent
b16dda9d4a
commit
b1e6b2f13c
@@ -792,8 +792,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::Present(
|
||||
WrappedID3D12GraphicsCommandList *list = (WrappedID3D12GraphicsCommandList *)pOpenCommandList;
|
||||
|
||||
// add a marker
|
||||
const char str[] = "ID3D12CommandQueueDownlevel::Present()";
|
||||
list->SetMarker(PIX_EVENT_ANSI_VERSION, str, sizeof(str) - 1);
|
||||
D3D12MarkerRegion::Set(list, "ID3D12CommandQueueDownlevel::Present()");
|
||||
|
||||
// the list is implicitly closed, serialise that
|
||||
D3D12ResourceRecord *listRecord = GetRecord(list);
|
||||
|
||||
@@ -56,8 +56,13 @@ void D3D12MarkerRegion::Begin(ID3D12GraphicsCommandList *list, const std::string
|
||||
{
|
||||
if(list)
|
||||
{
|
||||
// Some debuggers (but not all) will assume the event string is null-terminated, and
|
||||
// display one less character than specified by the size. Append a space to pad the
|
||||
// output without visibly changing the event marker for other debuggers.
|
||||
std::wstring text = StringFormat::UTF82Wide(marker);
|
||||
list->BeginEvent(0, text.c_str(), (UINT)text.size());
|
||||
text.append(L" ");
|
||||
UINT size = (UINT)text.size() * sizeof(wchar_t);
|
||||
list->BeginEvent(0, text.c_str(), size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +71,9 @@ void D3D12MarkerRegion::Begin(ID3D12CommandQueue *queue, const std::string &mark
|
||||
if(queue)
|
||||
{
|
||||
std::wstring text = StringFormat::UTF82Wide(marker);
|
||||
queue->BeginEvent(0, text.c_str(), (UINT)text.size());
|
||||
text.append(L" ");
|
||||
UINT size = (UINT)text.size() * sizeof(wchar_t);
|
||||
queue->BeginEvent(0, text.c_str(), size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +82,9 @@ void D3D12MarkerRegion::Set(ID3D12GraphicsCommandList *list, const std::string &
|
||||
if(list)
|
||||
{
|
||||
std::wstring text = StringFormat::UTF82Wide(marker);
|
||||
list->SetMarker(0, text.c_str(), (UINT)text.size());
|
||||
text.append(L" ");
|
||||
UINT size = (UINT)text.size() * sizeof(wchar_t);
|
||||
list->SetMarker(0, text.c_str(), size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +93,9 @@ void D3D12MarkerRegion::Set(ID3D12CommandQueue *queue, const std::string &marker
|
||||
if(queue)
|
||||
{
|
||||
std::wstring text = StringFormat::UTF82Wide(marker);
|
||||
queue->SetMarker(0, text.c_str(), (UINT)text.size());
|
||||
text.append(L" ");
|
||||
UINT size = (UINT)text.size() * sizeof(wchar_t);
|
||||
queue->SetMarker(0, text.c_str(), size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,15 +75,21 @@ inline std::string DecodeMarkerString(UINT Metadata, const void *pData, UINT Siz
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
|
||||
// There may be a space appended to the marker string - see D3D12MarkerRegion::Begin
|
||||
// If we encounter this extra space (or a null terminator), remove it.
|
||||
if(Metadata == PIX_EVENT_UNICODE_VERSION)
|
||||
{
|
||||
const wchar_t *w = (const wchar_t *)pData;
|
||||
MarkerText = StringFormat::Wide2UTF8(std::wstring(w, w + Size));
|
||||
MarkerText = StringFormat::Wide2UTF8(std::wstring(w, w + Size / sizeof(wchar_t)));
|
||||
if(!MarkerText.empty() && (MarkerText.back() == ' ' || MarkerText.back() == 0))
|
||||
MarkerText.pop_back();
|
||||
}
|
||||
else if(Metadata == PIX_EVENT_ANSI_VERSION)
|
||||
{
|
||||
const char *c = (const char *)pData;
|
||||
MarkerText = std::string(c, c + Size);
|
||||
if(!MarkerText.empty() && (MarkerText.back() == ' ' || MarkerText.back() == 0))
|
||||
MarkerText.pop_back();
|
||||
}
|
||||
else if(Metadata == PIX_EVENT_PIX3BLOB_VERSION)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user