[Mesa-dev] [PATCH 0/8] compiler: Add a new gl_image_format enum and use it

Eric Anholt eric at anholt.net
Thu Jul 13 16:57:43 UTC 2017


Jason Ekstrand <jason at jlekstrand.net> writes:

> I know what you're all thinking:  Why are we adding yet another format
> enum?  I asked myself the same question.  Really, I've spent enough of my
> life writing format enum conversion tables that I should know better.
>
> It all started as an attempt to write patch 6 which prints the formats of
> images used in shaders in nir_print.  Unfortunately, what I wanted to do
> was to use _mesa_enum_to_string to convert the GL enum (which is what we
> were using before) into a string to print.  The problem is that this
> function exists in mesa/main and is therefore unavailable in nir_print().
> So, instead of writing a remap table just for nir_print(), I decided to
> bite the bullet and add something to shader_enums.
>
> Really, I think this makes a fair amount of sense as the image formats in
> GLSL or SPIR-V really live in their own compiler enum space.  The only
> reason why we re-used the GL enums before was for convenience.  This meant
> that spirv_to_nir had a big table to convert SPIR-V enums to GL enums which
> is a bit awkward since it's for Vulkan.  In any case, I don't think this
> actually makes the situation any worse.

Could we just pull the Mesa formats and their names up to the top,
instead?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170713/4a1c1584/attachment.sig>


More information about the mesa-dev mailing list