[Mesa-dev] [PATCH 1/2] util: import cache.c/h from glsl

Emil Velikov emil.l.velikov at gmail.com
Mon Nov 14 10:21:20 UTC 2016


Hi Marek,

Please mention the reason behind the move - afaict it's not being used in 2/2.
I'm have no objection against the move.

There's a few comments below - feel free to squash those here or
address as follow-up(s).

On 13 November 2016 at 16:05, Marek Olšák <maraeo at gmail.com> wrote:

> -if ENABLE_SHADER_CACHE
With this the conditional is no longer used. Worth dropping the
AM_CONDITIONAL([ENABLE_SHADER_CACHE.... from configure.ac ?

> -glsl_libglsl_la_SOURCES += $(LIBGLSL_SHADER_CACHE_FILES)
> -endif
> -
>  glsl_libstandalone_la_SOURCES = \
>         $(GLSL_COMPILER_CXX_FILES)
>
>  glsl_libstandalone_la_LIBADD =                         \
>         glsl/libglsl.la                                 \
>         $(top_builddir)/src/libglsl_util.la             \
>         $(top_builddir)/src/util/libmesautil.la         \
>         $(PTHREAD_LIBS)
>
>  glsl_compiler_SOURCES = \
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 08d93e0..d05bcac 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -129,24 +129,20 @@ LIBGLSL_FILES = \
>         glsl/opt_redundant_jumps.cpp \
>         glsl/opt_structure_splitting.cpp \
>         glsl/opt_swizzle_swizzle.cpp \
>         glsl/opt_tree_grafting.cpp \
>         glsl/opt_vectorize.cpp \
>         glsl/program.h \
>         glsl/propagate_invariance.cpp \
>         glsl/s_expression.cpp \
>         glsl/s_expression.h
>
> -LIBGLSL_SHADER_CACHE_FILES = \
> -       glsl/cache.c \
> -       glsl/cache.h
> -
>  # glsl_compiler
>
>  GLSL_COMPILER_CXX_FILES = \
>         glsl/ir_builder_print_visitor.cpp \
>         glsl/ir_builder_print_visitor.h \
>         glsl/opt_add_neg_to_sub.h \
>         glsl/standalone_scaffolding.cpp \
>         glsl/standalone_scaffolding.h \
>         glsl/standalone.cpp \
>         glsl/standalone.h
> diff --git a/src/compiler/glsl/tests/cache_test.c b/src/compiler/glsl/tests/cache_test.c
> index 724dfcd..fce2bf4 100644
> --- a/src/compiler/glsl/tests/cache_test.c
> +++ b/src/compiler/glsl/tests/cache_test.c
> @@ -25,21 +25,21 @@
>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdbool.h>
>  #include <string.h>
>  #include <ftw.h>
>  #include <errno.h>
>  #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, ...)
With the below _mesa_warning -> print change this is no longer needed. Correct ?


> --- a/src/compiler/glsl/cache.c
> +++ b/src/util/disk_cache.c
> @@ -33,21 +33,23 @@
>  #include <fcntl.h>
>  #include <pwd.h>
>  #include <errno.h>
>  #include <dirent.h>
>
>  #include "util/u_atomic.h"
>  #include "util/mesa-sha1.h"
>  #include "util/ralloc.h"
>  #include "main/errors.h"
>
> -#include "cache.h"
> +#include "disk_cache.h"
> +
> +#ifdef ENABLE_SHADER_CACHE
>
Might as well move it to the top of the file ?


> rename from src/compiler/glsl/cache.h
> rename to src/util/disk_cache.h
> index d804169..066233f 100644
> --- a/src/compiler/glsl/cache.h
> +++ b/src/util/disk_cache.h

>  #pragma once
Maybe drop this ?

> -#ifndef CACHE_H
> -#define CACHE_H
> +#ifndef DISK_CACHE_H
> +#define DISK_CACHE_H
>
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
>
>  #include <stdint.h>
>  #include <stdbool.h>
>
And move these before the extern C ?

Thanks
-Emil


More information about the mesa-dev mailing list