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