iris: Fix key->input_vertices for 8_PATCH TCS mode.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 7 Jul 2019 23:48:10 +0000 (16:48 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 11 Jul 2019 08:18:24 +0000 (01:18 -0700)
We were failing to flag the program dirty when it changed.  Also, we
were unnecessarily setting key->input_vertices for SINGLE_PATCH mode,
which would reduce program cache hits.  Only set it if needed.

src/gallium/drivers/iris/iris_draw.c
src/gallium/drivers/iris/iris_program.c

index 50c18774c70c21caf60912b21b3d87190021062b..5793dc15064ca24b7429508a2ca371643cf44aca 100644 (file)
@@ -63,6 +63,9 @@ static void
 iris_update_draw_info(struct iris_context *ice,
                       const struct pipe_draw_info *info)
 {
+   struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
+   const struct brw_compiler *compiler = screen->compiler;
+
    if (ice->state.prim_mode != info->mode) {
       ice->state.prim_mode = info->mode;
       ice->state.dirty |= IRIS_DIRTY_VF_TOPOLOGY;
@@ -81,6 +84,10 @@ iris_update_draw_info(struct iris_context *ice,
       ice->state.vertices_per_patch = info->vertices_per_patch;
       ice->state.dirty |= IRIS_DIRTY_VF_TOPOLOGY;
 
+      /* 8_PATCH TCS needs this for key->input_vertices */
+      if (compiler->use_tcs_8_patch)
+         ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_TCS;
+
       /* Flag constants dirty for gl_PatchVerticesIn if needed. */
       const struct shader_info *tcs_info =
          iris_get_shader_info(ice, MESA_SHADER_TESS_CTRL);
index 502cbebb024d673466ce5623252bdc6eca07527a..8470b97a2e204fd3110c98aae2b122fdebf53abe 100644 (file)
@@ -1173,6 +1173,7 @@ iris_update_compiled_tcs(struct iris_context *ice)
    struct iris_uncompiled_shader *tcs =
       ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL];
    struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
+   const struct brw_compiler *compiler = screen->compiler;
    const struct gen_device_info *devinfo = &screen->devinfo;
 
    const struct shader_info *tes_info =
@@ -1181,7 +1182,8 @@ iris_update_compiled_tcs(struct iris_context *ice)
       KEY_INIT_NO_ID(devinfo->gen),
       .base.program_string_id = tcs ? tcs->program_id : 0,
       .tes_primitive_mode = tes_info->tess.primitive_mode,
-      .input_vertices = ice->state.vertices_per_patch,
+      .input_vertices =
+         !tcs || compiler->use_tcs_8_patch ? ice->state.vertices_per_patch : 0,
    };
    get_unified_tess_slots(ice, &key.outputs_written,
                           &key.patch_outputs_written);