1 | /*
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "unpacker.h"
|
---|
8 |
|
---|
9 | void crUnpackExtendChromiumParametervCR(PCrUnpackerState pState)
|
---|
10 | {
|
---|
11 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
|
---|
12 |
|
---|
13 | GLenum target = READ_DATA(pState, 8, GLenum );
|
---|
14 | GLenum type = READ_DATA(pState, 12, GLenum );
|
---|
15 | GLsizei count = READ_DATA(pState, 16, GLsizei );
|
---|
16 | GLvoid *values = DATA_POINTER(pState, 20, GLvoid );
|
---|
17 |
|
---|
18 | size_t cbValue = 0;
|
---|
19 | switch (type)
|
---|
20 | {
|
---|
21 | case GL_BYTE:
|
---|
22 | case GL_UNSIGNED_BYTE:
|
---|
23 | cbValue = sizeof(GLbyte);
|
---|
24 | break;
|
---|
25 | case GL_SHORT:
|
---|
26 | case GL_UNSIGNED_SHORT:
|
---|
27 | cbValue = sizeof(GLshort);
|
---|
28 | break;
|
---|
29 | case GL_INT:
|
---|
30 | case GL_UNSIGNED_INT:
|
---|
31 | cbValue = sizeof(GLint);
|
---|
32 | break;
|
---|
33 | case GL_FLOAT:
|
---|
34 | cbValue = sizeof(GLfloat);
|
---|
35 | break;
|
---|
36 | case GL_DOUBLE:
|
---|
37 | cbValue = sizeof(GLdouble);
|
---|
38 | break;
|
---|
39 | default:
|
---|
40 | crError("crUnpackExtendChromiumParametervCR: Invalid type (%#x) passed!\n", type);
|
---|
41 | pState->rcUnpack = VERR_INVALID_PARAMETER;
|
---|
42 | return;
|
---|
43 | }
|
---|
44 |
|
---|
45 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, values, count, cbValue);
|
---|
46 | pState->pDispatchTbl->ChromiumParametervCR(target, type, count, values);
|
---|
47 | }
|
---|
48 |
|
---|
49 | void crUnpackExtendDeleteQueriesARB(PCrUnpackerState pState)
|
---|
50 | {
|
---|
51 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
|
---|
52 |
|
---|
53 | GLsizei n = READ_DATA(pState, 8, GLsizei );
|
---|
54 | const GLuint *ids = DATA_POINTER(pState, 12, GLuint);
|
---|
55 |
|
---|
56 | if (n <= 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(pState, 12 + n * sizeof(GLuint)))
|
---|
57 | {
|
---|
58 | crError("crUnpackExtendDeleteQueriesARB: parameter 'n' is out of range");
|
---|
59 | return;
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, ids, n, GLuint);
|
---|
64 | pState->pDispatchTbl->DeleteQueriesARB(n, ids);
|
---|
65 | }
|
---|
66 |
|
---|
67 | void crUnpackExtendGetPolygonStipple(PCrUnpackerState pState)
|
---|
68 | {
|
---|
69 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, CRNetworkPointer);
|
---|
70 |
|
---|
71 | SET_RETURN_PTR(pState, 8 );
|
---|
72 | SET_WRITEBACK_PTR(pState, 16 );
|
---|
73 | GLubyte *mask = DATA_POINTER(pState, 8, GLubyte);
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * This method will write to the set writeback buffer and not to the mask argument, the mask argument is only used
|
---|
77 | * for GL_PIXEL_PACK_BUFFER_ARB contexts where it denotes an offset (GLint) which was already enclosed in the
|
---|
78 | * buffer verification.
|
---|
79 | */
|
---|
80 | pState->pDispatchTbl->GetPolygonStipple( mask );
|
---|
81 | }
|
---|
82 |
|
---|
83 | void crUnpackExtendGetPixelMapfv(PCrUnpackerState pState)
|
---|
84 | {
|
---|
85 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
|
---|
86 |
|
---|
87 | GLenum map = READ_DATA(pState, 8, GLenum );
|
---|
88 |
|
---|
89 | SET_RETURN_PTR(pState, 12 );
|
---|
90 | SET_WRITEBACK_PTR(pState, 20 );
|
---|
91 | GLfloat *values = DATA_POINTER(pState, 12, GLfloat);
|
---|
92 |
|
---|
93 | /* see crUnpackExtendGetPolygonStipple() for verification notes. */
|
---|
94 | pState->pDispatchTbl->GetPixelMapfv( map, values );
|
---|
95 | }
|
---|
96 |
|
---|
97 | void crUnpackExtendGetPixelMapuiv(PCrUnpackerState pState)
|
---|
98 | {
|
---|
99 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
|
---|
100 |
|
---|
101 | GLenum map = READ_DATA(pState, 8, GLenum );
|
---|
102 | GLuint *values;
|
---|
103 |
|
---|
104 | SET_RETURN_PTR(pState, 12 );
|
---|
105 | SET_WRITEBACK_PTR(pState, 20 );
|
---|
106 | values = DATA_POINTER(pState, 12, GLuint);
|
---|
107 |
|
---|
108 | /* see crUnpackExtendGetPolygonStipple() for verification notes. */
|
---|
109 | pState->pDispatchTbl->GetPixelMapuiv( map, values );
|
---|
110 | }
|
---|
111 |
|
---|
112 | void crUnpackExtendGetPixelMapusv(PCrUnpackerState pState)
|
---|
113 | {
|
---|
114 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
|
---|
115 |
|
---|
116 | GLenum map = READ_DATA(pState, 8, GLenum );
|
---|
117 | GLushort *values;
|
---|
118 |
|
---|
119 | SET_RETURN_PTR(pState, 12 );
|
---|
120 | SET_WRITEBACK_PTR(pState, 20 );
|
---|
121 | values = DATA_POINTER(pState, 12, GLushort);
|
---|
122 |
|
---|
123 | /* see crUnpackExtendGetPolygonStipple() for verification notes. */
|
---|
124 | pState->pDispatchTbl->GetPixelMapusv( map, values );
|
---|
125 | }
|
---|
126 |
|
---|
127 | void crUnpackExtendVBoxTexPresent(PCrUnpackerState pState)
|
---|
128 | {
|
---|
129 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, GLint);
|
---|
130 |
|
---|
131 | GLuint texture = READ_DATA(pState, 8, GLuint );
|
---|
132 | GLuint cfg = READ_DATA(pState, 12, GLuint );
|
---|
133 | GLint xPos = READ_DATA(pState, 16, GLint );
|
---|
134 | GLint yPos = READ_DATA(pState, 20, GLint );
|
---|
135 | GLint cRects = READ_DATA(pState, 24, GLint );
|
---|
136 | GLint *pRects = (GLint *)DATA_POINTER(pState, 28, GLvoid );
|
---|
137 |
|
---|
138 | if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(pState, 28 + 4 * cRects * sizeof(GLint)))
|
---|
139 | {
|
---|
140 | crError("crUnpackExtendVBoxTexPresent: parameter 'cRects' is out of range");
|
---|
141 | return;
|
---|
142 | }
|
---|
143 |
|
---|
144 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pRects, cRects * 4, GLint); /* Each rect as 4 points. */
|
---|
145 | pState->pDispatchTbl->VBoxTexPresent( texture, cfg, xPos, yPos, cRects, pRects );
|
---|
146 | }
|
---|