VirtualBox

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

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

3D: Validation of glDeleteQueries arguments

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