[Mesa-dev] [PATCH 7/9] softpipe: don't use 3-component formats
Marek Olšák
maraeo at gmail.com
Tue Aug 25 13:31:51 PDT 2015
On Tue, Aug 25, 2015 at 9:23 PM, Brian Paul <brianp at vmware.com> wrote:
> On 08/24/2015 06:59 PM, Marek Olšák wrote:
>>
>> On Tue, Aug 25, 2015 at 1:04 AM, 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) {
>>
>>
>> For simpler code and keeping TBO support:
>>
>> desc->is_array && desc->nr_channels == 3 && target != PIPE_BUFFER
>>
>> where desc = util_format_description(format)
>
>
> Formats such as PIPE_FORMAT_B8G8R8X8_UNORM report nr_channels=4. One also
Yes, X is counted as a component, that's the whole point. nr_channels
is 3 for RGB but not RGBX, which seems to be exactly what you want,
and "is_array" assures you won't remove R5G6B5, Z32_S8X24 and other
packed ones.
Basically, (nr_channels == 3 && is_array) covers this:
*_R8G8B8_*
*_R16G16B16_*
*_R32G32B32_*
*_R64G64B64_*
Marek
More information about the mesa-dev
mailing list