Brian Paul | 17 Aug 2012 18:58
Favicon

[PATCH 1/2] mesa: querying GL_TEXTURE_COMPRESSED_IMAGE_SIZE for a buffer obj is illegal

GL_INVALID_OPERATION is to be raised when querying a non-compressed
image/buffer.  Since a buffer object can't have a compressed format this
query always generates an error.
---
 src/mesa/main/texparam.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 8a5abe5..5a5547d 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
 <at>  <at>  -1136,13 +1136,9  <at>  <at>  get_tex_level_parameter_buffer(struct gl_context *ctx,

       /* GL_ARB_texture_compression */
       case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
-         if (_mesa_is_format_compressed(texFormat) &&
-             !_mesa_is_proxy_texture(target)) {
-            *params = _mesa_format_image_size(texFormat, bo->Size, 0, 0);
-         } else {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glGetTexLevelParameter[if]v(pname)");
-         }
+         /* Always illegal for GL_TEXTURE_BUFFER */
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetTexLevelParameter[if]v(pname)");
          break;

       /* GL_ARB_texture_float */
--

-- 
1.7.3.4
(Continue reading)

Brian Paul | 17 Aug 2012 18:58
Favicon

[PATCH 2/2] mesa: remove unused params, add const qualifiers

---
 src/mesa/main/texparam.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 5a5547d..41b9f97 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
 <at>  <at>  -926,7 +926,7  <at>  <at>  legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)

 static void
 get_tex_level_parameter_image(struct gl_context *ctx,
-                              struct gl_texture_object *texObj,
+                              const struct gl_texture_object *texObj,
                               GLenum target, GLint level,
                               GLenum pname, GLint *params)
 {
 <at>  <at>  -1073,11 +1073,10  <at>  <at>  invalid_pname:

 static void
 get_tex_level_parameter_buffer(struct gl_context *ctx,
-                               struct gl_texture_object *texObj,
-                               GLenum target, GLint level,
+                               const struct gl_texture_object *texObj,
                                GLenum pname, GLint *params)
 {
-   struct gl_buffer_object *bo = texObj->BufferObject;
+   const struct gl_buffer_object *bo = texObj->BufferObject;
    gl_format texFormat = texObj->_BufferObjectFormat;
    GLenum internalFormat = texObj->BufferObjectFormat;
(Continue reading)

Ian Romanick | 18 Aug 2012 05:17

Re: [PATCH 1/2] mesa: querying GL_TEXTURE_COMPRESSED_IMAGE_SIZE for a buffer obj is illegal

On 08/17/2012 09:58 AM, Brian Paul wrote:
> GL_INVALID_OPERATION is to be raised when querying a non-compressed
> image/buffer.  Since a buffer object can't have a compressed format this
> query always generates an error.

Good catch.  The series is

Reviewed-by: Ian Romanick <ian.d.romanick <at> intel.com>

> ---
>   src/mesa/main/texparam.c |   10 +++-------
>   1 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index 8a5abe5..5a5547d 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
>  <at>  <at>  -1136,13 +1136,9  <at>  <at>  get_tex_level_parameter_buffer(struct gl_context *ctx,
>
>         /* GL_ARB_texture_compression */
>         case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
> -         if (_mesa_is_format_compressed(texFormat) &&
> -             !_mesa_is_proxy_texture(target)) {
> -            *params = _mesa_format_image_size(texFormat, bo->Size, 0, 0);
> -         } else {
> -            _mesa_error(ctx, GL_INVALID_OPERATION,
> -                        "glGetTexLevelParameter[if]v(pname)");
> -         }
> +         /* Always illegal for GL_TEXTURE_BUFFER */
> +         _mesa_error(ctx, GL_INVALID_OPERATION,
(Continue reading)

Kenneth Graunke | 18 Aug 2012 07:20

Re: [PATCH 1/2] mesa: querying GL_TEXTURE_COMPRESSED_IMAGE_SIZE for a buffer obj is illegal

On 08/17/2012 09:58 AM, Brian Paul wrote:
> GL_INVALID_OPERATION is to be raised when querying a non-compressed
> image/buffer.  Since a buffer object can't have a compressed format this
> query always generates an error.
> ---
>  src/mesa/main/texparam.c |   10 +++-------
>  1 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index 8a5abe5..5a5547d 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
>  <at>  <at>  -1136,13 +1136,9  <at>  <at>  get_tex_level_parameter_buffer(struct gl_context *ctx,
>  
>        /* GL_ARB_texture_compression */
>        case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
> -         if (_mesa_is_format_compressed(texFormat) &&
> -             !_mesa_is_proxy_texture(target)) {
> -            *params = _mesa_format_image_size(texFormat, bo->Size, 0, 0);
> -         } else {
> -            _mesa_error(ctx, GL_INVALID_OPERATION,
> -                        "glGetTexLevelParameter[if]v(pname)");
> -         }
> +         /* Always illegal for GL_TEXTURE_BUFFER */
> +         _mesa_error(ctx, GL_INVALID_OPERATION,
> +                     "glGetTexLevelParameter[if]v(pname)");
>           break;
>  
>        /* GL_ARB_texture_float */

(Continue reading)


Gmane