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