iris: fix num viewports to be based on programs
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 20 Jun 2018 22:57:46 +0000 (15:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:07 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_program.c
src/gallium/drivers/iris/iris_state.c

index 669754e8aafadea54f9397b0987a7af29f0d95c4..136b1c388df58108b08381119fc16b0ea01293be 100644 (file)
@@ -443,6 +443,19 @@ update_last_vue_map(struct iris_context *ice)
       prog_data = ice->shaders.prog[MESA_SHADER_VERTEX]->prog_data;
 
    struct brw_vue_prog_data *vue_prog_data = (void *) prog_data;
+   struct brw_vue_map *vue_map = &vue_prog_data->vue_map;
+   struct brw_vue_map *old_map = ice->shaders.last_vue_map;
+   const uint64_t changed_slots =
+      (old_map ? old_map->slots_valid : 0ull) ^ vue_map->slots_valid;
+
+   if (changed_slots & VARYING_BIT_VIEWPORT) {
+      // XXX: could use ctx->Const.MaxViewports for old API efficiency
+      ice->state.num_viewports =
+         (vue_map->slots_valid & VARYING_BIT_VIEWPORT) ? IRIS_MAX_VIEWPORTS : 1;
+      ice->state.dirty |= IRIS_DIRTY_CLIP | IRIS_DIRTY_SF_CL_VIEWPORT;
+      // XXX: CC_VIEWPORT?
+   }
+
    ice->shaders.last_vue_map = &vue_prog_data->vue_map;
 }
 
index 794e46fc80585ecaa4bf70d6e3ccc52c44079ebe..7e791c68120c4f5290030f2cd27ff3333252720d 100644 (file)
@@ -1259,13 +1259,6 @@ iris_set_viewport_states(struct pipe_context *ctx,
       vp_map += GENX(SF_CLIP_VIEWPORT_length);
    }
 
-   unsigned num_viewports = start_slot + count;
-
-   if (num_viewports != ice->state.num_viewports) {
-      ice->state.num_viewports = num_viewports;
-      ice->state.dirty |= IRIS_DIRTY_CLIP;
-   }
-
    ice->state.dirty |= IRIS_DIRTY_SF_CL_VIEWPORT;
 }