glsl/shader_cache: Allow shader cache usage with transform feedback
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 13 Mar 2018 17:44:39 +0000 (10:44 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Mon, 19 Mar 2018 16:57:09 +0000 (09:57 -0700)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105444
Suggested-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/linker.cpp
src/compiler/glsl/shader_cache.cpp

index 1444b68cb02c27c6c65b0cc474145cf43a5d01d9..af09b7d03ee8c8d223069e670e83a53f7ab6d5fe 100644 (file)
@@ -4773,16 +4773,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
 #ifdef ENABLE_SHADER_CACHE
-   /* If transform feedback used on the program then compile all shaders. */
-   bool skip_cache = false;
-   if (prog->TransformFeedback.NumVarying > 0) {
-      for (unsigned i = 0; i < prog->NumShaders; i++) {
-         _mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);
-      }
-      skip_cache = true;
-   }
-
-   if (!skip_cache && shader_cache_read_program_metadata(ctx, prog))
+   if (shader_cache_read_program_metadata(ctx, prog))
       return;
 #endif
 
index bf884af79063ad254cee702a4782640dbaa9e52a..e43ed7aa675e726964282f42a5ebed2026696265 100644 (file)
@@ -160,6 +160,12 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
    prog->FragDataBindings->iterate(create_binding_str, &buf);
    ralloc_strcat(&buf, "fbi: ");
    prog->FragDataIndexBindings->iterate(create_binding_str, &buf);
+   ralloc_asprintf_append(&buf, "tf: %d ", prog->TransformFeedback.BufferMode);
+   for (unsigned int i = 0; i < prog->TransformFeedback.NumVarying; i++) {
+      ralloc_asprintf_append(&buf, "%s:%d ",
+                             prog->TransformFeedback.VaryingNames[i],
+                             prog->TransformFeedback.BufferStride[i]);
+   }
 
    /* SSO has an effect on the linked program so include this when generating
     * the sha also.