move u_math to src/util

Currently we have two sets of functions for bit counts, one in gallium
and one in core mesa. The ones in core mesa are header only in many
cases, since they reduce to "#define _mesa_bitcount popcount", but they
provide a fallback implementation. This is important because 32bit msvc
doesn't have popcountll, just popcount; so when nir (for example)
includes the core mesa header it doesn't (and shouldn't) link with core
mesa. To fix this we'll promote the version out of gallium util, then
replace the core mesa uses with the util version, since nir (and other
non-core mesa users) can and do link with mesautils.

Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Dylan Baker 2018-08-16 17:20:38 -07:00
parent aa4386ebfe
commit 80825abb5d
16 changed files with 15 additions and 15 deletions

View File

@ -26,7 +26,7 @@
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include <gallium/auxiliary/util/u_math.h>
#include "util/u_math.h"
#ifdef HAVE_VALGRIND
#include <valgrind.h>

View File

@ -294,8 +294,6 @@ C_SOURCES := \
util/u_linear.h \
util/u_log.c \
util/u_log.h \
util/u_math.c \
util/u_math.h \
util/u_memory.h \
util/u_mm.c \
util/u_mm.h \

View File

@ -314,8 +314,6 @@ files_libgallium = files(
'util/u_linear.h',
'util/u_log.c',
'util/u_log.h',
'util/u_math.c',
'util/u_math.h',
'util/u_memory.h',
'util/u_mm.c',
'util/u_mm.h',

View File

@ -32,11 +32,11 @@
* @author Jose Fonseca <jfonseca@vmware.com>
*/
#include "u_math.h"
#include "u_memory.h"
#include "u_format.h"
#include "u_format_s3tc.h"
#include "u_surface.h"
#include "util/u_math.h"
#include "pipe/p_defines.h"

View File

@ -23,10 +23,10 @@
*
**************************************************************************/
#include "u_math.h"
#include "u_format.h"
#include "u_format_bptc.h"
#include "util/format_srgb.h"
#include "util/u_math.h"
#define BPTC_BLOCK_DECODE
#include "../../../mesa/main/texcompress_bptc_tmp.h"

View File

@ -23,11 +23,11 @@
**************************************************************************/
#include <stdio.h>
#include "u_math.h"
#include "u_format.h"
#include "u_format_rgtc.h"
#include "u_format_latc.h"
#include "util/rgtc.h"
#include "util/u_math.h"
void
util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)

View File

@ -26,8 +26,8 @@
**************************************************************************/
#include "u_math.h"
#include "u_format_other.h"
#include "util/u_math.h"
#include "util/format_rgb9e5.h"
#include "util/format_r11g11b10f.h"

View File

@ -702,7 +702,7 @@ def is_format_hand_written(format):
def generate(formats):
print()
print('#include "pipe/p_compiler.h"')
print('#include "u_math.h"')
print('#include "util/u_math.h"')
print('#include "u_half.h"')
print('#include "u_format.h"')
print('#include "u_format_other.h"')

View File

@ -23,9 +23,9 @@
**************************************************************************/
#include <stdio.h>
#include "u_math.h"
#include "u_format.h"
#include "u_format_rgtc.h"
#include "util/u_math.h"
#include "util/rgtc.h"
void

View File

@ -24,10 +24,10 @@
**************************************************************************/
#include "u_dl.h"
#include "u_math.h"
#include "u_format.h"
#include "u_format_s3tc.h"
#include "util/format_srgb.h"
#include "util/u_math.h"
#include "../../../mesa/main/texcompress_s3tc_tmp.h"

View File

@ -46,7 +46,7 @@
#include "pipe/p_compiler.h"
#include "u_math.h"
#include "util/u_math.h"
/*

View File

@ -27,8 +27,8 @@
#include "u_debug.h"
#include "u_math.h"
#include "u_format_zs.h"
#include "util/u_math.h"
/*

View File

@ -55,6 +55,8 @@ MESA_UTIL_FILES := \
u_atomic.h \
u_dynarray.h \
u_endian.h \
u_math.c \
u_math.h \
u_queue.c \
u_queue.h \
u_string.h \

View File

@ -85,6 +85,8 @@ files_mesa_util = files(
'u_thread.h',
'u_vector.c',
'u_vector.h',
'u_math.c',
'u_math.h',
'vma.c',
'vma.h',
)

View File

@ -46,7 +46,7 @@
#include <float.h>
#include <stdarg.h>
#include "util/bitscan.h"
#include "bitscan.h"
#ifdef __cplusplus
extern "C" {