[Mesa-dev] [PATCH 06/15] mesa: Turn target_can_be_compressed() in to a utility function

Jason Ekstrand jason at jlekstrand.net
Wed Jul 30 14:54:35 PDT 2014


On Wed, Jul 30, 2014 at 2:04 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> On Tue, Jul 29, 2014 at 5:01 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > If we're going to make a utility function declared in glformats.h, let's
> > move the function body to glformats.c.
> >
> or just move the function declaration to teximage.h? That looks like a
> better
> place to declare texture target related functions.
>

Either way.  I guess it makes sense to keep it in teximage
--Jason


>
> >
> > On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat <anuj.phogat at gmail.com>
> wrote:
> >>
> >> Cc: <mesa-stable at lists.freedesktop.org>
> >> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> >> ---
> >>  src/mesa/main/glformats.h |  3 +++
> >>  src/mesa/main/teximage.c  | 12 ++++++------
> >>  2 files changed, 9 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> >> index af10899..5c3b2e3 100644
> >> --- a/src/mesa/main/glformats.h
> >> +++ b/src/mesa/main/glformats.h
> >> @@ -125,6 +125,9 @@ extern GLenum
> >>  _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
> >>                                        GLenum internalFormat);
> >>
> >> +extern GLboolean
> >> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> >> target,
> >> +                               GLenum intFormat);
> >>
> >>  #ifdef __cplusplus
> >>  }
> >> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> >> index 845ba80..b8627a3 100644
> >> --- a/src/mesa/main/teximage.c
> >> +++ b/src/mesa/main/teximage.c
> >> @@ -1779,9 +1779,9 @@ compressedteximage_only_format(const struct
> >> gl_context *ctx, GLenum format)
> >>   * Helper function to determine whether a target and specific
> compression
> >>   * format are supported.
> >>   */
> >> -static GLboolean
> >> -target_can_be_compressed(const struct gl_context *ctx, GLenum target,
> >> -                         GLenum intFormat)
> >> +GLboolean
> >> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> >> target,
> >> +                               GLenum intFormat)
> >>  {
> >>     (void) intFormat;  /* not used yet */
> >>
> >> @@ -2204,7 +2204,7 @@ texture_error_check( struct gl_context *ctx,
> >>
> >>     /* additional checks for compressed textures */
> >>     if (_mesa_is_compressed_format(ctx, internalFormat)) {
> >> -      if (!target_can_be_compressed(ctx, target, internalFormat)) {
> >> +      if (!_mesa_target_can_be_compressed(ctx, target,
> internalFormat)) {
> >>           _mesa_error(ctx, GL_INVALID_ENUM,
> >>                       "glTexImage%dD(target can't be compressed)",
> >> dimensions);
> >>           return GL_TRUE;
> >> @@ -2260,7 +2260,7 @@ compressed_texture_error_check(struct gl_context
> >> *ctx, GLint dimensions,
> >>     GLenum error = GL_NO_ERROR;
> >>     char *reason = ""; /* no error */
> >>
> >> -   if (!target_can_be_compressed(ctx, target, internalFormat)) {
> >> +   if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
> >>        reason = "target";
> >>        error = GL_INVALID_ENUM;
> >>        goto error;
> >> @@ -2694,7 +2694,7 @@ copytexture_error_check( struct gl_context *ctx,
> >> GLuint dimensions,
> >>     }
> >>
> >>     if (_mesa_is_compressed_format(ctx, internalFormat)) {
> >> -      if (!target_can_be_compressed(ctx, target, internalFormat)) {
> >> +      if (!_mesa_target_can_be_compressed(ctx, target,
> internalFormat)) {
> >>           _mesa_error(ctx, GL_INVALID_ENUM,
> >>                       "glCopyTexImage%dD(target)", dimensions);
> >>           return GL_TRUE;
> >> --
> >> 1.8.3.1
> >>
> >> _______________________________________________
> >> mesa-dev mailing list
> >> mesa-dev at lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140730/fb0f639b/attachment.html>


More information about the mesa-dev mailing list