1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Direct2D: Fix ETW tracing build errors

This makes Direct2DMetrics and current frameId accessible to implementation subclasses.

It also replaces JUCE_WRITE_TRACE_LOG with JUCE_WRITE_TRACE_LOG_VA as intended in original implementation.

Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
This commit is contained in:
Oli 2025-04-25 13:51:01 +01:00
parent 3ff8d4f640
commit 6972c4f0e3
4 changed files with 23 additions and 19 deletions

View file

@ -89,6 +89,16 @@ public:
return directWrite->getFonts();
}
uint64_t getFrameId() const
{
return owner.getFrameId();
}
Direct2DMetrics::Ptr getMetrics() const
{
return owner.metrics;
}
bool fillSpriteBatch (const RectangleList<float>& list);
DirectWriteGlyphRun glyphRun;

View file

@ -176,13 +176,7 @@ private:
struct Direct2DScopedElapsedTime
{
Direct2DScopedElapsedTime (Direct2DMetrics::Ptr& metricsIn, size_t accumulatorIndexIn)
: metrics (metricsIn.get()),
accumulatorIndex (accumulatorIndexIn)
{
}
Direct2DScopedElapsedTime (Direct2DMetrics* metricsIn, size_t accumulatorIndexIn)
Direct2DScopedElapsedTime (Direct2DMetrics::Ptr metricsIn, size_t accumulatorIndexIn)
: metrics (metricsIn),
accumulatorIndex (accumulatorIndexIn)
{
@ -195,7 +189,7 @@ struct Direct2DScopedElapsedTime
}
int64 startTicks = Time::getHighResolutionTicks();
Direct2DMetrics* metrics;
Direct2DMetrics::Ptr metrics;
size_t accumulatorIndex;
};

View file

@ -289,18 +289,18 @@ auto toVector (const RectangleList<Number>& list)
#define JUCE_TRACE_EVENT_INT_RECT_LIST(code, keyword, frameNumber, rect) \
{ \
const std::vector<INT32> vec = ::juce::etw::toVector (rect); \
JUCE_WRITE_TRACE_LOG (code, \
etw::softwareRendererKeyword, \
TraceLoggingValue ((UINT64) frameNumber, "frame"), \
TraceLoggingInt32Array (vec.data(), (UINT16) vec.size(), "rect")); \
JUCE_WRITE_TRACE_LOG_VA (code, \
etw::softwareRendererKeyword, \
TraceLoggingValue ((UINT64) frameNumber, "frame"), \
TraceLoggingInt32Array (vec.data(), (UINT16) vec.size(), "rect")); \
}
#define JUCE_TRACE_EVENT_INT_RECT(code, keyword, rect) \
{ \
const std::vector<INT32> vec = ::juce::etw::toVector (rect); \
JUCE_WRITE_TRACE_LOG (code, \
etw::softwareRendererKeyword, \
TraceLoggingInt32Array (vec.data(), (UINT16) vec.size(), "rect")); \
JUCE_WRITE_TRACE_LOG_VA (code, \
etw::softwareRendererKeyword, \
TraceLoggingInt32Array (vec.data(), (UINT16) vec.size(), "rect")); \
}
#else
#define JUCE_TRACE_EVENT_INT_RECT_LIST(code, keyword, frameNumber, rect)

View file

@ -554,7 +554,7 @@ public:
{
deferredRepaints.add (deferredRepaint);
JUCE_TRACE_EVENT_INT_RECT (etw::repaint, etw::paintKeyword, snappedRectangle);
JUCE_TRACE_EVENT_INT_RECT (etw::repaint, etw::paintKeyword, deferredRepaint);
}
SavedState* startFrame() override
@ -572,7 +572,7 @@ public:
dirtyRegionsInBackBuffer.add (deferredRepaints);
deferredRepaints.clear();
JUCE_TRACE_LOG_D2D_PAINT_CALL (etw::direct2dHwndPaintStart, owner.getFrameId());
JUCE_TRACE_LOG_D2D_PAINT_CALL (etw::direct2dHwndPaintStart, getFrameId());
return savedState;
}
@ -587,7 +587,7 @@ public:
void present()
{
JUCE_D2DMETRICS_SCOPED_ELAPSED_TIME (owner.metrics, present1Duration);
JUCE_D2DMETRICS_SCOPED_ELAPSED_TIME (getMetrics(), present1Duration);
if (swap.getBuffer() == nullptr || dirtyRegionsInBackBuffer.isEmpty() || ! swapEventReceived)
return;
@ -629,7 +629,7 @@ public:
// There's nothing waiting to be displayed in the backbuffer.
dirtyRegionsInBackBuffer.clear();
JUCE_TRACE_LOG_D2D_PAINT_CALL (etw::direct2dHwndPaintEnd, owner.getFrameId());
JUCE_TRACE_LOG_D2D_PAINT_CALL (etw::direct2dHwndPaintEnd, getFrameId());
}
Image createSnapshot() const