[Mesa-dev] [PATCH 7/9] softpipe: don't use 3-component formats

Roland Scheidegger sroland at vmware.com
Mon Aug 24 17:58:05 PDT 2015


Am 25.08.2015 um 01:08 schrieb Ilia Mirkin:
> On Mon, Aug 24, 2015 at 7:04 PM, Brian Paul <brianp at vmware.com> wrote:
>> Mesa and gallium don't have a complete set of matching 3-component
>> texture formats.  For example, 8-bit sRGB unorm.  To fully support
>> the GL_ARB_copy_image extension we need to have support for all of
>> these formats: RGB8_UNORM, RGB8_SNORM, RGB8_SRGB, RGB8_UINT, and
>> RGB8_SINT using the same component order.  Since we don't have that,
>> disable the 3-component formats for now.
>> ---
>>  src/gallium/drivers/softpipe/sp_screen.c | 25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>> index aeef8e6..24d79f1 100644
>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>> @@ -360,6 +360,31 @@ softpipe_is_format_supported( struct pipe_screen *screen,
>>        return FALSE;
>>     }
>>
>> +   if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) &&
>> +       ((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) {
>> +      if (format == PIPE_FORMAT_R8G8B8_UINT ||
>> +          format == PIPE_FORMAT_R8G8B8_SINT ||
>> +          format == PIPE_FORMAT_R8G8B8_UNORM ||
>> +          format == PIPE_FORMAT_R16G16B16_UINT ||
>> +          format == PIPE_FORMAT_R16G16B16_SINT ||
>> +          format == PIPE_FORMAT_R16G16B16_UNORM ||
>> +          format == PIPE_FORMAT_R16G16B16_FLOAT ||
>> +          format == PIPE_FORMAT_R32G32B32_UINT ||
>> +          format == PIPE_FORMAT_R32G32B32_SINT ||
>> +          format == PIPE_FORMAT_R32G32B32_UNORM ||
>> +          format == PIPE_FORMAT_R32G32B32_FLOAT) {
> 
> Won't this lose you ARB_texture_buffer_object_rgb32 support?
If so, my guess is we could just ditch support for 32bit UNORM formats
in llvmpipe and softpipe for sampling/rendering. They don't really work
in some useful way anyway and no hw supports them afaik (?).
(The reason being that floats don't have enough precision for converting
to such formats, though I guess with doubles it could work.)
I don't think there's any state tracker which would use them.

As for the 16bit formats, maybe mesa should get a 16bit unorm rgb
format? Doesn't make a lot of sense to me that we've got rgb and rgbx 16
bit variants for uint/sint/snorm/float but only rgbx for unorm?

(llvmpipe though actually has some trouble rendering to some of the 3
component formats last I checked.)

Roland


> 
>    static const struct st_extension_format_mapping tbo_rgb32[] = {
>       { {o(ARB_texture_buffer_object_rgb32) },
>         { PIPE_FORMAT_R32G32B32_FLOAT,
>           PIPE_FORMAT_R32G32B32_UINT,
>           PIPE_FORMAT_R32G32B32_SINT,
>         } },
> 
>       init_format_extensions(screen, extensions, tbo_rgb32,
>                              ARRAY_SIZE(tbo_rgb32), PIPE_BUFFER,
>                              PIPE_BIND_SAMPLER_VIEW);
> 
> 
> 
>> +         /* Don't support any 3-component formats for rendering/texturing
>> +          * since we don't support the corresponding 8-bit 3 channel UNORM
>> +          * formats.  This allows us to support GL_ARB_copy_image between
>> +          * GL_RGB8 and GL_RGB8UI, for example.  Otherwise, we may be asked to
>> +          * do a resource copy between PIPE_FORMAT_R8G8B8_UINT and
>> +          * PIPE_FORMAT_R8G8B8X8_UNORM, for example, which will not work
>> +          * (different bpp).
>> +          */
>> +         return FALSE;
>> +      }
>> +   }
>> +
>>     if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
>>         format != PIPE_FORMAT_ETC1_RGB8)
>>        return FALSE;
>> --
>> 1.9.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=7ox0_okH6uNJhTJz9joXdenkY_YeEo_g1SYjhTXEp-s&s=YIVRqdNLa1jknfnHUXQ7Eu7rnxc8MvshaEzbVxaC0Ao&e= 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=7ox0_okH6uNJhTJz9joXdenkY_YeEo_g1SYjhTXEp-s&s=YIVRqdNLa1jknfnHUXQ7Eu7rnxc8MvshaEzbVxaC0Ao&e= 
> 



More information about the mesa-dev mailing list