void RunN(int N) { vd::f64 start; vd::f64 end; TestDelegate::FunctionType callback = VD_BIND_FUNCTION(StaticTestMethod); std::vector< Core::Handle<TestDelegateThread> > threads; for(int j=0; j<8; ++j) { float value = 3.14f; start = Core::Process::GetTimeInSeconds(); for(int i = 0; i < N; ++i) { TestDelegateThread::DelegateType* delegate = VD_NEW(TestDelegateThread::DelegateType, callback, value); TestDelegateThread* thread = VD_NEW(TestDelegateThread, delegate); threads.push_back(thread); value += value; } end = Core::Process::GetTimeInSeconds(); m_ConnectTime += (end - start) / N; start = Core::Process::GetTimeInSeconds(); for(int h = 0; h < (int)threads.size(); ++h) { threads[h]->Setup(); threads[h]->Start(); } end = Core::Process::GetTimeInSeconds(); m_InvokeTime += (end - start) / N; bool more = true; while(more) { Core::Thread::Yield(); more = false; for(int h = 0; h < (int)threads.size(); ++h) { TestDelegateThread* t = threads[h]; if(t && t->GetDelegate() && t->GetDelegate()->IsReady() == false) more = true; } } start = Core::Process::GetTimeInSeconds(); for(int h = 0; h < (int)threads.size(); ++h) { TestDelegateThread* t = threads[h]; t->Join(); } end = Core::Process::GetTimeInSeconds(); m_DisconnectTime += (end - start) / N; } }
vd::status Context::Setup(void) { Destroy(); m_Renderer = VD_NEW(Renderer::Base, m_Graphics); if(m_Renderer == NULL) return Status::Code::OutOfMemory; return Status::Code::Success; }
vd::status Context::Reset(Skin::Base* skin) { Input::Base* old_input = m_Input; Canvas::Base* old_canvas = m_Canvas; ChangeSkin(skin ? skin : VD_NEW(Skin::Default, m_Renderer)); m_Canvas = VD_NEW(Canvas::Base, GetSkin() ); m_Canvas->Initialize(); // m_Canvas->SetDrawBackground( true ); // m_Canvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); m_Input = VD_NEW(Input::Base); m_Input->Initialize( m_Canvas ); VD_SAFE_DELETE(old_canvas); VD_SAFE_DELETE(old_input); return Status::Code::Success; }
Texture* Texture::Create3D( const Texture::Properties& properties, const void* ptr) { Texture* texture = VD_NEW(Texture); bool success = texture->Create(properties, ptr); if(!success) { vdLogGlobalWarning("Texture: Error Creating Texture!"); VD_DELETE(texture); return NULL; } return texture; }