+ /* Create a second sampler view to read stencil */
+ if (type == GL_STENCIL) {
+ write_stencil = GL_TRUE;
+ enum pipe_format stencil_format =
+ util_format_stencil_only(pt->format);
+ /* we should not be doing pixel map/transfer (see above) */
+ assert(num_sampler_view == 1);
+ sv[1] = st_create_texture_sampler_view_format(st->pipe, pt,
+ stencil_format);
+ if (!sv[1]) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
+ pipe_resource_reference(&pt, NULL);
+ pipe_sampler_view_reference(&sv[0], NULL);
+ return;
+ }
+ num_sampler_view++;
+ }