iris: don't segfault on !old_cso
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 10 Jan 2018 07:14:10 +0000 (23:14 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:04 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_state.c

index 66f33fc242b948b9a83868e8b6f4a2d8b92adbfe..842136fc00dcb396dd6fcfdfd556fca6b2548392 100644 (file)
@@ -540,14 +540,16 @@ iris_bind_rasterizer_state(struct pipe_context *ctx, void *state)
    struct iris_rasterizer_state *old_cso = ice->state.cso_rast;
    struct iris_rasterizer_state *new_cso = state;
 
-   /* Avoid re-emitting 3DSTATE_LINE_STIPPLE if we can, it's non-pipelined */
-   if (old_cso->line_stipple_factor != new_cso->line_stipple_factor ||
-       old_cso->line_stipple_pattern != new_cso->line_stipple_pattern) {
-      ice->state.dirty |= IRIS_DIRTY_LINE_STIPPLE;
-   }
+   if (old_cso) {
+      /* Try to avoid re-emitting 3DSTATE_LINE_STIPPLE, it's non-pipelined */
+      if (old_cso->line_stipple_factor != new_cso->line_stipple_factor ||
+          old_cso->line_stipple_pattern != new_cso->line_stipple_pattern) {
+         ice->state.dirty |= IRIS_DIRTY_LINE_STIPPLE;
+      }
 
-   if (old_cso->half_pixel_center != new_cso->half_pixel_center) {
-      ice->state.dirty |= IRIS_DIRTY_MULTISAMPLE;
+      if (old_cso->half_pixel_center != new_cso->half_pixel_center) {
+         ice->state.dirty |= IRIS_DIRTY_MULTISAMPLE;
+      }
    }
 
    ice->state.cso_rast = new_cso;