[Mesa-dev] [PATCH 30/65] glsl, i965: don't used shader cache when transform feedback enabled
Timothy Arceri
timothy.arceri at collabora.com
Fri Apr 29 13:33:29 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 | 11 +++++++++++
src/compiler/glsl/shader_cache.cpp | 7 +++++++
src/mesa/drivers/dri/i965/brw_shader_cache.c | 7 +++++++
3 files changed, 25 insertions(+)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 4477768..979dbb5 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4316,6 +4316,17 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
tfeedback_decl *tfeedback_decls = NULL;
#ifdef ENABLE_SHADER_CACHE
+ /* If transform feedback used on the program then compile all shaders. */
+ 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 (!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 333b262..9c7b18d 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