diff options
Diffstat (limited to 'dist/Mesa/src')
17 files changed, 72 insertions, 340 deletions
diff --git a/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.h b/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.h index 740a91974..43213fbeb 100644 --- a/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.h +++ b/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.h @@ -39,7 +39,6 @@ #include "pipe/p_compiler.h" -#include "u_pack_color.h" #include "u_math.h" @@ -52,58 +51,23 @@ util_format_srgb_to_linear_8unorm_table[256]; extern const uint8_t util_format_linear_to_srgb_8unorm_table[256]; -extern const unsigned -util_format_linear_to_srgb_helper_table[104]; - /** * Convert a unclamped linear float to srgb value in the [0,255]. + * XXX this hasn't been tested (render to srgb surface). + * XXX this needs optimization. */ static INLINE uint8_t util_format_linear_float_to_srgb_8unorm(float x) { - /* this would be exact but (probably much) slower */ - if (0) { - if (x >= 1.0f) - return 255; - else if (x >= 0.0031308f) - return float_to_ubyte(1.055f * powf(x, 0.41666666f) - 0.055f); - else if (x > 0.0f) - return float_to_ubyte(12.92f * x); - else - return 0; - } - else { - /* - * This is taken from https://gist.github.com/rygorous/2203834 - * Use LUT and do linear interpolation. - */ - union fi almostone, minval, f; - unsigned tab, bias, scale, t; - - almostone.ui = 0x3f7fffff; - minval.ui = (127-13) << 23; - - /* - * Clamp to [2^(-13), 1-eps]; these two values map to 0 and 1, respectively. - * The tests are carefully written so that NaNs map to 0, same as in the - * reference implementation. - */ - if (!(x > minval.f)) - x = minval.f; - if (x > almostone.f) - x = almostone.f; - - /* Do the table lookup and unpack bias, scale */ - f.f = x; - tab = util_format_linear_to_srgb_helper_table[(f.ui - minval.ui) >> 20]; - bias = (tab >> 16) << 9; - scale = tab & 0xffff; - - /* Grab next-highest mantissa bits and perform linear interpolation */ - t = (f.ui >> 12) & 0xff; - return (uint8_t) ((bias + scale*t) >> 16); - } + if (x >= 1.0f) + return 255; + else if (x >= 0.0031308f) + return float_to_ubyte(1.055f * powf(x, 0.41666f) - 0.055f); + else if (x > 0.0f) + return float_to_ubyte(12.92f * x); + else + return 0; } @@ -119,11 +83,6 @@ util_format_srgb_8unorm_to_linear_float(uint8_t x) } -/* - * XXX These 2 functions probably don't make a lot of sense (but lots - * of potential callers which most likely all don't make sense neither) - */ - /** * Convert a 8bit normalized value from linear to srgb. */ diff --git a/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.py b/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.py index c6c02f053..cd63ae789 100644 --- a/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.py +++ b/dist/Mesa/src/gallium/auxiliary/util/u_format_srgb.py @@ -40,7 +40,6 @@ CopyRight = ''' import math -import struct def srgb_to_linear(x): @@ -52,11 +51,10 @@ def srgb_to_linear(x): def linear_to_srgb(x): if x >= 0.0031308: - return 1.055 * math.pow(x, 0.41666666) - 0.055 + return 1.055 * math.pow(x, 0.41666) - 0.055 else: return 12.92 * x - def generate_srgb_tables(): print 'const float' print 'util_format_srgb_8unorm_to_linear_float_table[256] = {' @@ -86,59 +84,6 @@ def generate_srgb_tables(): print '};' print -# calculate the table interpolation values used in float linear to unorm8 srgb - numexp = 13 - mantissa_msb = 3 -# stepshift is just used to only use every x-th float to make things faster, -# 5 is largest value which still gives exact same table as 0 - stepshift = 5 - nbuckets = numexp << mantissa_msb - bucketsize = (1 << (23 - mantissa_msb)) >> stepshift - mantshift = 12 - valtable = [] - sum_aa = float(bucketsize) - sum_ab = 0.0 - sum_bb = 0.0 - for i in range(0, bucketsize): - j = (i << stepshift) >> mantshift - sum_ab += j - sum_bb += j*j - inv_det = 1.0 / (sum_aa * sum_bb - sum_ab * sum_ab) - - for bucket in range(0, nbuckets): - start = ((127 - numexp) << 23) + bucket*(bucketsize << stepshift) - sum_a = 0.0 - sum_b = 0.0 - - for i in range(0, bucketsize): - j = (i << stepshift) >> mantshift - fint = start + (i << stepshift) - ffloat = struct.unpack('f', struct.pack('I', fint))[0] - val = linear_to_srgb(ffloat) * 255.0 + 0.5 - sum_a += val - sum_b += j*val - - solved_a = inv_det * (sum_bb*sum_a - sum_ab*sum_b) - solved_b = inv_det * (sum_aa*sum_b - sum_ab*sum_a) - - scaled_a = solved_a * 65536.0 / 512.0 - scaled_b = solved_b * 65536.0 - - int_a = int(scaled_a + 0.5) - int_b = int(scaled_b + 0.5) - - valtable.append((int_a << 16) + int_b) - - print 'const unsigned' - print 'util_format_linear_to_srgb_helper_table[104] = {' - - for j in range(0, nbuckets, 4): - print ' ', - for i in range(j, j + 4): - print '0x%08x,' % (valtable[i],), - print - print '};' - print def main(): print '/* This file is autogenerated by u_format_srgb.py. Do not edit directly. */' diff --git a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_context.h b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_context.h index 56dfa2ccc..35105e861 100644 --- a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_context.h +++ b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_context.h @@ -32,9 +32,8 @@ #ifndef DRI_CONTEXT_H #define DRI_CONTEXT_H -#include "dri_util.h" #include "pipe/p_compiler.h" -#include "hud/hud_context.h" +#include "dri_wrapper.h" struct pipe_context; struct pipe_fence; @@ -50,13 +49,18 @@ struct dri_context __DRIdrawable *dPriv; __DRIdrawable *rPriv; + driOptionCache optionCache; + + drmLock *lock; + boolean isLocked; + boolean stLostLock; + boolean wsLostLock; + unsigned int bind_count; /* gallium */ struct st_api *stapi; struct st_context_iface *st; - struct pp_queue_t *pp; - struct hud_context *hud; }; static INLINE struct dri_context * @@ -86,11 +90,6 @@ boolean dri_create_context(gl_api api, const struct gl_config * visual, __DRIcontext * driContextPriv, - unsigned major_version, - unsigned minor_version, - uint32_t flags, - bool notify_reset, - unsigned *error, void *sharedContextPrivate); #endif diff --git a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_drawable.h b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_drawable.h index c5142181e..7f1aa512c 100644 --- a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -36,16 +36,13 @@ struct pipe_surface; struct st_framebuffer; struct dri_context; -#define DRI_SWAP_FENCES_MAX 4 -#define DRI_SWAP_FENCES_MASK 3 -#define DRI_SWAP_FENCES_DEFAULT 1 - struct dri_drawable { struct st_framebuffer_iface base; struct st_visual stvis; struct dri_screen *screen; + struct dri_context *context; /* dri */ __DRIdrawable *dPriv; @@ -57,34 +54,20 @@ struct dri_drawable unsigned old_h; struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; - struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT]; unsigned int texture_mask, texture_stamp; - struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; - unsigned int cur_fences; - unsigned int head; - unsigned int tail; - unsigned int desired_fences; - boolean flushing; /* prevents recursion in dri_flush */ - /* used only by DRISW */ struct pipe_surface *drisw_surface; /* hooks filled in by dri2 & drisw */ - void (*allocate_textures)(struct dri_context *ctx, - struct dri_drawable *drawable, + void (*allocate_textures)(struct dri_drawable *drawable, const enum st_attachment_type *statts, unsigned count); void (*update_drawable_info)(struct dri_drawable *drawable); - void (*flush_frontbuffer)(struct dri_context *ctx, - struct dri_drawable *drawable, + void (*flush_frontbuffer)(struct dri_drawable *drawable, enum st_attachment_type statt); - - void (*update_tex_buffer)(struct dri_drawable *drawable, - struct dri_context *ctx, - struct pipe_resource *res); }; static INLINE struct dri_drawable * @@ -110,19 +93,8 @@ dri_drawable_get_format(struct dri_drawable *drawable, enum pipe_format *format, unsigned *bind); -void -dri_pipe_blit(struct pipe_context *pipe, - struct pipe_resource *dst, - struct pipe_resource *src); - -void -dri_flush(__DRIcontext *cPriv, - __DRIdrawable *dPriv, - unsigned flags, - enum __DRI2throttleReason reason); - extern const __DRItexBufferExtension driTexBufferExtension; -extern const __DRI2throttleExtension dri2ThrottleExtension; + #endif /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_screen.h b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_screen.h index 7c8e5823f..8cb0a102c 100644 --- a/dist/Mesa/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/dist/Mesa/src/gallium/state_trackers/dri/common/dri_screen.h @@ -32,14 +32,13 @@ #ifndef DRI_SCREEN_H #define DRI_SCREEN_H -#include "dri_util.h" +#include "dri_wrapper.h" #include "xmlconfig.h" #include "pipe/p_compiler.h" #include "pipe/p_context.h" #include "pipe/p_state.h" #include "state_tracker/st_api.h" -#include "postprocess/filters.h" struct dri_context; struct dri_drawable; @@ -55,20 +54,15 @@ struct dri_screen /* dri */ __DRIscreen *sPriv; - boolean throttling_enabled; - int default_throttle_frames; - /** Configuration cache with default values for all contexts */ - driOptionCache optionCacheDefaults; - - /** The screen's effective configuration options */ + /** + * Configuration cache with default values for all contexts + */ driOptionCache optionCache; - /* Which postprocessing filters are enabled. */ - unsigned pp_enabled[PP_FILTERS]; - /* drm */ int fd; + drmLock *drmLock; /* gallium */ boolean d_depth_bits_last; @@ -84,26 +78,15 @@ struct dri_screen static INLINE struct dri_screen * dri_screen(__DRIscreen * sPriv) { - return (struct dri_screen *)sPriv->driverPrivate; + return (struct dri_screen *)sPriv->private; } struct __DRIimageRec { struct pipe_resource *texture; unsigned level; unsigned layer; - uint32_t dri_format; - uint32_t dri_components; void *loader_private; - - /** - * Provided by EGL_EXT_image_dma_buf_import. - */ - enum __DRIYUVColorSpace yuv_color_space; - enum __DRISampleRange sample_range; - enum __DRIChromaSiting horizontal_siting; - enum __DRIChromaSiting vertical_siting; - }; #ifndef __NOT_HAVE_DRM_H @@ -134,7 +117,8 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, const __DRIconfig ** dri_init_screen_helper(struct dri_screen *screen, - struct pipe_screen *pscreen); + struct pipe_screen *pscreen, + unsigned pixel_bits); void dri_destroy_screen_helper(struct dri_screen * screen); @@ -142,8 +126,6 @@ dri_destroy_screen_helper(struct dri_screen * screen); void dri_destroy_screen(__DRIscreen * sPriv); -extern const __DRIconfigOptionsExtension gallium_config_options; - #endif /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/dist/Mesa/src/gallium/state_trackers/dri/drm/SConscript b/dist/Mesa/src/gallium/state_trackers/dri/drm/SConscript index 07eaa0ae1..b188f76f9 100644 --- a/dist/Mesa/src/gallium/state_trackers/dri/drm/SConscript +++ b/dist/Mesa/src/gallium/state_trackers/dri/drm/SConscript @@ -5,18 +5,24 @@ Import('*') env = env.Clone() -env.PkgUseModules(['DRM']) +env.ParseConfig('pkg-config --cflags --libs libdrm') env.Append(CPPPATH = [ '#/src/mapi', '#/src/mesa', '#/src/gallium/state_trackers/dri/common', '#/src/mesa/drivers/dri/common', - xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h ]) +sources = [ + 'dri_context.c', + 'dri_drawable.c', + 'dri_screen.c', + 'dri2.c', +] + st_dri = env.ConvenienceLibrary( target = 'st_dri', - source = env.ParseSourceList('Makefile.sources', 'C_SOURCES') + source = sources, ) Export('st_dri') diff --git a/dist/Mesa/src/gallium/state_trackers/dri/sw/SConscript b/dist/Mesa/src/gallium/state_trackers/dri/sw/SConscript index 6d482a5bc..d0c3efc6f 100644 --- a/dist/Mesa/src/gallium/state_trackers/dri/sw/SConscript +++ b/dist/Mesa/src/gallium/state_trackers/dri/sw/SConscript @@ -10,13 +10,19 @@ env.Append(CPPPATH = [ '#/src/mesa', '#/src/gallium/state_trackers/dri/common', '#/src/mesa/drivers/dri/common', - xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h ]) env.Append(CPPDEFINES = [('__NOT_HAVE_DRM_H', '1')]) +sources = [ + 'dri_context.c', + 'dri_drawable.c', + 'dri_screen.c', + 'drisw.c', +] + st_drisw = env.ConvenienceLibrary( target = 'st_drisw', - source = env.ParseSourceList('Makefile.sources', 'C_SOURCES') + source = sources, ) Export('st_drisw') diff --git a/dist/Mesa/src/gallium/targets/dri-i915/SConscript b/dist/Mesa/src/gallium/targets/dri-i915/SConscript index b3bd3dd58..ab6001383 100644 --- a/dist/Mesa/src/gallium/targets/dri-i915/SConscript +++ b/dist/Mesa/src/gallium/targets/dri-i915/SConscript @@ -2,7 +2,7 @@ Import('*') env = drienv.Clone() -env.PkgUseModules('DRM_INTEL') +env.ParseConfig('pkg-config --cflags --libs libdrm_intel') env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD']) @@ -26,4 +26,4 @@ module = env.LoadableModule( SHLIBPREFIX = '', ) -env.Alias('dri-i915', module) +env.Alias('dri-i915', module)
\ No newline at end of file diff --git a/dist/Mesa/src/gallium/targets/dri-i915/target.c b/dist/Mesa/src/gallium/targets/dri-i915/target.c index 935eb0ebd..a27b7bd6d 100644 --- a/dist/Mesa/src/gallium/targets/dri-i915/target.c +++ b/dist/Mesa/src/gallium/targets/dri-i915/target.c @@ -26,4 +26,4 @@ create_screen(int fd) return screen; } -DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL) +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/dist/Mesa/src/gallium/targets/dri-nouveau/target.c b/dist/Mesa/src/gallium/targets/dri-nouveau/target.c index f0fcdd834..e725a4d9b 100644 --- a/dist/Mesa/src/gallium/targets/dri-nouveau/target.c +++ b/dist/Mesa/src/gallium/targets/dri-nouveau/target.c @@ -17,20 +17,4 @@ create_screen(int fd) return screen; } -static const struct drm_conf_ret share_fd_ret = { - .type = DRM_CONF_BOOL, - .val.val_int = true, -}; - -static const struct drm_conf_ret *drm_configuration(enum drm_conf conf) -{ - switch (conf) { - case DRM_CONF_SHARE_FD: - return &share_fd_ret; - default: - break; - } - return NULL; -} - -DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, drm_configuration) +DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen) diff --git a/dist/Mesa/src/gallium/targets/dri-swrast/SConscript b/dist/Mesa/src/gallium/targets/dri-swrast/SConscript index 8ddd14ea5..b67483800 100644 --- a/dist/Mesa/src/gallium/targets/dri-swrast/SConscript +++ b/dist/Mesa/src/gallium/targets/dri-swrast/SConscript @@ -1,6 +1,6 @@ Import('*') -env = driswenv.Clone() +env = drienv.Clone() env.Append(CPPPATH = [ '#/src/gallium/winsys/sw/dri', @@ -29,16 +29,14 @@ if env['llvm']: env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') env.Prepend(LIBS = [llvmpipe]) -swrast_sources = [ +swrastg_sources = [ 'swrast_drm_api.c' ] module = env.LoadableModule( - target ='swrast_dri.so', - source = swrast_sources, + target ='swrastg_dri.so', + source = swrastg_sources, SHLIBPREFIX = '', ) -module = env.InstallSharedLibrary(module) - env.Alias('dri-swrast', module) diff --git a/dist/Mesa/src/gallium/targets/dri-swrast/swrast_drm_api.c b/dist/Mesa/src/gallium/targets/dri-swrast/swrast_drm_api.c index a8973fd60..8d741c634 100644 --- a/dist/Mesa/src/gallium/targets/dri-swrast/swrast_drm_api.c +++ b/dist/Mesa/src/gallium/targets/dri-swrast/swrast_drm_api.c @@ -33,9 +33,6 @@ #include "target-helpers/inline_debug_helper.h" #include "target-helpers/inline_sw_helper.h" -#include "state_tracker/drm_driver.h" - -DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL); struct pipe_screen * drisw_create_screen(struct drisw_loader_funcs *lf) diff --git a/dist/Mesa/src/gallium/winsys/i915/drm/SConscript b/dist/Mesa/src/gallium/winsys/i915/drm/SConscript index 3d2762881..d8f5885b6 100644 --- a/dist/Mesa/src/gallium/winsys/i915/drm/SConscript +++ b/dist/Mesa/src/gallium/winsys/i915/drm/SConscript @@ -2,9 +2,14 @@ Import('*') env = env.Clone() -env.PkgUseModules('DRM') +env.ParseConfig('pkg-config --cflags libdrm') -i915drm_sources = env.ParseSourceList('Makefile.sources', 'C_SOURCES') +i915drm_sources = [ + 'i915_drm_batchbuffer.c', + 'i915_drm_buffer.c', + 'i915_drm_fence.c', + 'i915_drm_winsys.c', +] i915drm = env.ConvenienceLibrary( target ='i915drm', diff --git a/dist/Mesa/src/gallium/winsys/i915/sw/SConscript b/dist/Mesa/src/gallium/winsys/i915/sw/SConscript index 9d785191d..84f427a12 100644 --- a/dist/Mesa/src/gallium/winsys/i915/sw/SConscript +++ b/dist/Mesa/src/gallium/winsys/i915/sw/SConscript @@ -2,7 +2,12 @@ Import('*') env = env.Clone() -i915_sw_sources = env.ParseSourceList('Makefile.sources', 'C_SOURCES') +i915_sw_sources = [ + 'i915_sw_batchbuffer.c', + 'i915_sw_buffer.c', + 'i915_sw_winsys.c', + 'i915_sw_fence.c', +] i915sw = env.ConvenienceLibrary( target ='i915sw', diff --git a/dist/Mesa/src/glsl/ralloc.h b/dist/Mesa/src/glsl/ralloc.h index 4581a7a4e..d5338152f 100644 --- a/dist/Mesa/src/glsl/ralloc.h +++ b/dist/Mesa/src/glsl/ralloc.h @@ -54,7 +54,6 @@ extern "C" { #include <stddef.h> #include <stdarg.h> #include <stdbool.h> -#include "main/compiler.h" /** * \def ralloc(ctx, type) @@ -302,7 +301,7 @@ bool ralloc_strncat(char **dest, const char *str, size_t n); * * \return The newly allocated string. */ -char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3); +char *ralloc_asprintf (const void *ctx, const char *fmt, ...); /** * Print to a string, given a va_list. @@ -315,82 +314,21 @@ char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3); char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args); /** - * Rewrite the tail of an existing string, starting at a given index. - * - * Overwrites the contents of *str starting at \p start with newly formatted - * text, including a new null-terminator. Allocates more memory as necessary. - * - * This can be used to append formatted text when the length of the existing - * string is already known, saving a strlen() call. - * - * \sa ralloc_asprintf_append - * - * \param str The string to be updated. - * \param start The index to start appending new data at. - * \param fmt A printf-style formatting string - * - * \p str will be updated to the new pointer unless allocation fails. - * \p start will be increased by the length of the newly formatted text. - * - * \return True unless allocation failed. - */ -bool ralloc_asprintf_rewrite_tail(char **str, size_t *start, - const char *fmt, ...) - PRINTFLIKE(3, 4); - -/** - * Rewrite the tail of an existing string, starting at a given index. - * - * Overwrites the contents of *str starting at \p start with newly formatted - * text, including a new null-terminator. Allocates more memory as necessary. - * - * This can be used to append formatted text when the length of the existing - * string is already known, saving a strlen() call. - * - * \sa ralloc_vasprintf_append - * - * \param str The string to be updated. - * \param start The index to start appending new data at. - * \param fmt A printf-style formatting string - * \param args A va_list containing the data to be formatted - * - * \p str will be updated to the new pointer unless allocation fails. - * \p start will be increased by the length of the newly formatted text. - * - * \return True unless allocation failed. - */ -bool ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt, - va_list args); - -/** * Append formatted text to the supplied string. * - * This is equivalent to - * \code - * ralloc_asprintf_rewrite_tail(str, strlen(*str), fmt, ...) - * \endcode - * * \sa ralloc_asprintf - * \sa ralloc_asprintf_rewrite_tail * \sa ralloc_strcat * * \p str will be updated to the new pointer unless allocation fails. * * \return True unless allocation failed. */ -bool ralloc_asprintf_append (char **str, const char *fmt, ...) - PRINTFLIKE(2, 3); +bool ralloc_asprintf_append (char **str, const char *fmt, ...); /** * Append formatted text to the supplied string, given a va_list. * - * This is equivalent to - * \code - * ralloc_vasprintf_rewrite_tail(str, strlen(*str), fmt, args) - * \endcode - * * \sa ralloc_vasprintf - * \sa ralloc_vasprintf_rewrite_tail * \sa ralloc_strcat * * \p str will be updated to the new pointer unless allocation fails. @@ -404,42 +342,4 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); } /* end of extern "C" */ #endif -/** - * Declare C++ new and delete operators which use ralloc. - * - * Placing this macro in the body of a class makes it possible to do: - * - * TYPE *var = new(mem_ctx) TYPE(...); - * delete var; - * - * which is more idiomatic in C++ than calling ralloc. - */ -#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) \ -private: \ - static void _ralloc_destructor(void *p) \ - { \ - reinterpret_cast<TYPE *>(p)->~TYPE(); \ - } \ -public: \ - static void* operator new(size_t size, void *mem_ctx) \ - { \ - void *p = ralloc_size(mem_ctx, size); \ - assert(p != NULL); \ - if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \ - ralloc_set_destructor(p, _ralloc_destructor); \ - return p; \ - } \ - \ - static void operator delete(void *p) \ - { \ - /* The object's destructor is guaranteed to have already been \ - * called by the delete operator at this point -- Make sure it's \ - * not called again. \ - */ \ - if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \ - ralloc_set_destructor(p, NULL); \ - ralloc_free(p); \ - } - - #endif diff --git a/dist/Mesa/src/glsl/strtod.c b/dist/Mesa/src/glsl/strtod.c index 5d4346b5a..ff3459148 100644 --- a/dist/Mesa/src/glsl/strtod.c +++ b/dist/Mesa/src/glsl/strtod.c @@ -44,8 +44,7 @@ double glsl_strtod(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(__HAIKU__) && !defined(__UCLIBC__) +#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) static locale_t loc = NULL; if (!loc) { loc = newlocale(LC_CTYPE_MASK, "C", NULL); @@ -55,25 +54,3 @@ glsl_strtod(const char *s, char **end) return strtod(s, end); #endif } - - -/** - * Wrapper around strtof which uses the "C" locale so the decimal - * point is always '.' - */ -float -glsl_strtof(const char *s, char **end) -{ -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(__HAIKU__) && !defined(__UCLIBC__) - static locale_t loc = NULL; - if (!loc) { - loc = newlocale(LC_CTYPE_MASK, "C", NULL); - } - return strtof_l(s, end, loc); -#elif _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE - return strtof(s, end); -#else - return (float) strtod(s, end); -#endif -} diff --git a/dist/Mesa/src/glsl/strtod.h b/dist/Mesa/src/glsl/strtod.h index ad847dbb0..0cf6409d4 100644 --- a/dist/Mesa/src/glsl/strtod.h +++ b/dist/Mesa/src/glsl/strtod.h @@ -34,9 +34,6 @@ extern "C" { extern double glsl_strtod(const char *s, char **end); -extern float -glsl_strtof(const char *s, char **end); - #ifdef __cplusplus } |