1175-oglthread.patch

Naush, 01/15/2011 09:28 pm

Download (7.8 kB)

b/code/nel/include/nel/3d/driver.h Sat Jan 15 21:17:15 2011 +0100
571 571
	/// get the number of VBL wait when a swapBuffers() is issued. 0 means no synchronisation to the VBL
572 572
	virtual uint			getSwapVBLInterval()=0;
573 573

574
	/// Detach rendering context allowing a second thread to use the actual context.
575
	virtual bool detachContext()=0;
576
	/// Attach rendering context to current thread.
577
	virtual bool attachContext()=0;
578

574 579

575 580
	/// \name Profiling.
576 581
	// @{
b/code/nel/include/nel/3d/driver_user.h Sat Jan 15 21:17:15 2011 +0100
474 474
	virtual void			forceTextureResize(uint divisor);
475 475
	virtual void			forceNativeFragmentPrograms(bool nativeOnly);
476 476
	virtual bool			setMonitorColorProperties (const CMonitorColorProperties &properties);
477
	/// Detach rendering context allowing a second thread to use the actual context.
478
	virtual bool detachContext();
479
	/// Attach rendering context to current thread.
480
	virtual bool attachContext();
481

477 482
	// @}
478 483

479 484
	/// \name Shape Bank
b/code/nel/include/nel/3d/u_driver.h Sat Jan 15 21:17:15 2011 +0100
838 838
		virtual bool pasteTextFromClipboard(ucstring &text) =0;
839 839
	// @}
840 840

841
	/// \name Multi thread management
842
	// @{
843
		virtual bool detachContext()=0;
844
		virtual bool attachContext()=0;
845
	// @}
846

841 847
public:
842 848

843 849
	/**
b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp Sat Jan 15 21:17:15 2011 +0100
3889 3889
	return _EventEmitter.pasteTextFromClipboard(text);
3890 3890
}
3891 3891

3892
bool CDriverD3D::detachContext()
3893
{
3894
	return true;
3895
}
3896

3897
bool CDriverD3D::attachContext()
3898
{
3899
	return true;
3900
}
3892 3901
bool CDriverD3D::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY, bool cursor)
3893 3902
{
3894 3903
	CBitmap src = bitmap;
b/code/nel/src/3d/driver/direct3d/driver_direct3d.h Sat Jan 15 21:17:15 2011 +0100
2491 2491
	virtual bool copyTextToClipboard(const ucstring &text);
2492 2492
	virtual bool pasteTextFromClipboard(ucstring &text);
2493 2493

2494
	virtual bool attachContext();
2495
	virtual bool detachContext();
2496

2494 2497
public:
2495 2498
	#ifdef 	NL_DEBUG
2496 2499
		std::set<CVBDrvInfosD3D *> _LockedBuffers;
b/code/nel/src/3d/driver/opengl/driver_opengl.h Sat Jan 15 21:17:15 2011 +0100
340 340
	virtual bool			copyTextToClipboard(const ucstring &text);
341 341
	virtual bool			pasteTextFromClipboard(ucstring &text);
342 342

343

344
	virtual bool 			detachContext();
345
	virtual bool 			attachContext();
346

343 347
	virtual uint32			getAvailableVertexAGPMemory ();
344 348
	virtual uint32			getAvailableVertexVRAMMemory ();
345 349

b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp Sat Jan 15 21:17:15 2011 +0100
1113 1113

1114 1114
	return true;
1115 1115
}
1116

1116
// --------------------------------------------------
1117
bool CDriverGL::detachContext()
1118
{
1119
	bool ret=true;
1120
#if defined(NL_OS_WINDOWS)
1121
	ret=wglMakeCurrent(_hDC, NULL);
1122
#elif defined(NL_OS_UNIX)
1123
	ret=glXMakeCurrent (_dpy, None, NULL);
1124
#elif defined(NL_OS_MAC)
1125
	//ret=aglSetCurrentContext
1126
#else
1127
	#error "You have to implement me !"
1128
#endif
1129
	if (!ret)
1130
	{
1131
		nlwarning("Can't detach context %0X for threadID #%X", glGetError(), IThread::getCurrentThread());
1132
	}
1133
	return ret;
1134
}
1135
// --------------------------------------------------
1136
bool CDriverGL::attachContext()
1137
{
1138
	bool ret=true;
1139
#if defined(NL_OS_WINDOWS)
1140
	ret=wglMakeCurrent(_hDC, _hRC);
1141
#elif defined(NL_OS_UNIX)
1142
	ret=glXMakeCurrent (_dpy, _win, _ctx);
1143
#elif defined(NL_OS_MAC)
1144
	//ret=aglSetCurrentContext
1145
#else
1146
	#error "You have to implement me !"
1147
#endif
1148
	if (!ret)
1149
	{
1150
		nlwarning("Can't attach context %0X threadID #%X", glGetError(),IThread::getCurrentThread() );
1151
	}
1152
	return ret;
1153
}
1117 1154
// --------------------------------------------------
1118 1155
bool CDriverGL::saveScreenMode()
1119 1156
{
b/code/nel/src/3d/driver_user2.cpp Sat Jan 15 21:17:15 2011 +0100
260 260
	_Driver->profileTextureUsage(result);
261 261
}
262 262

263
bool CDriverUser::detachContext()
264
{
265
	return _Driver->detachContext();
266
}
263 267

268
bool CDriverUser::attachContext()
269
{
270
	return _Driver->attachContext();
271
}
264 272

265 273
} // NL3D
b/code/ryzom/client/src/cdb_branch.cpp Sat Jan 15 21:17:15 2011 +0100
87 87
// reset all static data
88 88
void CCDBNodeBranch::reset()
89 89
{
90
	for ( uint b=0; b!=INVALID_CDB_BANK; ++b )
90
	for ( uint b=0; b!=NB_CDB_BANKS; ++b )
91 91
		_CDBBankToUnifiedIndexMapping[b].clear();
92 92
	_UnifiedIndexToBank.clear();
93 93
	_CDBLastUnifiedIndex = 0;
b/code/ryzom/client/src/connection.cpp Sat Jan 15 21:17:15 2011 +0100
1046 1046
		// Update the DT T0 and T1 global variables
1047 1047
		updateClientTime();
1048 1048
		CInputHandlerManager::getInstance()->pumpEvents();
1049

1050
		Driver->attachContext();
1049 1051
		Driver->clearBuffers(CRGBA::Black);
1050 1052
		Driver->setMatrixMode2D11();
1051 1053

b/code/ryzom/client/src/far_tp.cpp Sat Jan 15 21:17:15 2011 +0100
582 582
			// Server Hop part 3.2: bypass character selection ui & select the same character.
583 583
			// Far TP part 3.2: bypass character selection ui & select the same character.
584 584
			//   This is called from farTPmainloop(), when CONNECTION:USER_CHARS is received.
585
			Driver->detachContext();
585 586
			if( !FarTP.isReselectingChar() )
586 587
			{
587 588
				FarTP.selectCharAndEnter();
......
1053 1054

1054 1055
	if (isIngame())
1055 1056
	{
1057
		// Get Rendering context
1058
		Driver->attachContext();
1056 1059
		// Display background (TODO: not Kami)
1057 1060
		beginLoading (StartBackground);
1058 1061
		UseEscapeDuringLoading = false;
......
1391 1394
void CFarTP::farTPmainLoop()
1392 1395
{
1393 1396
	ConnectionReadySent = false;
1397
	Driver->detachContext();
1394 1398
	LoginSM.pushEvent(CLoginStateMachine::ev_far_tp_main_loop_entered);
1395 1399
	uint nbRecoSelectCharReceived = 0;
1396 1400

......
1430 1434
				if ( nbRecoSelectCharReceived <= 1 )
1431 1435
				{
1432 1436
					ClientCfg.SelectCharacter = -1;	// turn off character autoselection
1437
					Driver->attachContext();
1433 1438
					if ( ! FarTP.reselectCharacter() ) // it should not return here in farTPmainLoop() in the same state otherwise this would be called twice
1434 1439
						return;
1435 1440
				}
......
1441 1446
		{
1442 1447
			// Don't call sendReady() within the cotask but within the main loop, as it contains
1443 1448
			// event/network loops that could trigger a global exit().
1449
			Driver->attachContext();
1444 1450
			sendReady();
1445 1451
			welcomeWindow = !isReselectingChar();
1446 1452
		}