[Mesa-dev] [PATCH v3] i965: Fix ETC2/EAC GetCompressed* functions on Gen7 GPUs

Alejandro PiƱeiro apinheiro at igalia.com
Sat May 5 07:59:35 UTC 2018


On 04/05/18 21:06, Eleni Maria Stea wrote:
> Hi Eero,
>
> On Fri, 4 May 2018 18:29:55 +0300
> Eero Tamminen <eero.t.tamminen at intel.com> wrote:
>
>> You mean returning CAVEAT_SUPPORT in params for compressed formats
>> which are transparently converted to uncompressed data?
> Well, that would be the best solution I think, if it's possible to
> modify an existing query in the extension, although I am not certain
> which is the best query to modify: TEXTURE_COMPRESSED, or
> INTERNALFORMAT_SUPPORTED (or maybe both?). 

Note: by spec, INTERNALFORMAT_SUPPORTED can only return TRUE/FALSE.
Probably that is because it is intended to return TRUE as far as it is
supported on any subset of possible operations. In that sense it doesn't
mention resource/target, so it is computed without it. I guess that they
reserved CAVEAT_SUPPORT for queries that ask for a given resource on a
specific context.

> There's also another solution that we already have, but we are not sure
> if it is correct:
>
> I noticed that both mesa and nvidia drivers return GL_FALSE when the
> pname is GL_TEXTURE_COMPRESSED and the format is emulated and GL_TRUE
> for the natively supported formats. (Specifically on mesa the code that
> performs the check is in src/mesa/main/formatquery.c and tests only
> for native support). 

FWIW2: as I mentioned to you in private, right now that is cause by a
bug, and not really intended. In any case, taking into account that
NVIDIA is doing that, perhaps the intention of that query was asking
what you point, if the format is really compressed or not.


> But if you take a look at this part of the extension specification:
>
> TEXTURE_COMPRESSED: If <internalformat> is a compressed format
>       that is supported for this type of resource, TRUE is returned in 
>       <params>. If the internal format is not compressed, or the type of
>       resource is not supported, FALSE is returned.
>
> it is not very clear if we should return true or false for an
> emulated format. Maybe returning false when we provide emulation is a
> bug in both drivers, just a convenient one in this case. :-)
>
> Is there any way to clarify what should be the correct behavior?

I think that it would be faster to just create a spec issue/bug instead
of debate here what that paragraph really means.
ARB_internalformat_query2 is a really long spec, so it is normal that
some parts need clarification (we already needed to ask). I will create
an issue in short.

FWIW, imho, there is another alternative. The thing is that I still find
strange to allow a format to be used on CompressedTexImage*D, and then
return FALSE when asking TEXTURE_COMPRESSED. I think that the compromise
would be allow this query to return CAVEAT_SUPPORT, because that is
exactly the problem here. Mesa supports that format (you can use on
CompressedTexImage*D, but with a CAVEAT.

>
> Do you think that even if the current behavior of the
> TEXTURE_COMPRESSED query is correct, in which case it should keep
> returning GL_FALSE for the emulated formats, we should nevertheless
> modify something else, e.g. the INTERNALFORMAT_SUPPORTED query, to
> return CAVEAT_SUPPORT? 
>
>> That API's not available for GLES v2, where I think ETC is most widely
>> used, so it would be more of a solution for GLES v3.x applications
>> only. Sounds OK to me.

Bummer here: query2 is not available on GLES v3.x either. Right now is a
desktop only extension. The spec have several references to GLES (some
of them are in fact implemented), but we found that they were leftovers,
as initially the plan was to use the extension on both GL and GLES, when
we tried to enable that extension for OpenGL ES:

https://lists.freedesktop.org/archives/piglit/2016-May/019765.html

>>
>> Hardest part will be propagating use of this query to engines &
>> toolkits that would benefit from using it. :-)
> +1 on that :)
>
> Thanks a lot for the suggestions and the feedback,
> Eleni
>
> PS: here is some code to clarify the current situation:
>
> [1]: https://github.com/hikiko/test-compression is a test program to
> quickly check the compressed formats supported (see
> the function print_compressed_formats at the end of main.c)
>
> [2]: https://pastebin.com/Qif74fFn is the output of [1] on HSW using
> the ETC patch and on nvidia where you can see that the natively
> supported compression formats return GL_TRUE in both cards whereas the
> emulated ones return GL_FALSE in both cards
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list