{
struct gl_texture_object *texObj;
- texObj = _mesa_lookup_texture(ctx, texture);
- if (!texObj) {
- /*
- * User passed a non-generated name.
- * Throw the error in the caller.
- */
+ texObj = _mesa_lookup_texture_err(ctx, texture, name);
+ if (!texObj)
return NULL;
- }
switch (texObj->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_RECTANGLE:
return texObj;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(target)", name);
return NULL;
}
{
const char *suffix = dsa ? "ture" : "";
+ if (texObj->HandleAllocated) {
+ /* The ARB_bindless_texture spec says:
+ *
+ * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
+ * CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
+ * functions defined in terms of these, if the texture object to be
+ * modified is referenced by one or more texture or image handles."
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTex%sParameter(immutable texture)", suffix);
+ return GL_FALSE;
+ }
+
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
if (texObj->BaseLevel == params[0])
return GL_FALSE;
+ /* Section 8.10 (Texture Parameters) of the OpenGL 4.5 Core Profile spec
+ * says:
+ *
+ * An INVALID_OPERATION error is generated if the effective target is
+ * TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or
+ * TEXTURE_RECTANGLE, and pname TEXTURE_BASE_LEVEL is set to a value
+ * other than zero.
+ *
+ * Note that section 3.8.8 (Texture Parameters) of the OpenGL 3.3 Core
+ * Profile spec said:
+ *
+ * The error INVALID_VALUE is generated if TEXTURE_BASE_LEVEL is set
+ * to any value other than zero.
+ *
+ * We take the 4.5 language as a correction to 3.3, and we implement
+ * that on all GL versions.
+ */
if ((texObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||
- texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) && params[0] != 0)
+ texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
+ texObj->Target == GL_TEXTURE_RECTANGLE) && params[0] != 0)
goto invalid_operation;
if (params[0] < 0) {
"glTex%sParameter(param=%d)", suffix, params[0]);
return GL_FALSE;
}
- if (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTex%sParameter(target=%s, param=%d)", suffix,
- _mesa_enum_to_string(texObj->Target), params[0]);
- return GL_FALSE;
- }
incomplete(ctx, texObj);
/** See note about ARB_texture_storage below */
}
goto invalid_pname;
+ case GL_TEXTURE_TILING_EXT:
+ if (ctx->Extensions.EXT_memory_object) {
+ texObj->TextureTiling = params[0];
+
+ return GL_TRUE;
+ }
+ goto invalid_pname;
+
default:
goto invalid_pname;
}
{
const char *suffix = dsa ? "ture" : "";
+ if (texObj->HandleAllocated) {
+ /* The ARB_bindless_texture spec says:
+ *
+ * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
+ * CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
+ * functions defined in terms of these, if the texture object to be
+ * modified is referenced by one or more texture or image handles."
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTex%sParameter(immutable texture)", suffix);
+ return GL_FALSE;
+ }
+
switch (pname) {
case GL_TEXTURE_MIN_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
break;
case GL_TEXTURE_BORDER_COLOR:
+ /* Border color exists in desktop OpenGL since 1.0 for GL_CLAMP. In
+ * OpenGL ES 2.0+, it only exists in when GL_OES_texture_border_clamp is
+ * enabled. It is never available in OpenGL ES 1.x.
+ *
+ * FIXME: Every driver that supports GLES2 has this extension. Elide
+ * the check?
+ */
if (ctx->API == API_OPENGLES ||
- !ctx->Extensions.ARB_texture_border_clamp)
+ (ctx->API == API_OPENGLES2 &&
+ !ctx->Extensions.ARB_texture_border_clamp))
goto invalid_pname;
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
}
return GL_TRUE;
+ case GL_TEXTURE_TILING_EXT:
+ if (ctx->Extensions.EXT_memory_object) {
+ texObj->TextureTiling = params[0];
+ return GL_TRUE;
+ }
+ goto invalid_pname;
+
default:
goto invalid_pname;
}
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
{
- if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameteriv(texture)");
- return;
- }
/* convert int params to float */
GLfloat fparams[4];
fparams[0] = INT_TO_FLOAT(params[0]);
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
+ if (texObj->HandleAllocated) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTextureParameterIiv(immutable texture)");
+ return;
+ }
+
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIiv(texture)");
return;
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
+ if (texObj->HandleAllocated) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTextureParameterIuiv(immutable texture)");
+ return;
+ }
+
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIuiv(texture)");
return;
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameterfv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfv(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameterfv(ctx, texObj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameterf");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterf(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameterf(ctx, texObj, pname, param, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameteri");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteri(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameteri(ctx, texObj, pname, param, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameteriv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriv(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameteriv(ctx, texObj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameterIiv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureParameterIiv(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameterIiv(ctx, texObj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glTextureParameterIuiv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureParameterIuiv(texture)");
+ if (!texObj)
return;
- }
_mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
}
* From the OpenGL 3.1 spec:
* "target may also be TEXTURE_BUFFER, indicating the texture buffer."
*/
- return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
- _mesa_has_OES_texture_buffer(ctx);
+ return (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) ||
+ _mesa_has_OES_texture_buffer(ctx);
case GL_TEXTURE_CUBE_MAP_ARRAY:
return _mesa_has_texture_cube_map_array(ctx);
}
*params = ENUM_TO_FLOAT(obj->Target);
break;
+ case GL_TEXTURE_TILING_EXT:
+ if (!ctx->Extensions.EXT_memory_object)
+ goto invalid_pname;
+ *params = ENUM_TO_FLOAT(obj->TextureTiling);
+ break;
+
default:
goto invalid_pname;
}
*params = (GLint) obj->Target;
break;
+ case GL_TEXTURE_TILING_EXT:
+ if (!ctx->Extensions.EXT_memory_object)
+ goto invalid_pname;
+ *params = (GLint) obj->TextureTiling;
+ break;
+
default:
goto invalid_pname;
}
GET_CURRENT_CONTEXT(ctx);
obj = get_texobj_by_name(ctx, texture, "glGetTextureParameterfv");
- if (!obj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterfv(texture)");
+ if (!obj)
return;
- }
get_tex_parameterfv(ctx, obj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
obj = get_texobj_by_name(ctx, texture, "glGetTextureParameteriv");
- if (!obj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameteriv(texture)");
+ if (!obj)
return;
- }
get_tex_parameteriv(ctx, obj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glGetTextureParameterIiv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterIiv(texture)");
+ if (!texObj)
return;
- }
get_tex_parameterIiv(ctx, texObj, pname, params, true);
}
GET_CURRENT_CONTEXT(ctx);
texObj = get_texobj_by_name(ctx, texture, "glGetTextureParameterIuiv");
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterIuiv(texture)");
+ if (!texObj)
return;
- }
get_tex_parameterIuiv(ctx, texObj, pname, params, true);
}