D3DPER debug events for DX11

This commit is contained in:
rextimmy 2016-12-23 15:59:32 +10:00
parent 4857e89ca8
commit 46037622c9
2 changed files with 32 additions and 3 deletions

View file

@ -37,6 +37,7 @@
#include "windowManager/platformWindow.h"
#include "gfx/D3D11/screenshotD3D11.h"
#include "materials/shaderData.h"
#include <d3d9.h> //ok now stressing out folks, this is just for debug events(D3DPER) :)
#ifdef TORQUE_DEBUG
#include "d3d11sdklayers.h"
@ -1678,4 +1679,32 @@ GFXCubemap * GFXD3D11Device::createCubemap()
GFXD3D11Cubemap* cube = new GFXD3D11Cubemap();
cube->registerResourceWithDevice(this);
return cube;
}
//------------------------------------------------------------------------------
void GFXD3D11Device::enterDebugEvent(ColorI color, const char *name)
{
// BJGFIX
WCHAR eventName[260];
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
D3DPERF_BeginEvent(D3DCOLOR_ARGB(color.alpha, color.red, color.green, color.blue),
(LPCWSTR)&eventName);
}
//------------------------------------------------------------------------------
void GFXD3D11Device::leaveDebugEvent()
{
D3DPERF_EndEvent();
}
//------------------------------------------------------------------------------
void GFXD3D11Device::setDebugMarker(ColorI color, const char *name)
{
// BJGFIX
WCHAR eventName[260];
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
D3DPERF_SetMarker(D3DCOLOR_ARGB(color.alpha, color.red, color.green, color.blue),
(LPCWSTR)&eventName);
}

View file

@ -70,9 +70,9 @@ private:
virtual GFXWindowTarget *allocWindowTarget(PlatformWindow *window);
virtual GFXTextureTarget *allocRenderToTextureTarget();
virtual void enterDebugEvent(ColorI color, const char *name){};
virtual void leaveDebugEvent(){};
virtual void setDebugMarker(ColorI color, const char *name){};
virtual void enterDebugEvent(ColorI color, const char *name);
virtual void leaveDebugEvent();
virtual void setDebugMarker(ColorI color, const char *name);
protected: