es1_conversion.c revision 8a263b6efd2c520a4ed9c98b9c8142c6c2c6f389
1#include <stdbool.h> 2#include "main/mfeatures.h" 3 4#if FEATURE_ES1 5 6#include "api_loopback.h" 7#include "api_exec.h" 8#include "blend.h" 9#include "clear.h" 10#include "clip.h" 11#include "context.h" 12#include "depth.h" 13#include "fog.h" 14#include "imports.h" 15#include "light.h" 16#include "lines.h" 17#include "matrix.h" 18#include "multisample.h" 19#include "pixelstore.h" 20#include "points.h" 21#include "polygon.h" 22#include "readpix.h" 23#include "texenv.h" 24#include "texgen.h" 25#include "texobj.h" 26#include "texparam.h" 27#include "mtypes.h" 28#include "viewport.h" 29#include "main/drawtex.h" 30#include "vbo/vbo.h" 31 32#ifndef GL_APIENTRY 33#define GL_APIENTRY GLAPIENTRY 34#endif 35 36#include "main/es1_conversion.h" 37 38void GL_APIENTRY 39_es_AlphaFuncx(GLenum func, GLclampx ref) 40{ 41 _mesa_AlphaFunc(func, (GLclampf) (ref / 65536.0f)); 42} 43 44void GL_APIENTRY 45_es_ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) 46{ 47 _mesa_ClearColor((GLclampf) (red / 65536.0f), 48 (GLclampf) (green / 65536.0f), 49 (GLclampf) (blue / 65536.0f), 50 (GLclampf) (alpha / 65536.0f)); 51} 52 53void GL_APIENTRY 54_es_ClearDepthx(GLclampx depth) 55{ 56 _mesa_ClearDepthf((GLclampf) (depth / 65536.0f)); 57} 58 59void GL_APIENTRY 60_es_ClipPlanef(GLenum plane, const GLfloat *equation) 61{ 62 unsigned int i; 63 GLdouble converted_equation[4]; 64 65 for (i = 0; i < Elements(converted_equation); i++) { 66 converted_equation[i] = (GLdouble) (equation[i]); 67 } 68 69 _mesa_ClipPlane(plane, converted_equation); 70} 71 72void GL_APIENTRY 73_es_ClipPlanex(GLenum plane, const GLfixed *equation) 74{ 75 unsigned int i; 76 GLdouble converted_equation[4]; 77 78 for (i = 0; i < Elements(converted_equation); i++) { 79 converted_equation[i] = (GLdouble) (equation[i] / 65536.0); 80 } 81 82 _mesa_ClipPlane(plane, converted_equation); 83} 84 85void GL_APIENTRY 86_es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) 87{ 88 _es_Color4f((GLfloat) (red / 255.0f), 89 (GLfloat) (green / 255.0f), 90 (GLfloat) (blue / 255.0f), 91 (GLfloat) (alpha / 255.0f)); 92} 93 94void GL_APIENTRY 95_es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) 96{ 97 _es_Color4f((GLfloat) (red / 65536.0f), 98 (GLfloat) (green / 65536.0f), 99 (GLfloat) (blue / 65536.0f), 100 (GLfloat) (alpha / 65536.0f)); 101} 102 103void GL_APIENTRY 104_es_DepthRangex(GLclampx zNear, GLclampx zFar) 105{ 106 _mesa_DepthRangef((GLclampf) (zNear / 65536.0f), 107 (GLclampf) (zFar / 65536.0f)); 108} 109 110void GL_APIENTRY 111_es_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) 112{ 113 114 _mesa_DrawTexf((GLfloat) (x / 65536.0f), 115 (GLfloat) (y / 65536.0f), 116 (GLfloat) (z / 65536.0f), 117 (GLfloat) (w / 65536.0f), 118 (GLfloat) (h / 65536.0f)); 119} 120 121void GL_APIENTRY 122_es_DrawTexxvOES(const GLfixed *coords) 123{ 124 unsigned int i; 125 GLfloat converted_coords[5]; 126 127 for (i = 0; i < Elements(converted_coords); i++) { 128 converted_coords[i] = (GLfloat) (coords[i] / 65536.0f); 129 } 130 131 _mesa_DrawTexfv(converted_coords); 132} 133 134void GL_APIENTRY 135_es_Fogx(GLenum pname, GLfixed param) 136{ 137 if (pname != GL_FOG_MODE) { 138 _mesa_Fogf(pname, (GLfloat) (param / 65536.0f)); 139 } else { 140 _mesa_Fogf(pname, (GLfloat) param); 141 } 142 143} 144 145void GL_APIENTRY 146_es_Fogxv(GLenum pname, const GLfixed *params) 147{ 148 unsigned int i; 149 unsigned int n_params = 4; 150 GLfloat converted_params[4]; 151 bool convert_params_value = true; 152 153 switch(pname) { 154 case GL_FOG_MODE: 155 convert_params_value = false; 156 n_params = 1; 157 break; 158 case GL_FOG_COLOR: 159 n_params = 4; 160 break; 161 case GL_FOG_DENSITY: 162 case GL_FOG_START: 163 case GL_FOG_END: 164 n_params = 1; 165 break; 166 default: 167 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 168 "glFogxv(pname=0x%x)", pname); 169 return; 170 } 171 172 if (convert_params_value) { 173 for (i = 0; i < n_params; i++) { 174 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 175 } 176 } else { 177 for (i = 0; i < n_params; i++) { 178 converted_params[i] = (GLfloat) params[i]; 179 } 180 } 181 182 _mesa_Fogfv(pname, converted_params); 183} 184 185void GL_APIENTRY 186_es_Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, 187 GLfloat zNear, GLfloat zFar) 188{ 189 _mesa_Frustum((GLdouble) (left), 190 (GLdouble) (right), 191 (GLdouble) (bottom), 192 (GLdouble) (top), 193 (GLdouble) (zNear), 194 (GLdouble) (zFar)); 195} 196 197void GL_APIENTRY 198_es_Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, 199 GLfixed zNear, GLfixed zFar) 200{ 201 _mesa_Frustum((GLdouble) (left / 65536.0), 202 (GLdouble) (right / 65536.0), 203 (GLdouble) (bottom / 65536.0), 204 (GLdouble) (top / 65536.0), 205 (GLdouble) (zNear / 65536.0), 206 (GLdouble) (zFar / 65536.0)); 207} 208 209void GL_APIENTRY 210_es_GetClipPlanef(GLenum plane, GLfloat *equation) 211{ 212 unsigned int i; 213 GLdouble converted_equation[4]; 214 215 _mesa_GetClipPlane(plane, converted_equation); 216 for (i = 0; i < Elements(converted_equation); i++) { 217 equation[i] = (GLfloat) (converted_equation[i]); 218 } 219} 220 221void GL_APIENTRY 222_es_GetClipPlanex(GLenum plane, GLfixed *equation) 223{ 224 unsigned int i; 225 GLdouble converted_equation[4]; 226 227 _mesa_GetClipPlane(plane, converted_equation); 228 for (i = 0; i < Elements(converted_equation); i++) { 229 equation[i] = (GLfixed) (converted_equation[i] * 65536); 230 } 231} 232 233void GL_APIENTRY 234_es_GetLightxv(GLenum light, GLenum pname, GLfixed *params) 235{ 236 unsigned int i; 237 unsigned int n_params = 4; 238 GLfloat converted_params[4]; 239 240 if (light < GL_LIGHT0 || light > GL_LIGHT7) { 241 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 242 "glGetLightxv(light=0x%x)", light); 243 return; 244 } 245 switch(pname) { 246 case GL_AMBIENT: 247 case GL_DIFFUSE: 248 case GL_SPECULAR: 249 case GL_POSITION: 250 n_params = 4; 251 break; 252 case GL_SPOT_DIRECTION: 253 n_params = 3; 254 break; 255 case GL_SPOT_EXPONENT: 256 case GL_SPOT_CUTOFF: 257 case GL_CONSTANT_ATTENUATION: 258 case GL_LINEAR_ATTENUATION: 259 case GL_QUADRATIC_ATTENUATION: 260 n_params = 1; 261 break; 262 default: 263 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 264 "glGetLightxv(pname=0x%x)", pname); 265 return; 266 } 267 268 _mesa_GetLightfv(light, pname, converted_params); 269 for (i = 0; i < n_params; i++) { 270 params[i] = (GLint) (converted_params[i] * 65536); 271 } 272} 273 274void GL_APIENTRY 275_es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params) 276{ 277 unsigned int i; 278 unsigned int n_params = 4; 279 GLfloat converted_params[4]; 280 281 switch(face) { 282 case GL_FRONT: 283 case GL_BACK: 284 break; 285 default: 286 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 287 "glGetMaterialxv(face=0x%x)", face); 288 return; 289 } 290 switch(pname) { 291 case GL_SHININESS: 292 n_params = 1; 293 break; 294 case GL_AMBIENT: 295 case GL_DIFFUSE: 296 case GL_SPECULAR: 297 case GL_EMISSION: 298 n_params = 4; 299 break; 300 default: 301 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 302 "glGetMaterialxv(pname=0x%x)", pname); 303 return; 304 } 305 306 _mesa_GetMaterialfv(face, pname, converted_params); 307 for (i = 0; i < n_params; i++) { 308 params[i] = (GLint) (converted_params[i] * 65536); 309 } 310} 311 312void GL_APIENTRY 313_es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params) 314{ 315 unsigned int i; 316 unsigned int n_params = 4; 317 GLfloat converted_params[4]; 318 bool convert_params_value = true; 319 320 switch(target) { 321 case GL_POINT_SPRITE: 322 if (pname != GL_COORD_REPLACE) { 323 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 324 "glGetTexEnvxv(target=0x%x)", target); 325 return; 326 } 327 break; 328 case GL_TEXTURE_FILTER_CONTROL_EXT: 329 if (pname != GL_TEXTURE_LOD_BIAS_EXT) { 330 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 331 "glGetTexEnvxv(target=0x%x)", target); 332 return; 333 } 334 break; 335 case GL_TEXTURE_ENV: 336 if (pname != GL_TEXTURE_ENV_COLOR && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA) { 337 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 338 "glGetTexEnvxv(target=0x%x)", target); 339 return; 340 } 341 break; 342 default: 343 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 344 "glGetTexEnvxv(target=0x%x)", target); 345 return; 346 } 347 switch(pname) { 348 case GL_COORD_REPLACE: 349 convert_params_value = false; 350 n_params = 1; 351 break; 352 case GL_TEXTURE_LOD_BIAS_EXT: 353 n_params = 1; 354 break; 355 case GL_TEXTURE_ENV_COLOR: 356 n_params = 4; 357 break; 358 case GL_RGB_SCALE: 359 case GL_ALPHA_SCALE: 360 n_params = 1; 361 break; 362 case GL_TEXTURE_ENV_MODE: 363 case GL_COMBINE_RGB: 364 case GL_COMBINE_ALPHA: 365 case GL_SRC0_RGB: 366 case GL_SRC1_RGB: 367 case GL_SRC2_RGB: 368 case GL_SRC0_ALPHA: 369 case GL_SRC1_ALPHA: 370 case GL_SRC2_ALPHA: 371 case GL_OPERAND0_RGB: 372 case GL_OPERAND1_RGB: 373 case GL_OPERAND2_RGB: 374 case GL_OPERAND0_ALPHA: 375 case GL_OPERAND1_ALPHA: 376 case GL_OPERAND2_ALPHA: 377 convert_params_value = false; 378 n_params = 1; 379 break; 380 default: 381 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 382 "glGetTexEnvxv(pname=0x%x)", pname); 383 return; 384 } 385 386 _mesa_GetTexEnvfv(target, pname, converted_params); 387 if (convert_params_value) { 388 for (i = 0; i < n_params; i++) { 389 params[i] = (GLint) (converted_params[i] * 65536); 390 } 391 } else { 392 for (i = 0; i < n_params; i++) { 393 params[i] = (GLfixed) converted_params[i]; 394 } 395 } 396} 397 398void GL_APIENTRY 399_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params) 400{ 401 _mesa_GetTexGeniv(coord, pname, params); 402} 403 404void GL_APIENTRY 405_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) 406{ 407 _mesa_GetTexGeniv(coord, pname, (GLint *) params); 408} 409 410void GL_APIENTRY 411_es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) 412{ 413 unsigned int i; 414 unsigned int n_params = 4; 415 GLfloat converted_params[4]; 416 bool convert_params_value = true; 417 418 switch(target) { 419 case GL_TEXTURE_2D: 420 case GL_TEXTURE_CUBE_MAP: 421 case GL_TEXTURE_EXTERNAL_OES: 422 break; 423 default: 424 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 425 "glGetTexParameterxv(target=0x%x)", target); 426 return; 427 } 428 switch(pname) { 429 case GL_TEXTURE_WRAP_S: 430 case GL_TEXTURE_WRAP_T: 431 case GL_TEXTURE_MIN_FILTER: 432 case GL_TEXTURE_MAG_FILTER: 433 case GL_GENERATE_MIPMAP: 434 convert_params_value = false; 435 n_params = 1; 436 break; 437 case GL_TEXTURE_CROP_RECT_OES: 438 n_params = 4; 439 break; 440 default: 441 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 442 "glGetTexParameterxv(pname=0x%x)", pname); 443 return; 444 } 445 446 _mesa_GetTexParameterfv(target, pname, converted_params); 447 if (convert_params_value) { 448 for (i = 0; i < n_params; i++) { 449 params[i] = (GLint) (converted_params[i] * 65536); 450 } 451 } else { 452 for (i = 0; i < n_params; i++) { 453 params[i] = (GLfixed) converted_params[i]; 454 } 455 } 456} 457 458void GL_APIENTRY 459_es_LightModelx(GLenum pname, GLfixed param) 460{ 461 _mesa_LightModelf(pname, (GLfloat) param); 462} 463 464void GL_APIENTRY 465_es_LightModelxv(GLenum pname, const GLfixed *params) 466{ 467 unsigned int i; 468 unsigned int n_params = 4; 469 GLfloat converted_params[4]; 470 bool convert_params_value = true; 471 472 switch(pname) { 473 case GL_LIGHT_MODEL_AMBIENT: 474 n_params = 4; 475 break; 476 case GL_LIGHT_MODEL_TWO_SIDE: 477 convert_params_value = false; 478 n_params = 1; 479 break; 480 default: 481 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 482 "glLightModelxv(pname=0x%x)", pname); 483 return; 484 } 485 486 if (convert_params_value) { 487 for (i = 0; i < n_params; i++) { 488 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 489 } 490 } else { 491 for (i = 0; i < n_params; i++) { 492 converted_params[i] = (GLfloat) params[i]; 493 } 494 } 495 496 _mesa_LightModelfv(pname, converted_params); 497} 498 499void GL_APIENTRY 500_es_Lightx(GLenum light, GLenum pname, GLfixed param) 501{ 502 _mesa_Lightf(light, pname, (GLfloat) (param / 65536.0f)); 503} 504 505void GL_APIENTRY 506_es_Lightxv(GLenum light, GLenum pname, const GLfixed *params) 507{ 508 unsigned int i; 509 unsigned int n_params = 4; 510 GLfloat converted_params[4]; 511 512 if (light < GL_LIGHT0 || light > GL_LIGHT7) { 513 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 514 "glLightxv(light=0x%x)", light); 515 return; 516 } 517 switch(pname) { 518 case GL_AMBIENT: 519 case GL_DIFFUSE: 520 case GL_SPECULAR: 521 case GL_POSITION: 522 n_params = 4; 523 break; 524 case GL_SPOT_DIRECTION: 525 n_params = 3; 526 break; 527 case GL_SPOT_EXPONENT: 528 case GL_SPOT_CUTOFF: 529 case GL_CONSTANT_ATTENUATION: 530 case GL_LINEAR_ATTENUATION: 531 case GL_QUADRATIC_ATTENUATION: 532 n_params = 1; 533 break; 534 default: 535 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 536 "glLightxv(pname=0x%x)", pname); 537 return; 538 } 539 540 for (i = 0; i < n_params; i++) { 541 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 542 } 543 544 _mesa_Lightfv(light, pname, converted_params); 545} 546 547void GL_APIENTRY 548_es_LineWidthx(GLfixed width) 549{ 550 _mesa_LineWidth((GLfloat) (width / 65536.0f)); 551} 552 553void GL_APIENTRY 554_es_LoadMatrixx(const GLfixed *m) 555{ 556 unsigned int i; 557 GLfloat converted_m[16]; 558 559 for (i = 0; i < Elements(converted_m); i++) { 560 converted_m[i] = (GLfloat) (m[i] / 65536.0f); 561 } 562 563 _mesa_LoadMatrixf(converted_m); 564} 565 566void GL_APIENTRY 567_es_Materialx(GLenum face, GLenum pname, GLfixed param) 568{ 569 if (face != GL_FRONT_AND_BACK) { 570 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 571 "glMaterialx(face=0x%x)", face); 572 return; 573 } 574 575 if (pname != GL_SHININESS) { 576 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 577 "glMaterialx(pname=0x%x)", pname); 578 return; 579 } 580 581 _es_Materialf(face, pname, (GLfloat) (param / 65536.0f)); 582} 583 584void GL_APIENTRY 585_es_Materialxv(GLenum face, GLenum pname, const GLfixed *params) 586{ 587 unsigned int i; 588 unsigned int n_params = 4; 589 GLfloat converted_params[4]; 590 591 if (face != GL_FRONT_AND_BACK) { 592 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 593 "glMaterialxv(face=0x%x)", face); 594 return; 595 } 596 597 switch(pname) { 598 case GL_AMBIENT: 599 case GL_DIFFUSE: 600 case GL_AMBIENT_AND_DIFFUSE: 601 case GL_SPECULAR: 602 case GL_EMISSION: 603 n_params = 4; 604 break; 605 case GL_SHININESS: 606 n_params = 1; 607 break; 608 default: 609 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 610 "glMaterialxv(pname=0x%x)", pname); 611 return; 612 } 613 614 for (i = 0; i < n_params; i++) { 615 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 616 } 617 618 _es_Materialfv(face, pname, converted_params); 619} 620 621void GL_APIENTRY 622_es_MultMatrixx(const GLfixed *m) 623{ 624 unsigned int i; 625 GLfloat converted_m[16]; 626 627 for (i = 0; i < Elements(converted_m); i++) { 628 converted_m[i] = (GLfloat) (m[i] / 65536.0f); 629 } 630 631 _mesa_MultMatrixf(converted_m); 632} 633 634void GL_APIENTRY 635_es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) 636{ 637 _es_MultiTexCoord4f(texture, 638 (GLfloat) (s / 65536.0f), 639 (GLfloat) (t / 65536.0f), 640 (GLfloat) (r / 65536.0f), 641 (GLfloat) (q / 65536.0f)); 642} 643 644void GL_APIENTRY 645_es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) 646{ 647 _es_Normal3f((GLfloat) (nx / 65536.0f), 648 (GLfloat) (ny / 65536.0f), 649 (GLfloat) (nz / 65536.0f)); 650} 651 652void GL_APIENTRY 653_es_Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, 654 GLfloat zNear, GLfloat zFar) 655{ 656 _mesa_Ortho((GLdouble) (left), 657 (GLdouble) (right), 658 (GLdouble) (bottom), 659 (GLdouble) (top), 660 (GLdouble) (zNear), 661 (GLdouble) (zFar)); 662} 663 664void GL_APIENTRY 665_es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, 666 GLfixed zNear, GLfixed zFar) 667{ 668 _mesa_Ortho((GLdouble) (left / 65536.0), 669 (GLdouble) (right / 65536.0), 670 (GLdouble) (bottom / 65536.0), 671 (GLdouble) (top / 65536.0), 672 (GLdouble) (zNear / 65536.0), 673 (GLdouble) (zFar / 65536.0)); 674} 675 676void GL_APIENTRY 677_es_PointParameterx(GLenum pname, GLfixed param) 678{ 679 switch(pname) { 680 case GL_POINT_SIZE_MIN: 681 case GL_POINT_SIZE_MAX: 682 case GL_POINT_FADE_THRESHOLD_SIZE: 683 break; 684 default: 685 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 686 "glPointParameterx(pname=0x%x)", pname); 687 return; 688 } 689 690 _mesa_PointParameterf(pname, (GLfloat) (param / 65536.0f)); 691} 692 693void GL_APIENTRY 694_es_PointParameterxv(GLenum pname, const GLfixed *params) 695{ 696 unsigned int i; 697 unsigned int n_params = 3; 698 GLfloat converted_params[3]; 699 700 switch(pname) { 701 case GL_POINT_SIZE_MIN: 702 case GL_POINT_SIZE_MAX: 703 case GL_POINT_FADE_THRESHOLD_SIZE: 704 n_params = 1; 705 break; 706 case GL_POINT_DISTANCE_ATTENUATION: 707 n_params = 3; 708 break; 709 default: 710 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 711 "glPointParameterxv(pname=0x%x)", pname); 712 return; 713 } 714 715 for (i = 0; i < n_params; i++) { 716 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 717 } 718 719 _mesa_PointParameterfv(pname, converted_params); 720} 721 722void GL_APIENTRY 723_es_PointSizex(GLfixed size) 724{ 725 _mesa_PointSize((GLfloat) (size / 65536.0f)); 726} 727 728void GL_APIENTRY 729_es_PolygonOffsetx(GLfixed factor, GLfixed units) 730{ 731 _mesa_PolygonOffset((GLfloat) (factor / 65536.0f), 732 (GLfloat) (units / 65536.0f)); 733} 734 735void GL_APIENTRY 736_es_Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) 737{ 738 _mesa_Rotatef((GLfloat) (angle / 65536.0f), 739 (GLfloat) (x / 65536.0f), 740 (GLfloat) (y / 65536.0f), 741 (GLfloat) (z / 65536.0f)); 742} 743 744void GL_APIENTRY 745_es_SampleCoveragex(GLclampx value, GLboolean invert) 746{ 747 _mesa_SampleCoverageARB((GLclampf) (value / 65536.0f), 748 invert); 749} 750 751void GL_APIENTRY 752_es_Scalex(GLfixed x, GLfixed y, GLfixed z) 753{ 754 _mesa_Scalef((GLfloat) (x / 65536.0f), 755 (GLfloat) (y / 65536.0f), 756 (GLfloat) (z / 65536.0f)); 757} 758 759void GL_APIENTRY 760_es_TexEnvx(GLenum target, GLenum pname, GLfixed param) 761{ 762 switch(target) { 763 case GL_POINT_SPRITE: 764 case GL_TEXTURE_FILTER_CONTROL_EXT: 765 case GL_TEXTURE_ENV: 766 break; 767 default: 768 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 769 "glTexEnvx(target=0x%x)", target); 770 return; 771 } 772 773 switch(pname) { 774 case GL_COORD_REPLACE: 775 case GL_TEXTURE_ENV_MODE: 776 case GL_COMBINE_RGB: 777 case GL_COMBINE_ALPHA: 778 case GL_SRC0_RGB: 779 case GL_SRC1_RGB: 780 case GL_SRC2_RGB: 781 case GL_SRC0_ALPHA: 782 case GL_SRC1_ALPHA: 783 case GL_SRC2_ALPHA: 784 case GL_OPERAND0_RGB: 785 case GL_OPERAND1_RGB: 786 case GL_OPERAND2_RGB: 787 case GL_OPERAND0_ALPHA: 788 case GL_OPERAND1_ALPHA: 789 case GL_OPERAND2_ALPHA: 790 _mesa_TexEnvf(target, pname, (GLfloat) param); 791 break; 792 case GL_TEXTURE_LOD_BIAS_EXT: 793 case GL_RGB_SCALE: 794 case GL_ALPHA_SCALE: 795 _mesa_TexEnvf(target, pname, (GLfloat) (param / 65536.0f)); 796 break; 797 default: 798 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 799 "glTexEnvx(pname=0x%x)", pname); 800 return; 801 } 802} 803 804void GL_APIENTRY 805_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params) 806{ 807 switch(target) { 808 case GL_POINT_SPRITE: 809 case GL_TEXTURE_FILTER_CONTROL_EXT: 810 case GL_TEXTURE_ENV: 811 break; 812 default: 813 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 814 "glTexEnvxv(target=0x%x)", target); 815 return; 816 } 817 818 switch(pname) { 819 case GL_COORD_REPLACE: 820 case GL_TEXTURE_ENV_MODE: 821 case GL_COMBINE_RGB: 822 case GL_COMBINE_ALPHA: 823 case GL_SRC0_RGB: 824 case GL_SRC1_RGB: 825 case GL_SRC2_RGB: 826 case GL_SRC0_ALPHA: 827 case GL_SRC1_ALPHA: 828 case GL_SRC2_ALPHA: 829 case GL_OPERAND0_RGB: 830 case GL_OPERAND1_RGB: 831 case GL_OPERAND2_RGB: 832 case GL_OPERAND0_ALPHA: 833 case GL_OPERAND1_ALPHA: 834 case GL_OPERAND2_ALPHA: 835 _mesa_TexEnvf(target, pname, (GLfloat) params[0]); 836 break; 837 case GL_TEXTURE_LOD_BIAS_EXT: 838 case GL_RGB_SCALE: 839 case GL_ALPHA_SCALE: 840 _mesa_TexEnvf(target, pname, (GLfloat) (params[0] / 65536.0f)); 841 break; 842 case GL_TEXTURE_ENV_COLOR: { 843 unsigned int i; 844 GLfloat converted_params[4]; 845 846 for (i = 0; i < Elements(converted_params); i++) { 847 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 848 } 849 850 _mesa_TexEnvfv(target, pname, converted_params); 851 break; 852 } 853 default: 854 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 855 "glTexEnvxv(pname=0x%x)", pname); 856 return; 857 } 858} 859 860void GL_APIENTRY 861_check_TexGeniOES(GLenum coord, GLenum pname, GLint param) 862{ 863 _es_TexGenf(coord, pname, (GLfloat) param); 864} 865 866void GL_APIENTRY 867_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params) 868{ 869 _es_TexGenf(coord, pname, (GLfloat) params[0]); 870} 871 872void GL_APIENTRY 873_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param) 874{ 875 _es_TexGenf(coord, pname, (GLfloat) param); 876} 877 878void GL_APIENTRY 879_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) 880{ 881 _es_TexGenf(coord, pname, (GLfloat) params[0]); 882} 883 884void GL_APIENTRY 885_es_TexParameterx(GLenum target, GLenum pname, GLfixed param) 886{ 887 if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT) { 888 _mesa_TexParameterf(target, pname, (GLfloat) (param / 65536.0f)); 889 } else { 890 _mesa_TexParameterf(target, pname, (GLfloat) param); 891 } 892} 893 894void GL_APIENTRY 895_es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params) 896{ 897 unsigned int i; 898 unsigned int n_params = 4; 899 GLfloat converted_params[4]; 900 bool convert_params_value = true; 901 902 switch(target) { 903 case GL_TEXTURE_2D: 904 case GL_TEXTURE_CUBE_MAP: 905 case GL_TEXTURE_EXTERNAL_OES: 906 break; 907 default: 908 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 909 "glTexParameterxv(target=0x%x)", target); 910 return; 911 } 912 switch(pname) { 913 case GL_TEXTURE_WRAP_S: 914 case GL_TEXTURE_WRAP_T: 915 convert_params_value = false; 916 n_params = 1; 917 break; 918 case GL_TEXTURE_MIN_FILTER: 919 case GL_TEXTURE_MAG_FILTER: 920 case GL_GENERATE_MIPMAP: 921 convert_params_value = false; 922 n_params = 1; 923 break; 924 case GL_TEXTURE_MAX_ANISOTROPY_EXT: 925 n_params = 1; 926 break; 927 case GL_TEXTURE_CROP_RECT_OES: 928 n_params = 4; 929 break; 930 default: 931 _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, 932 "glTexParameterxv(pname=0x%x)", pname); 933 return; 934 } 935 936 if (convert_params_value) { 937 for (i = 0; i < n_params; i++) { 938 converted_params[i] = (GLfloat) (params[i] / 65536.0f); 939 } 940 } else { 941 for (i = 0; i < n_params; i++) { 942 converted_params[i] = (GLfloat) params[i]; 943 } 944 } 945 946 _mesa_TexParameterfv(target, pname, converted_params); 947} 948 949void GL_APIENTRY 950_es_Translatex(GLfixed x, GLfixed y, GLfixed z) 951{ 952 _mesa_Translatef((GLfloat) (x / 65536.0f), 953 (GLfloat) (y / 65536.0f), 954 (GLfloat) (z / 65536.0f)); 955} 956 957#endif /* FEATURE_ES1 */ 958