[Mesa-dev] [PATCH 0/6] glGetTexImage fixes

Erik Faye-Lund erik.faye-lund at collabora.com
Thu Nov 22 16:48:36 UTC 2018


I was recently investigating a gl-error that appears some times while
using virgl, where I got a pretty nonsensical GL-error:

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

Now, the reason why this is nonsensical, is that glGetnTexImage doesn't 
have a 'depth'-argument, this value is generated internally in mesa.

What happens is that virgl ends up asking for the teximage for a
non-existen mipmap-level. Whoops, that shouldn't be done, but while 
we're in this area, let's clean this up.

My first fix was to revert 42891dbaa12 ("gettextsubimage: verify zoffset
and depth are correct"). But that would render that commit moot, but it
actually does fix something. So I'd rather not; it's a good change, but
this logic should only apply to glGetTextureSubImage.

So I decided to give glGetTextureSubImage its own error checking.

While working on this, I also realized that the error introduced in
b37b35a5d26 ("getteximage: assume texture image is empty for non defined
levels") was flawed; it shouldn't apply in the case where *all* of
width, xoffset and the texture's width are zero. And since we end up
checking explicitly for these conditions later, this should simply be a
no-op as per the spec. And we already have some support-code for this.

No regressions found in piglit.

Erik Faye-Lund (6):
  mesa/main: remove ARB suffix from glGetnTexImage
  mesa/main: remove bogus error for zero-sized images
  mesa/main: factor out tex-image error-checking
  mesa/main: factor out common error-checking
  mesa/main: check cube-completeness in common code
  mesa/main: fix incorrect detph-error

 src/mapi/glapi/gen/ARB_robustness.xml |   2 +-
 src/mapi/glapi/gen/gl_API.xml         |   9 +
 src/mesa/main/texgetimage.c           | 273 ++++++++++++++++----------
 src/mesa/main/texgetimage.h           |   4 +-
 4 files changed, 179 insertions(+), 109 deletions(-)

-- 
2.19.1



More information about the mesa-dev mailing list