[Mesa-dev] [PATCH 27/87] glsl, i965: don't used shader cache when transform feedback enabled
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 13 02:47:22 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 a6b9c26..ca758dc 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4512,7 +4512,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 0cb8f85..3ed46f3 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -343,6 +343,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 aceaf32..751abb1 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -210,6 +210,13 @@ upload_cached_program(struct brw_context *brw, gl_shader_stage stage)
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;
+
brw_vs_populate_key(brw, &vs_key);
switch (stage) {
case MESA_SHADER_VERTEX:
--
2.7.4
More information about the mesa-dev
mailing list