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