mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 02:50:09 +01:00
util: fix MSVC build issue in disk_cache.h
Windows doesn't have dlfcn.h. Protect the code in question with #if ENABLE_SHADER_CACHE test. And fix indentation. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
40e0dbf96c
commit
b87ef9e606
1 changed files with 16 additions and 10 deletions
|
|
@ -24,7 +24,9 @@
|
||||||
#ifndef DISK_CACHE_H
|
#ifndef DISK_CACHE_H
|
||||||
#define DISK_CACHE_H
|
#define DISK_CACHE_H
|
||||||
|
|
||||||
|
#ifdef ENABLE_SHADER_CACHE
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -43,16 +45,20 @@ struct disk_cache;
|
||||||
static inline bool
|
static inline bool
|
||||||
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
|
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
|
||||||
{
|
{
|
||||||
Dl_info info;
|
#ifdef ENABLE_SHADER_CACHE
|
||||||
struct stat st;
|
Dl_info info;
|
||||||
if (!dladdr(ptr, &info) || !info.dli_fname) {
|
struct stat st;
|
||||||
return false;
|
if (!dladdr(ptr, &info) || !info.dli_fname) {
|
||||||
}
|
return false;
|
||||||
if (stat(info.dli_fname, &st)) {
|
}
|
||||||
return false;
|
if (stat(info.dli_fname, &st)) {
|
||||||
}
|
return false;
|
||||||
*timestamp = st.st_mtim.tv_sec;
|
}
|
||||||
return true;
|
*timestamp = st.st_mtim.tv_sec;
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provide inlined stub functions if the shader cache is disabled. */
|
/* Provide inlined stub functions if the shader cache is disabled. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue