VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c@ 42499

Last change on this file since 42499 was 42499, checked in by vboxsync, 12 years ago

crOgl/wddm: per-context connections

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_packfunctions.h"
8#include "cr_error.h"
9#include "cr_net.h"
10#include "packspu.h"
11#include "packspu_proto.h"
12
13#if 0
14
15void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
16{
17 GET_THREAD(thread);
18 if (pack_spu.swap)
19 {
20 crPackSwapBuffersSWAP( window, flags );
21 }
22 else
23 {
24 crPackSwapBuffers( window, flags );
25 }
26 packspuFlush( (void *) thread );
27}
28
29
30#else
31
32void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
33{
34 GET_THREAD(thread);
35
36 if (pack_spu.swap)
37 {
38 crPackSwapBuffersSWAP( window, flags );
39 }
40 else
41 {
42 crPackSwapBuffers( window, flags );
43 }
44 packspuFlush( (void *) thread );
45
46 if (!(thread->netServer.conn->actual_network))
47 {
48 /* no synchronization needed */
49 return;
50 }
51
52 if (pack_spu.swapbuffer_sync) {
53 /* This won't block unless there has been more than 1 frame
54 * since we received a writeback acknowledgement. In the
55 * normal case there's no performance penalty for doing this
56 * (beyond the cost of packing the writeback request into the
57 * stream and receiving the reply), but it eliminates the
58 * problem of runaway rendering that can occur, eg when
59 * rendering frames consisting of a single large display list
60 * in a tight loop.
61 *
62 * Note that this is *not* the same as doing a sync after each
63 * swapbuffers, which would force a round-trip 'bubble' into
64 * the network stream under normal conditions.
65 *
66 * This is complicated because writeback in the pack spu is
67 * overridden to always set the value to zero when the
68 * reply is received, rather than decrementing it:
69 */
70 switch( thread->writeback ) {
71 case 0:
72 /* Request writeback.
73 */
74 thread->writeback = 1;
75 if (pack_spu.swap)
76 {
77 crPackWritebackSWAP( (GLint *) &thread->writeback );
78 }
79 else
80 {
81 crPackWriteback( (GLint *) &thread->writeback );
82 }
83 break;
84 case 1:
85 /* Make sure writeback from previous frame has been received.
86 */
87 CRPACKSPU_WRITEBACK_WAIT(thread, thread->writeback);
88 break;
89 }
90 }
91
92 /* want to emit a parameter here */
93 if (pack_spu.emit_GATHER_POST_SWAPBUFFERS)
94 {
95 if (pack_spu.swap)
96 crPackChromiumParameteriCRSWAP(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
97 else
98 crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
99 }
100}
101
102#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette