aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-10-01 12:04:07 +0200
committermarha <marha@users.sourceforge.net>2012-10-01 12:04:07 +0200
commit7305d42f2ad0462ca3916a73df49cc6b70b41fe4 (patch)
tree4de7ec9601f83c61d84e9b8cda40ca0f5ca6bc91 /mesalib/src/mesa/state_tracker/st_cb_texture.c
parentc86fbbd2c3bb30e96a614456bbb7688e0387cf8c (diff)
parent7ed9dbafdbc724c1030404f29678559134de559b (diff)
downloadvcxsrv-7305d42f2ad0462ca3916a73df49cc6b70b41fe4.tar.gz
vcxsrv-7305d42f2ad0462ca3916a73df49cc6b70b41fe4.tar.bz2
vcxsrv-7305d42f2ad0462ca3916a73df49cc6b70b41fe4.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libxcb mesa pixman xkeyboard-config git update 1 oct 2012 Conflicts: libxcb/src/man/.gitignore
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c70
1 files changed, 23 insertions, 47 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 5634a3e6e..473ff3a94 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -575,61 +575,40 @@ 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;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
- struct pipe_surface *dst_surface;
struct pipe_resource *dst_texture;
struct pipe_transfer *tex_xfer;
- unsigned bind = (PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
- PIPE_BIND_TRANSFER_READ);
+ struct pipe_blit_info blit;
+ unsigned bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_TRANSFER_READ);
/* create temp / dest surface */
- if (!util_create_rgba_surface(pipe, width, height, bind,
- &dst_texture, &dst_surface)) {
- _mesa_problem(ctx, "util_create_rgba_surface() failed "
+ if (!util_create_rgba_texture(pipe, width, height, bind,
+ &dst_texture)) {
+ _mesa_problem(ctx, "util_create_rgba_texture() failed "
"in decompress_with_blit()");
return;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
- /* 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.format = util_format_linear(sv_temp.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.src.resource = stObj->pt;
+ blit.src.level = texImage->Level;
+ blit.src.format = util_format_linear(stObj->pt->format);
+ blit.dst.resource = dst_texture;
+ blit.dst.level = 0;
+ blit.dst.format = dst_texture->format;
+ blit.src.box.x = blit.dst.box.x = 0;
+ blit.src.box.y = blit.dst.box.y = 0;
+ blit.src.box.z = 0; /* XXX compressed array textures? */
+ blit.dst.box.z = 0;
+ blit.src.box.width = blit.dst.box.width = width;
+ blit.src.box.height = blit.dst.box.height = height;
+ blit.src.box.depth = blit.dst.box.depth = 1;
+ blit.mask = PIPE_MASK_RGBA;
+ blit.filter = PIPE_TEX_FILTER_NEAREST;
+ blit.scissor_enable = FALSE;
/* blit/render/decompress */
- util_blit_pixels_tex(st->blit,
- src_view, /* pipe_resource (src) */
- 0, 0, /* src x0, y0 */
- width, height, /* src x1, y1 */
- dst_surface, /* pipe_surface (dst) */
- 0, 0, /* dst x0, y0 */
- width, height, /* dst x1, y1 */
- 0.0, /* z */
- PIPE_TEX_MIPFILTER_NEAREST);
-
- /* Restore conditional rendering state. */
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition,
- st->condition_mode);
- }
+ st->pipe->blit(st->pipe, &blit);
/* map the dst_surface so we can read from it */
tex_xfer = pipe_get_transfer(pipe,
@@ -691,10 +670,7 @@ end:
pipe->transfer_destroy(pipe, tex_xfer);
- /* destroy the temp / dest surface */
- util_destroy_rgba_surface(dst_texture, dst_surface);
-
- pipe_sampler_view_release(pipe, &src_view);
+ pipe_resource_reference(&dst_texture, NULL);
}