/** * Why does ATI_envmap_bumpmap require new entrypoints? Should just * reuse TexEnv ones... */ void GLAPIENTRY _mesa_TexBumpParameterivATI( GLenum pname, const GLint *param ) { GLfloat p[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { /* This isn't an "official" error case, but let's tell the user * that something's wrong. */ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterivATI"); return; } if (pname == GL_BUMP_ROT_MATRIX_ATI) { /* hope that conversion is correct here */ p[0] = INT_TO_FLOAT( param[0] ); p[1] = INT_TO_FLOAT( param[1] ); p[2] = INT_TO_FLOAT( param[2] ); p[3] = INT_TO_FLOAT( param[3] ); } else { p[0] = (GLfloat) param[0]; p[1] = p[2] = p[3] = 0.0F; /* init to zero, just to be safe */ } _mesa_TexBumpParameterfvATI( pname, p ); }
void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ) { GLfloat p[4]; switch (pname) { case GL_FOG_MODE: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_INDEX: case GL_FOG_COORDINATE_SOURCE_EXT: p[0] = (GLfloat) *params; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT( params[0] ); p[1] = INT_TO_FLOAT( params[1] ); p[2] = INT_TO_FLOAT( params[2] ); p[3] = INT_TO_FLOAT( params[3] ); break; default: /* Error will be caught later in _mesa_Fogfv */ ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F); } _mesa_Fogfv(pname, p); }
static void GLAPIENTRY VertexAttrib4Niv(GLuint index, const GLint *v) { _glapi_Dispatch->VertexAttrib4fNV(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); }
static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v) { CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]))); }
static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) { GL_CALL(VertexAttrib4fNV)(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); }
void glTexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; if (pname == GL_TEXTURE_ENV_COLOR) { p[0] = INT_TO_FLOAT( param[0] ); p[1] = INT_TO_FLOAT( param[1] ); p[2] = INT_TO_FLOAT( param[2] ); p[3] = INT_TO_FLOAT( param[3] ); } else { p[0] = (GLfloat) param[0]; p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ } glTexEnvfv( target, pname, p ); }
void GLAPIENTRY _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) { GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) return; switch (pname) { case GL_TEXTURE_BORDER_COLOR: { /* convert int params to float */ GLfloat fparams[4]; fparams[0] = INT_TO_FLOAT(params[0]); fparams[1] = INT_TO_FLOAT(params[1]); fparams[2] = INT_TO_FLOAT(params[2]); fparams[3] = INT_TO_FLOAT(params[3]); need_update = set_tex_parameterf(ctx, texObj, pname, fparams); } break; case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { /* convert int param to float */ GLfloat fparams[4]; fparams[0] = (GLfloat) params[0]; fparams[1] = fparams[2] = fparams[3] = 0.0F; need_update = set_tex_parameterf(ctx, texObj, pname, fparams); } break; default: /* this will generate an error if pname is illegal */ need_update = set_tex_parameteri(ctx, texObj, pname, params); } if (ctx->Driver.TexParameter && need_update) { GLfloat fparams[4]; fparams[0] = INT_TO_FLOAT(params[0]); if (pname == GL_TEXTURE_BORDER_COLOR || pname == GL_TEXTURE_CROP_RECT_OES) { fparams[1] = INT_TO_FLOAT(params[1]); fparams[2] = INT_TO_FLOAT(params[2]); fparams[3] = INT_TO_FLOAT(params[3]); } ctx->Driver.TexParameter(ctx, target, texObj, pname, fparams); } }
void _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_POSITION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; fparam[3] = (GLfloat) params[3]; break; case GL_SPOT_DIRECTION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: fparam[0] = (GLfloat) params[0]; break; default: /* error will be caught later in gl_Lightfv */ ; } _mesa_Lightfv( light, pname, fparam ); }
void _mesa_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_LIGHT_MODEL_AMBIENT: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: fparam[0] = (GLfloat) params[0]; break; default: /* Error will be caught later in gl_LightModelfv */ ; } _mesa_LightModelfv( pname, fparam ); }
void GLAPIENTRY _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) { struct gl_sampler_object *sampObj; GLuint res; GET_CURRENT_CONTEXT(ctx); sampObj = sampler_parameter_error_check(ctx, sampler, false, "glSamplerParameteriv"); if (!sampObj) return; switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, params[0]); break; case GL_TEXTURE_WRAP_T: res = set_sampler_wrap_t(ctx, sampObj, params[0]); break; case GL_TEXTURE_WRAP_R: res = set_sampler_wrap_r(ctx, sampObj, params[0]); break; case GL_TEXTURE_MIN_FILTER: res = set_sampler_min_filter(ctx, sampObj, params[0]); break; case GL_TEXTURE_MAG_FILTER: res = set_sampler_mag_filter(ctx, sampObj, params[0]); break; case GL_TEXTURE_MIN_LOD: res = set_sampler_min_lod(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_MAX_LOD: res = set_sampler_max_lod(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_LOD_BIAS: res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_COMPARE_MODE: res = set_sampler_compare_mode(ctx, sampObj, params[0]); break; case GL_TEXTURE_COMPARE_FUNC: res = set_sampler_compare_func(ctx, sampObj, params[0]); break; case GL_TEXTURE_MAX_ANISOTROPY_EXT: res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]); break; case GL_TEXTURE_SRGB_DECODE_EXT: res = set_sampler_srgb_decode(ctx, sampObj, params[0]); break; case GL_TEXTURE_BORDER_COLOR: { GLfloat c[4]; c[0] = INT_TO_FLOAT(params[0]); c[1] = INT_TO_FLOAT(params[1]); c[2] = INT_TO_FLOAT(params[2]); c[3] = INT_TO_FLOAT(params[3]); res = set_sampler_border_colorf(ctx, sampObj, c); } break; default: res = INVALID_PNAME; } switch (res) { case GL_FALSE: /* no change */ break; case GL_TRUE: /* state change - we do nothing special at this time */ break; case INVALID_PNAME: _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(pname=%s)\n", _mesa_enum_to_string(pname)); break; case INVALID_PARAM: _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(param=%d)\n", params[0]); break; case INVALID_VALUE: _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(param=%d)\n", params[0]); break; default: ; } }
static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); }
void GLAPIENTRY _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) { struct gl_sampler_object *sampObj; GLuint res; GET_CURRENT_CONTEXT(ctx); sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states: * * "An INVALID_OPERATION error is generated if sampler is not the name * of a sampler object previously returned from a call to GenSamplers." * * In desktop GL, an GL_INVALID_VALUE is returned instead. */ _mesa_error(ctx, (_mesa_is_gles(ctx) ? GL_INVALID_OPERATION : GL_INVALID_VALUE), "glSamplerParameteriv(sampler %u)", sampler); return; } switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, params[0]); break; case GL_TEXTURE_WRAP_T: res = set_sampler_wrap_t(ctx, sampObj, params[0]); break; case GL_TEXTURE_WRAP_R: res = set_sampler_wrap_r(ctx, sampObj, params[0]); break; case GL_TEXTURE_MIN_FILTER: res = set_sampler_min_filter(ctx, sampObj, params[0]); break; case GL_TEXTURE_MAG_FILTER: res = set_sampler_mag_filter(ctx, sampObj, params[0]); break; case GL_TEXTURE_MIN_LOD: res = set_sampler_min_lod(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_MAX_LOD: res = set_sampler_max_lod(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_LOD_BIAS: res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_COMPARE_MODE: res = set_sampler_compare_mode(ctx, sampObj, params[0]); break; case GL_TEXTURE_COMPARE_FUNC: res = set_sampler_compare_func(ctx, sampObj, params[0]); break; case GL_TEXTURE_MAX_ANISOTROPY_EXT: res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]); break; case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]); break; case GL_TEXTURE_SRGB_DECODE_EXT: res = set_sampler_srgb_decode(ctx, sampObj, params[0]); break; case GL_TEXTURE_BORDER_COLOR: { GLfloat c[4]; c[0] = INT_TO_FLOAT(params[0]); c[1] = INT_TO_FLOAT(params[1]); c[2] = INT_TO_FLOAT(params[2]); c[3] = INT_TO_FLOAT(params[3]); res = set_sampler_border_colorf(ctx, sampObj, c); } break; default: res = INVALID_PNAME; } switch (res) { case GL_FALSE: /* no change */ break; case GL_TRUE: /* state change - we do nothing special at this time */ break; case INVALID_PNAME: _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(pname=%s)\n", _mesa_enum_to_string(pname)); break; case INVALID_PARAM: _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(param=%d)\n", params[0]); break; case INVALID_VALUE: _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(param=%d)\n", params[0]); break; default: ; } }
void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); struct gl_convolution_attrib *conv; GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; conv = &ctx->Convolution1D; break; case GL_CONVOLUTION_2D: c = 1; conv = &ctx->Convolution2D; break; case GL_SEPARABLE_2D: c = 2; conv = &ctx->Separable2D; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); break; case GL_CONVOLUTION_BORDER_MODE: if (params[0] == (GLint) GL_REDUCE || params[0] == (GLint) GL_CONSTANT_BORDER || params[0] == (GLint) GL_REPLICATE_BORDER) { ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); return; } break; case GL_CONVOLUTION_FILTER_SCALE: /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ /* need cast to prevent compiler warnings */ ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; break; case GL_CONVOLUTION_FILTER_BIAS: /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ /* need cast to prevent compiler warnings */ ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); return; } ctx->NewState |= _NEW_PIXEL; }