summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-01-14 10:22:17 -0700
committerBrian Paul <[email protected]>2016-01-14 10:39:53 -0700
commit3038e8984df2be35a7164043ec6d385e32e26238 (patch)
treeb98815d07b7eabb312380128dca1b1a4cdefe12f /src/mesa/state_tracker
parentb1e11f4d71a570d39958871cc364841afb17bd13 (diff)
gallium/st: add pipe_context::generate_mipmap()
This patch adds a new interface to support hardware mipmap generation. PIPE_CAP_GENERATE_MIPMAP is added to allow a driver to specify if this new interface is supported; if not supported, the state tracker will fallback to mipmap generation by rendering/texturing. v2: add PIPE_CAP_GENERATE_MIPMAP to the disabled section for all drivers v3: add format to the generate_mipmap interface to allow mipmap generation using a format other than the resource format v4: fix return type of trace_context_generate_mipmap() Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index b3700406df0..3e6c0a73bc7 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -149,12 +149,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
last_layer = util_max_layer(pt, baseLevel);
}
- /* Try to generate the mipmap by rendering/texturing. If that fails,
- * use the software fallback.
+ /* First see if the driver supports hardware mipmap generation,
+ * if not then generate the mipmap by rendering/texturing.
+ * If that fails, use the software fallback.
*/
- if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
- first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
- _mesa_generate_mipmap(ctx, target, texObj);
+ if (!st->pipe->screen->get_param(st->pipe->screen,
+ PIPE_CAP_GENERATE_MIPMAP) ||
+ !st->pipe->generate_mipmap(st->pipe, pt, pt->format, baseLevel,
+ lastLevel, first_layer, last_layer)) {
+
+ if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
+ first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
+ _mesa_generate_mipmap(ctx, target, texObj);
+ }
}
/* Fill in the Mesa gl_texture_image fields */