summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-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 */