- /* init framebuffer state */
- memset(&fb, 0, sizeof(fb));
- fb.num_cbufs = 1;
-
- /* bind CSOs */
- pipe->bind_blend_state(pipe, blend_cso);
- pipe->bind_depth_stencil_alpha_state(pipe, depthstencil_cso);
- pipe->bind_rasterizer_state(pipe, rasterizer_cso);
- pipe->bind_sampler_state(pipe, 0, sampler_cso);
-
- /* bind shaders */
- pipe->bind_fs_state(pipe, stfp->fs->data);
- pipe->bind_vs_state(pipe, stvp->cso->data);
-
- /*
- * XXX for small mipmap levels, it may be faster to use the software
- * fallback path...
- */
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
-
- /*
- * Setup framebuffer / dest surface
- */
- fb.cbufs[0] = pipe->get_tex_surface(pipe, pt, face, dstLevel, zslice);
- pipe->set_framebuffer_state(pipe, &fb);
-
- simple_viewport(pipe, pt->width[dstLevel], pt->height[dstLevel]);
-
- /*
- * Setup src texture, override pt->first_level so we sample from
- * the right mipmap level.
- */
- pt->first_level = srcLevel;
- pipe->set_sampler_texture(pipe, 0, pt);
-
- draw_quad(st->ctx);
- }
-
- /* restore first_level */
- pt->first_level = first_level_save;
-
- /* restore pipe state */
- if (st->state.rasterizer)
- pipe->bind_rasterizer_state(pipe, st->state.rasterizer->data);
- if (st->state.fs)
- pipe->bind_fs_state(pipe, st->state.fs->data);
- if (st->state.vs)
- pipe->bind_vs_state(pipe, st->state.vs->cso->data);
- if (st->state.sampler[0])
- pipe->bind_sampler_state(pipe, 0, st->state.sampler[0]->data);
- pipe->set_sampler_texture(pipe, 0, st->state.sampler_texture[0]);
- pipe->set_viewport_state(pipe, &st->state.viewport);