summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-02-13 14:48:36 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-07-06 10:08:59 -0700
commit099bc3aaea93313c774a554a5dee56706ac4b674 (patch)
tree75250621896389184a676365e561b66093f47fc2
parent3539914e49118a5048e7c0f87d5014c088988195 (diff)
downloadmesa-099bc3aaea93313c774a554a5dee56706ac4b674.tar.gz
st/mesa: use private pipe_sampler_view in decompress_with_blit()
Similar to the previous commit. Also fix incorrect setting of the sampler view's state after it's created. We need to specify the first/last_level fields in the template instead. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (cherry picked from commit 0315cb9f8f3ec38fa9594860754fb53a67cf4c23)
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a19120afc31..f5bf018c346 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -611,8 +611,7 @@ decompress_with_blit(struct gl_context * ctx,
struct pipe_context *pipe = st->pipe;
struct st_texture_image *stImage = st_texture_image(texImage);
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
- struct pipe_sampler_view *src_view =
- st_get_texture_sampler_view(stObj, pipe);
+ struct pipe_sampler_view *src_view;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_surface *dst_surface;
@@ -634,8 +633,21 @@ decompress_with_blit(struct gl_context * ctx,
pipe->render_condition(pipe, NULL, 0);
}
- /* Choose the source mipmap level */
- src_view->u.tex.first_level = src_view->u.tex.last_level = texImage->Level;
+ /* Create sampler view that limits fetches to the source mipmap level */
+ {
+ struct pipe_sampler_view sv_temp;
+
+ u_sampler_view_default_template(&sv_temp, stObj->pt, stObj->pt->format);
+
+ sv_temp.u.tex.first_level =
+ sv_temp.u.tex.last_level = texImage->Level;
+
+ src_view = pipe->create_sampler_view(pipe, stObj->pt, &sv_temp);
+ if (!src_view) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+ return;
+ }
+ }
/* blit/render/decompress */
util_blit_pixels_tex(st->blit,
@@ -704,6 +716,8 @@ decompress_with_blit(struct gl_context * ctx,
/* destroy the temp / dest surface */
util_destroy_rgba_surface(dst_texture, dst_surface);
+
+ pipe_sampler_view_reference(&src_view, NULL);
}