summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-03-15 21:55:08 +0100
committerMichal Krol <michal@vmware.com>2010-03-16 11:25:12 +0100
commit8f55a95178069d5e8b18647e6b675fc403d68073 (patch)
treeb08c04fcc85e2c3d59ed15aff39c0f528933674c /src/mesa/state_tracker/st_cb_texture.c
parente4b8a307b25146202b1fb64339b307bde5ec3b30 (diff)
gallium: change remaining util functions to use cso sampler views
changes arguments of util_blit_pixels_tex and util_gen_mipmap to struct pipe_sampler_view * instead of struct pipe_texture *.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0c518a7e03..6ed1c60a51 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -63,6 +63,7 @@
#include "util/u_blit.h"
#include "util/u_format.h"
#include "util/u_surface.h"
+#include "util/u_sampler.h"
#include "util/u_math.h"
@@ -380,6 +381,8 @@ compress_with_blit(GLcontext * ctx,
gl_format mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *src_view;
struct pipe_surface *dst_surface;
struct pipe_transfer *tex_xfer;
void *map;
@@ -441,9 +444,16 @@ compress_with_blit(GLcontext * ctx,
pipe->transfer_unmap(pipe, tex_xfer);
pipe->tex_transfer_destroy(pipe, tex_xfer);
+ /* Create temporary sampler view */
+ u_sampler_view_default_template(&view_templ,
+ src_tex,
+ src_tex->format);
+ src_view = pipe->create_sampler_view(pipe, src_tex, &view_templ);
+
+
/* copy / compress image */
util_blit_pixels_tex(ctx->st->blit,
- src_tex, /* pipe_texture (src) */
+ src_view, /* sampler view (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -455,6 +465,7 @@ compress_with_blit(GLcontext * ctx,
pipe_surface_reference(&dst_surface, NULL);
pipe_texture_reference(&src_tex, NULL);
+ pipe_sampler_view_reference(&src_view, NULL);
return GL_TRUE;
}
@@ -817,6 +828,8 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_screen *screen = pipe->screen;
struct st_texture_image *stImage = st_texture_image(texImage);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+ struct pipe_sampler_view *src_view = st_get_stobj_sampler_view(stObj);
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_surface *dst_surface;
@@ -833,7 +846,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
/* blit/render/decompress */
util_blit_pixels_tex(ctx->st->blit,
- stImage->pt, /* pipe_texture (src) */
+ src_view, /* pipe_texture (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -1457,7 +1470,6 @@ st_copy_texsubimage(GLcontext *ctx,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj =
_mesa_select_tex_object(ctx, texUnit, target);
- struct st_texture_object *stObj = st_texture_object(texObj);
struct gl_texture_image *texImage =
_mesa_select_tex_image(ctx, texObj, target, level);
struct st_texture_image *stImage = st_texture_image(texImage);