summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2017-03-05 19:45:00 -0500
committerIlia Mirkin <[email protected]>2017-04-02 10:58:32 -0400
commit7a0c1eee0c25e343d8c276e4471e4a113d61f233 (patch)
treec8dd7dae6b21a84073595f9f498e679f75eef6b6 /src/gallium/drivers/nouveau/nv50
parent03a67fbbf7847cbdcc26b3bd86ee43e09a55cce9 (diff)
nv50: don't assume a rast is set when validating for clears
Clears can happen before a rast is set, which can in turn cause scissors and fragprog to be validated. Make sure that we handle this case. Reported-by: Andrew Randrianasulu <[email protected]> Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_shader_state.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state_validate.c7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
index d234748a0a0..7f32900a6e9 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
@@ -174,6 +174,9 @@ nv50_fragprog_validate(struct nv50_context *nv50)
struct nv50_program *fp = nv50->fragprog;
struct pipe_rasterizer_state *rast = &nv50->rast->pipe;
+ if (!fp || !rast)
+ return;
+
if (nv50->zsa && nv50->zsa->pipe.alpha.enabled) {
struct pipe_framebuffer_state *fb = &nv50->framebuffer;
bool blendable = fb->nr_cbufs == 0 || !fb->cbufs[0] ||
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
index c6f0363075a..fcf2228c178 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
@@ -186,16 +186,17 @@ nv50_validate_scissor(struct nv50_context *nv50)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
#ifdef NV50_SCISSORS_CLIPPING
int minx, maxx, miny, maxy, i;
+ bool rast_scissor = nv50->rast ? nv50->rast->pipe.scissor : false;
if (!(nv50->dirty_3d &
(NV50_NEW_3D_SCISSOR | NV50_NEW_3D_VIEWPORT | NV50_NEW_3D_FRAMEBUFFER)) &&
- nv50->state.scissor == nv50->rast->pipe.scissor)
+ nv50->state.scissor == rast_scissor)
return;
- if (nv50->state.scissor != nv50->rast->pipe.scissor)
+ if (nv50->state.scissor != rast_scissor)
nv50->scissors_dirty = (1 << NV50_MAX_VIEWPORTS) - 1;
- nv50->state.scissor = nv50->rast->pipe.scissor;
+ nv50->state.scissor = rast_scissor;
if ((nv50->dirty_3d & NV50_NEW_3D_FRAMEBUFFER) && !nv50->state.scissor)
nv50->scissors_dirty = (1 << NV50_MAX_VIEWPORTS) - 1;