From 690f232c09b594260f726d288a297c77e4e36ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 9 Nov 2017 21:14:37 -0800 Subject: [PATCH] Cleanup. --- examples/17-drawstress/drawstress.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index 8113fa2b8..d84b15022 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -167,9 +167,10 @@ public: // Imgui. imguiCreate(); - m_numThreads = (BX_COUNTOF(m_thread)+1)/2; + m_maxThreads = bx::min(caps->limits.maxEncoders, BX_COUNTOF(m_thread) ); + m_numThreads = (m_maxThreads+1)/2; - for (uint32_t ii = 0; ii < BX_COUNTOF(m_thread); ++ii) + for (int32_t ii = 0; ii < m_maxThreads; ++ii) { m_thread[ii].init(threadFunc, this); } @@ -177,7 +178,7 @@ public: int shutdown() override { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_thread); ++ii) + for (int32_t ii = 0; ii < m_maxThreads; ++ii) { m_thread[ii].push(reinterpret_cast(UINTPTR_MAX) ); m_thread[ii].shutdown(); @@ -346,7 +347,7 @@ public: ImGui::Checkbox("Auto adjust", &m_autoAdjust); - ImGui::SliderInt("Num threads", &m_numThreads, 1, BX_COUNTOF(m_thread) ); + ImGui::SliderInt("Num threads", &m_numThreads, 1, m_maxThreads); const uint32_t numThreads = m_numThreads; ImGui::SliderInt("Dim", &m_dim, 5, m_maxDim); @@ -424,6 +425,7 @@ public: int32_t m_maxDim; int32_t m_transform; int32_t m_numThreads; + int32_t m_maxThreads; int64_t m_timeOffset;