VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c@ 37216

Last change on this file since 37216 was 33475, checked in by vboxsync, 14 years ago

crOpenGL/wddm: multithreading fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 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 "packer.h"
8#include "cr_opcodes.h"
9#include "cr_mem.h"
10
11void PACK_APIENTRY crPackBoundsInfoCR( const CRrecti *bounds, const GLbyte *payload, GLint len, GLint num_opcodes )
12{
13 CR_GET_PACKER_CONTEXT(pc);
14 /* Don't get the buffered_ptr here because we've already
15 * verified that there's enough space for everything. */
16
17 unsigned char *data_ptr;
18 int len_aligned, total_len;
19
20 CR_LOCK_PACKER_CONTEXT(pc);
21
22 data_ptr = pc->buffer.data_current;
23 len_aligned = ( len + 0x3 ) & ~0x3;
24 total_len = 24 + len_aligned;
25
26 WRITE_DATA( 0, int, total_len );
27 WRITE_DATA( 4, int, bounds->x1 );
28 WRITE_DATA( 8, int, bounds->y1 );
29 WRITE_DATA( 12, int, bounds->x2 );
30 WRITE_DATA( 16, int, bounds->y2 );
31 WRITE_DATA( 20, int, num_opcodes );
32
33 /* skip the BOUNDSINFO */
34 data_ptr += 24;
35
36 /* put in padding opcodes (deliberately bogus) */
37 switch ( len_aligned - len )
38 {
39 case 3: *data_ptr++ = 0xff; /* FALLTHROUGH */
40 case 2: *data_ptr++ = 0xff; /* FALLTHROUGH */
41 case 1: *data_ptr++ = 0xff; /* FALLTHROUGH */
42 default: break;
43 }
44
45 crMemcpy( data_ptr, payload, len );
46
47 WRITE_OPCODE( pc, CR_BOUNDSINFOCR_OPCODE );
48 pc->buffer.data_current += 24 + len_aligned;
49 CR_UNLOCK_PACKER_CONTEXT(pc);
50}
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