This hash table is used in core Mesa, the GLSL compiler, and the i965
driver, which makes it a good candidate for the new src/util module.
It's much faster than program/hash_table.[ch] (see commit
6991c2922f5
for data), and José's u_hash_table.c has a comment saying Gallium should
probably consider switching to a linear probing hash table at some point.
So this seems like the best candidate for a shared data structure.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
- src/mesa/main/tests/hash_table/Makefile
src/util/Makefile
- src/util/tests/Makefile])
+ src/util/tests/Makefile
+ src/util/tests/hash_table/Makefile])
dnl Sort the dirs alphabetically
GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
noinst_PROGRAMS = glsl_compiler
tests_general_ir_test_SOURCES = \
- $(top_srcdir)/src/mesa/main/hash_table.c \
$(top_srcdir)/src/mesa/main/imports.c \
$(top_srcdir)/src/mesa/program/prog_hash_table.c\
$(top_srcdir)/src/mesa/program/symbol_table.c \
$(PTHREAD_LIBS)
tests_uniform_initializer_test_SOURCES = \
- $(top_srcdir)/src/mesa/main/hash_table.c \
$(top_srcdir)/src/mesa/main/imports.c \
$(top_srcdir)/src/mesa/program/prog_hash_table.c\
$(top_srcdir)/src/mesa/program/symbol_table.c \
$(LIBGLSL_FILES)
glsl_compiler_SOURCES = \
- $(top_srcdir)/src/mesa/main/hash_table.c \
$(top_srcdir)/src/mesa/main/imports.c \
$(top_srcdir)/src/mesa/program/prog_hash_table.c \
$(top_srcdir)/src/mesa/program/symbol_table.c \
$(PTHREAD_LIBS)
glsl_test_SOURCES = \
- $(top_srcdir)/src/mesa/main/hash_table.c \
$(top_srcdir)/src/mesa/main/imports.c \
$(top_srcdir)/src/mesa/program/prog_hash_table.c \
$(top_srcdir)/src/mesa/program/symbol_table.c \
# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/main'])
-env.Command('hash_table.c', '#src/mesa/main/hash_table.c', Copy('$TARGET', '$SOURCE'))
env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/program'])
compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
mesa_objs = env.StaticObject([
- 'hash_table.c',
'imports.c',
'prog_hash_table.c',
'symbol_table.c',
#include "ir_visitor.h"
#include "ir_variable_refcount.h"
#include "glsl_types.h"
-#include "main/hash_table.h"
+#include "util/hash_table.h"
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
{
#define LINK_UNIFORM_BLOCK_ACTIVE_VISITOR_H
#include "ir.h"
-#include "main/hash_table.h"
+#include "util/hash_table.h"
struct link_uniform_block_active {
const glsl_type *type;
#include "linker.h"
#include "ir_uniform.h"
#include "link_uniform_block_active_visitor.h"
-#include "main/hash_table.h"
+#include "util/hash_table.h"
#include "program.h"
namespace {
#include "ir_visitor.h"
#include "ir_variable_refcount.h"
#include "glsl_types.h"
-#include "main/hash_table.h"
+#include "util/hash_table.h"
static bool debug = false;
$(SRCDIR)main/getstring.c \
$(SRCDIR)main/glformats.c \
$(SRCDIR)main/hash.c \
- $(SRCDIR)main/hash_table.c \
$(SRCDIR)main/hint.c \
$(SRCDIR)main/histogram.c \
$(SRCDIR)main/image.c \
#include <sys/types.h>
-#include "main/hash_table.h"
+#include "util/hash_table.h"
#include "main/macros.h"
#include "main/shaderobj.h"
#include "main/fbobject.h"
#include "main/context.h"
#include "main/teximage.h"
#include "main/image.h"
-#include "main/hash_table.h"
#include "main/set.h"
#include "main/condrender.h"
+#include "util/hash_table.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
#include "hash.h"
#include "mtypes.h"
#include "version.h"
-#include "hash_table.h"
+#include "util/hash_table.h"
static mtx_t DynamicIDMutex = _MTX_INITIALIZER_NP;
static GLuint NextDynamicID = 1;
#include "glheader.h"
#include "imports.h"
#include "hash.h"
-#include "hash_table.h"
+#include "util/hash_table.h"
/**
* Magic GLuint object name that gets stored outside of the struct hash_table.
#include "main/dispatch.h"
#include "main/enums.h"
#include "main/hash.h"
-#include "main/hash_table.h"
#include "main/mtypes.h"
#include "main/pipelineobj.h"
#include "main/shaderapi.h"
#include "program/prog_print.h"
#include "program/prog_parameter.h"
#include "util/ralloc.h"
+#include "util/hash_table.h"
#include <stdbool.h>
#include "../glsl/glsl_parser_extras.h"
#include "../glsl/ir.h"
#include "imports.h"
#include "mtypes.h"
#include "hash.h"
-#include "hash_table.h"
#include "atifragshader.h"
#include "bufferobj.h"
#include "shared.h"
#include "shaderobj.h"
#include "syncobj.h"
+#include "util/hash_table.h"
/**
* Allocate and initialize a shared context state structure.
#include "dispatch.h"
#include "mtypes.h"
#include "set.h"
-#include "hash_table.h"
+#include "util/hash_table.h"
#include "syncobj.h"
-SUBDIRS = hash_table
-
AM_CFLAGS = \
$(X11_CFLAGS) \
$(PTHREAD_CFLAGS)
*/
#include <stdbool.h>
+#include "util/hash_table.h"
#include "context.h"
#include "glformats.h"
-#include "hash_table.h"
#include "set.h"
#include "texobj.h"
#include "teximage.h"
libmesautil_la_CPPFLAGS = \
$(DEFINES) \
-I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
$(VISIBILITY_CFLAGS)
-MESA_UTIL_FILES := \
+MESA_UTIL_FILES := \
+ hash_table.c \
ralloc.c
env.Prepend(CPPPATH = [
'#include',
+ '#src/mapi',
'#src/mesa',
'#src/util',
])
#include <stdlib.h>
#include <string.h>
-#include "main/hash_table.h"
+#include "hash_table.h"
#include "main/macros.h"
-#include "util/ralloc.h"
+#include "ralloc.h"
static const uint32_t deleted_key_value;
#include <inttypes.h>
#include <stdbool.h>
-#include "compiler.h"
+#include "main/compiler.h"
#ifdef __cplusplus
extern "C" {
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+SUBDIRS = hash_table
+
AM_CFLAGS = \
$(PTHREAD_CFLAGS)
AM_CPPFLAGS = \
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/util \
+ -I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mesa/main \
$(DEFINES) $(INCLUDE_DIRS)