aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--src/compiler/Makefile.glsl.am4
-rw-r--r--src/compiler/Makefile.sources4
-rw-r--r--src/compiler/glsl/tests/cache_test.c22
-rw-r--r--src/util/Makefile.sources2
-rw-r--r--src/util/disk_cache.c (renamed from src/compiler/glsl/cache.c)16
-rw-r--r--src/util/disk_cache.h (renamed from src/compiler/glsl/cache.h)11
7 files changed, 17 insertions, 43 deletions
diff --git a/configure.ac b/configure.ac
index 9d62b90cfb5..b89bf23801b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1361,7 +1361,6 @@ if test "x$with_sha1" = "x"; then
AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
fi
fi
-AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
if test "x$enable_shader_cache" = "xyes"; then
AC_DEFINE([ENABLE_SHADER_CACHE], [1], [Enable shader cache])
fi
diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index 3eac677de0d..5b1d74e2835 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -131,10 +131,6 @@ glsl_libglsl_la_SOURCES = \
$(LIBGLSL_GENERATED_FILES) \
$(LIBGLSL_FILES)
-if ENABLE_SHADER_CACHE
-glsl_libglsl_la_SOURCES += $(LIBGLSL_SHADER_CACHE_FILES)
-endif
-
glsl_libstandalone_la_SOURCES = \
$(GLSL_COMPILER_CXX_FILES)
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 08d93e0a261..d05bcacb9c5 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -136,10 +136,6 @@ LIBGLSL_FILES = \
glsl/s_expression.cpp \
glsl/s_expression.h
-LIBGLSL_SHADER_CACHE_FILES = \
- glsl/cache.c \
- glsl/cache.h
-
# glsl_compiler
GLSL_COMPILER_CXX_FILES = \
diff --git a/src/compiler/glsl/tests/cache_test.c b/src/compiler/glsl/tests/cache_test.c
index 724dfcd7753..94a3c1dfb9e 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -32,31 +32,11 @@
#include <stdarg.h>
#include "util/mesa-sha1.h"
-#include "cache.h"
+#include "util/disk_cache.h"
bool error = false;
#ifdef ENABLE_SHADER_CACHE
-void
-_mesa_warning(void *ctx, const char *fmt, ...);
-
-void
-_mesa_warning(void *ctx, const char *fmt, ...)
-{
- va_list vargs;
- (void) ctx;
-
- va_start(vargs, fmt);
-
- /* This output is not thread-safe, but that's good enough for the
- * standalone compiler.
- */
- fprintf(stderr, "Mesa warning: ");
- vfprintf(stderr, fmt, vargs);
- fprintf(stderr, "\n");
-
- va_end(vargs);
-}
static void
expect_equal(uint64_t actual, uint64_t expected, const char *test)
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index c5531c82d8a..b7ca347f5e8 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -4,6 +4,8 @@ MESA_UTIL_FILES := \
bitset.h \
debug.c \
debug.h \
+ disk_cache.c \
+ disk_cache.h \
format_r11g11b10f.h \
format_rgb9e5.h \
format_srgb.h \
diff --git a/src/compiler/glsl/cache.c b/src/util/disk_cache.c
index e74c27d3000..79242aa3c1e 100644
--- a/src/compiler/glsl/cache.c
+++ b/src/util/disk_cache.c
@@ -21,6 +21,8 @@
* IN THE SOFTWARE.
*/
+#ifdef ENABLE_SHADER_CACHE
+
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
@@ -40,7 +42,7 @@
#include "util/ralloc.h"
#include "main/errors.h"
-#include "cache.h"
+#include "disk_cache.h"
/* Number of bits to mask off from a cache key to get an index. */
#define CACHE_INDEX_KEY_BITS 16
@@ -86,9 +88,8 @@ mkdir_if_needed(char *path)
if (S_ISDIR(sb.st_mode)) {
return 0;
} else {
- _mesa_warning(NULL,
- "Cannot use %s for shader cache (not a directory)"
- "---disabling.\n", path);
+ fprintf(stderr, "Cannot use %s for shader cache (not a directory)"
+ "---disabling.\n", path);
return -1;
}
}
@@ -97,9 +98,8 @@ mkdir_if_needed(char *path)
if (ret == 0 || (ret == -1 && errno == EEXIST))
return 0;
- _mesa_warning(NULL,
- "Failed to create %s for shader cache (%s)---disabling.\n",
- path, strerror(errno));
+ fprintf(stderr, "Failed to create %s for shader cache (%s)---disabling.\n",
+ path, strerror(errno));
return -1;
}
@@ -708,3 +708,5 @@ cache_has_key(struct program_cache *cache, cache_key key)
return memcmp(entry, key, CACHE_KEY_SIZE) == 0;
}
+
+#endif
diff --git a/src/compiler/glsl/cache.h b/src/util/disk_cache.h
index d804169c656..d4d939883e6 100644
--- a/src/compiler/glsl/cache.h
+++ b/src/util/disk_cache.h
@@ -21,17 +21,16 @@
* IN THE SOFTWARE.
*/
-#pragma once
-#ifndef CACHE_H
-#define CACHE_H
+#ifndef DISK_CACHE_H
+#define DISK_CACHE_H
+
+#include <stdint.h>
+#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
-#include <stdint.h>
-#include <stdbool.h>
-
/* Size of cache keys in bytes. */
#define CACHE_KEY_SIZE 20