teximage: ensure that Tex*SubImage* checks format

We were previously not doing at least some of the checks. This uses the
same logic that is used in glTexImage*.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Ilia Mirkin
2019-09-02 18:50:01 -04:00
parent 8e92ce9ba5
commit 32d458fdff

View File

@@ -2205,6 +2205,15 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
if (!texture_formats_agree(texImage->InternalFormat, format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(incompatible internalFormat = %s, format = %s)",
callerName,
_mesa_enum_to_string(texImage->InternalFormat),
_mesa_enum_to_string(format));
return GL_TRUE;
}
GLenum internalFormat = _mesa_is_gles(ctx) ?
oes_float_internal_format(ctx, texImage->InternalFormat, type) :
texImage->InternalFormat;