mesa/main: fix incorrect depth-error
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 22 Nov 2018 10:10:50 +0000 (11:10 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 26 Nov 2018 11:29:54 +0000 (12:29 +0100)
commitc120dbfe4d18240315ecec9b43a61aeb9ab239ac
tree8c1bc3097c3208da2757f5cd4fbc305e043e91f3
parent38af69adfaf47019926bfe3a8cf352752068d389
mesa/main: fix incorrect depth-error

If glGetTexImage or glGetnTexImage is called with a level that doesn't
exist, we get an error message on this form:

Mesa: User error: GL_INVALID_VALUE in glGetTexImage(depth = 0)

This is clearly nonsensical, because these APIs don't even have a
depth-parameter. The reason is that get_texture_image_dims() return
all-zero dimensions for non-existent texture-images, and we go on to
validate these dimensions as if they were user-input, because
glGetTextureSubImage requires checking.

So let's split this logic in two, so glGetTextureSubImage can have
stricter input-validation. All arguments that are no longer validated
are generated internally by mesa, so there's no use in validating them.

Fixes: 42891dbaa12 "gettextsubimage: verify zoffset and depth are correct"
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
src/mesa/main/texgetimage.c