summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro PiƱeiro <[email protected]>2015-12-22 20:06:19 +0100
committerEduardo Lima Mitev <[email protected]>2016-03-03 15:14:07 +0100
commit8d7696f6380c38085029fff0eb00c3c18ea8e017 (patch)
tree414468c2a80f3de581164458cdfde7e2045f5957
parenta8736a2567057c0cb3cdd673743d9cc8b562b288 (diff)
mesa/formatquery: added FILTER pname support
It discards out the targets and internalformats that explicitly mention (per-spec) that doesn't support filter types other than NEAREST or NEAREST_MIPMAP_NEAREST. Those are: * Texture buffers target * Multisample targets * Any integer internalformat For the case of multisample targets, it was used the existing method _mesa_target_allows_setting_sampler_parameter. This would scalate better in the future if new targets appear that doesn't allow to set sampler parameters. We consider RENDERBUFFER to support LINEAR filters, because although it doesn't support this filter for sampling, you can set LINEAR on a blit operation using glBlitFramebuffer. Reviewed-by: Dave Airlie <[email protected]>
-rw-r--r--src/mesa/main/formatquery.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index e7645b161ee..cd32c034477 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -642,6 +642,7 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
case GL_FRAMEBUFFER_RENDERABLE:
case GL_FRAMEBUFFER_RENDERABLE_LAYERED:
case GL_FRAMEBUFFER_BLEND:
+ case GL_FILTER:
params[0] = GL_FULL_SUPPORT;
break;
@@ -1191,7 +1192,24 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_FILTER:
- /* @TODO */
+ /* If it doesn't allow to set sampler parameters then it would not allow
+ * to set a filter different to GL_NEAREST. In practice, this method
+ * only filters out MULTISAMPLE/MULTISAMPLE_ARRAY */
+ if (!_mesa_target_allows_setting_sampler_parameters(target))
+ goto end;
+
+ if (_mesa_is_enum_format_integer(internalformat))
+ goto end;
+
+ if (target == GL_TEXTURE_BUFFER)
+ goto end;
+
+ /* At this point we know that multi-texel filtering is supported. We
+ * need to call the driver to know if it is CAVEAT_SUPPORT or
+ * FULL_SUPPORT.
+ */
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_VERTEX_TEXTURE: