VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_bufferobject.c@ 21306

Last change on this file since 21306 was 21306, checked in by vboxsync, 15 years ago

crOpenGL: tabs to spaces

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 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_error.h"
9#include "cr_string.h"
10#include "cr_version.h"
11
12
13void PACK_APIENTRY
14crPackMapBufferARB( GLenum target, GLenum access,
15 void * return_value, int * writeback )
16{
17 (void)writeback;
18 (void)return_value;
19 (void)target;
20 (void)access;
21 crWarning("Can't pack MapBufferARB command!");
22}
23
24
25void PACK_APIENTRY
26crPackUnmapBufferARB( GLenum target, GLboolean* return_value, int * writeback )
27{
28 (void)target;
29 (void)return_value;
30 (void)writeback;
31 crWarning("Can't pack UnmapBufferARB command!");
32}
33
34
35void PACK_APIENTRY
36crPackBufferDataARB( GLenum target, GLsizeiptrARB size,
37 const GLvoid * data, GLenum usage )
38{
39 unsigned char *data_ptr;
40 int packet_length;
41
42 packet_length = sizeof(GLenum)
43 + sizeof(target) + sizeof(size) + sizeof(usage) + size;
44
45 data_ptr = (unsigned char *) crPackAlloc( packet_length );
46
47 WRITE_DATA( 0, GLenum, CR_BUFFERDATAARB_EXTEND_OPCODE );
48 WRITE_DATA( 4, GLenum, target );
49 WRITE_DATA( 8, GLsizeiptrARB, size ); /* XXX or 8 bytes? */
50 WRITE_DATA( 12, GLenum, usage );
51 if (data)
52 crMemcpy( data_ptr + 16, data, size );
53
54 crHugePacket( CR_EXTEND_OPCODE, data_ptr );
55 crPackFree( data_ptr );
56}
57
58
59void PACK_APIENTRY
60crPackBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size,
61 const GLvoid * data )
62{
63 unsigned char *data_ptr;
64 int packet_length;
65
66 if (!data)
67 return;
68
69 packet_length = sizeof(GLenum)
70 + sizeof(target) + sizeof(offset) + sizeof(size) + size;
71
72 data_ptr = (unsigned char *) crPackAlloc( packet_length );
73 WRITE_DATA( 0, GLenum, CR_BUFFERSUBDATAARB_EXTEND_OPCODE );
74 WRITE_DATA( 4, GLenum, target );
75 WRITE_DATA( 8, GLintptrARB, offset ); /* XXX or 8 bytes? */
76 WRITE_DATA( 12, GLsizeiptrARB, size ); /* XXX or 8 bytes? */
77 crMemcpy( data_ptr + 16, data, size );
78
79 crHugePacket( CR_EXTEND_OPCODE, data_ptr );
80 crPackFree( data_ptr );
81}
82
83
84void PACK_APIENTRY
85crPackDeleteBuffersARB(GLsizei n, const GLuint * buffers)
86{
87 unsigned char *data_ptr;
88 int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*buffers);
89
90 if (!buffers)
91 return;
92
93 data_ptr = (unsigned char *) crPackAlloc(packet_length);
94 WRITE_DATA( 0, GLenum, CR_DELETEBUFFERSARB_EXTEND_OPCODE );
95 WRITE_DATA( 4, GLsizei, n );
96 crMemcpy( data_ptr + 8, buffers, n * sizeof(*buffers) );
97 crHugePacket( CR_EXTEND_OPCODE, data_ptr );
98 crPackFree( data_ptr );
99}
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