Mesa (master): formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE
Alejandro Pinheiro
apinheiro at kemper.freedesktop.org
Fri Oct 27 13:05:03 UTC 2017
Module: Mesa
Branch: master
Commit: fd011376cb3d7713297e057eafbd1d0ef1df3667
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd011376cb3d7713297e057eafbd1d0ef1df3667
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Wed Oct 25 14:35:36 2017 +0200
formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE
>From the spec:
"IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
resource when used as an image textures is returned in
<params>. 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.
v2: fix typo (GetTextParameter vs GetTexParemeter) on comment (Illia Mirkin)
Reviewed-by: Antia Puentes <apuentes at igalia.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
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 77c7faa225..61f798c88f 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 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 <value> set
More information about the mesa-commit
mailing list