diff options
author | Brian Paul <[email protected]> | 2017-03-01 15:29:55 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2017-03-02 10:11:19 -0700 |
commit | b95ead850b8f6de7303eae21afa80c4adddd858f (patch) | |
tree | fdd41b0a8301bfa709bb849c1905af418d7f872d /src/gallium/drivers/svga/svga_state_need_swtnl.c | |
parent | 69fb8f3caee3e4e732dcf4b18a4fc2668e96c632 (diff) |
svga: fix crash regression since e027935a795
During the first update of the hw_clear_state atoms, we may not yet
have a current rasterizer state object. So, svga->curr.rast may be
NULL and we crash.
Add a few null pointer checks to work around this. Note that these
are only needed in the state update functions which are called for
'clear' validation.
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_state_need_swtnl.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_state_need_swtnl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c index b07c62da405..f9cea143ac9 100644 --- a/src/gallium/drivers/svga/svga_state_need_swtnl.c +++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c @@ -66,7 +66,8 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty) /* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE */ - if (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim)) { + if (svga->curr.rast && + (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim))) { SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (0x%x) & prim (0x%x)\n", __FUNCTION__, svga->curr.rast->need_pipeline, @@ -103,7 +104,7 @@ update_need_pipeline(struct svga_context *svga, unsigned dirty) /* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE */ - if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) { + if (svga->curr.rast && svga->curr.reduced_prim == PIPE_PRIM_POINTS) { unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable; unsigned generic_inputs = svga->curr.fs ? svga->curr.fs->generic_inputs : 0; |