VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_bufferobject.c@ 76690

Last change on this file since 76690 was 74890, checked in by vboxsync, 6 years ago

3D: Memory allocations fixed, bugref:9251. Merged changes r125768, r125779, r125780, r125812.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.5 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 "chromium.h"
8#include "cr_error.h"
9#include "cr_mem.h"
10#include "server_dispatch.h"
11#include "server.h"
12
13void * SERVER_DISPATCH_APIENTRY
14crServerDispatchMapBufferARB( GLenum target, GLenum access )
15{
16 return NULL;
17}
18
19GLboolean SERVER_DISPATCH_APIENTRY
20crServerDispatchUnmapBufferARB( GLenum target )
21{
22 return GL_FALSE;
23}
24
25void SERVER_DISPATCH_APIENTRY
26crServerDispatchGenBuffersARB(GLsizei n, GLuint *buffers)
27{
28 GLuint *local_buffers;
29 (void) buffers;
30
31 if (n >= INT32_MAX / sizeof(GLuint))
32 {
33 crError("crServerDispatchGenBuffersARB: parameter 'n' is out of range");
34 return;
35 }
36
37 local_buffers = (GLuint *)crCalloc(n * sizeof(*local_buffers));
38
39 if (!local_buffers)
40 {
41 crError("crServerDispatchGenBuffersARB: out of memory");
42 return;
43 }
44
45 crStateGenBuffersARB(n, local_buffers);
46
47 crServerReturnValue( local_buffers, n * sizeof(*local_buffers) );
48 crFree( local_buffers );
49}
50
51void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteBuffersARB( GLsizei n, const GLuint * buffer )
52{
53 crStateDeleteBuffersARB( n, buffer );
54}
55
56void SERVER_DISPATCH_APIENTRY
57crServerDispatchGetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
58{
59 crError( "glGetBufferPointervARB isn't *ever* allowed to be on the wire!" );
60 (void) target;
61 (void) pname;
62 (void) params;
63}
64
65void SERVER_DISPATCH_APIENTRY
66crServerDispatchGetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data)
67{
68 void *b;
69
70 b = crCalloc(size);
71 if (b) {
72 cr_server.head_spu->dispatch_table.GetBufferSubDataARB( target, offset, size, b );
73
74 crServerReturnValue( b, size );
75 crFree( b );
76 }
77 else {
78 crError("Out of memory in crServerDispatchGetBufferSubDataARB");
79 }
80}
81
82void SERVER_DISPATCH_APIENTRY
83crServerDispatchBindBufferARB(GLenum target, GLuint buffer)
84{
85 crStateBindBufferARB(target, buffer);
86 cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID(buffer));
87}
88
89GLboolean SERVER_DISPATCH_APIENTRY
90crServerDispatchIsBufferARB(GLuint buffer)
91{
92 /* since GenBuffersARB issued to host ogl only on bind + some other ops, the host drivers may not know about them
93 * so use state data*/
94 GLboolean retval = crStateIsBufferARB(buffer);
95 crServerReturnValue( &retval, sizeof(retval) );
96 return retval; /* WILL PROBABLY BE IGNORED */
97}
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