[Mesa-dev] [PATCH 18/87] glsl: skip shader cache unless program is made up of vs or fs
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 13 02:47:13 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 955700a..08f8e37 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -52,6 +52,13 @@ extern "C" {
}
static void
+compile_shaders(struct gl_context *ctx, struct gl_shader_program *prog) {
+ for (unsigned i = 0; i < prog->NumShaders; i++) {
+ _mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);
+ }
+}
+
+static void
encode_type_to_blob(struct blob *blob, const glsl_type *type)
{
uint32_t encoding;
@@ -469,6 +476,13 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
if (!cache)
return false;
+ for (unsigned i = 0; i < prog->NumShaders; i++) {
+ if (prog->Shaders[i]->Stage != MESA_SHADER_VERTEX &&
+ prog->Shaders[i]->Stage != MESA_SHADER_FRAGMENT) {
+ compile_shaders(ctx, prog);
+ return false;
+ }
+ }
/* Include bindings when creating sha1. These bindings change the resulting
* binary so they are just as important as the shader source.
--
2.7.4
More information about the mesa-dev
mailing list