diff options
author | Marek Olšák <[email protected]> | 2012-09-13 01:05:08 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:57 +0200 |
commit | d37e6b15ad545106d48af5c8abb75d0e28895d43 (patch) | |
tree | 561f633c3083ee5df032124e1bb53f46c9d2befd /src/mesa/state_tracker | |
parent | d1b929a13713e740c06e3abc8666fe56b513a41a (diff) |
st/mesa: implement decompress_with_blit using gallium blit
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 70 |
1 files changed, 23 insertions, 47 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5634a3e6e54..473ff3a94c5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/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); } |