Changeset 76792 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Jan 12, 2019 5:35:44 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getmap.c
r69390 r76792 16 16 { 17 17 switch (target) { 18 case GL_MAP1_VERTEX_3: 19 case GL_MAP1_VERTEX_4: 20 case GL_MAP1_INDEX: 21 case GL_MAP1_COLOR_4: 22 case GL_MAP1_NORMAL: 23 case GL_MAP1_TEXTURE_COORD_1: 24 case GL_MAP1_TEXTURE_COORD_2: 25 case GL_MAP1_TEXTURE_COORD_3: 26 case GL_MAP1_TEXTURE_COORD_4: 27 case GL_MAP2_VERTEX_3: 28 case GL_MAP2_VERTEX_4: 29 case GL_MAP2_INDEX: 30 case GL_MAP2_COLOR_4: 31 case GL_MAP2_NORMAL: 32 case GL_MAP2_TEXTURE_COORD_1: 33 case GL_MAP2_TEXTURE_COORD_2: 34 case GL_MAP2_TEXTURE_COORD_3: 35 case GL_MAP2_TEXTURE_COORD_4: 36 default: 18 case GL_MAP1_VERTEX_3: return 3; 19 case GL_MAP1_VERTEX_4: return 4; 20 case GL_MAP1_INDEX: return 1; 21 case GL_MAP1_COLOR_4: return 4; 22 case GL_MAP1_NORMAL: return 3; 23 case GL_MAP1_TEXTURE_COORD_1: return 1; 24 case GL_MAP1_TEXTURE_COORD_2: return 2; 25 case GL_MAP1_TEXTURE_COORD_3: return 3; 26 case GL_MAP1_TEXTURE_COORD_4: return 4; 27 case GL_MAP2_VERTEX_3: return 3; 28 case GL_MAP2_VERTEX_4: return 4; 29 case GL_MAP2_INDEX: return 1; 30 case GL_MAP2_COLOR_4: return 4; 31 case GL_MAP2_NORMAL: return 3; 32 case GL_MAP2_TEXTURE_COORD_1: return 1; 33 case GL_MAP2_TEXTURE_COORD_2: return 2; 34 case GL_MAP2_TEXTURE_COORD_3: return 3; 35 case GL_MAP2_TEXTURE_COORD_4: return 4; 36 default: return 0; 37 37 } 38 38 } 39 39 40 static GLuint __evaluator_dimension( GLenum target ) 41 { 42 switch( target ) 43 { 44 case GL_MAP1_COLOR_4: 45 case GL_MAP1_INDEX: 46 case GL_MAP1_NORMAL: 47 case GL_MAP1_TEXTURE_COORD_1: 48 case GL_MAP1_TEXTURE_COORD_2: 49 case GL_MAP1_TEXTURE_COORD_3: 50 case GL_MAP1_TEXTURE_COORD_4: 51 case GL_MAP1_VERTEX_3: 52 case GL_MAP1_VERTEX_4: 53 return 1; 54 55 case GL_MAP2_COLOR_4: 56 case GL_MAP2_INDEX: 57 case GL_MAP2_NORMAL: 58 case GL_MAP2_TEXTURE_COORD_1: 59 case GL_MAP2_TEXTURE_COORD_2: 60 case GL_MAP2_TEXTURE_COORD_3: 61 case GL_MAP2_TEXTURE_COORD_4: 62 case GL_MAP2_VERTEX_3: 63 case GL_MAP2_VERTEX_4: 64 return 2; 65 66 default: 67 return 0; 68 } 69 } 70 40 71 void SERVER_DISPATCH_APIENTRY crServerDispatchGetMapdv( GLenum target, GLenum query, GLdouble *v ) 41 72 { 42 GLdouble *coeffs = NULL; 43 GLdouble order[2]; 44 GLdouble domain[4]; 45 GLdouble *retptr = NULL; 46 GLint tempOrder[2]; 47 int dimension = 0; 48 unsigned int size = sizeof(GLdouble); 49 int evalcomp = __evaluator_components(target); 50 51 (void) v; 52 53 switch( target ) 54 { 55 case GL_MAP1_COLOR_4: 56 case GL_MAP1_INDEX: 57 case GL_MAP1_NORMAL: 58 case GL_MAP1_TEXTURE_COORD_1: 59 case GL_MAP1_TEXTURE_COORD_2: 60 case GL_MAP1_TEXTURE_COORD_3: 61 case GL_MAP1_TEXTURE_COORD_4: 62 case GL_MAP1_VERTEX_3: 63 case GL_MAP1_VERTEX_4: 64 dimension = 1; 65 break; 66 case GL_MAP2_COLOR_4: 67 case GL_MAP2_INDEX: 68 case GL_MAP2_NORMAL: 69 case GL_MAP2_TEXTURE_COORD_1: 70 case GL_MAP2_TEXTURE_COORD_2: 71 case GL_MAP2_TEXTURE_COORD_3: 72 case GL_MAP2_TEXTURE_COORD_4: 73 case GL_MAP2_VERTEX_3: 74 case GL_MAP2_VERTEX_4: 75 dimension = 2; 76 break; 77 default: 78 crError( "Bad target in crServerDispatchGetMapdv: %d", target ); 79 break; 80 } 81 82 switch(query) 83 { 84 case GL_ORDER: 85 cr_server.head_spu->dispatch_table.GetMapdv( target, query, order ); 86 retptr = &(order[0]); 87 size *= dimension; 88 break; 89 case GL_DOMAIN: 90 cr_server.head_spu->dispatch_table.GetMapdv( target, query, domain ); 91 retptr = &(domain[0]); 92 size *= dimension * 2; 93 break; 94 case GL_COEFF: 95 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 96 size *= evalcomp * tempOrder[0]; 97 if (dimension == 2) 98 size *= tempOrder[1]; 99 coeffs = (GLdouble *) crAlloc( size ); 100 cr_server.head_spu->dispatch_table.GetMapdv( target, query, coeffs ); 101 retptr = coeffs; 102 break; 103 default: 104 crError( "Bad query in crServerDispatchGetMapdv: %d", query ); 105 break; 106 } 107 108 crServerReturnValue( retptr, size ); 109 if (query == GL_COEFF) 110 { 111 crFree(coeffs); 112 } 73 GLdouble *coeffs = NULL; 74 GLdouble *retptr = NULL; 75 GLdouble order[2] = {0}; 76 GLdouble domain[4] = {0}; 77 GLint tempOrder[2] = {0}; 78 int dimension, evalcomp; 79 unsigned int size = sizeof(GLdouble); 80 (void) v; 81 82 evalcomp = __evaluator_components(target); 83 dimension = __evaluator_dimension(target); 84 85 if (evalcomp == 0 || dimension == 0) 86 { 87 crError( "Bad target in crServerDispatchGetMapdv: %d", target ); 88 return; 89 } 90 91 switch(query) 92 { 93 case GL_ORDER: 94 cr_server.head_spu->dispatch_table.GetMapdv( target, query, order ); 95 retptr = &(order[0]); 96 size *= dimension; 97 break; 98 case GL_DOMAIN: 99 cr_server.head_spu->dispatch_table.GetMapdv( target, query, domain ); 100 retptr = &(domain[0]); 101 size *= dimension * 2; 102 break; 103 case GL_COEFF: 104 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 105 size *= evalcomp * tempOrder[0]; 106 if (dimension == 2) 107 size *= tempOrder[1]; 108 109 if (size) 110 coeffs = (GLdouble *) crCalloc( size ); 111 112 if (coeffs) 113 { 114 cr_server.head_spu->dispatch_table.GetMapdv( target, query, coeffs ); 115 retptr = coeffs; 116 } 117 break; 118 default: 119 crError( "Bad query in crServerDispatchGetMapdv: %d", query ); 120 return; 121 } 122 123 crServerReturnValue( retptr, size ); 124 if (coeffs) 125 { 126 crFree(coeffs); 127 } 113 128 } 114 129 115 130 void SERVER_DISPATCH_APIENTRY crServerDispatchGetMapfv( GLenum target, GLenum query, GLfloat *v ) 116 131 { 117 GLfloat *coeffs = NULL; 118 GLfloat order[2]; 119 GLfloat domain[4]; 120 GLfloat *retptr = NULL; 121 GLint tempOrder[2]; 122 int dimension = 0; 123 unsigned int size = sizeof(GLfloat); 124 int evalcomp = __evaluator_components(target); 125 126 (void) v; 127 128 switch( target ) 129 { 130 case GL_MAP1_COLOR_4: 131 case GL_MAP1_INDEX: 132 case GL_MAP1_NORMAL: 133 case GL_MAP1_TEXTURE_COORD_1: 134 case GL_MAP1_TEXTURE_COORD_2: 135 case GL_MAP1_TEXTURE_COORD_3: 136 case GL_MAP1_TEXTURE_COORD_4: 137 case GL_MAP1_VERTEX_3: 138 case GL_MAP1_VERTEX_4: 139 dimension = 1; 140 break; 141 case GL_MAP2_COLOR_4: 142 case GL_MAP2_INDEX: 143 case GL_MAP2_NORMAL: 144 case GL_MAP2_TEXTURE_COORD_1: 145 case GL_MAP2_TEXTURE_COORD_2: 146 case GL_MAP2_TEXTURE_COORD_3: 147 case GL_MAP2_TEXTURE_COORD_4: 148 case GL_MAP2_VERTEX_3: 149 case GL_MAP2_VERTEX_4: 150 dimension = 2; 151 break; 152 default: 153 crError( "Bad target in crServerDispatchGetMapfv: %d", target ); 154 break; 155 } 156 157 switch(query) 158 { 159 case GL_ORDER: 160 cr_server.head_spu->dispatch_table.GetMapfv( target, query, order ); 161 retptr = &(order[0]); 162 size *= dimension; 163 break; 164 case GL_DOMAIN: 165 cr_server.head_spu->dispatch_table.GetMapfv( target, query, domain ); 166 retptr = &(domain[0]); 167 size *= dimension * 2; 168 break; 169 case GL_COEFF: 170 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 171 size *= evalcomp * tempOrder[0]; 172 if (dimension == 2) 173 size *= tempOrder[1]; 174 coeffs = (GLfloat *) crAlloc( size ); 175 cr_server.head_spu->dispatch_table.GetMapfv( target, query, coeffs ); 176 retptr = coeffs; 177 break; 178 default: 179 crError( "Bad query in crServerDispatchGetMapfv: %d", query ); 180 break; 181 } 182 183 crServerReturnValue( retptr, size ); 184 if (query == GL_COEFF) 185 { 186 crFree(coeffs); 187 } 132 GLfloat *coeffs = NULL; 133 GLfloat *retptr = NULL; 134 GLfloat order[2] = {0}; 135 GLfloat domain[4] = {0}; 136 GLint tempOrder[2] = {0}; 137 int dimension, evalcomp; 138 unsigned int size = sizeof(GLfloat); 139 (void) v; 140 141 evalcomp = __evaluator_components(target); 142 dimension = __evaluator_dimension(target); 143 144 if (evalcomp == 0 || dimension == 0) 145 { 146 crError( "Bad target in crServerDispatchGetMapfv: %d", target ); 147 return; 148 } 149 150 switch(query) 151 { 152 case GL_ORDER: 153 cr_server.head_spu->dispatch_table.GetMapfv( target, query, order ); 154 retptr = &(order[0]); 155 size *= dimension; 156 break; 157 case GL_DOMAIN: 158 cr_server.head_spu->dispatch_table.GetMapfv( target, query, domain ); 159 retptr = &(domain[0]); 160 size *= dimension * 2; 161 break; 162 case GL_COEFF: 163 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 164 size *= evalcomp * tempOrder[0]; 165 if (dimension == 2) 166 size *= tempOrder[1]; 167 168 if (size) 169 coeffs = (GLfloat *) crCalloc( size ); 170 171 if (coeffs) 172 { 173 cr_server.head_spu->dispatch_table.GetMapfv( target, query, coeffs ); 174 retptr = coeffs; 175 } 176 break; 177 default: 178 crError( "Bad query in crServerDispatchGetMapfv: %d", query ); 179 return; 180 } 181 182 crServerReturnValue( retptr, size ); 183 if (coeffs) 184 { 185 crFree(coeffs); 186 } 188 187 } 189 188 190 189 void SERVER_DISPATCH_APIENTRY crServerDispatchGetMapiv( GLenum target, GLenum query, GLint *v ) 191 190 { 192 GLint *coeffs = NULL; 193 GLint order[2]; 194 GLint domain[4]; 195 GLint *retptr = NULL; 196 GLint tempOrder[2]; 197 int dimension = 0; 198 unsigned int size = sizeof(GLint); 199 int evalcomp = __evaluator_components(target); 200 201 (void) v; 202 203 switch( target ) 204 { 205 case GL_MAP1_COLOR_4: 206 case GL_MAP1_INDEX: 207 case GL_MAP1_NORMAL: 208 case GL_MAP1_TEXTURE_COORD_1: 209 case GL_MAP1_TEXTURE_COORD_2: 210 case GL_MAP1_TEXTURE_COORD_3: 211 case GL_MAP1_TEXTURE_COORD_4: 212 case GL_MAP1_VERTEX_3: 213 case GL_MAP1_VERTEX_4: 214 dimension = 1; 215 break; 216 case GL_MAP2_COLOR_4: 217 case GL_MAP2_INDEX: 218 case GL_MAP2_NORMAL: 219 case GL_MAP2_TEXTURE_COORD_1: 220 case GL_MAP2_TEXTURE_COORD_2: 221 case GL_MAP2_TEXTURE_COORD_3: 222 case GL_MAP2_TEXTURE_COORD_4: 223 case GL_MAP2_VERTEX_3: 224 case GL_MAP2_VERTEX_4: 225 dimension = 2; 226 break; 227 default: 228 crError( "Bad target in crServerDispatchGetMapiv: %d", target ); 229 break; 230 } 231 232 switch(query) 233 { 234 case GL_ORDER: 235 cr_server.head_spu->dispatch_table.GetMapiv( target, query, order ); 236 retptr = &(order[0]); 237 size *= dimension; 238 break; 239 case GL_DOMAIN: 240 cr_server.head_spu->dispatch_table.GetMapiv( target, query, domain ); 241 retptr = &(domain[0]); 242 size *= dimension * 2; 243 break; 244 case GL_COEFF: 245 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 246 size *= evalcomp * tempOrder[0]; 247 if (dimension == 2) 248 size *= tempOrder[1]; 249 coeffs = (GLint *) crAlloc( size ); 250 cr_server.head_spu->dispatch_table.GetMapiv( target, query, coeffs ); 251 retptr = coeffs; 252 break; 253 default: 254 crError( "Bad query in crServerDispatchGetMapiv: %d", query ); 255 break; 256 } 257 258 crServerReturnValue( retptr, size ); 259 if (query == GL_COEFF) 260 { 261 crFree(coeffs); 262 } 263 } 264 191 GLint *coeffs = NULL; 192 GLint *retptr = NULL; 193 GLint order[2] = {0}; 194 GLint domain[4] = {0}; 195 GLint tempOrder[2] = {0}; 196 int dimension, evalcomp; 197 unsigned int size = sizeof(GLint); 198 (void) v; 199 200 evalcomp = __evaluator_components(target); 201 dimension = __evaluator_dimension(target); 202 203 if (evalcomp == 0 || dimension == 0) 204 { 205 crError( "Bad target in crServerDispatchGetMapiv: %d", target ); 206 return; 207 } 208 209 switch(query) 210 { 211 case GL_ORDER: 212 cr_server.head_spu->dispatch_table.GetMapiv( target, query, order ); 213 retptr = &(order[0]); 214 size *= dimension; 215 break; 216 case GL_DOMAIN: 217 cr_server.head_spu->dispatch_table.GetMapiv( target, query, domain ); 218 retptr = &(domain[0]); 219 size *= dimension * 2; 220 break; 221 case GL_COEFF: 222 cr_server.head_spu->dispatch_table.GetMapiv( target, GL_ORDER, tempOrder ); 223 size *= evalcomp * tempOrder[0]; 224 if (dimension == 2) 225 size *= tempOrder[1]; 226 227 if (size) 228 coeffs = (GLint *) crCalloc( size ); 229 230 if (coeffs) 231 { 232 cr_server.head_spu->dispatch_table.GetMapiv( target, query, coeffs ); 233 retptr = coeffs; 234 } 235 break; 236 default: 237 crError( "Bad query in crServerDispatchGetMapiv: %d", query ); 238 break; 239 } 240 241 crServerReturnValue( retptr, size ); 242 if (coeffs) 243 { 244 crFree(coeffs); 245 } 246 } 247
Note:
See TracChangeset
for help on using the changeset viewer.