tr_backend.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "tr_local.h"
  23. frameData_t *frameData;
  24. backEndState_t backEnd;
  25. /*
  26. ======================
  27. RB_SetDefaultGLState
  28. This should initialize all GL state that any part of the entire program
  29. may touch, including the editor.
  30. ======================
  31. */
  32. void RB_SetDefaultGLState( void ) {
  33. int i;
  34. RB_LogComment( "--- R_SetDefaultGLState ---\n" );
  35. qglClearDepth( 1.0f );
  36. qglColor4f (1,1,1,1);
  37. glDisableClientState( GL_INDEX_ARRAY );
  38. glDisableClientState( GL_COLOR_ARRAY );
  39. glDisableClientState( GL_SECONDARY_COLOR_ARRAY_EXT );
  40. glDisableClientState( GL_VERTEX_ARRAY );
  41. // the vertex array is always enabled
  42. qglEnableClientState( GL_VERTEX_ARRAY );
  43. qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
  44. qglDisableClientState( GL_COLOR_ARRAY );
  45. //
  46. // make sure our GL state vector is set correctly
  47. //
  48. memset( &backEnd.glState, 0, sizeof( backEnd.glState ) );
  49. backEnd.glState.forceGlState = true;
  50. qglColorMask( 1, 1, 1, 1 );
  51. qglEnable( GL_DEPTH_TEST );
  52. qglEnable( GL_BLEND );
  53. qglEnable( GL_SCISSOR_TEST );
  54. qglEnable( GL_CULL_FACE );
  55. qglDisable( GL_LIGHTING );
  56. qglDisable( GL_LINE_STIPPLE );
  57. qglDisable( GL_STENCIL_TEST );
  58. qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
  59. qglDepthMask( GL_TRUE );
  60. qglDepthFunc( GL_ALWAYS );
  61. qglCullFace( GL_FRONT_AND_BACK );
  62. qglShadeModel( GL_SMOOTH );
  63. if ( r_useScissor.GetBool() ) {
  64. qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
  65. }
  66. for ( i = glConfig.maxTextureUnits - 1 ; i >= 0 ; i-- ) {
  67. GL_SelectTexture( i );
  68. // object linear texgen is our default
  69. qglTexGenf( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
  70. qglTexGenf( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
  71. qglTexGenf( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
  72. qglTexGenf( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
  73. GL_TexEnv( GL_MODULATE );
  74. qglDisable( GL_TEXTURE_2D );
  75. if ( glConfig.texture3DAvailable ) {
  76. qglDisable( GL_TEXTURE_3D );
  77. }
  78. if ( glConfig.cubeMapAvailable ) {
  79. qglDisable( GL_TEXTURE_CUBE_MAP_EXT );
  80. }
  81. }
  82. }
  83. /*
  84. ====================
  85. RB_LogComment
  86. ====================
  87. */
  88. void RB_LogComment( const char *comment, ... ) {
  89. va_list marker;
  90. if ( !tr.logFile ) {
  91. return;
  92. }
  93. fprintf( tr.logFile, "// " );
  94. va_start( marker, comment );
  95. vfprintf( tr.logFile, comment, marker );
  96. va_end( marker );
  97. }
  98. //=============================================================================
  99. /*
  100. ====================
  101. GL_SelectTexture
  102. ====================
  103. */
  104. void GL_SelectTexture( int unit ) {
  105. if ( backEnd.glState.currenttmu == unit ) {
  106. return;
  107. }
  108. if ( unit < 0 || unit >= glConfig.maxTextureUnits && unit >= glConfig.maxTextureImageUnits ) {
  109. common->Warning( "GL_SelectTexture: unit = %i", unit );
  110. return;
  111. }
  112. qglActiveTextureARB( GL_TEXTURE0_ARB + unit );
  113. qglClientActiveTextureARB( GL_TEXTURE0_ARB + unit );
  114. RB_LogComment( "glActiveTextureARB( %i );\nglClientActiveTextureARB( %i );\n", unit, unit );
  115. backEnd.glState.currenttmu = unit;
  116. }
  117. /*
  118. ====================
  119. GL_Cull
  120. This handles the flipping needed when the view being
  121. rendered is a mirored view.
  122. ====================
  123. */
  124. void GL_Cull( int cullType ) {
  125. if ( backEnd.glState.faceCulling == cullType ) {
  126. return;
  127. }
  128. if ( cullType == CT_TWO_SIDED ) {
  129. qglDisable( GL_CULL_FACE );
  130. } else {
  131. if ( backEnd.glState.faceCulling == CT_TWO_SIDED ) {
  132. qglEnable( GL_CULL_FACE );
  133. }
  134. if ( cullType == CT_BACK_SIDED ) {
  135. if ( backEnd.viewDef->isMirror ) {
  136. qglCullFace( GL_FRONT );
  137. } else {
  138. qglCullFace( GL_BACK );
  139. }
  140. } else {
  141. if ( backEnd.viewDef->isMirror ) {
  142. qglCullFace( GL_BACK );
  143. } else {
  144. qglCullFace( GL_FRONT );
  145. }
  146. }
  147. }
  148. backEnd.glState.faceCulling = cullType;
  149. }
  150. /*
  151. ====================
  152. GL_TexEnv
  153. ====================
  154. */
  155. void GL_TexEnv( int env ) {
  156. tmu_t *tmu;
  157. tmu = &backEnd.glState.tmu[backEnd.glState.currenttmu];
  158. if ( env == tmu->texEnv ) {
  159. return;
  160. }
  161. tmu->texEnv = env;
  162. switch ( env ) {
  163. case GL_COMBINE_EXT:
  164. case GL_MODULATE:
  165. case GL_REPLACE:
  166. case GL_DECAL:
  167. case GL_ADD:
  168. qglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env );
  169. break;
  170. default:
  171. common->Error( "GL_TexEnv: invalid env '%d' passed\n", env );
  172. break;
  173. }
  174. }
  175. /*
  176. =================
  177. GL_ClearStateDelta
  178. Clears the state delta bits, so the next GL_State
  179. will set every item
  180. =================
  181. */
  182. void GL_ClearStateDelta( void ) {
  183. backEnd.glState.forceGlState = true;
  184. }
  185. /*
  186. ====================
  187. GL_State
  188. This routine is responsible for setting the most commonly changed state
  189. ====================
  190. */
  191. void GL_State( int stateBits ) {
  192. int diff;
  193. if ( !r_useStateCaching.GetBool() || backEnd.glState.forceGlState ) {
  194. // make sure everything is set all the time, so we
  195. // can see if our delta checking is screwing up
  196. diff = -1;
  197. backEnd.glState.forceGlState = false;
  198. } else {
  199. diff = stateBits ^ backEnd.glState.glStateBits;
  200. if ( !diff ) {
  201. return;
  202. }
  203. }
  204. //
  205. // check depthFunc bits
  206. //
  207. if ( diff & ( GLS_DEPTHFUNC_EQUAL | GLS_DEPTHFUNC_LESS | GLS_DEPTHFUNC_ALWAYS ) ) {
  208. if ( stateBits & GLS_DEPTHFUNC_EQUAL ) {
  209. qglDepthFunc( GL_EQUAL );
  210. } else if ( stateBits & GLS_DEPTHFUNC_ALWAYS ) {
  211. qglDepthFunc( GL_ALWAYS );
  212. } else {
  213. qglDepthFunc( GL_LEQUAL );
  214. }
  215. }
  216. //
  217. // check blend bits
  218. //
  219. if ( diff & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) {
  220. GLenum srcFactor, dstFactor;
  221. switch ( stateBits & GLS_SRCBLEND_BITS ) {
  222. case GLS_SRCBLEND_ZERO:
  223. srcFactor = GL_ZERO;
  224. break;
  225. case GLS_SRCBLEND_ONE:
  226. srcFactor = GL_ONE;
  227. break;
  228. case GLS_SRCBLEND_DST_COLOR:
  229. srcFactor = GL_DST_COLOR;
  230. break;
  231. case GLS_SRCBLEND_ONE_MINUS_DST_COLOR:
  232. srcFactor = GL_ONE_MINUS_DST_COLOR;
  233. break;
  234. case GLS_SRCBLEND_SRC_ALPHA:
  235. srcFactor = GL_SRC_ALPHA;
  236. break;
  237. case GLS_SRCBLEND_ONE_MINUS_SRC_ALPHA:
  238. srcFactor = GL_ONE_MINUS_SRC_ALPHA;
  239. break;
  240. case GLS_SRCBLEND_DST_ALPHA:
  241. srcFactor = GL_DST_ALPHA;
  242. break;
  243. case GLS_SRCBLEND_ONE_MINUS_DST_ALPHA:
  244. srcFactor = GL_ONE_MINUS_DST_ALPHA;
  245. break;
  246. case GLS_SRCBLEND_ALPHA_SATURATE:
  247. srcFactor = GL_SRC_ALPHA_SATURATE;
  248. break;
  249. default:
  250. srcFactor = GL_ONE; // to get warning to shut up
  251. common->Error( "GL_State: invalid src blend state bits\n" );
  252. break;
  253. }
  254. switch ( stateBits & GLS_DSTBLEND_BITS ) {
  255. case GLS_DSTBLEND_ZERO:
  256. dstFactor = GL_ZERO;
  257. break;
  258. case GLS_DSTBLEND_ONE:
  259. dstFactor = GL_ONE;
  260. break;
  261. case GLS_DSTBLEND_SRC_COLOR:
  262. dstFactor = GL_SRC_COLOR;
  263. break;
  264. case GLS_DSTBLEND_ONE_MINUS_SRC_COLOR:
  265. dstFactor = GL_ONE_MINUS_SRC_COLOR;
  266. break;
  267. case GLS_DSTBLEND_SRC_ALPHA:
  268. dstFactor = GL_SRC_ALPHA;
  269. break;
  270. case GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA:
  271. dstFactor = GL_ONE_MINUS_SRC_ALPHA;
  272. break;
  273. case GLS_DSTBLEND_DST_ALPHA:
  274. dstFactor = GL_DST_ALPHA;
  275. break;
  276. case GLS_DSTBLEND_ONE_MINUS_DST_ALPHA:
  277. dstFactor = GL_ONE_MINUS_DST_ALPHA;
  278. break;
  279. default:
  280. dstFactor = GL_ONE; // to get warning to shut up
  281. common->Error( "GL_State: invalid dst blend state bits\n" );
  282. break;
  283. }
  284. qglBlendFunc( srcFactor, dstFactor );
  285. }
  286. //
  287. // check depthmask
  288. //
  289. if ( diff & GLS_DEPTHMASK ) {
  290. if ( stateBits & GLS_DEPTHMASK ) {
  291. qglDepthMask( GL_FALSE );
  292. } else {
  293. qglDepthMask( GL_TRUE );
  294. }
  295. }
  296. //
  297. // check colormask
  298. //
  299. if ( diff & (GLS_REDMASK|GLS_GREENMASK|GLS_BLUEMASK|GLS_ALPHAMASK) ) {
  300. GLboolean r, g, b, a;
  301. r = ( stateBits & GLS_REDMASK ) ? 0 : 1;
  302. g = ( stateBits & GLS_GREENMASK ) ? 0 : 1;
  303. b = ( stateBits & GLS_BLUEMASK ) ? 0 : 1;
  304. a = ( stateBits & GLS_ALPHAMASK ) ? 0 : 1;
  305. qglColorMask( r, g, b, a );
  306. }
  307. //
  308. // fill/line mode
  309. //
  310. if ( diff & GLS_POLYMODE_LINE ) {
  311. if ( stateBits & GLS_POLYMODE_LINE ) {
  312. qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
  313. } else {
  314. qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
  315. }
  316. }
  317. //
  318. // alpha test
  319. //
  320. if ( diff & GLS_ATEST_BITS ) {
  321. switch ( stateBits & GLS_ATEST_BITS ) {
  322. case 0:
  323. qglDisable( GL_ALPHA_TEST );
  324. break;
  325. case GLS_ATEST_EQ_255:
  326. qglEnable( GL_ALPHA_TEST );
  327. qglAlphaFunc( GL_EQUAL, 1 );
  328. break;
  329. case GLS_ATEST_LT_128:
  330. qglEnable( GL_ALPHA_TEST );
  331. qglAlphaFunc( GL_LESS, 0.5 );
  332. break;
  333. case GLS_ATEST_GE_128:
  334. qglEnable( GL_ALPHA_TEST );
  335. qglAlphaFunc( GL_GEQUAL, 0.5 );
  336. break;
  337. default:
  338. assert( 0 );
  339. break;
  340. }
  341. }
  342. backEnd.glState.glStateBits = stateBits;
  343. }
  344. /*
  345. ============================================================================
  346. RENDER BACK END THREAD FUNCTIONS
  347. ============================================================================
  348. */
  349. /*
  350. =============
  351. RB_SetGL2D
  352. This is not used by the normal game paths, just by some tools
  353. =============
  354. */
  355. void RB_SetGL2D( void ) {
  356. // set 2D virtual screen size
  357. qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
  358. if ( r_useScissor.GetBool() ) {
  359. qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
  360. }
  361. qglMatrixMode( GL_PROJECTION );
  362. qglLoadIdentity();
  363. qglOrtho( 0, 640, 480, 0, 0, 1 ); // always assume 640x480 virtual coordinates
  364. qglMatrixMode( GL_MODELVIEW );
  365. qglLoadIdentity();
  366. GL_State( GLS_DEPTHFUNC_ALWAYS |
  367. GLS_SRCBLEND_SRC_ALPHA |
  368. GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
  369. GL_Cull( CT_TWO_SIDED );
  370. qglDisable( GL_DEPTH_TEST );
  371. qglDisable( GL_STENCIL_TEST );
  372. }
  373. /*
  374. =============
  375. RB_SetBuffer
  376. =============
  377. */
  378. static void RB_SetBuffer( const void *data ) {
  379. const setBufferCommand_t *cmd;
  380. // see which draw buffer we want to render the frame to
  381. cmd = (const setBufferCommand_t *)data;
  382. backEnd.frameCount = cmd->frameCount;
  383. qglDrawBuffer( cmd->buffer );
  384. // clear screen for debugging
  385. // automatically enable this with several other debug tools
  386. // that might leave unrendered portions of the screen
  387. if ( r_clear.GetFloat() || idStr::Length( r_clear.GetString() ) != 1 || r_lockSurfaces.GetBool() || r_singleArea.GetBool() || r_showOverDraw.GetBool() ) {
  388. float c[3];
  389. if ( sscanf( r_clear.GetString(), "%f %f %f", &c[0], &c[1], &c[2] ) == 3 ) {
  390. qglClearColor( c[0], c[1], c[2], 1 );
  391. } else if ( r_clear.GetInteger() == 2 ) {
  392. qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
  393. } else if ( r_showOverDraw.GetBool() ) {
  394. qglClearColor( 1.0f, 1.0f, 1.0f, 1.0f );
  395. } else {
  396. qglClearColor( 1.0f, 0.0f, 1.0f, 1.0f );
  397. }
  398. qglClear( GL_COLOR_BUFFER_BIT );
  399. }
  400. }
  401. /*
  402. ===============
  403. RB_ShowImages
  404. Draw all the images to the screen, on top of whatever
  405. was there. This is used to test for texture thrashing.
  406. ===============
  407. */
  408. void RB_ShowImages( void ) {
  409. int i;
  410. idImage *image;
  411. float x, y, w, h;
  412. int start, end;
  413. RB_SetGL2D();
  414. //qglClearColor( 0.2, 0.2, 0.2, 1 );
  415. //qglClear( GL_COLOR_BUFFER_BIT );
  416. qglFinish();
  417. start = Sys_Milliseconds();
  418. for ( i = 0 ; i < globalImages->images.Num() ; i++ ) {
  419. image = globalImages->images[i];
  420. if ( image->texnum == idImage::TEXTURE_NOT_LOADED && image->partialImage == NULL ) {
  421. continue;
  422. }
  423. w = glConfig.vidWidth / 20;
  424. h = glConfig.vidHeight / 15;
  425. x = i % 20 * w;
  426. y = i / 20 * h;
  427. // show in proportional size in mode 2
  428. if ( r_showImages.GetInteger() == 2 ) {
  429. w *= image->uploadWidth / 512.0f;
  430. h *= image->uploadHeight / 512.0f;
  431. }
  432. image->Bind();
  433. qglBegin (GL_QUADS);
  434. qglTexCoord2f( 0, 0 );
  435. qglVertex2f( x, y );
  436. qglTexCoord2f( 1, 0 );
  437. qglVertex2f( x + w, y );
  438. qglTexCoord2f( 1, 1 );
  439. qglVertex2f( x + w, y + h );
  440. qglTexCoord2f( 0, 1 );
  441. qglVertex2f( x, y + h );
  442. qglEnd();
  443. }
  444. qglFinish();
  445. end = Sys_Milliseconds();
  446. common->Printf( "%i msec to draw all images\n", end - start );
  447. }
  448. /*
  449. =============
  450. RB_SwapBuffers
  451. =============
  452. */
  453. const void RB_SwapBuffers( const void *data ) {
  454. // texture swapping test
  455. if ( r_showImages.GetInteger() != 0 ) {
  456. RB_ShowImages();
  457. }
  458. // force a gl sync if requested
  459. if ( r_finish.GetBool() ) {
  460. qglFinish();
  461. }
  462. RB_LogComment( "***************** RB_SwapBuffers *****************\n\n\n" );
  463. // don't flip if drawing to front buffer
  464. if ( !r_frontBuffer.GetBool() ) {
  465. GLimp_SwapBuffers();
  466. }
  467. }
  468. /*
  469. =============
  470. RB_CopyRender
  471. Copy part of the current framebuffer to an image
  472. =============
  473. */
  474. const void RB_CopyRender( const void *data ) {
  475. const copyRenderCommand_t *cmd;
  476. cmd = (const copyRenderCommand_t *)data;
  477. if ( r_skipCopyTexture.GetBool() ) {
  478. return;
  479. }
  480. RB_LogComment( "***************** RB_CopyRender *****************\n" );
  481. if (cmd->image) {
  482. cmd->image->CopyFramebuffer( cmd->x, cmd->y, cmd->imageWidth, cmd->imageHeight, false );
  483. }
  484. }
  485. /*
  486. ====================
  487. RB_ExecuteBackEndCommands
  488. This function will be called syncronously if running without
  489. smp extensions, or asyncronously by another thread.
  490. ====================
  491. */
  492. int backEndStartTime, backEndFinishTime;
  493. void RB_ExecuteBackEndCommands( const emptyCommand_t *cmds ) {
  494. // r_debugRenderToTexture
  495. int c_draw3d = 0, c_draw2d = 0, c_setBuffers = 0, c_swapBuffers = 0, c_copyRenders = 0;
  496. if ( cmds->commandId == RC_NOP && !cmds->next ) {
  497. return;
  498. }
  499. backEndStartTime = Sys_Milliseconds();
  500. // needed for editor rendering
  501. RB_SetDefaultGLState();
  502. // upload any image loads that have completed
  503. globalImages->CompleteBackgroundImageLoads();
  504. for ( ; cmds ; cmds = (const emptyCommand_t *)cmds->next ) {
  505. switch ( cmds->commandId ) {
  506. case RC_NOP:
  507. break;
  508. case RC_DRAW_VIEW:
  509. RB_DrawView( cmds );
  510. if ( ((const drawSurfsCommand_t *)cmds)->viewDef->viewEntitys ) {
  511. c_draw3d++;
  512. }
  513. else {
  514. c_draw2d++;
  515. }
  516. break;
  517. case RC_SET_BUFFER:
  518. RB_SetBuffer( cmds );
  519. c_setBuffers++;
  520. break;
  521. case RC_SWAP_BUFFERS:
  522. RB_SwapBuffers( cmds );
  523. c_swapBuffers++;
  524. break;
  525. case RC_COPY_RENDER:
  526. RB_CopyRender( cmds );
  527. c_copyRenders++;
  528. break;
  529. default:
  530. common->Error( "RB_ExecuteBackEndCommands: bad commandId" );
  531. break;
  532. }
  533. }
  534. // go back to the default texture so the editor doesn't mess up a bound image
  535. qglBindTexture( GL_TEXTURE_2D, 0 );
  536. backEnd.glState.tmu[0].current2DMap = -1;
  537. // stop rendering on this thread
  538. backEndFinishTime = Sys_Milliseconds();
  539. backEnd.pc.msec = backEndFinishTime - backEndStartTime;
  540. if ( r_debugRenderToTexture.GetInteger() == 1 ) {
  541. common->Printf( "3d: %i, 2d: %i, SetBuf: %i, SwpBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_swapBuffers, c_copyRenders, backEnd.c_copyFrameBuffer );
  542. backEnd.c_copyFrameBuffer = 0;
  543. }
  544. }