i965: Use a uniform for gl_PatchVerticesIn in the TCS on Gen8+.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 1 Jun 2016 07:08:55 +0000 (00:08 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 15 Jun 2016 19:47:37 +0000 (12:47 -0700)
We still need to recompile the passthrough shader when this value
changes, as it also affects the output vertex count.  But otherwise,
we can eliminate recompiles on Gen8+.

We probably want to do this for Gen7 as well, but that requires
rewriting the input release code to use a loop, which is a trade-off
I'd need to consider in more detail.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Cc: mesa-stable@lists.freedesktop.org
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_tcs.c

index ea8e8fdd1e3d7f610ed23736bd8878e02d1584b2..f7c787415cea892c3794a2c090348e0f6100178c 100644 (file)
@@ -599,6 +599,7 @@ brw_initialize_context_constants(struct brw_context *brw)
       ctx->Const.MaxClipPlanes = 8;
 
    ctx->Const.LowerTessLevel = true;
+   ctx->Const.LowerTCSPatchVerticesIn = brw->gen >= 8;
    ctx->Const.LowerTESPatchVerticesIn = true;
    ctx->Const.PrimitiveRestartForPatches = true;
 
index 7fc8eb40726cca8ccda1338022237daf5b00ea3f..8a5dd7e31cd4916d9e23f88b31407632a10e4eb7 100644 (file)
@@ -337,7 +337,8 @@ brw_upload_tcs_prog(struct brw_context *brw,
 
    memset(&key, 0, sizeof(key));
 
-   key.input_vertices = ctx->TessCtrlProgram.patch_vertices;
+   if (brw->gen < 8 || !tcp)
+      key.input_vertices = ctx->TessCtrlProgram.patch_vertices;
    key.outputs_written = per_vertex_slots;
    key.patch_outputs_written = per_patch_slots;
 
@@ -389,7 +390,8 @@ brw_tcs_precompile(struct gl_context *ctx,
    brw_setup_tex_for_precompile(brw, &key.tex, prog);
 
    /* Guess that the input and output patches have the same dimensionality. */
-   key.input_vertices = shader_prog->TessCtrl.VerticesOut;
+   if (brw->gen < 8)
+      key.input_vertices = shader_prog->TessCtrl.VerticesOut;
 
    key.tes_primitive_mode =
       shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL] ?