void GL_APIENTRY
_es_TexParameterx(GLenum target, GLenum pname, GLfixed param)
{
- GLfloat converted_param;
- bool convert_param_value = true;
-
- switch(pname) {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- convert_param_value = false;
- break;
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- convert_param_value = false;
- break;
- case GL_GENERATE_MIPMAP:
- if (param != GL_TRUE && param != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(pname=0x%x)", pname);
- return;
- }
-
- if (convert_param_value) {
- converted_param = (GLfloat) (param / 65536.0f);
+ if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT) {
+ _mesa_TexParameterf(target, pname, (GLfloat) (param / 65536.0f));
} else {
- converted_param = (GLfloat) param;
+ _mesa_TexParameterf(target, pname, (GLfloat) param);
}
-
- _mesa_TexParameterf(target, pname, converted_param);
}
void GL_APIENTRY
break;
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
- convert_params_value = false;
- n_params = 1;
- break;
case GL_GENERATE_MIPMAP:
- if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
return GL_FALSE;
case GL_TEXTURE_BASE_LEVEL:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->BaseLevel == params[0])
return GL_FALSE;
if (params[0] < 0 ||
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_pname;
+
if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
goto invalid_param;
if (texObj->GenerateMipmap != params[0]) {
return GL_FALSE;
case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
+ || _mesa_is_gles3(ctx)) {
if (texObj->Sampler.CompareMode == params[0])
return GL_FALSE;
if (params[0] == GL_NONE ||
goto invalid_pname;
case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
+ || _mesa_is_gles3(ctx)) {
if (texObj->Sampler.CompareFunc == params[0])
return GL_FALSE;
switch (params[0]) {
goto invalid_pname;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
+ /* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
+ * existed in OpenGL ES.
+ */
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_texture) {
if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
+ if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
+ goto invalid_pname;
+
texObj->CropRect[0] = params[0];
texObj->CropRect[1] = params[1];
texObj->CropRect[2] = params[2];
case GL_TEXTURE_SWIZZLE_G_EXT:
case GL_TEXTURE_SWIZZLE_B_EXT:
case GL_TEXTURE_SWIZZLE_A_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_swizzle)
+ || _mesa_is_gles3(ctx)) {
const GLuint comp = pname - GL_TEXTURE_SWIZZLE_R_EXT;
const GLint swz = comp_to_swizzle(params[0]);
if (swz < 0) {
goto invalid_pname;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_swizzle)
+ || _mesa_is_gles3(ctx)) {
GLuint comp;
flush(ctx);
for (comp = 0; comp < 4; comp++) {
goto invalid_pname;
case GL_TEXTURE_SRGB_DECODE_EXT:
- if (ctx->Extensions.EXT_texture_sRGB_decode) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_texture_sRGB_decode) {
GLenum decode = params[0];
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
if (texObj->Sampler.sRGBDecode != decode) {
goto invalid_pname;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- if (ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.AMD_seamless_cubemap_per_texture) {
GLenum param = params[0];
if (param != GL_TRUE && param != GL_FALSE) {
goto invalid_param;
{
switch (pname) {
case GL_TEXTURE_MIN_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->Sampler.MinLod == params[0])
return GL_FALSE;
flush(ctx);
return GL_TRUE;
case GL_TEXTURE_MAX_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->Sampler.MaxLod == params[0])
return GL_FALSE;
flush(ctx);
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
flush(ctx);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
return GL_TRUE;
else {
static GLuint count = 0;
if (count++ < 10)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
+ goto invalid_pname;
}
return GL_FALSE;
case GL_TEXTURE_LOD_BIAS:
- /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
+ /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias.
+ * It was removed in core-profile, and it has never existed in OpenGL
+ * ES.
+ */
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
if (texObj->Sampler.LodBias != params[0]) {
flush(ctx);
texObj->Sampler.LodBias = params[0];
break;
case GL_TEXTURE_BORDER_COLOR:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
+
flush(ctx);
/* ARB_texture_float disables clamping */
if (ctx->Extensions.ARB_texture_float) {
return GL_TRUE;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
+ goto invalid_pname;
}
return GL_FALSE;
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}