i965: Only set key->high_quality_derivatives when it matters.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 26 Oct 2017 22:22:45 +0000 (15:22 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 30 Oct 2017 03:54:16 +0000 (20:54 -0700)
This avoids recompiles for shaders that don't use explicit derivatives
when ctx->Hint.FragmentShaderDerivative == GL_NICEST.

For example, GFXBench 5 Aztec Ruins sets the GL_NICEST hint before
compiling any shaders, but none of them use dFdx() or dFdy() - only
implicit derivatives.  This doesn't eliminate any recompiles, but
does eliminate one of the reasons for doing so.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_wm.c

index ad1c8aed79e1056462681095cf8567a2abfe6a00..a1e39b55fcbe59edfe30e9039e8825707e3453bb 100644 (file)
@@ -521,6 +521,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
 
    /* _NEW_HINT */
    key->high_quality_derivatives =
+      prog->info.uses_fddx_fddy &&
       ctx->Hint.FragmentShaderDerivative == GL_NICEST;
 
    if (devinfo->gen < 6)