mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 04:53:06 +01:00
Cleanup internal profiler.
This commit is contained in:
2
3rdparty/stb/stb_truetype.h
vendored
2
3rdparty/stb/stb_truetype.h
vendored
@@ -253,7 +253,7 @@
|
||||
// Documentation & header file 520 LOC \___ 660 LOC documentation
|
||||
// Sample code 140 LOC /
|
||||
// Truetype parsing 620 LOC ---- 620 LOC TrueType
|
||||
// Software rasterization 240 LOC \.
|
||||
// Software rasterization 240 LOC \_
|
||||
// Curve tessellation 120 LOC \__ 550 LOC Bitmap creation
|
||||
// Bitmap management 100 LOC /
|
||||
// Baked bitmap interface 70 LOC /
|
||||
|
||||
60
src/bgfx.cpp
60
src/bgfx.cpp
@@ -2681,6 +2681,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateIndexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateIndexBuffer", 0xff2040ff);
|
||||
|
||||
IndexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2698,6 +2700,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyIndexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyIndexBuffer", 0xff2040ff);
|
||||
|
||||
IndexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2707,6 +2711,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateVertexDecl:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateVertexDecl", 0xff2040ff);
|
||||
|
||||
VertexDeclHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2719,6 +2725,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyVertexDecl:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyVertexDecl", 0xff2040ff);
|
||||
|
||||
VertexDeclHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2728,6 +2736,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateVertexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateVertexBuffer", 0xff2040ff);
|
||||
|
||||
VertexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2748,6 +2758,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyVertexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyVertexBuffer", 0xff2040ff);
|
||||
|
||||
VertexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2757,6 +2769,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateDynamicIndexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateDynamicIndexBuffer", 0xff2040ff);
|
||||
|
||||
IndexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2772,6 +2786,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::UpdateDynamicIndexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("UpdateDynamicIndexBuffer", 0xff2040ff);
|
||||
|
||||
IndexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2792,6 +2808,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyDynamicIndexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyDynamicIndexBuffer", 0xff2040ff);
|
||||
|
||||
IndexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2801,6 +2819,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateDynamicVertexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateDynamicVertexBuffer", 0xff2040ff);
|
||||
|
||||
VertexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2816,6 +2836,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::UpdateDynamicVertexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("UpdateDynamicVertexBuffer", 0xff2040ff);
|
||||
|
||||
VertexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2836,6 +2858,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyDynamicVertexBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyDynamicVertexBuffer", 0xff2040ff);
|
||||
|
||||
VertexBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2845,6 +2869,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateShader:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateShader", 0xff2040ff);
|
||||
|
||||
ShaderHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2859,6 +2885,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyShader:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyShader", 0xff2040ff);
|
||||
|
||||
ShaderHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2868,6 +2896,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateProgram:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateProgram", 0xff2040ff);
|
||||
|
||||
ProgramHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2883,6 +2913,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyProgram:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyProgram", 0xff2040ff);
|
||||
|
||||
ProgramHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2892,6 +2924,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateTexture:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateTexture", 0xff2040ff);
|
||||
|
||||
TextureHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2932,6 +2966,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::UpdateTexture:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("UpdateTexture", 0xff2040ff);
|
||||
|
||||
if (m_textureUpdateBatch.isFull() )
|
||||
{
|
||||
flushTextureUpdateBatch(_cmdbuf);
|
||||
@@ -2965,6 +3001,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::ReadTexture:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("ReadTexture", 0xff2040ff);
|
||||
|
||||
TextureHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -2980,6 +3018,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::ResizeTexture:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("ResizeTexture", 0xff2040ff);
|
||||
|
||||
TextureHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3001,6 +3041,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyTexture:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyTexture", 0xff2040ff);
|
||||
|
||||
TextureHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3010,6 +3052,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateFrameBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateFrameBuffer", 0xff2040ff);
|
||||
|
||||
FrameBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3050,6 +3094,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyFrameBuffer:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyFrameBuffer", 0xff2040ff);
|
||||
|
||||
FrameBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3059,6 +3105,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::CreateUniform:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("CreateUniform", 0xff2040ff);
|
||||
|
||||
UniformHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3079,6 +3127,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::DestroyUniform:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("DestroyUniform", 0xff2040ff);
|
||||
|
||||
UniformHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3088,6 +3138,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::RequestScreenShot:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("RequestScreenShot", 0xff2040ff);
|
||||
|
||||
FrameBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3102,6 +3154,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::UpdateViewName:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("UpdateViewName", 0xff2040ff);
|
||||
|
||||
ViewId id;
|
||||
_cmdbuf.read(id);
|
||||
|
||||
@@ -3116,6 +3170,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::InvalidateOcclusionQuery:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("InvalidateOcclusionQuery", 0xff2040ff);
|
||||
|
||||
OcclusionQueryHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3125,6 +3181,8 @@ namespace bgfx
|
||||
|
||||
case CommandBuffer::SetName:
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("SetName", 0xff2040ff);
|
||||
|
||||
Handle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
@@ -3216,7 +3274,7 @@ namespace bgfx
|
||||
, vendorId(BGFX_PCI_ID_NONE)
|
||||
, deviceId(0)
|
||||
, debug(BX_ENABLED(BGFX_CONFIG_DEBUG) )
|
||||
, profile(BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
, profile(BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
, callback(NULL)
|
||||
, allocator(NULL)
|
||||
{
|
||||
|
||||
44
src/bgfx_p.h
44
src/bgfx_p.h
@@ -25,24 +25,24 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
// Check handle, cannot be bgfx::kInvalidHandle and must be valid.
|
||||
#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \
|
||||
BX_CHECK(isValid(_handle) \
|
||||
&& _handleAlloc.isValid(_handle.idx) \
|
||||
, "Invalid handle. %s handle: %d (max %d)" \
|
||||
, _desc \
|
||||
, _handle.idx \
|
||||
, _handleAlloc.getMaxHandles() \
|
||||
)
|
||||
#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \
|
||||
BX_CHECK(isValid(_handle) \
|
||||
&& _handleAlloc.isValid(_handle.idx) \
|
||||
, "Invalid handle. %s handle: %d (max %d)" \
|
||||
, _desc \
|
||||
, _handle.idx \
|
||||
, _handleAlloc.getMaxHandles() \
|
||||
)
|
||||
|
||||
// Check handle, it's ok to be bgfx::kInvalidHandle or must be valid.
|
||||
#define BGFX_CHECK_HANDLE_INVALID_OK(_desc, _handleAlloc, _handle) \
|
||||
BX_CHECK(!isValid(_handle) \
|
||||
|| _handleAlloc.isValid(_handle.idx) \
|
||||
, "Invalid handle. %s handle: %d (max %d)" \
|
||||
, _desc \
|
||||
, _handle.idx \
|
||||
, _handleAlloc.getMaxHandles() \
|
||||
)
|
||||
BX_CHECK(!isValid(_handle) \
|
||||
|| _handleAlloc.isValid(_handle.idx) \
|
||||
, "Invalid handle. %s handle: %d (max %d)" \
|
||||
, _desc \
|
||||
, _handle.idx \
|
||||
, _handleAlloc.getMaxHandles() \
|
||||
)
|
||||
|
||||
#if BGFX_CONFIG_MULTITHREADED
|
||||
# define BGFX_MUTEX_SCOPE(_mutex) bx::MutexScope BX_CONCATENATE(mutexScope, __LINE__)(_mutex)
|
||||
@@ -51,14 +51,16 @@
|
||||
#endif // BGFX_CONFIG_MULTITHREADED
|
||||
|
||||
#if BGFX_CONFIG_PROFILER
|
||||
# define BGFX_PROFILER_SCOPE(_name, _abgr) ProfilerScope BX_CONCATENATE(profilerScope, __LINE__)(_name, _abgr, __FILE__, uint16_t(__LINE__) )
|
||||
# define BGFX_PROFILER_BEGIN(_name, _abgr) g_callback->profilerBeginLiteral(_name, _abgr, __FILE__, uint16_t(__LINE__) )
|
||||
# define BGFX_PROFILER_END() g_callback->profilerEnd()
|
||||
# define BGFX_PROFILER_SCOPE(_name, _abgr) ProfilerScope BX_CONCATENATE(profilerScope, __LINE__)(_name, _abgr, __FILE__, uint16_t(__LINE__) )
|
||||
# define BGFX_PROFILER_BEGIN(_name, _abgr) g_callback->profilerBegin(_name, _abgr, __FILE__, uint16_t(__LINE__) )
|
||||
# define BGFX_PROFILER_BEGIN_LITERAL(_name, _abgr) g_callback->profilerBeginLiteral(_name, _abgr, __FILE__, uint16_t(__LINE__) )
|
||||
# define BGFX_PROFILER_END() g_callback->profilerEnd()
|
||||
# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP()
|
||||
#else
|
||||
# define BGFX_PROFILER_SCOPE(_name, _abgr) BX_NOOP()
|
||||
# define BGFX_PROFILER_BEGIN(_name, _abgr) BX_NOOP()
|
||||
# define BGFX_PROFILER_END() BX_NOOP()
|
||||
# define BGFX_PROFILER_SCOPE(_name, _abgr) BX_NOOP()
|
||||
# define BGFX_PROFILER_BEGIN(_name, _abgr) BX_NOOP()
|
||||
# define BGFX_PROFILER_BEGIN_LITERAL(_name, _abgr) BX_NOOP()
|
||||
# define BGFX_PROFILER_END() BX_NOOP()
|
||||
# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP()
|
||||
#endif // BGFX_PROFILER_SCOPE
|
||||
|
||||
|
||||
15
src/config.h
15
src/config.h
@@ -148,21 +148,16 @@
|
||||
# define BGFX_CONFIG_DEBUG_PERFHUD 0
|
||||
#endif // BGFX_CONFIG_DEBUG_NVPERFHUD
|
||||
|
||||
/// Enable PIX markers.
|
||||
#ifndef BGFX_CONFIG_DEBUG_PIX
|
||||
# define BGFX_CONFIG_DEBUG_PIX BGFX_CONFIG_DEBUG
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX
|
||||
/// Enable annotation for graphics debuggers.
|
||||
#ifndef BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
# define BGFX_CONFIG_DEBUG_ANNOTATION BGFX_CONFIG_DEBUG
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
|
||||
/// Enable DX11 object names.
|
||||
#ifndef BGFX_CONFIG_DEBUG_OBJECT_NAME
|
||||
# define BGFX_CONFIG_DEBUG_OBJECT_NAME BGFX_CONFIG_DEBUG
|
||||
# define BGFX_CONFIG_DEBUG_OBJECT_NAME BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
#endif // BGFX_CONFIG_DEBUG_OBJECT_NAME
|
||||
|
||||
/// Enable Metal markers.
|
||||
#ifndef BGFX_CONFIG_DEBUG_MTL
|
||||
# define BGFX_CONFIG_DEBUG_MTL BGFX_CONFIG_DEBUG
|
||||
#endif // BGFX_CONFIG_DEBUG_MTL
|
||||
|
||||
/// Enable uniform debug checks.
|
||||
#ifndef BGFX_CONFIG_DEBUG_UNIFORM
|
||||
# define BGFX_CONFIG_DEBUG_UNIFORM BGFX_CONFIG_DEBUG
|
||||
|
||||
@@ -10,6 +10,23 @@
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
inline constexpr uint32_t toAbgr8(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
|
||||
{
|
||||
return 0
|
||||
| (uint32_t(_r)<<24)
|
||||
| (uint32_t(_g)<<16)
|
||||
| (uint32_t(_b)<< 8)
|
||||
| (uint32_t(_a) )
|
||||
;
|
||||
}
|
||||
|
||||
constexpr uint32_t kColorFrame = toAbgr8(0xff, 0xd7, 0xc9);
|
||||
constexpr uint32_t kColorView = toAbgr8(0xe4, 0xb4, 0x8e);
|
||||
constexpr uint32_t kColorDraw = toAbgr8(0xc6, 0xe5, 0xb9);
|
||||
constexpr uint32_t kColorCompute = toAbgr8(0xa7, 0xdb, 0xd8);
|
||||
constexpr uint32_t kColorMarker = toAbgr8(0xff, 0x00, 0x00);
|
||||
constexpr uint32_t kColorResource = toAbgr8(0xff, 0x40, 0x20);
|
||||
|
||||
struct BlitState
|
||||
{
|
||||
BlitState(const Frame* _frame)
|
||||
|
||||
@@ -64,16 +64,6 @@
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
constexpr uint32_t toRgba8(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a)
|
||||
{
|
||||
return 0
|
||||
| (uint32_t(_r)<<24)
|
||||
| (uint32_t(_g)<<16)
|
||||
| (uint32_t(_b)<< 8)
|
||||
| (uint32_t(_a) )
|
||||
;
|
||||
}
|
||||
|
||||
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
|
||||
typedef ::IUnknown IUnknown;
|
||||
#else
|
||||
@@ -133,11 +123,11 @@ namespace bgfx
|
||||
typedef void (WINAPI* PFN_D3DPERF_SET_OPTIONS)(DWORD _options);
|
||||
typedef DWORD (WINAPI* PFN_D3DPERF_GET_STATUS)();
|
||||
|
||||
#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_SETMARKER(_color, _name) D3DPERF_SetMarker(_color, _name)
|
||||
#define _PIX_BEGINEVENT(_color, _name) D3DPERF_BeginEvent(_color, _name)
|
||||
#define _PIX_ENDEVENT() D3DPERF_EndEvent()
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX
|
||||
#if BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
# define PIX_SETMARKER(_color, _name) _PIX_SETMARKER(_color, _name)
|
||||
# define PIX_BEGINEVENT(_color, _name) _PIX_BEGINEVENT(_color, _name)
|
||||
# define PIX_ENDEVENT() _PIX_ENDEVENT()
|
||||
@@ -145,15 +135,7 @@ namespace bgfx
|
||||
# define PIX_SETMARKER(_color, _name) BX_UNUSED(_name)
|
||||
# define PIX_BEGINEVENT(_color, _name) BX_UNUSED(_name)
|
||||
# define PIX_ENDEVENT()
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX
|
||||
|
||||
#define D3DCOLOR_FRAME toRgba8(0xff, 0xd7, 0xc9, 0xff)
|
||||
#define D3DCOLOR_VIEW toRgba8(0xe4, 0xb4, 0x8e, 0xff)
|
||||
#define D3DCOLOR_VIEW_L toRgba8(0xf9, 0xee, 0xe5, 0xff)
|
||||
#define D3DCOLOR_VIEW_R toRgba8(0xe8, 0xd3, 0xc0, 0xff)
|
||||
#define D3DCOLOR_DRAW toRgba8(0xc6, 0xe5, 0xb9, 0xff)
|
||||
#define D3DCOLOR_COMPUTE toRgba8(0xa7, 0xdb, 0xd8, 0xff)
|
||||
#define D3DCOLOR_MARKER toRgba8(0xff, 0x00, 0x00, 0xff)
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
|
||||
inline bool isType(IUnknown* _interface, const GUID& _id)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,22 @@
|
||||
namespace bgfx { namespace d3d11
|
||||
{
|
||||
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];
|
||||
static char s_viewName [BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
|
||||
inline void setViewType(ViewId _view, const bx::StringView _str)
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION | BGFX_CONFIG_PROFILER) )
|
||||
{
|
||||
const uint32_t len = _str.getLength();
|
||||
|
||||
bx::memCopy(&s_viewName[_view][3], _str.getPtr(), len);
|
||||
|
||||
wchar_t tmpW[16];
|
||||
mbstowcs(tmpW, _str.getPtr(), len);
|
||||
|
||||
bx::memCopy(&s_viewNameW[_view][3], tmpW, len*2);
|
||||
}
|
||||
}
|
||||
|
||||
struct PrimInfo
|
||||
{
|
||||
@@ -798,7 +813,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
m_d3d9Dll = NULL;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
// D3D11_1.h has ID3DUserDefinedAnnotation
|
||||
// https://web.archive.org/web/20190207230424/https://docs.microsoft.com/en-us/windows/desktop/api/d3d11_1/nn-d3d11_1-id3duserdefinedannotation
|
||||
@@ -808,11 +823,20 @@ namespace bgfx { namespace d3d11
|
||||
D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9Dll, "D3DPERF_SetMarker" );
|
||||
D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9Dll, "D3DPERF_BeginEvent");
|
||||
D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9Dll, "D3DPERF_EndEvent" );
|
||||
BX_CHECK(NULL != D3DPERF_SetMarker
|
||||
&& NULL != D3DPERF_BeginEvent
|
||||
&& NULL != D3DPERF_EndEvent
|
||||
, "Failed to initialize PIX events."
|
||||
);
|
||||
|
||||
if (NULL == D3DPERF_SetMarker
|
||||
|| NULL == D3DPERF_BeginEvent
|
||||
|| NULL == D3DPERF_EndEvent)
|
||||
{
|
||||
BX_TRACE("Failed to initialize PIX events.");
|
||||
|
||||
D3DPERF_SetMarker = NULL;
|
||||
D3DPERF_BeginEvent = NULL;
|
||||
D3DPERF_EndEvent = NULL;
|
||||
|
||||
bx::dlclose(m_d3d9Dll);
|
||||
m_d3d9Dll = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1081,7 +1105,7 @@ namespace bgfx { namespace d3d11
|
||||
m_numWindows = 1;
|
||||
|
||||
#if USE_D3D11_DYNAMIC_LIB
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
HRESULT hr = m_deviceCtx->QueryInterface(IID_ID3DUserDefinedAnnotation, (void**)&m_annotation);
|
||||
|
||||
@@ -1962,7 +1986,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
void updateViewName(ViewId _id, const char* _name) override
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
|
||||
, _name
|
||||
@@ -1988,13 +2012,13 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
void setMarker(const char* _marker, uint16_t _len) override
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
uint32_t size = _len*sizeof(wchar_t);
|
||||
wchar_t* name = (wchar_t*)alloca(size+2);
|
||||
name[_len] = L'\0';
|
||||
mbstowcs(name, _marker, _len);
|
||||
PIX_SETMARKER(D3DCOLOR_MARKER, name);
|
||||
PIX_SETMARKER(kColorMarker, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5210,7 +5234,7 @@ namespace bgfx { namespace d3d11
|
||||
renderDocTriggerCapture();
|
||||
}
|
||||
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
|
||||
BGFX_D3D11_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorView);
|
||||
|
||||
ID3D11DeviceContext* deviceCtx = m_deviceCtx;
|
||||
|
||||
@@ -5226,12 +5250,14 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource);
|
||||
TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data, true);
|
||||
}
|
||||
|
||||
if (0 < _render->m_vboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource);
|
||||
TransientVertexBuffer* vb = _render->m_transientVb;
|
||||
m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data, true);
|
||||
}
|
||||
@@ -5325,21 +5351,18 @@ namespace bgfx { namespace d3d11
|
||||
setFrameBuffer(fbh);
|
||||
}
|
||||
|
||||
PIX_ENDEVENT();
|
||||
if (item > 1)
|
||||
{
|
||||
profiler.end();
|
||||
}
|
||||
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
setViewType(view, " ");
|
||||
BGFX_D3D11_PROFILER_BEGIN(view, kColorView);
|
||||
|
||||
profiler.begin(view);
|
||||
|
||||
viewState.m_rect = _render->m_view[view].m_rect;
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
wchar_t* viewNameW = s_viewNameW[view];
|
||||
viewNameW[3] = L' ';
|
||||
viewNameW[4] = L' ';
|
||||
PIX_BEGINEVENT(D3DCOLOR_VIEW, viewNameW);
|
||||
}
|
||||
|
||||
const Rect& scissorRect = _render->m_view[view].m_scissor;
|
||||
viewHasScissor = !scissorRect.isZero();
|
||||
@@ -5370,13 +5393,9 @@ namespace bgfx { namespace d3d11
|
||||
{
|
||||
wasCompute = true;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
wchar_t* viewNameW = s_viewNameW[view];
|
||||
viewNameW[3] = L'C';
|
||||
PIX_ENDEVENT();
|
||||
PIX_BEGINEVENT(D3DCOLOR_COMPUTE, viewNameW);
|
||||
}
|
||||
setViewType(view, "C");
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
BGFX_D3D11_PROFILER_BEGIN(view, kColorCompute);
|
||||
|
||||
deviceCtx->IASetVertexBuffers(0, 2, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero);
|
||||
deviceCtx->IASetIndexBuffer(NULL, DXGI_FORMAT_R16_UINT, 0);
|
||||
@@ -5529,13 +5548,9 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
if (wasCompute)
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
wchar_t* viewNameW = s_viewNameW[view];
|
||||
viewNameW[3] = L' ';
|
||||
PIX_ENDEVENT();
|
||||
PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
|
||||
}
|
||||
setViewType(view, " ");
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
BGFX_D3D11_PROFILER_BEGIN(view, kColorDraw);
|
||||
|
||||
currentProgram = BGFX_INVALID_HANDLE;
|
||||
m_currentProgram = NULL;
|
||||
@@ -6057,13 +6072,9 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
if (wasCompute)
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
wchar_t* viewNameW = s_viewNameW[view];
|
||||
viewNameW[3] = L'C';
|
||||
PIX_ENDEVENT();
|
||||
PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
|
||||
}
|
||||
setViewType(view, "C");
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
BGFX_D3D11_PROFILER_BEGIN(view, kColorCompute);
|
||||
|
||||
invalidateCompute();
|
||||
}
|
||||
@@ -6085,7 +6096,7 @@ namespace bgfx { namespace d3d11
|
||||
}
|
||||
}
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
|
||||
int64_t timeEnd = bx::getHPCounter();
|
||||
int64_t frameTime = timeEnd - timeBegin;
|
||||
@@ -6130,7 +6141,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||
{
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
|
||||
BGFX_D3D11_PROFILER_BEGIN_LITERAL("debugstats", kColorFrame);
|
||||
|
||||
m_needPresent = true;
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
@@ -6258,15 +6269,15 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
blit(this, _textVideoMemBlitter, tvm);
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
}
|
||||
else if (_render->m_debug & BGFX_DEBUG_TEXT)
|
||||
{
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
|
||||
BGFX_D3D11_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame);
|
||||
|
||||
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D11_PROFILER_END();
|
||||
}
|
||||
|
||||
m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL);
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#define USE_D3D11_STAGING_BUFFER 0
|
||||
|
||||
#if !USE_D3D11_DYNAMIC_LIB
|
||||
# undef BGFX_CONFIG_DEBUG_PIX
|
||||
# define BGFX_CONFIG_DEBUG_PIX 0
|
||||
# undef BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
# define BGFX_CONFIG_DEBUG_ANNOTATION 0
|
||||
#endif // !USE_D3D11_DYNAMIC_LIB
|
||||
|
||||
BX_PRAGMA_DIAGNOSTIC_PUSH();
|
||||
@@ -40,19 +40,37 @@ BX_PRAGMA_DIAGNOSTIC_POP()
|
||||
#include "nvapi.h"
|
||||
#include "dxgi.h"
|
||||
|
||||
#define BGFX_D3D11_BLEND_STATE_MASK (0 \
|
||||
| BGFX_STATE_BLEND_MASK \
|
||||
| BGFX_STATE_BLEND_EQUATION_MASK \
|
||||
| BGFX_STATE_BLEND_INDEPENDENT \
|
||||
| BGFX_STATE_BLEND_ALPHA_TO_COVERAGE \
|
||||
| BGFX_STATE_WRITE_A \
|
||||
| BGFX_STATE_WRITE_RGB \
|
||||
)
|
||||
#define BGFX_D3D11_BLEND_STATE_MASK (0 \
|
||||
| BGFX_STATE_BLEND_MASK \
|
||||
| BGFX_STATE_BLEND_EQUATION_MASK \
|
||||
| BGFX_STATE_BLEND_INDEPENDENT \
|
||||
| BGFX_STATE_BLEND_ALPHA_TO_COVERAGE \
|
||||
| BGFX_STATE_WRITE_A \
|
||||
| BGFX_STATE_WRITE_RGB \
|
||||
)
|
||||
|
||||
#define BGFX_D3D11_DEPTH_STENCIL_MASK (0 \
|
||||
| BGFX_STATE_WRITE_Z \
|
||||
| BGFX_STATE_DEPTH_TEST_MASK \
|
||||
)
|
||||
| BGFX_STATE_WRITE_Z \
|
||||
| BGFX_STATE_DEPTH_TEST_MASK \
|
||||
)
|
||||
|
||||
#define BGFX_D3D11_PROFILER_BEGIN(_view, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX_BEGINEVENT(_abgr, s_viewNameW[_view]); \
|
||||
BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D11_PROFILER_BEGIN_LITERAL(_name, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX_BEGINEVENT(_abgr, L"" # _name); \
|
||||
BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D11_PROFILER_END() \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
BGFX_PROFILER_END(); \
|
||||
PIX_ENDEVENT(); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
namespace bgfx { namespace d3d11
|
||||
{
|
||||
|
||||
@@ -15,15 +15,23 @@
|
||||
# endif // BX_PLATFORM_WINRT
|
||||
#endif // !BX_PLATFORM_WINDOWS
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
#if BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
PFN_PIX_GET_THREAD_INFO bgfx_PIXGetThreadInfo;
|
||||
PFN_PIX_EVENTS_REPLACE_BLOCK bgfx_PIXEventsReplaceBlock;
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
|
||||
namespace bgfx { namespace d3d12
|
||||
{
|
||||
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
|
||||
inline void setViewType(ViewId _view, const bx::StringView _str)
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION || BGFX_CONFIG_PROFILER) )
|
||||
{
|
||||
bx::memCopy(&s_viewName[_view][3], _str.getPtr(), _str.getLength() );
|
||||
}
|
||||
}
|
||||
|
||||
struct PrimInfo
|
||||
{
|
||||
D3D_PRIMITIVE_TOPOLOGY m_topology;
|
||||
@@ -623,7 +631,7 @@ namespace bgfx { namespace d3d12
|
||||
#endif // BX_COMPILER_MSVC
|
||||
}
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
#if BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
static PIXEventsThreadInfo s_pixEventsThreadInfo;
|
||||
|
||||
PIXEventsThreadInfo* WINAPI stubPIXGetThreadInfo()
|
||||
@@ -636,7 +644,7 @@ namespace bgfx { namespace d3d12
|
||||
BX_UNUSED(_getEarliestTime);
|
||||
return 0;
|
||||
}
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
|
||||
struct RendererContextD3D12 : public RendererContextI
|
||||
{
|
||||
@@ -680,7 +688,7 @@ namespace bgfx { namespace d3d12
|
||||
ErrorState::Enum errorState = ErrorState::Default;
|
||||
// LUID luid;
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
#if BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
m_winPixEvent = bx::dlopen("WinPixEventRuntime.dll");
|
||||
|
||||
if (NULL != m_winPixEvent)
|
||||
@@ -695,7 +703,7 @@ namespace bgfx { namespace d3d12
|
||||
bgfx_PIXGetThreadInfo = stubPIXGetThreadInfo;
|
||||
bgfx_PIXEventsReplaceBlock = stubPIXEventsReplaceBlock;
|
||||
}
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
|
||||
|
||||
if (_init.debug
|
||||
|| _init.profile)
|
||||
@@ -1868,9 +1876,9 @@ namespace bgfx { namespace d3d12
|
||||
{
|
||||
BX_UNUSED(_len);
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
PIX3_SETMARKER(m_commandList, D3DCOLOR_MARKER, _marker);
|
||||
PIX3_SETMARKER(m_commandList, kColorMarker, _marker);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5696,8 +5704,6 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
|
||||
{
|
||||
PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "rendererSubmit");
|
||||
|
||||
if (m_lost
|
||||
|| updateResolution(_render->m_resolution) )
|
||||
{
|
||||
@@ -5709,6 +5715,8 @@ namespace bgfx { namespace d3d12
|
||||
renderDocTriggerCapture();
|
||||
}
|
||||
|
||||
BGFX_D3D12_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorFrame);
|
||||
|
||||
int64_t timeBegin = bx::getHPCounter();
|
||||
int64_t captureElapsed = 0;
|
||||
|
||||
@@ -5716,12 +5724,14 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource);
|
||||
TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
m_indexBuffers[ib->handle.idx].update(m_commandList, 0, _render->m_iboffset, ib->data);
|
||||
}
|
||||
|
||||
if (0 < _render->m_vboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource);
|
||||
TransientVertexBuffer* vb = _render->m_transientVb;
|
||||
m_vertexBuffers[vb->handle.idx].update(m_commandList, 0, _render->m_vboffset, vb->data);
|
||||
}
|
||||
@@ -5919,13 +5929,9 @@ namespace bgfx { namespace d3d12
|
||||
{
|
||||
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);
|
||||
}
|
||||
setViewType(view, "C");
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
BGFX_D3D12_PROFILER_BEGIN(view, kColorCompute);
|
||||
|
||||
commandListChanged = true;
|
||||
}
|
||||
@@ -6128,14 +6134,9 @@ namespace bgfx { namespace d3d12
|
||||
{
|
||||
wasCompute = false;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
BX_UNUSED(s_viewName);
|
||||
char* viewName = s_viewName[view];
|
||||
viewName[3] = ' ';
|
||||
PIX3_ENDEVENT(m_commandList);
|
||||
PIX3_BEGINEVENT(m_commandList, D3DCOLOR_DRAW, viewName);
|
||||
}
|
||||
setViewType(view, " ");
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
BGFX_D3D12_PROFILER_BEGIN(view, kColorDraw);
|
||||
|
||||
commandListChanged = true;
|
||||
}
|
||||
@@ -6514,13 +6515,9 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
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);
|
||||
}
|
||||
setViewType(view, "C");
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
BGFX_D3D12_PROFILER_BEGIN(view, kColorCompute);
|
||||
}
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
@@ -6540,7 +6537,7 @@ namespace bgfx { namespace d3d12
|
||||
}
|
||||
}
|
||||
|
||||
PIX3_ENDEVENT(m_commandList);
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
|
||||
int64_t timeEnd = bx::getHPCounter();
|
||||
int64_t frameTime = timeEnd - timeBegin;
|
||||
@@ -6602,7 +6599,7 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||
{
|
||||
PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugstats");
|
||||
BGFX_D3D12_PROFILER_BEGIN_LITERAL("debugstats", kColorFrame);
|
||||
|
||||
// m_needPresent = true;
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
@@ -6766,15 +6763,15 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
blit(this, _textVideoMemBlitter, tvm);
|
||||
|
||||
PIX3_ENDEVENT(m_commandList);
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
}
|
||||
else if (_render->m_debug & BGFX_DEBUG_TEXT)
|
||||
{
|
||||
PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugtext");
|
||||
BGFX_D3D12_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame);
|
||||
|
||||
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
|
||||
|
||||
PIX3_ENDEVENT(m_commandList);
|
||||
BGFX_D3D12_PROFILER_END();
|
||||
}
|
||||
|
||||
m_commandList->OMSetRenderTargets(0, NULL, false, NULL);
|
||||
|
||||
@@ -52,7 +52,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
#include "nvapi.h"
|
||||
#include "dxgi.h"
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX
|
||||
#if BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
# if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
|
||||
typedef struct PIXEventsThreadInfo* (WINAPI* PFN_PIX_GET_THREAD_INFO)();
|
||||
typedef uint64_t (WINAPI* PFN_PIX_EVENTS_REPLACE_BLOCK)(bool _getEarliestTime);
|
||||
@@ -80,7 +80,25 @@ extern "C" uint64_t WINAPI bgfx_PIXEventsReplaceBlock(bool _g
|
||||
# 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
|
||||
#endif // BGFX_CONFIG_DEBUG_ANNOTATION
|
||||
|
||||
#define BGFX_D3D12_PROFILER_BEGIN(_view, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX3_BEGINEVENT(m_commandList, _abgr, s_viewName[_view]); \
|
||||
BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D12_PROFILER_BEGIN_LITERAL(_name, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX3_BEGINEVENT(m_commandList, _abgr, "" # _name); \
|
||||
BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D12_PROFILER_END() \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
BGFX_PROFILER_END(); \
|
||||
PIX3_ENDEVENT(m_commandList); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
namespace bgfx { namespace d3d12
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace bgfx { namespace d3d9
|
||||
{
|
||||
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];
|
||||
static char s_viewName [BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
|
||||
struct PrimInfo
|
||||
{
|
||||
@@ -485,17 +485,22 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
m_nvapi.init();
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9Dll, "D3DPERF_SetMarker");
|
||||
D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9Dll, "D3DPERF_BeginEvent");
|
||||
D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9Dll, "D3DPERF_EndEvent");
|
||||
|
||||
BX_CHECK(NULL != D3DPERF_SetMarker
|
||||
&& NULL != D3DPERF_BeginEvent
|
||||
&& NULL != D3DPERF_EndEvent
|
||||
, "Failed to initialize PIX events."
|
||||
);
|
||||
if (NULL == D3DPERF_SetMarker
|
||||
|| NULL == D3DPERF_BeginEvent
|
||||
|| NULL == D3DPERF_EndEvent)
|
||||
{
|
||||
BX_TRACE("Failed to initialize PIX events.");
|
||||
|
||||
D3DPERF_SetMarker = NULL;
|
||||
D3DPERF_BeginEvent = NULL;
|
||||
D3DPERF_EndEvent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_d3d9ex = NULL;
|
||||
@@ -1291,7 +1296,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void updateViewName(ViewId _id, const char* _name) override
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
|
||||
, _name
|
||||
@@ -1317,14 +1322,14 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void setMarker(const char* _marker, uint16_t _len) override
|
||||
{
|
||||
#if BGFX_CONFIG_DEBUG_PIX
|
||||
uint32_t size = _len*sizeof(wchar_t);
|
||||
wchar_t* name = (wchar_t*)alloca(size+2);
|
||||
mbstowcs(name, _marker, size);
|
||||
name[_len] = L'\0';
|
||||
PIX_SETMARKER(D3DCOLOR_MARKER, name);
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX
|
||||
BX_UNUSED(_marker, _len);
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
uint32_t size = _len*sizeof(wchar_t);
|
||||
wchar_t* name = (wchar_t*)alloca(size+2);
|
||||
mbstowcs(name, _marker, size);
|
||||
name[_len] = L'\0';
|
||||
PIX_SETMARKER(kColorMarker, name);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void setName(Handle _handle, const char* _name, uint16_t _len) override
|
||||
@@ -3718,10 +3723,10 @@ namespace bgfx { namespace d3d9
|
||||
{
|
||||
IDirect3DDevice9* device = m_device;
|
||||
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
|
||||
|
||||
updateResolution(_render->m_resolution);
|
||||
|
||||
BGFX_D3D9_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorView);
|
||||
|
||||
int64_t timeBegin = bx::getHPCounter();
|
||||
int64_t captureElapsed = 0;
|
||||
|
||||
@@ -3735,12 +3740,14 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource);
|
||||
TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data, true);
|
||||
}
|
||||
|
||||
if (0 < _render->m_vboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource);
|
||||
TransientVertexBuffer* vb = _render->m_transientVb;
|
||||
m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data, true);
|
||||
}
|
||||
@@ -3857,14 +3864,15 @@ namespace bgfx { namespace d3d9
|
||||
setFrameBuffer(fbh);
|
||||
}
|
||||
|
||||
PIX_ENDEVENT();
|
||||
if (item > 0)
|
||||
{
|
||||
profiler.end();
|
||||
}
|
||||
|
||||
BGFX_D3D9_PROFILER_END();
|
||||
BGFX_D3D9_PROFILER_BEGIN(view, kColorView);
|
||||
|
||||
profiler.begin(view);
|
||||
PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[view]);
|
||||
|
||||
viewState.m_rect = _render->m_view[view].m_rect;
|
||||
const Rect& scissorRect = _render->m_view[view].m_scissor;
|
||||
@@ -4380,7 +4388,7 @@ namespace bgfx { namespace d3d9
|
||||
}
|
||||
}
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D9_PROFILER_END();
|
||||
|
||||
int64_t timeEnd = bx::getHPCounter();
|
||||
int64_t frameTime = timeEnd - timeBegin;
|
||||
@@ -4425,7 +4433,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||
{
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
|
||||
BGFX_D3D9_PROFILER_BEGIN_LITERAL("debugstats", kColorFrame);
|
||||
|
||||
m_needPresent = true;
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
@@ -4523,15 +4531,15 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
blit(this, _textVideoMemBlitter, tvm);
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D9_PROFILER_END();
|
||||
}
|
||||
else if (_render->m_debug & BGFX_DEBUG_TEXT)
|
||||
{
|
||||
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
|
||||
BGFX_D3D9_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame);
|
||||
|
||||
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
|
||||
|
||||
PIX_ENDEVENT();
|
||||
BGFX_D3D9_PROFILER_END();
|
||||
}
|
||||
|
||||
device->EndScene();
|
||||
|
||||
@@ -25,6 +25,24 @@
|
||||
#include "renderer_d3d.h"
|
||||
#include "nvapi.h"
|
||||
|
||||
#define BGFX_D3D9_PROFILER_BEGIN(_view, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX_BEGINEVENT(_abgr, s_viewNameW[_view]); \
|
||||
BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D9_PROFILER_BEGIN_LITERAL(_name, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
PIX_BEGINEVENT(_abgr, L"" # _name); \
|
||||
BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_D3D9_PROFILER_END() \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
BGFX_PROFILER_END(); \
|
||||
PIX_ENDEVENT(); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
namespace bgfx { namespace d3d9
|
||||
{
|
||||
# if defined(D3D_DISABLE_9EX)
|
||||
|
||||
@@ -14,6 +14,14 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
|
||||
inline void setViewType(ViewId _view, const bx::StringView _str)
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION || BGFX_CONFIG_PROFILER) )
|
||||
{
|
||||
bx::memCopy(&s_viewName[_view][3], _str.getPtr(), _str.getLength() );
|
||||
}
|
||||
}
|
||||
|
||||
struct PrimInfo
|
||||
{
|
||||
GLenum m_type;
|
||||
@@ -1005,6 +1013,14 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
}
|
||||
|
||||
static void GL_APIENTRY stubPushDebugGroup(GLenum /*_source*/, GLuint /*_id*/, GLsizei /*_length*/, const char* /*_message*/)
|
||||
{
|
||||
}
|
||||
|
||||
static void GL_APIENTRY stubPopDebugGroup()
|
||||
{
|
||||
}
|
||||
|
||||
static void GL_APIENTRY stubObjectLabel(GLenum /*_identifier*/, GLuint /*_name*/, GLsizei /*_length*/, const char* /*_label*/)
|
||||
{
|
||||
}
|
||||
@@ -2503,6 +2519,13 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
, GL_TRUE
|
||||
) );
|
||||
}
|
||||
|
||||
if (NULL == glPushDebugGroup
|
||||
|| NULL == glPopDebugGroup)
|
||||
{
|
||||
glPushDebugGroup = stubPushDebugGroup;
|
||||
glPopDebugGroup = stubPopDebugGroup;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_extension[Extension::ARB_seamless_cube_map].m_supported)
|
||||
@@ -6299,6 +6322,8 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
renderDocTriggerCapture();
|
||||
}
|
||||
|
||||
BGFX_GL_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorView);
|
||||
|
||||
if (1 < m_numWindows
|
||||
&& m_vaoSupport)
|
||||
{
|
||||
@@ -6334,12 +6359,14 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource);
|
||||
TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data, true);
|
||||
}
|
||||
|
||||
if (0 < _render->m_vboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource);
|
||||
TransientVertexBuffer* vb = _render->m_transientVb;
|
||||
m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data, true);
|
||||
}
|
||||
@@ -6452,16 +6479,13 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
profiler.end();
|
||||
}
|
||||
|
||||
BGFX_GL_PROFILER_END();
|
||||
setViewType(view, " ");
|
||||
BGFX_GL_PROFILER_BEGIN(view, kColorView);
|
||||
|
||||
profiler.begin(view);
|
||||
|
||||
viewState.m_rect = _render->m_view[view].m_rect;
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
char* viewName = s_viewName[view];
|
||||
viewName[3] = ' ';
|
||||
viewName[4] = ' ';
|
||||
GL_CHECK(glInsertEventMarker(0, viewName) );
|
||||
}
|
||||
|
||||
const Rect& scissorRect = _render->m_view[view].m_scissor;
|
||||
viewHasScissor = !scissorRect.isZero();
|
||||
@@ -6496,12 +6520,9 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
{
|
||||
wasCompute = true;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
char* viewName = s_viewName[view];
|
||||
viewName[3] = 'C';
|
||||
GL_CHECK(glInsertEventMarker(0, viewName) );
|
||||
}
|
||||
setViewType(view, "C");
|
||||
BGFX_GL_PROFILER_END();
|
||||
BGFX_GL_PROFILER_BEGIN(view, kColorCompute);
|
||||
}
|
||||
|
||||
if (computeSupported)
|
||||
@@ -6618,12 +6639,9 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
{
|
||||
wasCompute = false;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
char* viewName = s_viewName[view];
|
||||
viewName[3] = ' ';
|
||||
GL_CHECK(glInsertEventMarker(0, viewName) );
|
||||
}
|
||||
setViewType(view, " ");
|
||||
BGFX_GL_PROFILER_END();
|
||||
BGFX_GL_PROFILER_BEGIN(view, kColorDraw);
|
||||
}
|
||||
|
||||
const RenderDraw& draw = renderItem.draw;
|
||||
@@ -7341,6 +7359,13 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
boundProgram = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (wasCompute)
|
||||
{
|
||||
setViewType(view, "C");
|
||||
BGFX_GL_PROFILER_END();
|
||||
BGFX_GL_PROFILER_BEGIN(view, kColorCompute);
|
||||
}
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
blitMsaaFbo();
|
||||
@@ -7365,6 +7390,8 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
}
|
||||
}
|
||||
|
||||
BGFX_GL_PROFILER_END();
|
||||
|
||||
m_glctx.makeCurrent(NULL);
|
||||
int64_t timeEnd = bx::getHPCounter();
|
||||
int64_t frameTime = timeEnd - timeBegin;
|
||||
@@ -7410,6 +7437,8 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||
{
|
||||
BGFX_GL_PROFILER_BEGIN_LITERAL("debugstats", kColorFrame);
|
||||
|
||||
m_needPresent = true;
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
|
||||
@@ -7578,10 +7607,16 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
}
|
||||
|
||||
blit(this, _textVideoMemBlitter, tvm);
|
||||
|
||||
BGFX_GL_PROFILER_END();
|
||||
}
|
||||
else if (_render->m_debug & BGFX_DEBUG_TEXT)
|
||||
{
|
||||
BGFX_GL_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame);
|
||||
|
||||
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
|
||||
|
||||
BGFX_GL_PROFILER_END();
|
||||
}
|
||||
}
|
||||
} } // namespace bgfx
|
||||
|
||||
@@ -30,6 +30,24 @@
|
||||
|| BX_PLATFORM_WINDOWS \
|
||||
)
|
||||
|
||||
#define BGFX_GL_PROFILER_BEGIN(_view, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
GL_CHECK(glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, s_viewName[view]) ); \
|
||||
BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_GL_PROFILER_BEGIN_LITERAL(_name, _abgr) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
GL_CHECK(glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "" # _name) ); \
|
||||
BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BGFX_GL_PROFILER_END() \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
BGFX_PROFILER_END(); \
|
||||
GL_CHECK(glPopDebugGroup() ); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
# if BGFX_CONFIG_RENDERER_OPENGL >= 31
|
||||
# include <gl/glcorearb.h>
|
||||
|
||||
@@ -987,14 +987,11 @@ namespace bgfx { namespace mtl
|
||||
|
||||
void updateViewName(ViewId _id, const char* _name) override
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
{
|
||||
bx::strCopy(
|
||||
&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
|
||||
, BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
|
||||
, _name
|
||||
);
|
||||
}
|
||||
bx::strCopy(
|
||||
&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
|
||||
, BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
|
||||
, _name
|
||||
);
|
||||
}
|
||||
|
||||
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override
|
||||
@@ -1011,7 +1008,7 @@ namespace bgfx { namespace mtl
|
||||
{
|
||||
BX_UNUSED(_len);
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
m_renderCommandEncoder.insertDebugSignpost(_marker);
|
||||
}
|
||||
@@ -3787,12 +3784,12 @@ namespace bgfx { namespace mtl
|
||||
m_renderCommandEncoderFrameBufferHandle = fbh;
|
||||
MTL_RELEASE(renderPassDescriptor);
|
||||
}
|
||||
else if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) )
|
||||
else if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
rce.popDebugGroup();
|
||||
}
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
rce.pushDebugGroup(s_viewName[view]);
|
||||
}
|
||||
@@ -3827,12 +3824,13 @@ namespace bgfx { namespace mtl
|
||||
|
||||
m_computeCommandEncoder = m_commandBuffer.computeCommandEncoder();
|
||||
}
|
||||
else if (viewChanged && BX_ENABLED(BGFX_CONFIG_DEBUG_MTL))
|
||||
else if (viewChanged && BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
m_computeCommandEncoder.popDebugGroup();
|
||||
}
|
||||
|
||||
if ( viewChanged && BX_ENABLED(BGFX_CONFIG_DEBUG_MTL))
|
||||
if (viewChanged
|
||||
&& BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
s_viewName[view][3] = L'C';
|
||||
m_computeCommandEncoder.pushDebugGroup(s_viewName[view]);
|
||||
@@ -4409,7 +4407,7 @@ namespace bgfx { namespace mtl
|
||||
}
|
||||
}
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
|
||||
@@ -2295,7 +2295,7 @@ VK_IMPORT_DEVICE
|
||||
|
||||
void setMarker(const char* _marker, uint16_t _len) override
|
||||
{
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
BX_UNUSED(_len);
|
||||
|
||||
@@ -3865,12 +3865,14 @@ VK_DESTROY
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource);
|
||||
// TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
// m_indexBuffers[ib->handle.idx].update(m_commandList, 0, _render->m_iboffset, ib->data);
|
||||
}
|
||||
|
||||
if (0 < _render->m_vboffset)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource);
|
||||
// TransientVertexBuffer* vb = _render->m_transientVb;
|
||||
// m_vertexBuffers[vb->handle.idx].update(m_commandList, 0, _render->m_vboffset, vb->data);
|
||||
}
|
||||
@@ -3999,7 +4001,7 @@ VK_DESTROY
|
||||
vkCmdEndRenderPass(m_commandBuffer);
|
||||
beginRenderPass = false;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
vkCmdEndDebugUtilsLabelEXT(m_commandBuffer);
|
||||
}
|
||||
@@ -4034,7 +4036,7 @@ BX_UNUSED(currentSamplerStateIdx);
|
||||
rpbi.renderArea.extent.height = rect.m_height;
|
||||
VK_CHECK(vkBeginCommandBuffer(m_commandBuffer, &cbbi) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
VkDebugUtilsLabelEXT dul;
|
||||
dul.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
@@ -4285,7 +4287,7 @@ BX_UNUSED(currentSamplerStateIdx);
|
||||
wasCompute = false;
|
||||
}
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
BX_UNUSED(s_viewName);
|
||||
// wchar_t* viewNameW = s_viewNameW[view];
|
||||
@@ -4821,7 +4823,7 @@ BX_UNUSED(presentMin, presentMax);
|
||||
vkCmdEndRenderPass(m_commandBuffer);
|
||||
beginRenderPass = false;
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) )
|
||||
{
|
||||
vkCmdEndDebugUtilsLabelEXT(m_commandBuffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user