[Mesa-dev] [PATCH 11/15] mesa: Add a helper function _mesa_is_enum_format_unsized()

Anuj Phogat anuj.phogat at gmail.com
Wed Jul 30 21:29:08 PDT 2014


On Tue, Jul 29, 2014 at 5:02 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>
>
>
> On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>>
>> Function is utilized by next patch in the series.
>>
>> Cc: <mesa-stable at lists.freedesktop.org>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>>  src/mesa/main/glformats.c | 18 ++++++++++++++++++
>>  src/mesa/main/glformats.h |  3 +++
>>  2 files changed, 21 insertions(+)
>>
>> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
>> index 05a3842..b95ecea 100644
>> --- a/src/mesa/main/glformats.c
>> +++ b/src/mesa/main/glformats.c
>> @@ -356,6 +356,24 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum
>> type)
>>  }
>>
>>  /**
>> + * Test if the given format is an unsized color format.
>> + */
>> +GLboolean
>> +_mesa_is_enum_format_unsized(GLenum format)
>> +{
>> +   switch (format) {
>> +   case GL_RGBA:
>> +   case GL_RGB:
>> +   case GL_ALPHA:
>> +   case GL_LUMINANCE:
>> +   case GL_LUMINANCE_ALPHA:
>> +      return GL_TRUE;
>> +   default:
>> +      return GL_FALSE;
>
>
> What about GL_RED, GL_RG, GL_INTENSITY, GL_DEPTH_COMPONENT,
> GL_DEPTH_STENICIL, GL_SRGB, and GL_SRGB_ALPHA?  If we're going to add
> another metadata function, we should probably at least try to include these.
> Otherwise, someone is liable to make a mistake with it later.
>
I just included the unsized internalformats (listed in table 3.3) accepted by
glCopyTexImage() in GLES 3.0. I'll add more unsized formats to make the
function usable in other cases as well.

>>
>> +   }
>> +}
>> +
>> +/**
>>   * Test if the given format is a SNORM (signed-normalized) format.
>>   */
>>  GLboolean
>> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
>> index d4856e5..b2ef77b 100644
>> --- a/src/mesa/main/glformats.h
>> +++ b/src/mesa/main/glformats.h
>> @@ -60,6 +60,9 @@ extern GLboolean
>>  _mesa_is_type_unsigned(GLenum type);
>>
>>  extern GLboolean
>> +_mesa_is_enum_format_unsized(GLenum format);
>> +
>> +extern GLboolean
>>  _mesa_is_enum_format_snorm(GLenum format);
>>
>>  extern GLboolean
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>


More information about the mesa-dev mailing list