[Mesa-dev] [PATCH 30/68] glsl, i965: don't used shader cache when transform feedback enabled
Timothy Arceri
timothy.arceri at collabora.com
Wed Jun 1 06:23:11 UTC 2016
Note in future we may want to use the cache when in shader xfb
qualifiers override the API.
---
src/compiler/glsl/linker.cpp | 15 ++++++++++++++-
src/compiler/glsl/shader_cache.cpp | 7 +++++++
src/mesa/drivers/dri/i965/brw_shader_cache.c | 7 +++++++
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index da7f2ee..f35c0e7 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4483,7 +4483,20 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
tfeedback_decl *tfeedback_decls = NULL;
#ifdef ENABLE_SHADER_CACHE
- if (!is_cache_fallback && shader_cache_read_program_metadata(ctx, prog))
+ /* 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++) {
+ if (prog->Shaders[i]->ir) {
+ continue;
+ }
+ _mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);
+ }
+ skip_cache = true;
+ }
+
+ if (!is_cache_fallback && !skip_cache &&
+ shader_cache_read_program_metadata(ctx, prog))
return;
#endif
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 30255bc..e5f5f48 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -356,6 +356,13 @@ write_program_resource_data(struct blob *metadata,
}
}
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ /* Don't bother caching transform feedback varyings/buffers as we will
+ * always relink a program which enables transform feedback.
+ * TODO: We may want to this for shaders that use the xfb_* qualifiers.
+ */
+ break;
default:
assert(!"Support for writting resource not yet implemneted.");
}
diff --git a/src/mesa/drivers/dri/i965/brw_shader_cache.c b/src/mesa/drivers/dri/i965/brw_shader_cache.c
index e5aa022..7945b16 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -66,6 +66,13 @@ upload_cached_program(struct brw_context *brw)
if (prog == NULL)
return;
+ /* FIXME: For now we don't read from the cache if transform feedback is
+ * enabled. However we should be able to use cached shaders when the xfb_*
+ * qualifiers were used to enable transform feedback.
+ */
+ if (prog->TransformFeedback.NumVarying > 0)
+ return;
+
offset += snprintf(manifest + offset, sizeof(manifest) - offset,
"program: %s\n", _mesa_sha1_format(sha1_buf, prog->sha1));
--
2.5.5
More information about the mesa-dev
mailing list