CmRenderSystem.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. // RenderSystem implementation
  25. // Note that most of this class is abstract since
  26. // we cannot know how to implement the behaviour without
  27. // being aware of the 3D API. However there are a few
  28. // simple functions which can have a base implementation
  29. #include "CmRenderSystem.h"
  30. #include "CmViewport.h"
  31. #include "CmException.h"
  32. #include "CmRenderTarget.h"
  33. #include "CmRenderWindow.h"
  34. #include "CmHardwarePixelBuffer.h"
  35. #include "CmHardwareOcclusionQuery.h"
  36. #include "CmDeferredRenderSystem.h"
  37. #include "boost/bind.hpp"
  38. namespace CamelotEngine {
  39. static const TexturePtr sNullTexPtr;
  40. //-----------------------------------------------------------------------
  41. RenderSystem::RenderSystem()
  42. : mActiveRenderTarget(0)
  43. , mActiveViewport(0)
  44. // This means CULL clockwise vertices, i.e. front of poly is counter-clockwise
  45. // This makes it the same as OpenGL and other right-handed systems
  46. , mCullingMode(CULL_CLOCKWISE)
  47. , mVSync(true)
  48. , mVSyncInterval(1)
  49. , mInvertVertexWinding(false)
  50. , mDisabledTexUnitsFrom(0)
  51. , mVertexProgramBound(false)
  52. , mGeometryProgramBound(false)
  53. , mFragmentProgramBound(false)
  54. , mClipPlanesDirty(true)
  55. , mRealCapabilities(0)
  56. , mCurrentCapabilities(0)
  57. , mUseCustomCapabilities(false)
  58. , mUsingSeparateRenderThread(false)
  59. , mRenderThreadFunc(nullptr)
  60. , mRenderThreadShutdown(false)
  61. {
  62. }
  63. //-----------------------------------------------------------------------
  64. RenderSystem::~RenderSystem()
  65. {
  66. shutdown();
  67. delete mRealCapabilities;
  68. mRealCapabilities = 0;
  69. // Current capabilities managed externally
  70. mCurrentCapabilities = 0;
  71. }
  72. //-----------------------------------------------------------------------
  73. void RenderSystem::swapAllRenderTargetBuffers(bool waitForVSync)
  74. {
  75. // Update all in order of priority
  76. // This ensures render-to-texture targets get updated before render windows
  77. RenderTargetPriorityMap::iterator itarg, itargend;
  78. itargend = mPrioritisedRenderTargets.end();
  79. for( itarg = mPrioritisedRenderTargets.begin(); itarg != itargend; ++itarg )
  80. {
  81. if( itarg->second->isActive())
  82. itarg->second->swapBuffers(waitForVSync);
  83. }
  84. }
  85. //-----------------------------------------------------------------------
  86. RenderWindow* RenderSystem::startUp(bool runOnSeparateThread, bool autoCreateWindow, const String& windowTitle)
  87. {
  88. // Subclasses should take it from here
  89. // They should ALL call this superclass method from
  90. // their own startUp() implementations.
  91. mRenderThreadId = CM_THREAD_CURRENT_ID;
  92. mVertexProgramBound = false;
  93. mGeometryProgramBound = false;
  94. mFragmentProgramBound = false;
  95. return 0;
  96. }
  97. //---------------------------------------------------------------------------------------------
  98. void RenderSystem::useCustomRenderSystemCapabilities(RenderSystemCapabilities* capabilities)
  99. {
  100. if (mRealCapabilities != 0)
  101. {
  102. CM_EXCEPT(InternalErrorException,
  103. "Custom render capabilities must be set before the RenderSystem is initialised.");
  104. }
  105. mCurrentCapabilities = capabilities;
  106. mUseCustomCapabilities = true;
  107. }
  108. //---------------------------------------------------------------------------------------------
  109. bool RenderSystem::_createRenderWindows(const RenderWindowDescriptionList& renderWindowDescriptions,
  110. RenderWindowList& createdWindows)
  111. {
  112. unsigned int fullscreenWindowsCount = 0;
  113. // Grab some information and avoid duplicate render windows.
  114. for (unsigned int nWindow=0; nWindow < renderWindowDescriptions.size(); ++nWindow)
  115. {
  116. const RenderWindowDescription* curDesc = &renderWindowDescriptions[nWindow];
  117. // Count full screen windows.
  118. if (curDesc->useFullScreen)
  119. fullscreenWindowsCount++;
  120. bool renderWindowFound = false;
  121. if (mRenderTargets.find(curDesc->name) != mRenderTargets.end())
  122. renderWindowFound = true;
  123. else
  124. {
  125. for (unsigned int nSecWindow = nWindow + 1 ; nSecWindow < renderWindowDescriptions.size(); ++nSecWindow)
  126. {
  127. if (curDesc->name == renderWindowDescriptions[nSecWindow].name)
  128. {
  129. renderWindowFound = true;
  130. break;
  131. }
  132. }
  133. }
  134. // Make sure we don't already have a render target of the
  135. // same name as the one supplied
  136. if(renderWindowFound)
  137. {
  138. String msg;
  139. msg = "A render target of the same name '" + String(curDesc->name) + "' already "
  140. "exists. You cannot create a new window with this name.";
  141. CM_EXCEPT(InternalErrorException, msg);
  142. }
  143. }
  144. // Case we have to create some full screen rendering windows.
  145. if (fullscreenWindowsCount > 0)
  146. {
  147. // Can not mix full screen and windowed rendering windows.
  148. if (fullscreenWindowsCount != renderWindowDescriptions.size())
  149. {
  150. CM_EXCEPT(InvalidParametersException,
  151. "Can not create mix of full screen and windowed rendering windows");
  152. }
  153. }
  154. return true;
  155. }
  156. //---------------------------------------------------------------------------------------------
  157. void RenderSystem::destroyRenderWindow(const String& name)
  158. {
  159. destroyRenderTarget(name);
  160. }
  161. //---------------------------------------------------------------------------------------------
  162. void RenderSystem::destroyRenderTexture(const String& name)
  163. {
  164. destroyRenderTarget(name);
  165. }
  166. //---------------------------------------------------------------------------------------------
  167. void RenderSystem::destroyRenderTarget(const String& name)
  168. {
  169. RenderTarget* rt = detachRenderTarget(name);
  170. delete rt;
  171. }
  172. //---------------------------------------------------------------------------------------------
  173. void RenderSystem::attachRenderTarget( RenderTarget &target )
  174. {
  175. assert( target.getPriority() < OGRE_NUM_RENDERTARGET_GROUPS );
  176. mRenderTargets.insert( RenderTargetMap::value_type( target.getName(), &target ) );
  177. mPrioritisedRenderTargets.insert(
  178. RenderTargetPriorityMap::value_type(target.getPriority(), &target ));
  179. }
  180. //---------------------------------------------------------------------------------------------
  181. RenderTarget * RenderSystem::getRenderTarget( const String &name )
  182. {
  183. RenderTargetMap::iterator it = mRenderTargets.find( name );
  184. RenderTarget *ret = NULL;
  185. if( it != mRenderTargets.end() )
  186. {
  187. ret = it->second;
  188. }
  189. return ret;
  190. }
  191. //---------------------------------------------------------------------------------------------
  192. RenderTarget * RenderSystem::detachRenderTarget( const String &name )
  193. {
  194. RenderTargetMap::iterator it = mRenderTargets.find( name );
  195. RenderTarget *ret = NULL;
  196. if( it != mRenderTargets.end() )
  197. {
  198. ret = it->second;
  199. /* Remove the render target from the priority groups. */
  200. RenderTargetPriorityMap::iterator itarg, itargend;
  201. itargend = mPrioritisedRenderTargets.end();
  202. for( itarg = mPrioritisedRenderTargets.begin(); itarg != itargend; ++itarg )
  203. {
  204. if( itarg->second == ret ) {
  205. mPrioritisedRenderTargets.erase( itarg );
  206. break;
  207. }
  208. }
  209. mRenderTargets.erase( it );
  210. }
  211. /// If detached render target is the active render target, reset active render target
  212. if(ret == mActiveRenderTarget)
  213. mActiveRenderTarget = 0;
  214. return ret;
  215. }
  216. //-----------------------------------------------------------------------
  217. Viewport* RenderSystem::getViewport(void)
  218. {
  219. return mActiveViewport;
  220. }
  221. //-----------------------------------------------------------------------
  222. void RenderSystem::setTextureUnitSettings(size_t texUnit, const TexturePtr& tex, const SamplerState& tl)
  223. {
  224. // This method is only ever called to set a texture unit to valid details
  225. // The method _disableTextureUnit is called to turn a unit off
  226. // Vertex texture binding?
  227. if (mCurrentCapabilities->hasCapability(RSC_VERTEX_TEXTURE_FETCH) &&
  228. !mCurrentCapabilities->getVertexTextureUnitsShared())
  229. {
  230. if (tl.getBindingType() == SamplerState::BT_VERTEX)
  231. {
  232. // Bind vertex texture
  233. setVertexTexture(texUnit, tex);
  234. // bind nothing to fragment unit (hardware isn't shared but fragment
  235. // unit can't be using the same index
  236. setTexture(texUnit, true, sNullTexPtr);
  237. }
  238. else
  239. {
  240. // vice versa
  241. setVertexTexture(texUnit, sNullTexPtr);
  242. setTexture(texUnit, true, tex);
  243. }
  244. }
  245. else
  246. {
  247. // Shared vertex / fragment textures or no vertex texture support
  248. // Bind texture (may be blank)
  249. setTexture(texUnit, true, tex);
  250. }
  251. // Set texture layer filtering
  252. setTextureFiltering(texUnit,
  253. tl.getTextureFiltering(FT_MIN),
  254. tl.getTextureFiltering(FT_MAG),
  255. tl.getTextureFiltering(FT_MIP));
  256. // Set texture layer filtering
  257. setTextureAnisotropy(texUnit, tl.getTextureAnisotropy());
  258. // Set mipmap biasing
  259. setTextureMipmapBias(texUnit, tl.getTextureMipmapBias());
  260. // Texture addressing mode
  261. const SamplerState::UVWAddressingMode& uvw = tl.getTextureAddressingMode();
  262. setTextureAddressingMode(texUnit, uvw);
  263. }
  264. //-----------------------------------------------------------------------
  265. void RenderSystem::setVertexTexture(size_t unit, const TexturePtr& tex)
  266. {
  267. CM_EXCEPT(NotImplementedException,
  268. "This rendersystem does not support separate vertex texture samplers, "
  269. "you should use the regular texture samplers which are shared between "
  270. "the vertex and fragment units.");
  271. }
  272. //-----------------------------------------------------------------------
  273. void RenderSystem::disableTextureUnit(size_t texUnit)
  274. {
  275. setTexture(texUnit, false, sNullTexPtr);
  276. }
  277. //---------------------------------------------------------------------
  278. void RenderSystem::disableTextureUnitsFrom(size_t texUnit)
  279. {
  280. size_t disableTo = CM_MAX_TEXTURE_LAYERS;
  281. if (disableTo > mDisabledTexUnitsFrom)
  282. disableTo = mDisabledTexUnitsFrom;
  283. mDisabledTexUnitsFrom = texUnit;
  284. for (size_t i = texUnit; i < disableTo; ++i)
  285. {
  286. disableTextureUnit(i);
  287. }
  288. }
  289. //-----------------------------------------------------------------------
  290. void RenderSystem::setTextureFiltering(size_t unit, FilterOptions minFilter,
  291. FilterOptions magFilter, FilterOptions mipFilter)
  292. {
  293. setTextureFiltering(unit, FT_MIN, minFilter);
  294. setTextureFiltering(unit, FT_MAG, magFilter);
  295. setTextureFiltering(unit, FT_MIP, mipFilter);
  296. }
  297. //-----------------------------------------------------------------------
  298. CullingMode RenderSystem::getCullingMode(void) const
  299. {
  300. return mCullingMode;
  301. }
  302. //-----------------------------------------------------------------------
  303. bool RenderSystem::getWaitForVerticalBlank(void) const
  304. {
  305. return mVSync;
  306. }
  307. //-----------------------------------------------------------------------
  308. void RenderSystem::setWaitForVerticalBlank(bool enabled)
  309. {
  310. mVSync = enabled;
  311. }
  312. //-----------------------------------------------------------------------
  313. void RenderSystem::shutdown(void)
  314. {
  315. // Remove all the render targets.
  316. // (destroy primary target last since others may depend on it)
  317. RenderTarget* primary = 0;
  318. for (RenderTargetMap::iterator it = mRenderTargets.begin(); it != mRenderTargets.end(); ++it)
  319. {
  320. if (!primary && it->second->isPrimary())
  321. primary = it->second;
  322. else
  323. delete it->second;
  324. }
  325. delete primary;
  326. mRenderTargets.clear();
  327. mPrioritisedRenderTargets.clear();
  328. if(mUsingSeparateRenderThread)
  329. shutdownRenderThread();
  330. }
  331. //-----------------------------------------------------------------------
  332. void RenderSystem::beginGeometryCount(void)
  333. {
  334. mBatchCount = mFaceCount = mVertexCount = 0;
  335. }
  336. //-----------------------------------------------------------------------
  337. unsigned int RenderSystem::getFaceCount(void) const
  338. {
  339. return static_cast< unsigned int >( mFaceCount );
  340. }
  341. //-----------------------------------------------------------------------
  342. unsigned int RenderSystem::getBatchCount(void) const
  343. {
  344. return static_cast< unsigned int >( mBatchCount );
  345. }
  346. //-----------------------------------------------------------------------
  347. unsigned int RenderSystem::getVertexCount(void) const
  348. {
  349. return static_cast< unsigned int >( mVertexCount );
  350. }
  351. //-----------------------------------------------------------------------
  352. void RenderSystem::convertColorValue(const Color& colour, UINT32* pDest)
  353. {
  354. *pDest = VertexElement::convertColourValue(colour, getColorVertexElementType());
  355. }
  356. //-----------------------------------------------------------------------
  357. void RenderSystem::render(const RenderOperation& op)
  358. {
  359. // Update stats
  360. size_t val;
  361. if (op.useIndexes)
  362. val = op.indexData->indexCount;
  363. else
  364. val = op.vertexData->vertexCount;
  365. switch(op.operationType)
  366. {
  367. case RenderOperation::OT_TRIANGLE_LIST:
  368. mFaceCount += val / 3;
  369. break;
  370. case RenderOperation::OT_TRIANGLE_STRIP:
  371. case RenderOperation::OT_TRIANGLE_FAN:
  372. mFaceCount += val - 2;
  373. break;
  374. case RenderOperation::OT_POINT_LIST:
  375. case RenderOperation::OT_LINE_LIST:
  376. case RenderOperation::OT_LINE_STRIP:
  377. break;
  378. }
  379. mVertexCount += op.vertexData->vertexCount;
  380. mBatchCount += 1;
  381. // sort out clip planes
  382. // have to do it here in case of matrix issues
  383. if (mClipPlanesDirty)
  384. {
  385. setClipPlanesImpl(mClipPlanes);
  386. mClipPlanesDirty = false;
  387. }
  388. }
  389. //-----------------------------------------------------------------------
  390. void RenderSystem::setInvertVertexWinding(bool invert)
  391. {
  392. mInvertVertexWinding = invert;
  393. }
  394. //-----------------------------------------------------------------------
  395. bool RenderSystem::getInvertVertexWinding(void) const
  396. {
  397. return mInvertVertexWinding;
  398. }
  399. //---------------------------------------------------------------------
  400. void RenderSystem::addClipPlane (const Plane &p)
  401. {
  402. mClipPlanes.push_back(p);
  403. mClipPlanesDirty = true;
  404. }
  405. //---------------------------------------------------------------------
  406. void RenderSystem::addClipPlane (float A, float B, float C, float D)
  407. {
  408. addClipPlane(Plane(A, B, C, D));
  409. }
  410. //---------------------------------------------------------------------
  411. void RenderSystem::setClipPlanes(const PlaneList& clipPlanes)
  412. {
  413. if (clipPlanes != mClipPlanes)
  414. {
  415. mClipPlanes = clipPlanes;
  416. mClipPlanesDirty = true;
  417. }
  418. }
  419. //---------------------------------------------------------------------
  420. void RenderSystem::resetClipPlanes()
  421. {
  422. if (!mClipPlanes.empty())
  423. {
  424. mClipPlanes.clear();
  425. mClipPlanesDirty = true;
  426. }
  427. }
  428. //-----------------------------------------------------------------------
  429. void RenderSystem::bindGpuProgram(GpuProgram* prg)
  430. {
  431. switch(prg->getType())
  432. {
  433. case GPT_VERTEX_PROGRAM:
  434. // mark clip planes dirty if changed (programmable can change space)
  435. if (!mVertexProgramBound && !mClipPlanes.empty())
  436. mClipPlanesDirty = true;
  437. mVertexProgramBound = true;
  438. break;
  439. case GPT_GEOMETRY_PROGRAM:
  440. mGeometryProgramBound = true;
  441. break;
  442. case GPT_FRAGMENT_PROGRAM:
  443. mFragmentProgramBound = true;
  444. break;
  445. }
  446. }
  447. //-----------------------------------------------------------------------
  448. void RenderSystem::unbindGpuProgram(GpuProgramType gptype)
  449. {
  450. switch(gptype)
  451. {
  452. case GPT_VERTEX_PROGRAM:
  453. // mark clip planes dirty if changed (programmable can change space)
  454. if (mVertexProgramBound && !mClipPlanes.empty())
  455. mClipPlanesDirty = true;
  456. mVertexProgramBound = false;
  457. break;
  458. case GPT_GEOMETRY_PROGRAM:
  459. mGeometryProgramBound = false;
  460. break;
  461. case GPT_FRAGMENT_PROGRAM:
  462. mFragmentProgramBound = false;
  463. break;
  464. }
  465. }
  466. //-----------------------------------------------------------------------
  467. bool RenderSystem::isGpuProgramBound(GpuProgramType gptype)
  468. {
  469. switch(gptype)
  470. {
  471. case GPT_VERTEX_PROGRAM:
  472. return mVertexProgramBound;
  473. case GPT_GEOMETRY_PROGRAM:
  474. return mGeometryProgramBound;
  475. case GPT_FRAGMENT_PROGRAM:
  476. return mFragmentProgramBound;
  477. }
  478. // Make compiler happy
  479. return false;
  480. }
  481. void RenderSystem::initRenderThread()
  482. {
  483. mRenderThreadFunc = new RenderWorkerFunc(this);
  484. #if CM_THREAD_SUPPORT
  485. CM_THREAD_CREATE(t, *mRenderThreadFunc);
  486. mRenderThread = t;
  487. CM_LOCK_MUTEX_NAMED(mDeferredRSInitMutex, lock)
  488. CM_THREAD_WAIT(mDeferredRSInitCondition, mDeferredRSInitMutex, lock)
  489. // TODO - Block here until I am sure render thread is running and initialized
  490. #else
  491. CM_EXCEPT(InternalErrorException, "Attempting to start a render thread but Camelot isn't compiled with thread support.");
  492. #endif
  493. }
  494. void RenderSystem::runRenderThread()
  495. {
  496. mRenderThreadId = CM_THREAD_CURRENT_ID;
  497. mUsingSeparateRenderThread = true;
  498. CM_THREAD_NOTIFY_ALL(mDeferredRSInitCondition)
  499. while(true)
  500. {
  501. if(mRenderThreadShutdown)
  502. return;
  503. // Wait until we get some ready commands
  504. {
  505. CM_LOCK_MUTEX_NAMED(mDeferredRSMutex, lock)
  506. bool anyCommandsReady = false;
  507. for(auto iter = mDeferredRenderSystems.begin(); iter != mDeferredRenderSystems.end(); ++iter)
  508. {
  509. if((*iter)->hasReadyCommands())
  510. {
  511. anyCommandsReady = true;
  512. break;
  513. }
  514. }
  515. if(!anyCommandsReady)
  516. CM_THREAD_WAIT(mDeferredRSReadyCondition, mDeferredRSMutex, lock)
  517. }
  518. {
  519. CM_LOCK_MUTEX(mDeferredRSMutex);
  520. for(auto iter = mDeferredRenderSystems.begin(); iter != mDeferredRenderSystems.end(); ++iter)
  521. {
  522. (*iter)->playbackCommands();
  523. }
  524. }
  525. }
  526. }
  527. void RenderSystem::shutdownRenderThread()
  528. {
  529. mRenderThreadShutdown = true;
  530. // Wake all threads. They will quit after they see the shutdown flag
  531. CM_THREAD_NOTIFY_ALL(mDeferredRSReadyCondition)
  532. mRenderThread->join();
  533. CM_THREAD_DESTROY(mRenderThread);
  534. mRenderThread = nullptr;
  535. mUsingSeparateRenderThread = false;
  536. mRenderThreadId = CM_THREAD_CURRENT_ID;
  537. mDeferredRenderSystems.clear();
  538. }
  539. void RenderSystem::notifyCommandsReadyCallback()
  540. {
  541. CM_THREAD_NOTIFY_ALL(mDeferredRSReadyCondition)
  542. }
  543. DeferredRenderSystemPtr RenderSystem::createDeferredRenderSystem()
  544. {
  545. DeferredRenderSystemPtr newDeferredRS = DeferredRenderSystemPtr(
  546. new DeferredRenderSystem(CM_THREAD_CURRENT_ID, boost::bind(&RenderSystem::notifyCommandsReadyCallback, this))
  547. );
  548. {
  549. CM_LOCK_MUTEX(mDeferredRSMutex);
  550. mDeferredRenderSystems.push_back(newDeferredRS);
  551. }
  552. return newDeferredRS;
  553. }
  554. void RenderSystem::throwIfInvalidThread()
  555. {
  556. if(CM_THREAD_CURRENT_ID != getRenderThreadId())
  557. CM_EXCEPT(InternalErrorException, "Calling the render system from a non-render thread!");
  558. }
  559. /************************************************************************/
  560. /* THREAD WORKER */
  561. /************************************************************************/
  562. RenderSystem::RenderWorkerFunc::RenderWorkerFunc(RenderSystem* rs)
  563. :mRS(rs)
  564. {
  565. assert(mRS != nullptr);
  566. }
  567. void RenderSystem::RenderWorkerFunc::operator()()
  568. {
  569. mRS->runRenderThread();
  570. }
  571. }