summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvc0/nvc0_surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_surface.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_surface.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c
index 6773f96baa6..607b02e0277 100644
--- a/src/gallium/drivers/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nvc0/nvc0_surface.c
@@ -457,7 +457,6 @@ struct nvc0_blitctx
unsigned num_samplers[5];
struct pipe_sampler_view *texture[2];
struct nv50_tsc_entry *sampler[2];
- enum pipe_format format;
unsigned dirty;
} saved;
struct nvc0_program vp;
@@ -728,19 +727,26 @@ nvc0_blitctx_get_color_mask_and_fp(struct nvc0_blitctx *blit,
}
static void
-nvc0_blit_set_dst(struct nvc0_context *nvc0, struct pipe_surface *surf,
- struct nvc0_blitctx *blit)
+nvc0_blit_set_dst(struct nvc0_context *nvc0,
+ struct pipe_resource *res, unsigned level, unsigned layer)
{
- blit->saved.format = surf->format;
+ struct pipe_context *pipe = &nvc0->base.pipe;
+ struct pipe_surface templ;
+
+ if (util_format_is_depth_or_stencil(res->format))
+ templ.format = nvc0_blit_zeta_to_colour_format(res->format);
+ else
+ templ.format = res->format;
- if (util_format_is_depth_or_stencil(surf->format))
- surf->format = nvc0_blit_zeta_to_colour_format(surf->format);
+ templ.usage = PIPE_USAGE_STREAM;
+ templ.u.tex.level = level;
+ templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
- nvc0->framebuffer.cbufs[0] = surf;
+ nvc0->framebuffer.cbufs[0] = nvc0_miptree_surface_new(pipe, res, &templ);
nvc0->framebuffer.nr_cbufs = 1;
nvc0->framebuffer.zsbuf = NULL;
- nvc0->framebuffer.width = surf->width;
- nvc0->framebuffer.height = surf->height;
+ nvc0->framebuffer.width = nvc0->framebuffer.cbufs[0]->width;
+ nvc0->framebuffer.height = nvc0->framebuffer.cbufs[0]->height;
}
static INLINE void
@@ -893,7 +899,7 @@ nvc0_blitctx_post_blit(struct nvc0_context *nvc0, struct nvc0_blitctx *blit)
{
int s;
- nvc0->framebuffer.cbufs[0]->format = blit->saved.format;
+ pipe_surface_reference(&nvc0->framebuffer.cbufs[0], NULL);
nvc0->framebuffer.width = blit->saved.fb.width;
nvc0->framebuffer.height = blit->saved.fb.height;
@@ -942,7 +948,7 @@ nvc0_resource_resolve(struct pipe_context *pipe,
struct nvc0_blitctx *blit = screen->blitctx;
struct nouveau_pushbuf *push = screen->base.pushbuf;
struct pipe_resource *src = info->src.res;
- struct pipe_resource *dst = info->dst.surface->texture;
+ struct pipe_resource *dst = info->dst.res;
float x0, x1, y0, y1;
float x_range, y_range;
@@ -958,8 +964,8 @@ nvc0_resource_resolve(struct pipe_context *pipe,
nvc0_blitctx_pre_blit(blit, nvc0);
- nvc0_blit_set_dst(nvc0, info->dst.surface, blit);
- nvc0_blit_set_src(nvc0, src, 0, info->src.layer, blit->filter);
+ nvc0_blit_set_dst(nvc0, dst, info->dst.level, info->dst.layer);
+ nvc0_blit_set_src(nvc0, src, 0, info->src.layer, blit->filter);
nvc0_blitctx_prepare_state(blit);