VirtualBox

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

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

3D: Parameters validation corrected, bugref:9327

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.6 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 <= 0 || 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 if (size <= 0 || size >= INT32_MAX / 2)
71 {
72 crError("crServerDispatchGetBufferSubDataARB: size is out of range");
73 return;
74 }
75
76 b = crCalloc(size);
77
78 if (b) {
79 cr_server.head_spu->dispatch_table.GetBufferSubDataARB( target, offset, size, b );
80
81 crServerReturnValue( b, size );
82 crFree( b );
83 }
84 else {
85 crError("Out of memory in crServerDispatchGetBufferSubDataARB");
86 }
87}
88
89void SERVER_DISPATCH_APIENTRY
90crServerDispatchBindBufferARB(GLenum target, GLuint buffer)
91{
92 crStateBindBufferARB(target, buffer);
93 cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID(buffer));
94}
95
96GLboolean SERVER_DISPATCH_APIENTRY
97crServerDispatchIsBufferARB(GLuint buffer)
98{
99 /* since GenBuffersARB issued to host ogl only on bind + some other ops, the host drivers may not know about them
100 * so use state data*/
101 GLboolean retval = crStateIsBufferARB(buffer);
102 crServerReturnValue( &retval, sizeof(retval) );
103 return retval; /* WILL PROBABLY BE IGNORED */
104}
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