[Mesa-dev] [PATCH] mesa: Avoid format converversions for TexImage with unsized internalFormat
Chris Wilson
chris at chris-wilson.co.uk
Fri Sep 4 08:30:22 PDT 2015
On Fri, Sep 04, 2015 at 09:37:37AM +0100, Chris Wilson wrote:
> On Fri, Sep 04, 2015 at 09:00:39AM +0100, Chris Wilson wrote:
> > On Fri, Sep 04, 2015 at 08:51:25AM +0100, Chris Wilson wrote:
> > > + /* We use the user's pixel format and type as a guide for the texture
> > > + * format preferrring to store the texels in a matching format to the
> > > + * incoming pixels. This ideally allows for a conversion free upload
> > > + * and download path - but only if the requested internalFormat
> > > + * requires no conversion.
> > > + */
> > > + if (_mesa_is_enum_format_unsized(internalFormat)) {
> > > + /* unsized also implies no preferred internal datatype */
> > > + mesa_format tex_format = _mesa_format_from_format_and_type(format, type);
> >
> > The issue here is that _mesa_format_from_format_and_type() doesn't
> > recognise all possible patterns and asserts. Is there a safe it could
> > return?
>
> A second issue is how to resolve the render-to-texture conflicts, e.g.
> gl-3.2-layered-rendering-framebuffer-layer-complete. Is exchanging
> texture formats at that point a tractable solution?
Using meta at the point of Driver.RenderTexture() is problematic due to
recursive locking - I couldn't see a clean way to resolve it
immediately. I found I could reduce the impact of the issue down to a
handful of tests within piglit (notably the
tests/spec/gl-3.2/layered-rendering all had the same pattern of
allocating a GL_RGB floating point texture for rendering into) by
splitting the completness testing for GL_READ_FRAMEBUFFER and
GL_DRAW_FRAMEBUFFER (i.e. only require render targets is we are drawing
and allow textures to bound for reading).
The next issue that arose was that _mesa_get_format_base_format()
reports GL_SRGB as GL_RGB so we no longer use an sRGB TexFormat.
Resolved with a _mesa_is_srgb_internalformat() and
_mesa_get_linear_format_srgb().
After that there are just a couple of residual piglit failures due to
the change in precision of a texture (e.g
tests/shaders/glsl-fs-lots-of-tex.shader_test).
So that just leaves the stumbling block of what to do about
render-to-texture now failing (for GL_RGB + GL_FLOAT and other RGB array
types) because we are more precisely internalFormat?
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list