Mesa (master): draw: assert that we have non-null fragment shader

Brian Paul brianp at kemper.freedesktop.org
Thu Nov 3 22:57:42 UTC 2011


Module: Mesa
Branch: master
Commit: e814d577253d3b618cc40e36f9d50b42fe61d6ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e814d577253d3b618cc40e36f9d50b42fe61d6ed

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Nov  3 16:55:18 2011 -0600

draw: assert that we have non-null fragment shader

Instead of just segfaulting.  Recently ran into this.

---

 src/gallium/auxiliary/draw/draw_pipe_pstipple.c   |    2 ++
 src/gallium/auxiliary/draw/draw_pipe_wide_point.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index fe3627b..0401a45 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -361,6 +361,8 @@ generate_pstip_fs(struct pstip_stage *pstip)
    tgsi_dump(pstip_fs.tokens, 0);
 #endif
 
+   assert(pstip->fs);
+
    pstip->fs->sampler_unit = transform.freeSampler;
    assert(pstip->fs->sampler_unit < PIPE_MAX_SAMPLERS);
 
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 0b86ba1..8e0a117 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -229,6 +229,8 @@ widepoint_first_point(struct draw_stage *stage,
       const struct draw_fragment_shader *fs = draw->fs.fragment_shader;
       uint i;
 
+      assert(fs);
+
       wide->num_texcoord_gen = 0;
 
       /* Loop over fragment shader inputs looking for generic inputs




More information about the mesa-commit mailing list