本文整理汇总了C++中VE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ VE_ASSERT函数的具体用法?C++ VE_ASSERT怎么用?C++ VE_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VeCreateThread
//--------------------------------------------------------------------------
VeJobSystem::VeJobSystem(size_t stFGNum, size_t stBGNum) noexcept
{
if (stFGNum)
{
m_i32FGState.store(0, std::memory_order_relaxed);
m_kFGThreads.resize(stFGNum);
for (size_t i(0); i < m_kFGThreads.size(); ++i)
{
fore_thread& t = m_kFGThreads[i];
t.index = (uint32_t)i;
t.cond_val = 0;
t.handle = VeCreateThread(&FGThreadCallback,
&t, VE_JOB_FG_PRIORITY, VE_JOB_FG_STACK_SIZE);
}
}
if (stBGNum)
{
VE_ASSERT(stBGNum <= (VE_JOB_BG_BUFFER_MASK + 1));
m_i32BGState.store(0, std::memory_order_relaxed);
m_i32BGAvailableNum.store(0, std::memory_order_relaxed);
m_kBGThreads.resize(stBGNum);
for (size_t i(0); i < m_kBGThreads.size(); ++i)
{
back_thread& t = m_kBGThreads[i];
t.handle = VeCreateThread(&BGThreadCallback,
&t, VE_JOB_BG_PRIORITY, VE_JOB_BG_STACK_SIZE);
t.index = (uint32_t)i;
}
}
m_i32BGJobNum.store(0, std::memory_order_relaxed);
m_u32FrameCount.store(0, std::memory_order_relaxed);
}
示例2: IncRefCount
//--------------------------------------------------------------------------
bool VeJob::Start() noexcept
{
IncRefCount();
{
std::lock_guard<vtd::spin_lock> lock(m_kLock);
if (m_u32Pointer == 0 && m_u32Wait == 0 && m_kTaskArray.size())
{
VE_ASSERT(m_kRelatedJobs.empty());
m_u32Pointer = 1;
}
else
{
return false;
}
}
auto& kAtom = m_kTaskArray.front();
if (kAtom.m_eExecute == VeJob::EXE_BACKGROUND)
{
ve_job_sys.m_akBGQueues[kAtom.m_ePriority].push(this);
ve_job_sys.m_i32BGJobNum.fetch_add(1, std::memory_order_relaxed);
auto pt = ve_job_sys.m_kWaitingThreads.pop();
if (pt)
{
pt->loop.set();
}
}
else
{
size_t stFrame = ve_job_sys.m_u32FrameCount.load(std::memory_order_relaxed) & 1;
stFrame = kAtom.m_eExecute == VeJob::EXE_FG_CURRENT ? stFrame : (!stFrame);
ve_job_sys.m_akFGQueues[stFrame][kAtom.m_ePriority].push(this);
}
return true;
}
示例3: VeDebugOutputCore
//--------------------------------------------------------------------------
bool WindowsVideoDevice::AddDisplay(const VeChar8* pcDeviceName) noexcept
{
VeDebugOutputCore("Display: %s\n", pcDeviceName);
VeDisplayMode kMode;
if (!GetDisplayMode(pcDeviceName, ENUM_CURRENT_SETTINGS, &kMode))
{
return false;
}
m_kDisplayList.resize(m_kDisplayList.size() + 1);
VeVideoDisplay& kDisplay = m_kDisplayList.back();
VeDisplayData* pkDisplayData = VE_NEW VeDisplayData;
VE_ASSERT(pkDisplayData);
DISPLAY_DEVICEA device;
device.cb = sizeof(device);
if (EnumDisplayDevicesA(pcDeviceName, 0, &device, 0))
{
kDisplay.m_kName = device.DeviceString;
}
kDisplay.m_kDesktopMode = kMode;
kDisplay.m_kCurrentMode = kMode;
kDisplay.m_spDriverData = pkDisplayData;
return true;
}
示例4: lock
//--------------------------------------------------------------------------
void VeJob::End(bool bSuccess) noexcept
{
VeVector<VeJobPtr> kRelatedJobs;
{
std::lock_guard<vtd::spin_lock> lock(m_kLock);
VE_ASSERT(!m_u32Wait);
m_u32Pointer = 0;
kRelatedJobs = std::move(m_kRelatedJobs);
}
if (bSuccess)
{
for (auto& job : kRelatedJobs)
{
job->Resume();
}
}
else
{
for (auto& job : kRelatedJobs)
{
job->End(false);
}
}
OnEnd(bSuccess);
DecRefCount();
}
示例5: VE_ASSERT
//--------------------------------------------------------------------------
VeThread::~VeThread()
{
VE_ASSERT(m_u32State == 0);
m_pkParams->m_pkThis = NULL;
m_pkParams->m_kEventLoop.Set();
m_pkParams = NULL;
}
示例6: m_numButtons
InputDevice::InputDevice(uint8_t numKeys) :
m_numButtons(numKeys)
{
VE_ASSERT(numKeys < MaxKeys, "Too many keys");
memset(m_state, 0, sizeof(m_state));
memset(m_lastState, 0, sizeof(m_lastState));
}
示例7: VE_ASSERT
bool InputDevice::isReleased(uint8_t key) const
{
VE_ASSERT(key < m_numButtons, "Key out of bounds");
// ~0 = 1, ~1 = 0
// if m_lastState == 1 && m_state == 0
return (m_lastState[key] & ~m_state[key]) != 0;
}
示例8: VE_ASSERT
void UIScrollView::AddChild(UIWidget* pkWidget, VeInt32 i32ZOrder)
{
VE_ASSERT(pkWidget);
pkWidget->SetParent(this);
m_kChildren.AttachBack(*pkWidget);
m_pkInnerNode->addChild(pkWidget, i32ZOrder);
UpdateBounding();
}
示例9: VE_ASSERT
//--------------------------------------------------------------------------
void Connection::_Disconnect()
{
VE_ASSERT(m_pkPeer);
m_pkPeer->Shutdown(300);
VENet::VEPeerInterface::DestroyInstance(m_pkPeer);
m_pkPeer = NULL;
g_pClient->m_kConnectOffList.AttachBack(m_kNode);
}
示例10: D3D12RenderWindow
//--------------------------------------------------------------------------
VeRenderWindowPtr D3D12Renderer::CreateRenderWindow(
const VeWindowPtr& spWindow) noexcept
{
D3D12RenderWindow* pkRenderWindow = VE_NEW D3D12RenderWindow(spWindow);
VE_ASSERT(pkRenderWindow);
pkRenderWindow->Init(*this);
return pkRenderWindow;
}
示例11: VeRenderTick
//--------------------------------------------------------------------------
VeIAVertexBuffer::VeIAVertexBuffer(const VeChar8* pcName,
VeUInt32 u32Slot, VeUInt32 u32Stride, VeUInt32 u32Offset)
: VeRenderTick(VeRenderTick::IA_VERTEX_BUFFER), m_u32Slot(u32Slot)
, m_u32Stride(u32Stride), m_u32Offset(u32Offset)
{
g_pRenderer->GetRenderObject(pcName, m_spBuffer);
VE_ASSERT(m_spBuffer);
}
示例12: VE_ASSERT
//--------------------------------------------------------------------------
void VeBinaryOStream::Transfer(VeBinaryIStream& kFrom, VeInt32 i32Length)
{
VE_ASSERT(i32Length > 0);
void* pvBuffer = VeMalloc(i32Length);
VE_ASSERT_EQ(kFrom.Read(pvBuffer, i32Length), i32Length);
AddBlob(pvBuffer, i32Length);
VeFree(pvBuffer);
}
示例13: MultiByteToWideChar
//--------------------------------------------------------------------------
void WindowsWindow::SetTitle(const char* pcTitle) noexcept
{
int32_t i32Num = MultiByteToWideChar(CP_UTF8, 0, pcTitle, -1, nullptr, 0);
VE_ASSERT(i32Num >= 0);
VeDyanmicStack<WCHAR> kBuf(i32Num + 1);
kBuf[size_t(i32Num)] = 0;
MultiByteToWideChar(CP_UTF8, 0, pcTitle, -1, kBuf, i32Num);
SetWindowTextW(m_hHandle, kBuf);
}
示例14: ThreadParams
//--------------------------------------------------------------------------
VeThread::VeThread(int32_t i32Priority, size_t stStackSize) noexcept
{
m_u32State.store(0, std::memory_order_relaxed);
m_pkParams = VE_NEW ThreadParams();
m_pkParams->m_kEvent.set();
m_pkParams->m_pkThis = this;
m_hThread = VeCreateThread(Callback, m_pkParams, i32Priority, stStackSize);
VE_ASSERT(m_hThread);
}
示例15: VE_ASSERT
//--------------------------------------------------------------------------
void WindowsVideoDevice::_RestoreWindow(VeWindow::Data* pkWindow) noexcept
{
VE_ASSERT(pkWindow);
VeWindowData* pkData = (VeWindowData*)pkWindow->m_spDriverdata;
HWND hWnd = pkData->m_hWnd;
pkData->m_bExpectedResize = TRUE;
ShowWindow(hWnd, SW_RESTORE);
pkData->m_bExpectedResize = FALSE;
}