* Only the glGetTexLevelParameter() functions accept proxy targets.
*/
static struct gl_texture_object *
-get_texobj_by_name(struct gl_context *ctx, GLuint texture, GLboolean get)
+get_texobj_by_name(struct gl_context *ctx, GLuint texture, const char *name)
{
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,
- "gl%sTextureParameter(target)", get ? "Get" : "");
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name);
return NULL;
}
static inline void
flush(struct gl_context *ctx)
{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
}
/**
* This is called just prior to changing any texture object state which
* could affect texture completeness (texture base level, max level).
- * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
+ * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE_OBJECT
* state flag and then mark the texture object as 'incomplete' so that any
* per-texture derived state gets recomputed.
*/
static inline void
incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
_mesa_dirty_texobj(ctx, texObj);
}
{
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))
{
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))
}
if (ctx->Driver.TexParameter && need_update) {
- ctx->Driver.TexParameter(ctx, texObj, pname, ¶m);
+ ctx->Driver.TexParameter(ctx, texObj, pname);
}
}
}
if (ctx->Driver.TexParameter && need_update) {
- ctx->Driver.TexParameter(ctx, texObj, pname, params);
+ ctx->Driver.TexParameter(ctx, texObj, pname);
}
}
}
if (ctx->Driver.TexParameter && need_update) {
- GLfloat fparam = (GLfloat) param;
- ctx->Driver.TexParameter(ctx, texObj, pname, &fparam);
+ ctx->Driver.TexParameter(ctx, texObj, pname);
}
}
}
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, texObj, pname, fparams);
+ ctx->Driver.TexParameter(ctx, texObj, pname);
}
}
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ 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;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.i, params);
break;
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ 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;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the unsigned integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.ui, params);
break;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameterfv");
+ if (!texObj)
return;
- }
_mesa_texture_parameterfv(ctx, texObj, pname, params, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterf(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameterf");
+ if (!texObj)
return;
- }
_mesa_texture_parameterf(ctx, texObj, pname, param, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteri(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameteri");
+ if (!texObj)
return;
- }
_mesa_texture_parameteri(ctx, texObj, pname, param, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameteriv");
+ if (!texObj)
return;
- }
_mesa_texture_parameteriv(ctx, texObj, pname, params, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureParameterIiv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameterIiv");
+ if (!texObj)
return;
- }
_mesa_texture_parameterIiv(ctx, texObj, pname, params, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureParameterIuiv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glTextureParameterIuiv");
+ if (!texObj)
return;
- }
_mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
}
*/
return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
_mesa_has_OES_texture_buffer(ctx);
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return _mesa_has_texture_cube_map_array(ctx);
}
if (!_mesa_is_desktop_gl(ctx))
return GL_TRUE;
case GL_PROXY_TEXTURE_CUBE_MAP:
return ctx->Extensions.ARB_texture_cube_map;
- case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
- case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
return ctx->Extensions.ARB_texture_cube_map_array;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
- if (_mesa_is_format_compressed(texFormat) &&
+ if (_mesa_is_format_compressed(texFormat) &&
!_mesa_is_proxy_texture(target)) {
*params = _mesa_format_image_size(texFormat, img->Width,
img->Height, img->Depth);
- }
- else {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTex%sLevelParameter[if]v(pname=%s)", suffix,
- _mesa_enum_to_string(pname));
- }
+ } else {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTex%sLevelParameter[if]v(pname=%s)", suffix,
+ _mesa_enum_to_string(pname));
+ }
break;
case GL_TEXTURE_COMPRESSED:
*params = (GLint) _mesa_is_format_compressed(texFormat);
}
+/**
+ * Handle a glGetTexLevelParamteriv() call for a texture buffer.
+ */
static void
get_tex_level_parameter_buffer(struct gl_context *ctx,
const struct gl_texture_object *texObj,
GLenum baseFormat = _mesa_get_format_base_format(texFormat);
const char *suffix = dsa ? "ture" : "";
+ assert(texObj->Target == GL_TEXTURE_BUFFER);
+
if (!bo) {
/* undefined texture buffer object */
switch (pname) {
struct gl_texture_object *obj;
GET_CURRENT_CONTEXT(ctx);
- obj = get_texobj_by_name(ctx, texture, GL_TRUE);
- if (!obj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterfv(texture)");
+ obj = get_texobj_by_name(ctx, texture, "glGetTextureParameterfv");
+ if (!obj)
return;
- }
get_tex_parameterfv(ctx, obj, pname, params, true);
}
struct gl_texture_object *obj;
GET_CURRENT_CONTEXT(ctx);
- obj = get_texobj_by_name(ctx, texture, GL_TRUE);
- if (!obj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameteriv(texture)");
+ obj = get_texobj_by_name(ctx, texture, "glGetTextureParameteriv");
+ if (!obj)
return;
- }
get_tex_parameteriv(ctx, obj, pname, params, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterIiv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glGetTextureParameterIiv");
+ if (!texObj)
return;
- }
get_tex_parameterIiv(ctx, texObj, pname, params, true);
}
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
- if (!texObj) {
- /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureParameterIuiv(texture)");
+ texObj = get_texobj_by_name(ctx, texture, "glGetTextureParameterIuiv");
+ if (!texObj)
return;
- }
get_tex_parameterIuiv(ctx, texObj, pname, params, true);
}