[Mesa-dev] [PATCH] i965: Always compile fp64 funcs when needed

Matt Turner mattst88 at gmail.com
Fri Jan 25 20:43:09 UTC 2019


Compilation of user-specified shaders with software fp64 works by
compiling on demand an "fp64-funcs" shader implementing various fp64
operations and then linking it into the "user shader".

In

   commit 64b8c86d37ebb1e1d286c69d642d52b7bcf051d3
   Author: Timothy Arceri <tarceri at itsqueeze.com>
   Date:   Thu Jan 17 17:16:29 2019 +1100

       glsl: be much more aggressive when skipping shader compilation

we changed the behavior of the shader cache to skip compilation earlier
when we get a cache hit.

After the aforementioned commit, compiling a user program using fp64
would store into the cache an entry for the fp64-funcs shader.
Subsequent compilations of uncached user shaders using fp64 would fail
in compile_fp64_funcs() after finding a cache entry for the fp64-funcs,
but being unprepared to read from the cache.

It's unclear to me how to retrieve the cached NIR of the fp64-funcs (if
it even is cached), so just call _mesa_glsl_compile_shader() with
force_recompile=true in order to ensure we generate the fp64-funcs
successfully.
---
 src/mesa/drivers/dri/i965/brw_program.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index c01143decd0..9ab25cf664c 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -40,6 +40,7 @@
 #include "tnl/tnl.h"
 #include "util/ralloc.h"
 #include "compiler/glsl/ir.h"
+#include "compiler/glsl/program.h"
 #include "compiler/glsl/glsl_to_nir.h"
 #include "compiler/glsl/float64_glsl.h"
 
@@ -87,7 +88,7 @@ compile_fp64_funcs(struct gl_context *ctx,
 
    sh->Source = float64_source;
    sh->CompileStatus = COMPILE_FAILURE;
-   _mesa_compile_shader(ctx, sh);
+   _mesa_glsl_compile_shader(ctx, sh, false, false, true);
 
    if (!sh->CompileStatus) {
       if (sh->InfoLog) {
-- 
2.19.2



More information about the mesa-dev mailing list