[Mesa-dev] [PATCH] formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE

2017-10-27 Thread Alejandro Piñeiro
From the spec:
   "IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
resource when used as an image textures is returned in
. This is equivalent to calling GetTexParameter"

So we would need to return None for any target not supported by
GetTexParameter. By mistake, we were using the target check for
GetTexLevelParameter.
---
 src/mesa/main/formatquery.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 77c7faa2251..39c628039b8 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -1430,7 +1430,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
   if (!_mesa_has_ARB_shader_image_load_store(ctx))
  goto end;
 
-  if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))
+  /* As pointed by the spec quote below, this pname query should return
+   * the same value that GetTexParameter. So if the target is not valid
+   * for GetTexParameter we return the unsupported value. The check below
+   * is the same target check used by GetTextParameter.
+   */
+  int targetIndex = _mesa_tex_target_to_index(ctx, target);
+  if (targetIndex < 0 || targetIndex == TEXTURE_BUFFER_INDEX)
  goto end;
 
   /* From spec: "Equivalent to calling GetTexParameter with  set
-- 
2.11.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE

2017-10-27 Thread Antia Puentes

Thanks for fixing this.

Reviewed-by: Antia Puentes 


On 27/10/17 11:18, Alejandro Piñeiro wrote:

 From the spec:
"IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
 resource when used as an image textures is returned in
 . This is equivalent to calling GetTexParameter"

So we would need to return None for any target not supported by
GetTexParameter. By mistake, we were using the target check for
GetTexLevelParameter.
---
  src/mesa/main/formatquery.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 77c7faa2251..39c628039b8 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -1430,7 +1430,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
if (!_mesa_has_ARB_shader_image_load_store(ctx))
   goto end;
  
-  if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))

+  /* As pointed by the spec quote below, this pname query should return
+   * the same value that GetTexParameter. So if the target is not valid
+   * for GetTexParameter we return the unsupported value. The check below
+   * is the same target check used by GetTextParameter.
+   */
+  int targetIndex = _mesa_tex_target_to_index(ctx, target);
+  if (targetIndex < 0 || targetIndex == TEXTURE_BUFFER_INDEX)
   goto end;
  
/* From spec: "Equivalent to calling GetTexParameter with  set


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE

2017-10-27 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Fri, Oct 27, 2017 at 11:18 AM, Alejandro Piñeiro
 wrote:
> From the spec:
>"IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
> resource when used as an image textures is returned in
> . This is equivalent to calling GetTexParameter"
>
> So we would need to return None for any target not supported by
> GetTexParameter. By mistake, we were using the target check for
> GetTexLevelParameter.
> ---
>  src/mesa/main/formatquery.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
> index 77c7faa2251..39c628039b8 100644
> --- a/src/mesa/main/formatquery.c
> +++ b/src/mesa/main/formatquery.c
> @@ -1430,7 +1430,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
> internalformat, GLenum pname,
>if (!_mesa_has_ARB_shader_image_load_store(ctx))
>   goto end;
>
> -  if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))
> +  /* As pointed by the spec quote below, this pname query should return
> +   * the same value that GetTexParameter. So if the target is not valid
> +   * for GetTexParameter we return the unsupported value. The check below
> +   * is the same target check used by GetTextParameter.
> +   */
> +  int targetIndex = _mesa_tex_target_to_index(ctx, target);
> +  if (targetIndex < 0 || targetIndex == TEXTURE_BUFFER_INDEX)
>   goto end;
>
>/* From spec: "Equivalent to calling GetTexParameter with  set
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE

2017-10-27 Thread Ilia Mirkin
On Fri, Oct 27, 2017 at 5:18 AM, Alejandro Piñeiro  wrote:
> From the spec:
>"IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
> resource when used as an image textures is returned in
> . This is equivalent to calling GetTexParameter"
>
> So we would need to return None for any target not supported by
> GetTexParameter. By mistake, we were using the target check for
> GetTexLevelParameter.
> ---
>  src/mesa/main/formatquery.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
> index 77c7faa2251..39c628039b8 100644
> --- a/src/mesa/main/formatquery.c
> +++ b/src/mesa/main/formatquery.c
> @@ -1430,7 +1430,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
> internalformat, GLenum pname,
>if (!_mesa_has_ARB_shader_image_load_store(ctx))
>   goto end;
>
> -  if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))
> +  /* As pointed by the spec quote below, this pname query should return
> +   * the same value that GetTexParameter. So if the target is not valid
> +   * for GetTexParameter we return the unsupported value. The check below
> +   * is the same target check used by GetTextParameter.

GetTexParameter

> +   */
> +  int targetIndex = _mesa_tex_target_to_index(ctx, target);
> +  if (targetIndex < 0 || targetIndex == TEXTURE_BUFFER_INDEX)
>   goto end;
>
>/* From spec: "Equivalent to calling GetTexParameter with  set
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev