[Mesa-dev,06/11] mesa: Add _mesa_is_array_texture helper

Submitted by Eduardo Lima Mitev on Feb. 10, 2015, 3:40 p.m.

Details

Message ID 1423582848-18526-7-git-send-email-elima@igalia.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Eduardo Lima Mitev Feb. 10, 2015, 3:40 p.m.
From: Iago Toral Quiroga <itoral@igalia.com>

---
 src/mesa/main/teximage.c | 22 ++++++++++++++++++++++
 src/mesa/main/teximage.h |  3 +++
 2 files changed, 25 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c9c48bb..f0d0ef0 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -739,6 +739,28 @@  _mesa_is_proxy_texture(GLenum target)
 
 
 /**
+ * Test if a target is an array target.
+ *
+ * \param target texture target.
+ *
+ * \return GL_TRUE if the target is an array target, GL_FALSE otherwise.
+ */
+GLboolean
+_mesa_is_array_texture(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D_ARRAY:
+   case GL_TEXTURE_2D_ARRAY:
+   case GL_TEXTURE_CUBE_MAP_ARRAY:
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+      return GL_TRUE;
+   default:
+      return GL_FALSE;
+   };
+}
+
+
+/**
  * Return the proxy target which corresponds to the given texture target
  */
 static GLenum
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 02b0eda..6a77ece 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -66,6 +66,9 @@  _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
 extern GLboolean
 _mesa_is_proxy_texture(GLenum target);
 
+extern GLboolean
+_mesa_is_array_texture(GLenum target);
+
 extern struct gl_texture_image *
 _mesa_new_texture_image( struct gl_context *ctx );
 

Comments

On 02/10/2015 08:40 AM, Eduardo Lima Mitev wrote:
> From: Iago Toral Quiroga <itoral@igalia.com>
>
> ---
>   src/mesa/main/teximage.c | 22 ++++++++++++++++++++++
>   src/mesa/main/teximage.h |  3 +++
>   2 files changed, 25 insertions(+)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index c9c48bb..f0d0ef0 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -739,6 +739,28 @@ _mesa_is_proxy_texture(GLenum target)
>
>
>   /**
> + * Test if a target is an array target.
> + *
> + * \param target texture target.
> + *
> + * \return GL_TRUE if the target is an array target, GL_FALSE otherwise.
> + */
> +GLboolean
> +_mesa_is_array_texture(GLenum target)
> +{
> +   switch (target) {
> +   case GL_TEXTURE_1D_ARRAY:
> +   case GL_TEXTURE_2D_ARRAY:
> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> +      return GL_TRUE;
> +   default:
> +      return GL_FALSE;
> +   };
> +}
> +
> +
> +/**
>    * Return the proxy target which corresponds to the given texture target
>    */
>   static GLenum
> diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
> index 02b0eda..6a77ece 100644
> --- a/src/mesa/main/teximage.h
> +++ b/src/mesa/main/teximage.h
> @@ -66,6 +66,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
>   extern GLboolean
>   _mesa_is_proxy_texture(GLenum target);
>
> +extern GLboolean
> +_mesa_is_array_texture(GLenum target);
> +
>   extern struct gl_texture_image *
>   _mesa_new_texture_image( struct gl_context *ctx );
>
>

For non-API booleans, we're usually using bool/true/false nowadays.

But not a big deal.  Reviewed-by: Brian Paul <brianp@vmware.com>

-Brian
On 02/10/2015 08:10 AM, Brian Paul wrote:
> On 02/10/2015 08:40 AM, Eduardo Lima Mitev wrote:
>> From: Iago Toral Quiroga <itoral@igalia.com>
>>
>> ---
>>   src/mesa/main/teximage.c | 22 ++++++++++++++++++++++
>>   src/mesa/main/teximage.h |  3 +++
>>   2 files changed, 25 insertions(+)
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index c9c48bb..f0d0ef0 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -739,6 +739,28 @@ _mesa_is_proxy_texture(GLenum target)
>>
>>
>>   /**
>> + * Test if a target is an array target.
>> + *
>> + * \param target texture target.
>> + *
>> + * \return GL_TRUE if the target is an array target, GL_FALSE otherwise.
>> + */
>> +GLboolean
>> +_mesa_is_array_texture(GLenum target)
>> +{
>> +   switch (target) {
>> +   case GL_TEXTURE_1D_ARRAY:
>> +   case GL_TEXTURE_2D_ARRAY:
>> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
>> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>> +      return GL_TRUE;
>> +   default:
>> +      return GL_FALSE;
>> +   };
>> +}
>> +
>> +
>> +/**
>>    * Return the proxy target which corresponds to the given texture
>> target
>>    */
>>   static GLenum
>> diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
>> index 02b0eda..6a77ece 100644
>> --- a/src/mesa/main/teximage.h
>> +++ b/src/mesa/main/teximage.h
>> @@ -66,6 +66,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint
>> internalFormat );
>>   extern GLboolean
>>   _mesa_is_proxy_texture(GLenum target);
>>
>> +extern GLboolean
>> +_mesa_is_array_texture(GLenum target);
>> +
>>   extern struct gl_texture_image *
>>   _mesa_new_texture_image( struct gl_context *ctx );
>>
>>
> 
> For non-API booleans, we're usually using bool/true/false nowadays.

I was going to say the same thing. :)

> But not a big deal.  Reviewed-by: Brian Paul <brianp@vmware.com>
> 
> -Brian
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
On Tue, 2015-02-10 at 09:24 -0800, Ian Romanick wrote:
> On 02/10/2015 08:10 AM, Brian Paul wrote:
> > On 02/10/2015 08:40 AM, Eduardo Lima Mitev wrote:
> >> From: Iago Toral Quiroga <itoral@igalia.com>
> >>
> >> ---
> >>   src/mesa/main/teximage.c | 22 ++++++++++++++++++++++
> >>   src/mesa/main/teximage.h |  3 +++
> >>   2 files changed, 25 insertions(+)
> >>
> >> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> >> index c9c48bb..f0d0ef0 100644
> >> --- a/src/mesa/main/teximage.c
> >> +++ b/src/mesa/main/teximage.c
> >> @@ -739,6 +739,28 @@ _mesa_is_proxy_texture(GLenum target)
> >>
> >>
> >>   /**
> >> + * Test if a target is an array target.
> >> + *
> >> + * \param target texture target.
> >> + *
> >> + * \return GL_TRUE if the target is an array target, GL_FALSE otherwise.
> >> + */
> >> +GLboolean
> >> +_mesa_is_array_texture(GLenum target)
> >> +{
> >> +   switch (target) {
> >> +   case GL_TEXTURE_1D_ARRAY:
> >> +   case GL_TEXTURE_2D_ARRAY:
> >> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> >> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> >> +      return GL_TRUE;
> >> +   default:
> >> +      return GL_FALSE;
> >> +   };
> >> +}
> >> +
> >> +
> >> +/**
> >>    * Return the proxy target which corresponds to the given texture
> >> target
> >>    */
> >>   static GLenum
> >> diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
> >> index 02b0eda..6a77ece 100644
> >> --- a/src/mesa/main/teximage.h
> >> +++ b/src/mesa/main/teximage.h
> >> @@ -66,6 +66,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint
> >> internalFormat );
> >>   extern GLboolean
> >>   _mesa_is_proxy_texture(GLenum target);
> >>
> >> +extern GLboolean
> >> +_mesa_is_array_texture(GLenum target);
> >> +
> >>   extern struct gl_texture_image *
> >>   _mesa_new_texture_image( struct gl_context *ctx );
> >>
> >>
> > 
> > For non-API booleans, we're usually using bool/true/false nowadays.
> 
> I was going to say the same thing. :)
> 
> > But not a big deal.  Reviewed-by: Brian Paul <brianp@vmware.com>
> > 
> > -Brian

I'll change that, thanks for reviewing.

Iago

> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev