[PATCH] svga: Check vs and fs pointer when updating states.

Vic Lee llyzs at 163.com
Sat Mar 3 02:57:16 PST 2012


Application may call clear command before setting any vertex or fragment. The
svga driver will try to apply all pipeline states even when a clear command is
called, which does not require any shader or rasterizer states. Add those
pointer checks to avoid segfault in such situation.

Signed-off-by: Vic Lee <llyzs at 163.com>
---
 src/gallium/drivers/svga/svga_state_need_swtnl.c |    4 ++--
 1 files changed, 2 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 8c39a4b..281181d 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -136,14 +136,14 @@ update_need_pipeline( struct svga_context *svga,
 
    /* EDGEFLAGS
     */
-    if (vs->base.info.writes_edgeflag) {
+   if (vs && vs->base.info.writes_edgeflag) {
       SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__);
       need_pipeline = TRUE;
    }
 
    /* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
     */
-   if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
+   if (svga->curr.fs && svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
       unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable;
       unsigned generic_inputs = svga->curr.fs->generic_inputs;
 
-- 
1.7.9.1


--------------000207020604070706040309--


More information about the mesa-dev mailing list