summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2013-06-19 00:02:24 +0200
committerChristoph Bumiller <[email protected]>2013-06-19 00:02:24 +0200
commit7f7b05d6b324c15b6573dfe1e90d4d5cf416a59b (patch)
tree90699813b49213286e745a2cb2f895c575138137
parent712269d6744a8849d1d0cf01fa0132d969b79ed4 (diff)
nv50: avoid crash on updating RASTERIZE_ENABLE state
When doing blit using the 3D engine, the rasterizer cso may be NULL. Ported from nvc0 commit 8aa8b0539. Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index d6066f2ae96..30dab0bf961 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -458,6 +458,7 @@ struct nv50_blitctx
enum pipe_texture_target target;
struct {
struct pipe_framebuffer_state fb;
+ struct nv50_rasterizer_stateobj *rast;
struct nv50_program *vp;
struct nv50_program *gp;
struct nv50_program *fp;
@@ -467,6 +468,7 @@ struct nv50_blitctx
struct nv50_tsc_entry *sampler[2];
uint32_t dirty;
} saved;
+ struct nv50_rasterizer_stateobj rast;
};
static void
@@ -836,10 +838,14 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *ctx)
ctx->saved.fb.cbufs[0] = nv50->framebuffer.cbufs[0];
ctx->saved.fb.zsbuf = nv50->framebuffer.zsbuf;
+ ctx->saved.rast = nv50->rast;
+
ctx->saved.vp = nv50->vertprog;
ctx->saved.gp = nv50->gmtyprog;
ctx->saved.fp = nv50->fragprog;
+ nv50->rast = &ctx->rast;
+
nv50->vertprog = &blitter->vp;
nv50->gmtyprog = NULL;
nv50->fragprog = ctx->fp;
@@ -884,6 +890,8 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit)
nv50->framebuffer.cbufs[0] = blit->saved.fb.cbufs[0];
nv50->framebuffer.zsbuf = blit->saved.fb.zsbuf;
+ nv50->rast = blit->saved.rast;
+
nv50->vertprog = blit->saved.vp;
nv50->gmtyprog = blit->saved.gp;
nv50->fragprog = blit->saved.fp;
@@ -1328,6 +1336,8 @@ nv50_blitctx_create(struct nv50_context *nv50)
nv50->blit->nv50 = nv50;
+ nv50->blit->rast.pipe.half_pixel_center = 1;
+
return TRUE;
}