Not actively used. Reviewed-by: Brian Paul <brianp@vmware.com>tags/mesa-8.0-rc1
| @@ -83,7 +83,7 @@ def AddOptions(opts): | |||
| opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine, | |||
| allowed_values=('generic', 'ppc', 'x86', 'x86_64'))) | |||
| opts.Add(EnumOption('platform', 'target platform', host_platform, | |||
| allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'cygwin', 'sunos', 'freebsd8'))) | |||
| allowed_values=('linux', 'cell', 'windows', 'darwin', 'cygwin', 'sunos', 'freebsd8'))) | |||
| opts.Add(BoolOption('embedded', 'embedded build', 'no')) | |||
| opts.Add('toolchain', 'compiler toolchain', default_toolchain) | |||
| opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no')) | |||
| @@ -113,11 +113,6 @@ def generate(env): | |||
| # Toolchain | |||
| platform = env['platform'] | |||
| if env['toolchain'] == 'default': | |||
| if platform == 'winddk': | |||
| env['toolchain'] = 'winddk' | |||
| elif platform == 'wince': | |||
| env['toolchain'] = 'wcesdk' | |||
| env.Tool(env['toolchain']) | |||
| # Allow override compiler and specify additional flags from environment | |||
| @@ -281,7 +276,7 @@ def generate(env): | |||
| ] | |||
| if gcc: | |||
| cppdefines += [('__MSVCRT_VERSION__', '0x0700')] | |||
| if msvc and env['toolchain'] != 'winddk': | |||
| if msvc: | |||
| cppdefines += [ | |||
| 'VC_EXTRALEAN', | |||
| '_USE_MATH_DEFINES', | |||
| @@ -292,57 +287,8 @@ def generate(env): | |||
| ] | |||
| if env['build'] in ('debug', 'checked'): | |||
| cppdefines += ['_DEBUG'] | |||
| if env['toolchain'] == 'winddk': | |||
| # Mimic WINDDK's builtin flags. See also: | |||
| # - WINDDK's bin/makefile.new i386mk.inc for more info. | |||
| # - buildchk_wxp_x86.log files, generated by the WINDDK's build | |||
| # - http://alter.org.ua/docs/nt_kernel/vc8_proj/ | |||
| if machine == 'x86': | |||
| cppdefines += ['_X86_', 'i386'] | |||
| if machine == 'x86_64': | |||
| cppdefines += ['_AMD64_', 'AMD64'] | |||
| if platform == 'winddk': | |||
| cppdefines += [ | |||
| 'STD_CALL', | |||
| ('CONDITION_HANDLING', '1'), | |||
| ('NT_INST', '0'), | |||
| ('WIN32', '100'), | |||
| ('_NT1X_', '100'), | |||
| ('WINNT', '1'), | |||
| ('_WIN32_WINNT', '0x0501'), # minimum required OS version | |||
| ('WINVER', '0x0501'), | |||
| ('_WIN32_IE', '0x0603'), | |||
| ('WIN32_LEAN_AND_MEAN', '1'), | |||
| ('DEVL', '1'), | |||
| ('__BUILDMACHINE__', 'WinDDK'), | |||
| ('FPO', '0'), | |||
| ] | |||
| if env['build'] in ('debug', 'checked'): | |||
| cppdefines += [('DBG', 1)] | |||
| if platform == 'wince': | |||
| cppdefines += [ | |||
| '_CRT_SECURE_NO_DEPRECATE', | |||
| '_USE_32BIT_TIME_T', | |||
| 'UNICODE', | |||
| '_UNICODE', | |||
| ('UNDER_CE', '600'), | |||
| ('_WIN32_WCE', '0x600'), | |||
| 'WINCEOEM', | |||
| 'WINCEINTERNAL', | |||
| 'WIN32', | |||
| 'STRICT', | |||
| 'x86', | |||
| '_X86_', | |||
| 'INTERNATIONAL', | |||
| ('INTLMSG_CODEPAGE', '1252'), | |||
| ] | |||
| if platform == 'windows': | |||
| cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER'] | |||
| if platform == 'winddk': | |||
| cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY'] | |||
| if platform == 'wince': | |||
| cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE'] | |||
| cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL'] | |||
| if env['embedded']: | |||
| cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED'] | |||
| env.Append(CPPDEFINES = cppdefines) | |||
| @@ -463,39 +409,6 @@ def generate(env): | |||
| ccflags += [ | |||
| # TODO | |||
| ] | |||
| if platform == 'winddk': | |||
| ccflags += [ | |||
| '/Zl', # omit default library name in .OBJ | |||
| '/Zp8', # 8bytes struct member alignment | |||
| '/Gy', # separate functions for linker | |||
| '/Gm-', # disable minimal rebuild | |||
| '/WX', # treat warnings as errors | |||
| '/Gz', # __stdcall Calling convention | |||
| '/GX-', # disable C++ EH | |||
| '/GR-', # disable C++ RTTI | |||
| '/GF', # enable read-only string pooling | |||
| '/G6', # optimize for PPro, P-II, P-III | |||
| '/Ze', # enable extensions | |||
| '/Gi-', # disable incremental compilation | |||
| '/QIfdiv-', # disable Pentium FDIV fix | |||
| '/hotpatch', # prepares an image for hotpatching. | |||
| #'/Z7', #enable old-style debug info | |||
| ] | |||
| if platform == 'wince': | |||
| # See also C:\WINCE600\public\common\oak\misc\makefile.def | |||
| ccflags += [ | |||
| '/Zl', # omit default library name in .OBJ | |||
| '/GF', # enable read-only string pooling | |||
| '/GR-', # disable C++ RTTI | |||
| '/GS', # enable security checks | |||
| # Allow disabling language conformance to maintain backward compat | |||
| #'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef | |||
| #'/Zc:forScope-', # don't enforce Standard C++ for scoping rules | |||
| #'/wd4867', | |||
| #'/wd4430', | |||
| #'/MT', | |||
| #'/U_MT', | |||
| ] | |||
| # Automatic pdb generation | |||
| # See http://scons.tigris.org/issues/show_bug.cgi?id=1656 | |||
| env.EnsureSConsVersion(0, 98, 0) | |||
| @@ -558,45 +471,6 @@ def generate(env): | |||
| '/fixed:no', | |||
| '/incremental:no', | |||
| ] | |||
| if platform == 'winddk': | |||
| linkflags += [ | |||
| '/merge:_PAGE=PAGE', | |||
| '/merge:_TEXT=.text', | |||
| '/section:INIT,d', | |||
| '/opt:ref', | |||
| '/opt:icf', | |||
| '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221', | |||
| '/incremental:no', | |||
| '/fullbuild', | |||
| '/release', | |||
| '/nodefaultlib', | |||
| '/wx', | |||
| '/debug', | |||
| '/debugtype:cv', | |||
| '/version:5.1', | |||
| '/osversion:5.1', | |||
| '/functionpadmin:5', | |||
| '/safeseh', | |||
| '/pdbcompress', | |||
| '/stack:0x40000,0x1000', | |||
| '/driver', | |||
| '/align:0x80', | |||
| '/subsystem:native,5.01', | |||
| '/base:0x10000', | |||
| '/entry:DrvEnableDriver', | |||
| ] | |||
| if env['build'] != 'release': | |||
| linkflags += [ | |||
| '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx | |||
| ] | |||
| if platform == 'wince': | |||
| linkflags += [ | |||
| '/nodefaultlib', | |||
| #'/incremental:no', | |||
| #'/fullbuild', | |||
| '/entry:_DllMainCRTStartup', | |||
| ] | |||
| env.Append(LINKFLAGS = linkflags) | |||
| env.Append(SHLINKFLAGS = shlinkflags) | |||
| @@ -71,10 +71,6 @@ os_free_aligned(void *ptr); | |||
| # include "os_memory_debug.h" | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| # include "os_memory_win32k.h" | |||
| #else | |||
| # include "os_memory_stdc.h" | |||
| @@ -1,123 +0,0 @@ | |||
| /************************************************************************** | |||
| * | |||
| * Copyright 2008-2010 VMware, Inc. | |||
| * All Rights Reserved. | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a | |||
| * copy of this software and associated documentation files (the | |||
| * "Software"), to deal in the Software without restriction, including | |||
| * without limitation the rights to use, copy, modify, merge, publish, | |||
| * distribute, sub license, and/or sell copies of the Software, and to | |||
| * permit persons to whom the Software is furnished to do so, subject to | |||
| * the following conditions: | |||
| * | |||
| * The above copyright notice and this permission notice (including the | |||
| * next paragraph) shall be included in all copies or substantial portions | |||
| * of the Software. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |||
| * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |||
| * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR | |||
| * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |||
| * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |||
| * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| * | |||
| **************************************************************************/ | |||
| /* | |||
| * OS memory management abstractions for Windows kernel. | |||
| */ | |||
| #ifndef _OS_MEMORY_H_ | |||
| #error "Must not be included directly. Include os_memory.h instead" | |||
| #endif | |||
| #include "pipe/p_compiler.h" | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| void * __stdcall | |||
| EngAllocMem(unsigned long Flags, | |||
| unsigned long MemSize, | |||
| unsigned long Tag); | |||
| void __stdcall | |||
| EngFreeMem(void *Mem); | |||
| #define os_malloc(_size) EngAllocMem(0, _size, 'D3AG') | |||
| #define os_calloc(_count, _size) EngAllocMem(1, (_count)*(_size), 'D3AG') | |||
| #define _os_free(_ptr) EngFreeMem(_ptr) | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| void * | |||
| ExAllocatePool(unsigned long PoolType, | |||
| size_t NumberOfBytes); | |||
| void | |||
| ExFreePool(void *P); | |||
| #define os_malloc(_size) ExAllocatePool(0, _size) | |||
| #define _os_free(_ptr) ExFreePool(_ptr) | |||
| static INLINE void * | |||
| os_calloc(unsigned count, unsigned size) | |||
| { | |||
| void *ptr = os_malloc(count * size); | |||
| if (ptr) { | |||
| memset(ptr, 0, count * size); | |||
| } | |||
| return ptr; | |||
| } | |||
| #else | |||
| #error "Unsupported subsystem" | |||
| #endif | |||
| static INLINE void | |||
| os_free( void *ptr ) | |||
| { | |||
| if (ptr) { | |||
| _os_free(ptr); | |||
| } | |||
| } | |||
| static INLINE void * | |||
| os_realloc(void *old_ptr, unsigned old_size, unsigned new_size) | |||
| { | |||
| void *new_ptr = NULL; | |||
| if (new_size != 0) { | |||
| unsigned copy_size = old_size < new_size ? old_size : new_size; | |||
| new_ptr = os_malloc( new_size ); | |||
| if (new_ptr && old_ptr && copy_size) { | |||
| memcpy(new_ptr, old_ptr, copy_size); | |||
| } | |||
| } | |||
| os_free(old_ptr); | |||
| return new_ptr; | |||
| } | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #include "os_memory_aligned.h" | |||
| @@ -31,19 +31,7 @@ | |||
| #include <stdarg.h> | |||
| #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY | |||
| #include <windows.h> | |||
| #include <winddi.h> | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <windows.h> | |||
| #include <types.h> | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| #ifndef WIN32_LEAN_AND_MEAN | |||
| #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers | |||
| @@ -59,44 +47,16 @@ | |||
| #endif | |||
| #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY | |||
| static INLINE void | |||
| _EngDebugPrint(const char *format, ...) | |||
| { | |||
| va_list ap; | |||
| va_start(ap, format); | |||
| EngDebugPrint("", (PCHAR)format, ap); | |||
| va_end(ap); | |||
| } | |||
| #endif | |||
| void | |||
| os_log_message(const char *message) | |||
| { | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| _EngDebugPrint("%s", message); | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| OutputDebugStringA(message); | |||
| if(GetConsoleWindow() && !IsDebuggerPresent()) { | |||
| fflush(stdout); | |||
| fputs(message, stderr); | |||
| fflush(stderr); | |||
| } | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| wchar_t *wide_format; | |||
| long wide_str_len; | |||
| /* Format is ascii - needs to be converted to wchar_t for printing */ | |||
| wide_str_len = MultiByteToWideChar(CP_ACP, 0, message, -1, NULL, 0); | |||
| wide_format = (wchar_t *) malloc((wide_str_len+1) * sizeof(wchar_t)); | |||
| if (wide_format) { | |||
| MultiByteToWideChar(CP_ACP, 0, message, -1, | |||
| wide_format, wide_str_len); | |||
| NKDbgPrintfW(wide_format, wide_format); | |||
| free(wide_format); | |||
| } | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| /* TODO */ | |||
| #else /* !PIPE_SUBSYSTEM_WINDOWS */ | |||
| fflush(stdout); | |||
| fputs(message, stderr); | |||
| @@ -104,85 +64,9 @@ os_log_message(const char *message) | |||
| } | |||
| #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY | |||
| static const char * | |||
| find(const char *start, const char *end, char c) | |||
| { | |||
| const char *p; | |||
| for(p = start; !end || p != end; ++p) { | |||
| if(*p == c) | |||
| return p; | |||
| if(*p < 32) | |||
| break; | |||
| } | |||
| return NULL; | |||
| } | |||
| static int | |||
| compare(const char *start, const char *end, const char *s) | |||
| { | |||
| const char *p, *q; | |||
| for(p = start, q = s; p != end && *q != '\0'; ++p, ++q) { | |||
| if(*p != *q) | |||
| return 0; | |||
| } | |||
| return p == end && *q == '\0'; | |||
| } | |||
| static void | |||
| copy(char *dst, const char *start, const char *end, size_t n) | |||
| { | |||
| const char *p; | |||
| char *q; | |||
| for(p = start, q = dst, n = n - 1; p != end && n; ++p, ++q, --n) | |||
| *q = *p; | |||
| *q = '\0'; | |||
| } | |||
| #endif | |||
| const char * | |||
| os_get_option(const char *name) | |||
| { | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| /* EngMapFile creates the file if it does not exists, so it must either be | |||
| * disabled on release versions (or put in a less conspicuous place). */ | |||
| #ifdef DEBUG | |||
| const char *result = NULL; | |||
| ULONG_PTR iFile = 0; | |||
| const void *pMap = NULL; | |||
| const char *sol, *eol, *sep; | |||
| static char output[1024]; | |||
| pMap = EngMapFile(L"\\??\\c:\\gallium.cfg", 0, &iFile); | |||
| if(pMap) { | |||
| sol = (const char *)pMap; | |||
| while(1) { | |||
| /* TODO: handle LF line endings */ | |||
| eol = find(sol, NULL, '\r'); | |||
| if(!eol || eol == sol) | |||
| break; | |||
| sep = find(sol, eol, '='); | |||
| if(!sep) | |||
| break; | |||
| if(compare(sol, sep, name)) { | |||
| copy(output, sep + 1, eol, sizeof(output)); | |||
| result = output; | |||
| break; | |||
| } | |||
| sol = eol + 2; | |||
| } | |||
| EngUnmapFile(iFile); | |||
| } | |||
| return result; | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| /* TODO: implement */ | |||
| return NULL; | |||
| #else | |||
| return getenv(name); | |||
| #endif | |||
| } | |||
| @@ -66,7 +66,7 @@ extern "C" { | |||
| /* | |||
| * Abort the program. | |||
| */ | |||
| #if defined(DEBUG) || defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| #if defined(DEBUG) | |||
| # define os_abort() os_break() | |||
| #else | |||
| # define os_abort() abort() | |||
| @@ -37,13 +37,7 @@ | |||
| #if defined(PIPE_OS_UNIX) | |||
| # include <sys/time.h> /* timeval */ | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| # include <windows.h> | |||
| # include <winddi.h> | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| # include <windows.h> | |||
| extern VOID KeQuerySystemTime(PLARGE_INTEGER); | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| # include <windows.h> | |||
| #else | |||
| # error Unsupported OS | |||
| @@ -61,16 +55,7 @@ os_time_get(void) | |||
| gettimeofday(&tv, NULL); | |||
| return tv.tv_usec + tv.tv_sec*1000000LL; | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| static LONGLONG frequency; | |||
| LONGLONG counter; | |||
| if(!frequency) | |||
| EngQueryPerformanceFrequency(&frequency); | |||
| EngQueryPerformanceCounter(&counter); | |||
| return counter*INT64_C(1000000)/frequency; | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| static LARGE_INTEGER frequency; | |||
| LARGE_INTEGER counter; | |||
| @@ -79,40 +64,11 @@ os_time_get(void) | |||
| QueryPerformanceCounter(&counter); | |||
| return counter.QuadPart*INT64_C(1000000)/frequency.QuadPart; | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| /* Updated every 10 miliseconds, measured in units of 100 nanoseconds. | |||
| * http://msdn.microsoft.com/en-us/library/ms801642.aspx */ | |||
| LARGE_INTEGER counter; | |||
| KeQuerySystemTime(&counter); | |||
| return counter.QuadPart/10; | |||
| #endif | |||
| } | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| void | |||
| os_time_sleep(int64_t usecs) | |||
| { | |||
| static LONGLONG frequency; | |||
| LONGLONG start, curr, end; | |||
| EngQueryPerformanceCounter(&start); | |||
| if(!frequency) | |||
| EngQueryPerformanceFrequency(&frequency); | |||
| end = start + (usecs * frequency + 999999LL)/1000000LL; | |||
| do { | |||
| EngQueryPerformanceCounter(&curr); | |||
| } while(start <= curr && curr < end || | |||
| end < start && (curr < end || start <= curr)); | |||
| } | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| void | |||
| os_time_sleep(int64_t usecs) | |||
| @@ -18,10 +18,7 @@ | |||
| * locally coded assembly, compiler intrinsic or ultimately a | |||
| * mutex-based implementation. | |||
| */ | |||
| #if (defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || \ | |||
| defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)) | |||
| #define PIPE_ATOMIC_OS_UNLOCKED | |||
| #elif defined(PIPE_OS_SOLARIS) | |||
| #if defined(PIPE_OS_SOLARIS) | |||
| #define PIPE_ATOMIC_OS_SOLARIS | |||
| #elif defined(PIPE_CC_MSVC) | |||
| #define PIPE_ATOMIC_MSVC_INTRINSIC | |||
| @@ -274,11 +274,7 @@ void _debug_assert_fail(const char *expr, | |||
| const char *function) | |||
| { | |||
| _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr); | |||
| #if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE)) | |||
| #else | |||
| if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE)) | |||
| #endif | |||
| os_abort(); | |||
| else | |||
| _debug_printf("continuing...\n"); | |||
| @@ -453,42 +449,6 @@ void debug_dump_image(const char *prefix, | |||
| unsigned stride, | |||
| const void *data) | |||
| { | |||
| #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY | |||
| static unsigned no = 0; | |||
| char filename[256]; | |||
| WCHAR wfilename[sizeof(filename)]; | |||
| ULONG_PTR iFile = 0; | |||
| struct { | |||
| unsigned format; | |||
| unsigned cpp; | |||
| unsigned width; | |||
| unsigned height; | |||
| } header; | |||
| unsigned char *pMap = NULL; | |||
| unsigned i; | |||
| util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix); | |||
| for(i = 0; i < sizeof(filename); ++i) | |||
| wfilename[i] = (WCHAR)filename[i]; | |||
| pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile); | |||
| if(!pMap) | |||
| return; | |||
| header.format = format; | |||
| header.cpp = cpp; | |||
| header.width = width; | |||
| header.height = height; | |||
| memcpy(pMap, &header, sizeof(header)); | |||
| pMap += sizeof(header); | |||
| for(i = 0; i < height; ++i) { | |||
| memcpy(pMap, (unsigned char *)data + stride*i, cpp*width); | |||
| pMap += cpp*width; | |||
| } | |||
| EngUnmapFile(iFile); | |||
| #elif defined(PIPE_OS_UNIX) | |||
| /* write a ppm file */ | |||
| char filename[256]; | |||
| FILE *f; | |||
| @@ -534,7 +494,6 @@ void debug_dump_image(const char *prefix, | |||
| else { | |||
| fprintf(stderr, "Can't open %s for writing\n", filename); | |||
| } | |||
| #endif | |||
| } | |||
| /* FIXME: dump resources, not surfaces... */ | |||
| @@ -636,7 +595,6 @@ debug_dump_surface_bmp(struct pipe_context *pipe, | |||
| const char *filename, | |||
| struct pipe_surface *surface) | |||
| { | |||
| #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT | |||
| struct pipe_transfer *transfer; | |||
| struct pipe_resource *texture = surface->texture; | |||
| @@ -647,7 +605,6 @@ debug_dump_surface_bmp(struct pipe_context *pipe, | |||
| debug_dump_transfer_bmp(pipe, filename, transfer); | |||
| pipe->transfer_destroy(pipe, transfer); | |||
| #endif | |||
| } | |||
| void | |||
| @@ -655,7 +612,6 @@ debug_dump_transfer_bmp(struct pipe_context *pipe, | |||
| const char *filename, | |||
| struct pipe_transfer *transfer) | |||
| { | |||
| #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT | |||
| float *rgba; | |||
| if (!transfer) | |||
| @@ -679,7 +635,6 @@ debug_dump_transfer_bmp(struct pipe_context *pipe, | |||
| FREE(rgba); | |||
| error1: | |||
| ; | |||
| #endif | |||
| } | |||
| void | |||
| @@ -687,7 +642,6 @@ debug_dump_float_rgba_bmp(const char *filename, | |||
| unsigned width, unsigned height, | |||
| float *rgba, unsigned stride) | |||
| { | |||
| #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT | |||
| FILE *stream; | |||
| struct bmp_file_header bmfh; | |||
| struct bmp_info_header bmih; | |||
| @@ -738,7 +692,6 @@ debug_dump_float_rgba_bmp(const char *filename, | |||
| fclose(stream); | |||
| error1: | |||
| ; | |||
| #endif | |||
| } | |||
| #endif | |||
| @@ -24,7 +24,7 @@ | |||
| * | |||
| **************************************************************************/ | |||
| #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) | |||
| #if defined(DEBUG) | |||
| /* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output | |||
| * on Linux, use tools/addr2line.sh to postprocess it before anything else | |||
| @@ -48,74 +48,8 @@ extern "C" { | |||
| #endif | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| __inline double ceil(double val) | |||
| { | |||
| double ceil_val; | |||
| if ((val - (long) val) == 0) { | |||
| ceil_val = val; | |||
| } | |||
| else { | |||
| if (val > 0) { | |||
| ceil_val = (long) val + 1; | |||
| } | |||
| else { | |||
| ceil_val = (long) val; | |||
| } | |||
| } | |||
| return ceil_val; | |||
| } | |||
| #ifndef PIPE_SUBSYSTEM_WINDOWS_CE_OGL | |||
| __inline double floor(double val) | |||
| { | |||
| double floor_val; | |||
| if ((val - (long) val) == 0) { | |||
| floor_val = val; | |||
| } | |||
| else { | |||
| if (val > 0) { | |||
| floor_val = (long) val; | |||
| } | |||
| else { | |||
| floor_val = (long) val - 1; | |||
| } | |||
| } | |||
| return floor_val; | |||
| } | |||
| #endif | |||
| #pragma function(pow) | |||
| __inline double __cdecl pow(double val, double exponent) | |||
| { | |||
| /* XXX */ | |||
| assert(0); | |||
| return 0; | |||
| } | |||
| #pragma function(log) | |||
| __inline double __cdecl log(double val) | |||
| { | |||
| /* XXX */ | |||
| assert(0); | |||
| return 0; | |||
| } | |||
| #pragma function(atan2) | |||
| __inline double __cdecl atan2(double val) | |||
| { | |||
| /* XXX */ | |||
| assert(0); | |||
| return 0; | |||
| } | |||
| #else | |||
| #include <math.h> | |||
| #include <stdarg.h> | |||
| #endif | |||
| #ifndef M_SQRT2 | |||
| @@ -125,7 +59,7 @@ __inline double __cdecl atan2(double val) | |||
| #if defined(_MSC_VER) | |||
| #if _MSC_VER < 1400 && !defined(__cplusplus) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| #if _MSC_VER < 1400 && !defined(__cplusplus) | |||
| static INLINE float cosf( float f ) | |||
| { | |||
| @@ -1113,11 +1113,7 @@ again: | |||
| * Factor of ten with the number of digits needed for the fractional | |||
| * part. For example, if the precision is 3, the mask will be 1000. | |||
| */ | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| mask = (unsigned long)mypow10(precision); | |||
| #else | |||
| mask = (UINTMAX_T)mypow10(precision); | |||
| #endif | |||
| /* | |||
| * We "cheat" by converting the fractional part to integer by | |||
| * multiplying by a factor of ten. | |||
| @@ -1369,11 +1365,7 @@ cast(LDOUBLE value) | |||
| if (value >= UINTMAX_MAX) | |||
| return UINTMAX_MAX; | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| result = (unsigned long)value; | |||
| #else | |||
| result = (UINTMAX_T)value; | |||
| #endif | |||
| /* | |||
| * At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to | |||
| * an integer type converts e.g. 1.9 to 2 instead of 1 (which violates | |||
| @@ -229,20 +229,10 @@ | |||
| #endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ | |||
| #if defined(PIPE_OS_WINDOWS) | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) | |||
| /* Windows 2000/XP Display Driver */ | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) | |||
| /* Windows 2000/XP Miniport Driver */ | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) | |||
| /* Windows User-space Library */ | |||
| #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) | |||
| /* Windows CE 5.0/6.0 */ | |||
| #else | |||
| #ifdef _WIN32_WCE | |||
| #define PIPE_SUBSYSTEM_WINDOWS_CE | |||
| #else /* !_WIN32_WCE */ | |||
| #error No PIPE_SUBSYSTEM_WINDOWS_xxx subsystem defined. | |||
| #endif /* !_WIN32_WCE */ | |||
| #define PIPE_SUBSYSTEM_WINDOWS_USER | |||
| #endif | |||
| #endif /* PIPE_OS_WINDOWS */ | |||
| @@ -4,83 +4,81 @@ | |||
| Import('*') | |||
| if env['platform'] != 'winddk': | |||
| env = env.Clone() | |||
| env = env.Clone() | |||
| env.Append(CPPDEFINES = [ | |||
| 'MAPI_MODE_UTIL', | |||
| ]) | |||
| if env['platform'] == 'windows': | |||
| env.Append(CPPDEFINES = [ | |||
| 'MAPI_MODE_UTIL', | |||
| '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers | |||
| 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers | |||
| ]) | |||
| if env['gles']: | |||
| env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS']) | |||
| else: | |||
| # prevent _glapi_* from being declared __declspec(dllimport) | |||
| env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) | |||
| env.Append(CPPPATH = [ | |||
| '#/src/mapi', | |||
| '#/src/mesa', | |||
| ]) | |||
| glapi_sources = [ | |||
| 'glapi_dispatch.c', | |||
| 'glapi_entrypoint.c', | |||
| 'glapi_getproc.c', | |||
| 'glapi_nop.c', | |||
| 'glthread.c', | |||
| 'glapi.c', | |||
| ] | |||
| if env['platform'] == 'windows': | |||
| mapi_sources = [ | |||
| 'u_current.c', | |||
| 'u_execmem.c', | |||
| 'u_thread.c', | |||
| ] | |||
| for s in mapi_sources: | |||
| o = env.SharedObject(s[:-2], '../mapi/' + s) | |||
| glapi_sources.append(o) | |||
| # | |||
| # Assembly sources | |||
| # | |||
| if env['gcc'] and env['platform'] != 'windows': | |||
| if env['machine'] == 'x86': | |||
| env.Append(CPPDEFINES = [ | |||
| '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers | |||
| 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers | |||
| 'USE_X86_ASM', | |||
| ]) | |||
| if env['gles']: | |||
| env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS']) | |||
| else: | |||
| # prevent _glapi_* from being declared __declspec(dllimport) | |||
| env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) | |||
| env.Append(CPPPATH = [ | |||
| '#/src/mapi', | |||
| '#/src/mesa', | |||
| ]) | |||
| glapi_sources = [ | |||
| 'glapi_dispatch.c', | |||
| 'glapi_entrypoint.c', | |||
| 'glapi_getproc.c', | |||
| 'glapi_nop.c', | |||
| 'glthread.c', | |||
| 'glapi.c', | |||
| ] | |||
| mapi_sources = [ | |||
| 'u_current.c', | |||
| 'u_execmem.c', | |||
| 'u_thread.c', | |||
| ] | |||
| for s in mapi_sources: | |||
| o = env.SharedObject(s[:-2], '../mapi/' + s) | |||
| glapi_sources.append(o) | |||
| glapi_sources += [ | |||
| 'glapi_x86.S', | |||
| ] | |||
| elif env['machine'] == 'x86_64': | |||
| env.Append(CPPDEFINES = [ | |||
| 'USE_X86_64_ASM', | |||
| ]) | |||
| glapi_sources += [ | |||
| 'glapi_x86-64.S' | |||
| ] | |||
| elif env['machine'] == 'sparc': | |||
| env.Append(CPPDEFINES = [ | |||
| 'USE_SPARC_ASM', | |||
| ]) | |||
| glapi_sources += [ | |||
| 'glapi_sparc.S' | |||
| ] | |||
| else: | |||
| pass | |||
| # | |||
| # Assembly sources | |||
| # | |||
| if env['gcc'] and env['platform'] != 'windows': | |||
| if env['machine'] == 'x86': | |||
| env.Append(CPPDEFINES = [ | |||
| 'USE_X86_ASM', | |||
| ]) | |||
| glapi_sources += [ | |||
| 'glapi_x86.S', | |||
| ] | |||
| elif env['machine'] == 'x86_64': | |||
| env.Append(CPPDEFINES = [ | |||
| 'USE_X86_64_ASM', | |||
| ]) | |||
| glapi_sources += [ | |||
| 'glapi_x86-64.S' | |||
| ] | |||
| elif env['machine'] == 'sparc': | |||
| env.Append(CPPDEFINES = [ | |||
| 'USE_SPARC_ASM', | |||
| ]) | |||
| glapi_sources += [ | |||
| 'glapi_sparc.S' | |||
| ] | |||
| else: | |||
| pass | |||
| if env['toolchain'] == 'crossmingw': | |||
| # compile these files without -gstabs option | |||
| glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c") | |||
| glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c") | |||
| if env['toolchain'] == 'crossmingw': | |||
| # compile these files without -gstabs option | |||
| glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c") | |||
| glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c") | |||
| glapi = env.ConvenienceLibrary( | |||
| target = 'glapi', | |||
| source = glapi_sources, | |||
| ) | |||
| Export('glapi') | |||
| glapi = env.ConvenienceLibrary( | |||
| target = 'glapi', | |||
| source = glapi_sources, | |||
| ) | |||
| Export('glapi') | |||
| @@ -63,54 +63,53 @@ def mapi_objects(env, printer, mode): | |||
| return objects | |||
| if env['platform'] != 'winddk': | |||
| env = env.Clone() | |||
| env['SHLIBPREFIX'] = 'lib' | |||
| env['LIBPREFIX'] = 'lib' | |||
| shared_glapi_objects = mapi_objects(env, 'shared-glapi', 'glapi') | |||
| shared_glapi = env.SharedLibrary( | |||
| target = 'glapi', | |||
| source = shared_glapi_objects, | |||
| ) | |||
| # manually add LIBPREFIX on windows | |||
| if env['platform'] == 'windows': | |||
| libs = ['libglapi'] | |||
| else: | |||
| libs = ['glapi'] | |||
| es1api_objects = mapi_objects(env, 'es1api', 'bridge') | |||
| es1api = env.SharedLibrary( | |||
| target = 'GLESv1_CM', | |||
| source = es1api_objects, | |||
| LIBPATH = ['.'], | |||
| LIBS = libs, | |||
| ) | |||
| es2api_objects = mapi_objects(env, 'es2api', 'bridge') | |||
| es2api = env.SharedLibrary( | |||
| target = 'GLESv2', | |||
| source = es2api_objects, | |||
| LIBPATH = ['.'], | |||
| LIBS = libs, | |||
| ) | |||
| env.InstallSharedLibrary(shared_glapi, version=(0, 0, 0)) | |||
| env.InstallSharedLibrary(es1api, version=(1, 0, 0)) | |||
| env.InstallSharedLibrary(es2api, version=(2, 0, 0)) | |||
| if env['platform'] == 'windows': | |||
| shared_glapi = env.FindIxes(shared_glapi, 'LIBPREFIX', 'LIBSUFFIX') | |||
| else: | |||
| shared_glapi = env.FindIxes(shared_glapi, 'SHLIBPREFIX', 'SHLIBSUFFIX') | |||
| # build glapi bridge as a convenience libarary for libgl-xlib/libgl-gdi | |||
| bridge_glapi_objects = mapi_objects(env, 'glapi', 'bridge') | |||
| bridge_glapi = env.ConvenienceLibrary( | |||
| target = 'glapi_bridge', | |||
| source = bridge_glapi_objects, | |||
| ) | |||
| Export(['shared_glapi', 'bridge_glapi']) | |||
| env = env.Clone() | |||
| env['SHLIBPREFIX'] = 'lib' | |||
| env['LIBPREFIX'] = 'lib' | |||
| shared_glapi_objects = mapi_objects(env, 'shared-glapi', 'glapi') | |||
| shared_glapi = env.SharedLibrary( | |||
| target = 'glapi', | |||
| source = shared_glapi_objects, | |||
| ) | |||
| # manually add LIBPREFIX on windows | |||
| if env['platform'] == 'windows': | |||
| libs = ['libglapi'] | |||
| else: | |||
| libs = ['glapi'] | |||
| es1api_objects = mapi_objects(env, 'es1api', 'bridge') | |||
| es1api = env.SharedLibrary( | |||
| target = 'GLESv1_CM', | |||
| source = es1api_objects, | |||
| LIBPATH = ['.'], | |||
| LIBS = libs, | |||
| ) | |||
| es2api_objects = mapi_objects(env, 'es2api', 'bridge') | |||
| es2api = env.SharedLibrary( | |||
| target = 'GLESv2', | |||
| source = es2api_objects, | |||
| LIBPATH = ['.'], | |||
| LIBS = libs, | |||
| ) | |||
| env.InstallSharedLibrary(shared_glapi, version=(0, 0, 0)) | |||
| env.InstallSharedLibrary(es1api, version=(1, 0, 0)) | |||
| env.InstallSharedLibrary(es2api, version=(2, 0, 0)) | |||
| if env['platform'] == 'windows': | |||
| shared_glapi = env.FindIxes(shared_glapi, 'LIBPREFIX', 'LIBSUFFIX') | |||
| else: | |||
| shared_glapi = env.FindIxes(shared_glapi, 'SHLIBPREFIX', 'SHLIBSUFFIX') | |||
| # build glapi bridge as a convenience libarary for libgl-xlib/libgl-gdi | |||
| bridge_glapi_objects = mapi_objects(env, 'glapi', 'bridge') | |||
| bridge_glapi = env.ConvenienceLibrary( | |||
| target = 'glapi_bridge', | |||
| source = bridge_glapi_objects, | |||
| ) | |||
| Export(['shared_glapi', 'bridge_glapi']) | |||
| @@ -5,59 +5,57 @@ from sys import executable as python_cmd | |||
| Import('*') | |||
| if env['platform'] != 'winddk': | |||
| env = env.Clone() | |||
| vgapi_header = env.CodeGenerate( | |||
| target = '#src/mapi/vgapi/vgapi_tmp.h', | |||
| script = '../mapi/mapi_abi.py', | |||
| source = 'vgapi.csv', | |||
| command = python_cmd + ' $SCRIPT --printer vgapi --mode lib $SOURCE > $TARGET' | |||
| ) | |||
| env.Append(CPPDEFINES = [ | |||
| 'MAPI_ABI_HEADER=\\"vgapi/vgapi_tmp.h\\"', | |||
| 'MAPI_DLL_EXPORTS', | |||
| 'KHRONOS_DLL_EXPORTS', | |||
| ]) | |||
| env.Append(CPPPATH = [ | |||
| '#/include', | |||
| '#/src/mapi', | |||
| ]) | |||
| mapi_sources = [ | |||
| 'entry.c', | |||
| 'mapi.c', | |||
| 'stub.c', | |||
| 'table.c', | |||
| 'u_current.c', | |||
| 'u_execmem.c', | |||
| 'u_thread.c', | |||
| ] | |||
| vgapi_objects = [] | |||
| for s in mapi_sources: | |||
| o = env.SharedObject(s[:-2], '../mapi/' + s) | |||
| vgapi_objects.append(o) | |||
| env.Depends(vgapi_objects, vgapi_header) | |||
| # libOpenVG.dll | |||
| env['LIBPREFIX'] = 'lib' | |||
| env['SHLIBPREFIX'] = 'lib' | |||
| openvg = env.SharedLibrary( | |||
| target = 'OpenVG', | |||
| source = vgapi_objects, | |||
| ) | |||
| env.InstallSharedLibrary(openvg, version=(1, 0, 0)) | |||
| if env['platform'] == 'windows': | |||
| openvg = env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX') | |||
| else: | |||
| openvg = env.FindIxes(openvg, 'SHLIBPREFIX', 'SHLIBSUFFIX') | |||
| Export(['openvg']) | |||
| env = env.Clone() | |||
| vgapi_header = env.CodeGenerate( | |||
| target = '#src/mapi/vgapi/vgapi_tmp.h', | |||
| script = '../mapi/mapi_abi.py', | |||
| source = 'vgapi.csv', | |||
| command = python_cmd + ' $SCRIPT --printer vgapi --mode lib $SOURCE > $TARGET' | |||
| ) | |||
| env.Append(CPPDEFINES = [ | |||
| 'MAPI_ABI_HEADER=\\"vgapi/vgapi_tmp.h\\"', | |||
| 'MAPI_DLL_EXPORTS', | |||
| 'KHRONOS_DLL_EXPORTS', | |||
| ]) | |||
| env.Append(CPPPATH = [ | |||
| '#/include', | |||
| '#/src/mapi', | |||
| ]) | |||
| mapi_sources = [ | |||
| 'entry.c', | |||
| 'mapi.c', | |||
| 'stub.c', | |||
| 'table.c', | |||
| 'u_current.c', | |||
| 'u_execmem.c', | |||
| 'u_thread.c', | |||
| ] | |||
| vgapi_objects = [] | |||
| for s in mapi_sources: | |||
| o = env.SharedObject(s[:-2], '../mapi/' + s) | |||
| vgapi_objects.append(o) | |||
| env.Depends(vgapi_objects, vgapi_header) | |||
| # libOpenVG.dll | |||
| env['LIBPREFIX'] = 'lib' | |||
| env['SHLIBPREFIX'] = 'lib' | |||
| openvg = env.SharedLibrary( | |||
| target = 'OpenVG', | |||
| source = vgapi_objects, | |||
| ) | |||
| env.InstallSharedLibrary(openvg, version=(1, 0, 0)) | |||
| if env['platform'] == 'windows': | |||
| openvg = env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX') | |||
| else: | |||
| openvg = env.FindIxes(openvg, 'SHLIBPREFIX', 'SHLIBSUFFIX') | |||
| Export(['openvg']) | |||