[Mesa-dev] [PATCH 1/2] gallium: add red-alpha texture formats and a couple of util functions
Marek Olšák
maraeo at gmail.com
Fri Feb 8 05:03:59 PST 2013
On Fri, Feb 8, 2013 at 1:56 AM, Brian Paul <brianp at vmware.com> wrote:
> On 02/07/2013 01:13 PM, Marek Olšák wrote:
>>
>> This is for glGetTexImage and it will be used for samplers only (which
>> some
>> drivers already implement by reading util_format_description).
>> ---
>> src/gallium/auxiliary/util/u_format.csv | 12 +++
>> src/gallium/auxiliary/util/u_format.h | 123
>> +++++++++++++++++++++++++++++++
>> src/gallium/include/pipe/p_format.h | 12 +++
>> 3 files changed, 147 insertions(+)
>>
>> diff --git a/src/gallium/auxiliary/util/u_format.csv
>> b/src/gallium/auxiliary/util/u_format.csv
>> index 1d27407..f3925bb 100644
>> --- a/src/gallium/auxiliary/util/u_format.csv
>> +++ b/src/gallium/auxiliary/util/u_format.csv
>> @@ -360,3 +360,15 @@ PIPE_FORMAT_R16G16B16X16_SINT , plain, 1, 1,
>> sp16, sp16, sp16, x16, xyz1,
>> PIPE_FORMAT_R32G32B32X32_FLOAT , plain, 1, 1, f32, f32, f32,
>> x32, xyz1, rgb
>> PIPE_FORMAT_R32G32B32X32_UINT , plain, 1, 1, up32, up32, up32,
>> x32, xyz1, rgb
>> PIPE_FORMAT_R32G32B32X32_SINT , plain, 1, 1, sp32, sp32, sp32,
>> x32, xyz1, rgb
>> +
>> +PIPE_FORMAT_R8A8_SNORM , plain, 1, 1, sn8 , sn8 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R16A16_UNORM , plain, 1, 1, un16 , un16 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R16A16_SNORM , plain, 1, 1, sn16 , sn16 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R16A16_FLOAT , plain, 1, 1, f16 , f16 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R32A32_FLOAT , plain, 1, 1, f32 , f32 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R8A8_UINT , plain, 1, 1, up8 , up8 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R8A8_SINT , plain, 1, 1, sp8 , sp8 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R16A16_UINT , plain, 1, 1, up16 , up16 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R16A16_SINT , plain, 1, 1, sp16 , sp16 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R32A32_UINT , plain, 1, 1, up32 , up32 , ,
>> , x00y, rgb
>> +PIPE_FORMAT_R32A32_SINT , plain, 1, 1, sp32 , sp32 , ,
>> , x00y, rgb
>> diff --git a/src/gallium/auxiliary/util/u_format.h
>> b/src/gallium/auxiliary/util/u_format.h
>> index 63015dd..1a5d954 100644
>> --- a/src/gallium/auxiliary/util/u_format.h
>> +++ b/src/gallium/auxiliary/util/u_format.h
>> @@ -888,6 +888,129 @@ util_format_stencil_only(enum pipe_format format)
>> }
>>
>> /**
>> + * Converts PIPE_FORMAT_*I* to PIPE_FORMAT_*R*.
>> + * This is identity for non-intensity formats.
>> + */
>> +static INLINE enum pipe_format
>> +util_format_intensity_to_red(enum pipe_format format)
>> +{
>> + if (!util_format_is_intensity(format))
>> + return format;
>
>
> If we removed that test, and just did 'return format' for the default case,
> wouldn't that work too? We seem to be catching all the intensity formats in
> the switch. That way we could avoid a util_format_description() call.
>
> Then, the default case below could have
> assert(!util_format_is_intensity(format))
> as a sanity check.
You're right. The assertion would suffice, I'll update the patch.
Marek
More information about the mesa-dev
mailing list