mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
mesa32: Remove outdated files.
svn path=/branches/ros-amd64-bringup/; revision=40985
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
MESA_DRIVER_COMMON_SOURCES = \
|
||||
driverfuncs.c
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
MESA_GLAPI_SOURCES = \
|
||||
glapi.c \
|
||||
glthread.c
|
||||
|
||||
MESA_GLAPI_HEADERS = \
|
||||
dispatch.h \
|
||||
glapi.h \
|
||||
glapioffsets.h \
|
||||
glapitable.h \
|
||||
glapitemp.h \
|
||||
glprocs.h \
|
||||
glthread.h
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef API_EVAL_H
|
||||
#define API_EVAL_H
|
||||
|
||||
#include "mtypes.h"
|
||||
|
||||
extern void _mesa_EvalPoint1( GLint i );
|
||||
extern void _mesa_EvalPoint2( GLint i, GLint j );
|
||||
extern void _mesa_EvalCoord1f( GLfloat u );
|
||||
extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v );
|
||||
extern void _mesa_EvalCoord1fv( const GLfloat *u );
|
||||
extern void _mesa_EvalCoord2fv( const GLfloat *u );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
-392
@@ -1,392 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2008 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \file mcopmiler.h
|
||||
*
|
||||
* Define helper macros/etc that are platform or compiler-specific.
|
||||
* There shouldn't be anything specific to GL in here.
|
||||
*/
|
||||
|
||||
#ifndef MCOMPILER_H
|
||||
#define MCOMPILER_H
|
||||
|
||||
|
||||
|
||||
/* Get typedefs for uintptr_t and friends */
|
||||
#if defined(__MINGW32__) || defined(__NetBSD__)
|
||||
# include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <BaseTsd.h>
|
||||
# if _MSC_VER == 1200
|
||||
typedef UINT_PTR uintptr_t;
|
||||
# endif
|
||||
#else
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* NULL
|
||||
*/
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function inlining
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
# define INLINE __inline__
|
||||
#elif defined(__MSC__)
|
||||
# define INLINE __inline
|
||||
#elif defined(_MSC_VER)
|
||||
# define INLINE __inline
|
||||
#elif defined(__ICL)
|
||||
# define INLINE __inline
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define INLINE inline
|
||||
#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
|
||||
# define INLINE __inline
|
||||
#else
|
||||
# define INLINE
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* PUBLIC/USED macros for symbol export.
|
||||
*
|
||||
* If we build the library with gcc's -fvisibility=hidden flag, we'll
|
||||
* use the PUBLIC macro to mark functions that are to be exported.
|
||||
*
|
||||
* We also need to define a USED attribute, so the optimizer doesn't
|
||||
* inline a static function that we later use in an alias. - ajax
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
|
||||
# define PUBLIC __attribute__((visibility("default")))
|
||||
# define USED __attribute__((used))
|
||||
#else
|
||||
# define PUBLIC
|
||||
# define USED
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Some compilers don't like some of Mesa's const usage.
|
||||
*/
|
||||
#ifdef NO_CONST
|
||||
# define CONST
|
||||
#else
|
||||
# define CONST const
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* ASSERT macro
|
||||
*/
|
||||
#if defined(BUILD_FOR_SNAP) && defined(CHECKED)
|
||||
# define ASSERT(X) _CHECK(X)
|
||||
#elif defined(DEBUG)
|
||||
# define ASSERT(X) assert(X)
|
||||
#else
|
||||
# define ASSERT(X)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* __builtin_expect() dummy for non-gcc
|
||||
*/
|
||||
#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900)
|
||||
# define __builtin_expect(x, y) x
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The __FUNCTION__ gcc variable is generally only used for debugging.
|
||||
* If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
|
||||
* Don't define it if using a newer Windows compiler.
|
||||
*/
|
||||
#if defined(__VMS)
|
||||
# define __FUNCTION__ "VMS$NL:"
|
||||
#elif __STDC_VERSION__ < 199901L
|
||||
# if ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \
|
||||
(!defined(_MSC_VER) || _MSC_VER < 1300)
|
||||
# define __FUNCTION__ "<unknown>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/** gcc -pedantic warns about long string literals, LONGSTRING silences that */
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 2) || \
|
||||
((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
|
||||
# define LONGSTRING
|
||||
#else
|
||||
# define LONGSTRING __extension__
|
||||
#endif
|
||||
|
||||
|
||||
/* Create a macro so that asm functions can be linked into compilers other
|
||||
* than GNU C
|
||||
*/
|
||||
#ifndef _ASMAPI
|
||||
#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
|
||||
#define _ASMAPI __cdecl
|
||||
#else
|
||||
#define _ASMAPI
|
||||
#endif
|
||||
#ifdef PTR_DECL_IN_FRONT
|
||||
#define _ASMAPIP * _ASMAPI
|
||||
#else
|
||||
#define _ASMAPIP _ASMAPI *
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_X86_ASM
|
||||
#define _NORMAPI _ASMAPI
|
||||
#define _NORMAPIP _ASMAPIP
|
||||
#else
|
||||
#define _NORMAPI
|
||||
#define _NORMAPIP *
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* XXX is this used anymore?
|
||||
*/
|
||||
#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
|
||||
#define CAPI _cdecl
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* USE_IEEE: Determine if we're using IEEE floating point
|
||||
*/
|
||||
#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
|
||||
defined(__s390x__) || defined(__powerpc__) || \
|
||||
defined(__x86_64__) || \
|
||||
defined(ia64) || defined(__ia64__) || \
|
||||
defined(__hppa__) || defined(hpux) || \
|
||||
defined(__mips) || defined(_MIPS_ARCH) || \
|
||||
defined(__arm__) || \
|
||||
defined(__sh__) || defined(__m32r__) || \
|
||||
(defined(__sun) && defined(_IEEE_754)) || \
|
||||
(defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
|
||||
#define USE_IEEE
|
||||
#define IEEE_ONE 0x3f800000
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* finite macro
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
|
||||
# define __WIN32__
|
||||
# define finite _finite
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__)
|
||||
# define finite _finite
|
||||
# pragma disable_message(201) /* Disable unreachable code warnings */
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* IS_INF_OR_NAN: test if float is infinite or NaN
|
||||
*/
|
||||
#ifdef USE_IEEE
|
||||
static INLINE int IS_INF_OR_NAN( float x )
|
||||
{
|
||||
fi_type tmp;
|
||||
tmp.f = x;
|
||||
return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
|
||||
}
|
||||
#elif defined(isfinite)
|
||||
#define IS_INF_OR_NAN(x) (!isfinite(x))
|
||||
#elif defined(finite)
|
||||
#define IS_INF_OR_NAN(x) (!finite(x))
|
||||
#elif defined(__VMS)
|
||||
#define IS_INF_OR_NAN(x) (!finite(x))
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define IS_INF_OR_NAN(x) (!isfinite(x))
|
||||
#else
|
||||
#define IS_INF_OR_NAN(x) (!finite(x))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
|
||||
*** original mode to a temporary).
|
||||
*** END_FAST_MATH: Restore x86 FPU to original mode.
|
||||
***/
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
/*
|
||||
* Set the x86 FPU control word to guarentee only 32 bits of precision
|
||||
* are stored in registers. Allowing the FPU to store more introduces
|
||||
* differences between situations where numbers are pulled out of memory
|
||||
* vs. situations where the compiler is able to optimize register usage.
|
||||
*
|
||||
* In the worst case, we force the compiler to use a memory access to
|
||||
* truncate the float, by specifying the 'volatile' keyword.
|
||||
*/
|
||||
/* Hardware default: All exceptions masked, extended double precision,
|
||||
* round to nearest (IEEE compliant):
|
||||
*/
|
||||
#define DEFAULT_X86_FPU 0x037f
|
||||
/* All exceptions masked, single precision, round to nearest:
|
||||
*/
|
||||
#define FAST_X86_FPU 0x003f
|
||||
/* The fldcw instruction will cause any pending FP exceptions to be
|
||||
* raised prior to entering the block, and we clear any pending
|
||||
* exceptions before exiting the block. Hence, asm code has free
|
||||
* reign over the FPU while in the fast math block.
|
||||
*/
|
||||
#if defined(NO_FAST_MATH)
|
||||
#define START_FAST_MATH(x) \
|
||||
do { \
|
||||
static unsigned mask = DEFAULT_X86_FPU; \
|
||||
__asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
|
||||
__asm__ ( "fldcw %0" : : "m" (mask) ); \
|
||||
} while (0)
|
||||
#else
|
||||
#define START_FAST_MATH(x) \
|
||||
do { \
|
||||
static unsigned mask = FAST_X86_FPU; \
|
||||
__asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
|
||||
__asm__ ( "fldcw %0" : : "m" (mask) ); \
|
||||
} while (0)
|
||||
#endif
|
||||
/* Restore original FPU mode, and clear any exceptions that may have
|
||||
* occurred in the FAST_MATH block.
|
||||
*/
|
||||
#define END_FAST_MATH(x) \
|
||||
do { \
|
||||
__asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \
|
||||
} while (0)
|
||||
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */
|
||||
#define FAST_X86_FPU 0x003f /* See GCC comments above */
|
||||
void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
|
||||
#pragma aux _watcom_start_fast_math = \
|
||||
"fnstcw word ptr [eax]" \
|
||||
"fldcw word ptr [ecx]" \
|
||||
parm [eax] [ecx] \
|
||||
modify exact [];
|
||||
void _watcom_end_fast_math(unsigned short *x);
|
||||
#pragma aux _watcom_end_fast_math = \
|
||||
"fnclex" \
|
||||
"fldcw word ptr [eax]" \
|
||||
parm [eax] \
|
||||
modify exact [];
|
||||
#if defined(NO_FAST_MATH)
|
||||
#define START_FAST_MATH(x) \
|
||||
do { \
|
||||
static unsigned short mask = DEFAULT_X86_FPU; \
|
||||
_watcom_start_fast_math(&x,&mask); \
|
||||
} while (0)
|
||||
#else
|
||||
#define START_FAST_MATH(x) \
|
||||
do { \
|
||||
static unsigned short mask = FAST_X86_FPU; \
|
||||
_watcom_start_fast_math(&x,&mask); \
|
||||
} while (0)
|
||||
#endif
|
||||
#define END_FAST_MATH(x) _watcom_end_fast_math(&x)
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */
|
||||
#define FAST_X86_FPU 0x003f /* See GCC comments above */
|
||||
#if defined(NO_FAST_MATH)
|
||||
#define START_FAST_MATH(x) do {\
|
||||
static unsigned mask = DEFAULT_X86_FPU;\
|
||||
__asm fnstcw word ptr [x]\
|
||||
__asm fldcw word ptr [mask]\
|
||||
} while(0)
|
||||
#else
|
||||
#define START_FAST_MATH(x) do {\
|
||||
static unsigned mask = FAST_X86_FPU;\
|
||||
__asm fnstcw word ptr [x]\
|
||||
__asm fldcw word ptr [mask]\
|
||||
} while(0)
|
||||
#endif
|
||||
#define END_FAST_MATH(x) do {\
|
||||
__asm fnclex\
|
||||
__asm fldcw word ptr [x]\
|
||||
} while(0)
|
||||
|
||||
#else
|
||||
#define START_FAST_MATH(x) x = 0
|
||||
#define END_FAST_MATH(x) (void)(x)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
|
||||
* Do not use them unless absolutely necessary!
|
||||
* Try to use a runtime test instead.
|
||||
* For now, only used by some DRI hardware drivers for color/texel packing.
|
||||
*/
|
||||
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
|
||||
#if defined(__linux__)
|
||||
#include <byteswap.h>
|
||||
#define CPU_TO_LE32( x ) bswap_32( x )
|
||||
#else /*__linux__*/
|
||||
#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
|
||||
#endif /*__linux__*/
|
||||
#define MESA_BIG_ENDIAN 1
|
||||
#else
|
||||
#define CPU_TO_LE32( x ) ( x )
|
||||
#define MESA_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MCOMPILER_H */
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
# List of source files in this directory used for X.org xserver build
|
||||
MESA_MAIN_SOURCES = \
|
||||
accum.c \
|
||||
api_arrayelt.c \
|
||||
api_loopback.c \
|
||||
api_noop.c \
|
||||
api_validate.c \
|
||||
arrayobj.c \
|
||||
attrib.c \
|
||||
blend.c \
|
||||
bufferobj.c \
|
||||
buffers.c \
|
||||
clip.c \
|
||||
colortab.c \
|
||||
context.c \
|
||||
convolve.c \
|
||||
debug.c \
|
||||
depth.c \
|
||||
depthstencil.c \
|
||||
dlist.c \
|
||||
drawpix.c \
|
||||
enable.c \
|
||||
enums.c \
|
||||
eval.c \
|
||||
execmem.c \
|
||||
extensions.c \
|
||||
fbobject.c \
|
||||
feedback.c \
|
||||
fog.c \
|
||||
framebuffer.c \
|
||||
get.c \
|
||||
getstring.c \
|
||||
hash.c \
|
||||
hint.c \
|
||||
histogram.c \
|
||||
image.c \
|
||||
imports.c \
|
||||
light.c \
|
||||
lines.c \
|
||||
matrix.c \
|
||||
mipmap.c \
|
||||
mm.c \
|
||||
occlude.c \
|
||||
pixel.c \
|
||||
points.c \
|
||||
polygon.c \
|
||||
rastpos.c \
|
||||
rbadaptors.c \
|
||||
renderbuffer.c \
|
||||
state.c \
|
||||
stencil.c \
|
||||
texcompress.c \
|
||||
texcompress_fxt1.c \
|
||||
texcompress_s3tc.c \
|
||||
texenvprogram.c \
|
||||
texformat.c \
|
||||
teximage.c \
|
||||
texobj.c \
|
||||
texrender.c \
|
||||
texstate.c \
|
||||
texstore.c \
|
||||
varray.c \
|
||||
$(VSNPRINTF_SOURCES) \
|
||||
vtxfmt.c
|
||||
|
||||
MESA_VSNPRINTF_SOURCES = \
|
||||
vsnprintf.c
|
||||
|
||||
MESA_MAIN_HEADERS = \
|
||||
accum.h \
|
||||
api_arrayelt.h \
|
||||
api_eval.h \
|
||||
api_loopback.h \
|
||||
api_noop.h \
|
||||
api_validate.h \
|
||||
arrayobj.h \
|
||||
attrib.h \
|
||||
bitset.h \
|
||||
blend.h \
|
||||
bufferobj.h \
|
||||
buffers.h \
|
||||
clip.h \
|
||||
colormac.h \
|
||||
colortab.h \
|
||||
config.h \
|
||||
context.h \
|
||||
convolve.h \
|
||||
dd.h \
|
||||
debug.h \
|
||||
depth.h \
|
||||
depthstencil.h \
|
||||
dlist.h \
|
||||
drawpix.h \
|
||||
enable.h \
|
||||
enums.h \
|
||||
eval.h \
|
||||
extensions.h \
|
||||
fbobject.h \
|
||||
feedback.h \
|
||||
fog.h \
|
||||
framebuffer.h \
|
||||
get.h \
|
||||
glheader.h \
|
||||
hash.h \
|
||||
hint.h \
|
||||
histogram.h \
|
||||
image.h \
|
||||
imports.h \
|
||||
light.h \
|
||||
lines.h \
|
||||
macros.h \
|
||||
matrix.h \
|
||||
mipmap.h \
|
||||
mm.h \
|
||||
mtypes.h \
|
||||
occlude.h \
|
||||
pixel.h \
|
||||
points.h \
|
||||
polygon.h \
|
||||
rastpos.h \
|
||||
rbadaptors.h \
|
||||
renderbuffer.h \
|
||||
simple_list.h \
|
||||
state.h \
|
||||
stencil.h \
|
||||
texcompress.h \
|
||||
texenvprogram.h \
|
||||
texformat.h \
|
||||
texformat_tmp.h \
|
||||
teximage.h \
|
||||
texobj.h \
|
||||
texrender.h \
|
||||
texstate.h \
|
||||
texstore.h \
|
||||
varray.h \
|
||||
version.h \
|
||||
vtxfmt.h \
|
||||
vtxfmt_tmp.h
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
MESA_MATH_SOURCES = \
|
||||
m_debug_clip.c \
|
||||
m_debug_norm.c \
|
||||
m_debug_xform.c \
|
||||
m_eval.c \
|
||||
m_matrix.c \
|
||||
m_translate.c \
|
||||
m_vector.c \
|
||||
m_xform.c
|
||||
|
||||
MESA_MATH_HEADERS = \
|
||||
m_clip_tmp.h \
|
||||
m_copy_tmp.h \
|
||||
m_debug.h \
|
||||
m_debug_util.h \
|
||||
m_dotprod_tmp.h \
|
||||
m_eval.h \
|
||||
m_matrix.h \
|
||||
m_norm_tmp.h \
|
||||
m_trans_tmp.h \
|
||||
m_translate.h \
|
||||
m_vector.h \
|
||||
m_xform.h \
|
||||
m_xform_tmp.h \
|
||||
mathmod.h
|
||||
@@ -1,8 +0,0 @@
|
||||
MESA_SHADER_GRAMMAR_SOURCES = \
|
||||
grammar_mesa.c
|
||||
|
||||
MESA_SHADER_GRAMMAR_HEADERS = \
|
||||
grammar.c \
|
||||
grammar.h \
|
||||
grammar_mesa.h \
|
||||
grammar_syn.h
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
|
||||
#include "main/glheader.h"
|
||||
#include "main/mtypes.h"
|
||||
|
||||
|
||||
/**
|
||||
* Write shader and associated info to a file.
|
||||
*/
|
||||
void
|
||||
_mesa_write_shader_to_file(const struct gl_shader *shader)
|
||||
{
|
||||
const char *type;
|
||||
char filename[100];
|
||||
FILE *f;
|
||||
|
||||
if (shader->Type == GL_FRAGMENT_SHADER)
|
||||
type = "frag";
|
||||
else
|
||||
type = "vert";
|
||||
|
||||
snprintf(filename, strlen(filename), "shader_%u.%s", shader->Name, type);
|
||||
f = fopen(filename, "w");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Unable to open %s for writing\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "/* Shader %u source */\n", shader->Name);
|
||||
fputs(shader->Source, f);
|
||||
fprintf(f, "\n");
|
||||
|
||||
fprintf(f, "/* Compile status: %d */\n", shader->CompileStatus);
|
||||
fprintf(f, "\n");
|
||||
|
||||
if (shader->CompileStatus) {
|
||||
FILE *stdout_save;
|
||||
|
||||
stdout_save = stdout;
|
||||
stdout = f;
|
||||
|
||||
fprintf(f, "/*GPU code */\n");
|
||||
_mesa_print_program(shader->Program);
|
||||
|
||||
stdout = stdout_save;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,501 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2006 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SimplexNoise1234
|
||||
* Copyright (c) 2003-2005, Stefan Gustavson
|
||||
*
|
||||
* Contact: [email protected]
|
||||
*/
|
||||
|
||||
/** \file
|
||||
\brief C implementation of Perlin Simplex Noise over 1,2,3, and 4 dimensions.
|
||||
\author Stefan Gustavson ([email protected])
|
||||
*/
|
||||
|
||||
/*
|
||||
* This implementation is "Simplex Noise" as presented by
|
||||
* Ken Perlin at a relatively obscure and not often cited course
|
||||
* session "Real-Time Shading" at Siggraph 2001 (before real
|
||||
* time shading actually took on), under the title "hardware noise".
|
||||
* The 3D function is numerically equivalent to his Java reference
|
||||
* code available in the PDF course notes, although I re-implemented
|
||||
* it from scratch to get more readable code. The 1D, 2D and 4D cases
|
||||
* were implemented from scratch by me from Ken Perlin's text.
|
||||
*
|
||||
* This file has no dependencies on any other file, not even its own
|
||||
* header file. The header file is made for use by external code only.
|
||||
*/
|
||||
|
||||
|
||||
#include "main/imports.h"
|
||||
#include "slang_library_noise.h"
|
||||
|
||||
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------
|
||||
* Static data
|
||||
*/
|
||||
|
||||
/*
|
||||
* Permutation table. This is just a random jumble of all numbers 0-255,
|
||||
* repeated twice to avoid wrapping the index at 255 for each lookup.
|
||||
* This needs to be exactly the same for all instances on all platforms,
|
||||
* so it's easiest to just keep it as static explicit data.
|
||||
* This also removes the need for any initialisation of this class.
|
||||
*
|
||||
* Note that making this an int[] instead of a char[] might make the
|
||||
* code run faster on platforms with a high penalty for unaligned single
|
||||
* byte addressing. Intel x86 is generally single-byte-friendly, but
|
||||
* some other CPUs are faster with 4-aligned reads.
|
||||
* However, a char[] is smaller, which avoids cache trashing, and that
|
||||
* is probably the most important aspect on most architectures.
|
||||
* This array is accessed a *lot* by the noise functions.
|
||||
* A vector-valued noise over 3D accesses it 96 times, and a
|
||||
* float-valued 4D noise 64 times. We want this to fit in the cache!
|
||||
*/
|
||||
unsigned char perm[512] = {151,160,137,91,90,15,
|
||||
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
|
||||
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
|
||||
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
|
||||
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
|
||||
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
|
||||
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
|
||||
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
|
||||
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
|
||||
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
|
||||
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
|
||||
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
|
||||
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,
|
||||
151,160,137,91,90,15,
|
||||
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
|
||||
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
|
||||
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
|
||||
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
|
||||
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
|
||||
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
|
||||
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
|
||||
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
|
||||
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
|
||||
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
|
||||
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
|
||||
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
|
||||
};
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Helper functions to compute gradients-dot-residualvectors (1D to 4D)
|
||||
* Note that these generate gradients of more than unit length. To make
|
||||
* a close match with the value range of classic Perlin noise, the final
|
||||
* noise values need to be rescaled to fit nicely within [-1,1].
|
||||
* (The simplex noise functions as such also have different scaling.)
|
||||
* Note also that these noise functions are the most practical and useful
|
||||
* signed version of Perlin noise. To return values according to the
|
||||
* RenderMan specification from the SL noise() and pnoise() functions,
|
||||
* the noise values need to be scaled and offset to [0,1], like this:
|
||||
* float SLnoise = (SimplexNoise1234::noise(x,y,z) + 1.0) * 0.5;
|
||||
*/
|
||||
|
||||
static float grad1( int hash, float x ) {
|
||||
int h = hash & 15;
|
||||
float grad = 1.0f + (h & 7); /* Gradient value 1.0, 2.0, ..., 8.0 */
|
||||
if (h&8) grad = -grad; /* Set a random sign for the gradient */
|
||||
return ( grad * x ); /* Multiply the gradient with the distance */
|
||||
}
|
||||
|
||||
static float grad2( int hash, float x, float y ) {
|
||||
int h = hash & 7; /* Convert low 3 bits of hash code */
|
||||
float u = h<4 ? x : y; /* into 8 simple gradient directions, */
|
||||
float v = h<4 ? y : x; /* and compute the dot product with (x,y). */
|
||||
return ((h&1)? -u : u) + ((h&2)? -2.0f*v : 2.0f*v);
|
||||
}
|
||||
|
||||
static float grad3( int hash, float x, float y , float z ) {
|
||||
int h = hash & 15; /* Convert low 4 bits of hash code into 12 simple */
|
||||
float u = h<8 ? x : y; /* gradient directions, and compute dot product. */
|
||||
float v = h<4 ? y : h==12||h==14 ? x : z; /* Fix repeats at h = 12 to 15 */
|
||||
return ((h&1)? -u : u) + ((h&2)? -v : v);
|
||||
}
|
||||
|
||||
static float grad4( int hash, float x, float y, float z, float t ) {
|
||||
int h = hash & 31; /* Convert low 5 bits of hash code into 32 simple */
|
||||
float u = h<24 ? x : y; /* gradient directions, and compute dot product. */
|
||||
float v = h<16 ? y : z;
|
||||
float w = h<8 ? z : t;
|
||||
return ((h&1)? -u : u) + ((h&2)? -v : v) + ((h&4)? -w : w);
|
||||
}
|
||||
|
||||
/* A lookup table to traverse the simplex around a given point in 4D. */
|
||||
/* Details can be found where this table is used, in the 4D noise method. */
|
||||
/* TODO: This should not be required, backport it from Bill's GLSL code! */
|
||||
static unsigned char simplex[64][4] = {
|
||||
{0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,3,0},
|
||||
{0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,3,2,0},
|
||||
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
|
||||
{1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0},
|
||||
{1,0,2,3},{1,0,3,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0},
|
||||
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
|
||||
{2,0,1,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0},
|
||||
{2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},{3,2,1,0}};
|
||||
|
||||
/* 1D simplex noise */
|
||||
GLfloat _slang_library_noise1 (GLfloat x)
|
||||
{
|
||||
int i0 = FASTFLOOR(x);
|
||||
int i1 = i0 + 1;
|
||||
float x0 = x - i0;
|
||||
float x1 = x0 - 1.0f;
|
||||
float t1 = 1.0f - x1*x1;
|
||||
float n0, n1;
|
||||
|
||||
float t0 = 1.0f - x0*x0;
|
||||
/* if(t0 < 0.0f) t0 = 0.0f; // this never happens for the 1D case */
|
||||
t0 *= t0;
|
||||
n0 = t0 * t0 * grad1(perm[i0 & 0xff], x0);
|
||||
|
||||
/* if(t1 < 0.0f) t1 = 0.0f; // this never happens for the 1D case */
|
||||
t1 *= t1;
|
||||
n1 = t1 * t1 * grad1(perm[i1 & 0xff], x1);
|
||||
/* The maximum value of this noise is 8*(3/4)^4 = 2.53125 */
|
||||
/* A factor of 0.395 would scale to fit exactly within [-1,1], but */
|
||||
/* we want to match PRMan's 1D noise, so we scale it down some more. */
|
||||
return 0.25f * (n0 + n1);
|
||||
}
|
||||
|
||||
/* 2D simplex noise */
|
||||
GLfloat _slang_library_noise2 (GLfloat x, GLfloat y)
|
||||
{
|
||||
#define F2 0.366025403f /* F2 = 0.5*(sqrt(3.0)-1.0) */
|
||||
#define G2 0.211324865f /* G2 = (3.0-Math.sqrt(3.0))/6.0 */
|
||||
|
||||
float n0, n1, n2; /* Noise contributions from the three corners */
|
||||
|
||||
/* Skew the input space to determine which simplex cell we're in */
|
||||
float s = (x+y)*F2; /* Hairy factor for 2D */
|
||||
float xs = x + s;
|
||||
float ys = y + s;
|
||||
int i = FASTFLOOR(xs);
|
||||
int j = FASTFLOOR(ys);
|
||||
|
||||
float t = (float)(i+j)*G2;
|
||||
float X0 = i-t; /* Unskew the cell origin back to (x,y) space */
|
||||
float Y0 = j-t;
|
||||
float x0 = x-X0; /* The x,y distances from the cell origin */
|
||||
float y0 = y-Y0;
|
||||
|
||||
float x1, y1, x2, y2;
|
||||
int ii, jj;
|
||||
float t0, t1, t2;
|
||||
|
||||
/* For the 2D case, the simplex shape is an equilateral triangle. */
|
||||
/* Determine which simplex we are in. */
|
||||
int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
|
||||
if(x0>y0) {i1=1; j1=0;} /* lower triangle, XY order: (0,0)->(1,0)->(1,1) */
|
||||
else {i1=0; j1=1;} /* upper triangle, YX order: (0,0)->(0,1)->(1,1) */
|
||||
|
||||
/* A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and */
|
||||
/* a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where */
|
||||
/* c = (3-sqrt(3))/6 */
|
||||
|
||||
x1 = x0 - i1 + G2; /* Offsets for middle corner in (x,y) unskewed coords */
|
||||
y1 = y0 - j1 + G2;
|
||||
x2 = x0 - 1.0f + 2.0f * G2; /* Offsets for last corner in (x,y) unskewed coords */
|
||||
y2 = y0 - 1.0f + 2.0f * G2;
|
||||
|
||||
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
|
||||
ii = i % 256;
|
||||
jj = j % 256;
|
||||
|
||||
/* Calculate the contribution from the three corners */
|
||||
t0 = 0.5f - x0*x0-y0*y0;
|
||||
if(t0 < 0.0f) n0 = 0.0f;
|
||||
else {
|
||||
t0 *= t0;
|
||||
n0 = t0 * t0 * grad2(perm[ii+perm[jj]], x0, y0);
|
||||
}
|
||||
|
||||
t1 = 0.5f - x1*x1-y1*y1;
|
||||
if(t1 < 0.0f) n1 = 0.0f;
|
||||
else {
|
||||
t1 *= t1;
|
||||
n1 = t1 * t1 * grad2(perm[ii+i1+perm[jj+j1]], x1, y1);
|
||||
}
|
||||
|
||||
t2 = 0.5f - x2*x2-y2*y2;
|
||||
if(t2 < 0.0f) n2 = 0.0f;
|
||||
else {
|
||||
t2 *= t2;
|
||||
n2 = t2 * t2 * grad2(perm[ii+1+perm[jj+1]], x2, y2);
|
||||
}
|
||||
|
||||
/* Add contributions from each corner to get the final noise value. */
|
||||
/* The result is scaled to return values in the interval [-1,1]. */
|
||||
return 40.0f * (n0 + n1 + n2); /* TODO: The scale factor is preliminary! */
|
||||
}
|
||||
|
||||
/* 3D simplex noise */
|
||||
GLfloat _slang_library_noise3 (GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
/* Simple skewing factors for the 3D case */
|
||||
#define F3 0.333333333f
|
||||
#define G3 0.166666667f
|
||||
|
||||
float n0, n1, n2, n3; /* Noise contributions from the four corners */
|
||||
|
||||
/* Skew the input space to determine which simplex cell we're in */
|
||||
float s = (x+y+z)*F3; /* Very nice and simple skew factor for 3D */
|
||||
float xs = x+s;
|
||||
float ys = y+s;
|
||||
float zs = z+s;
|
||||
int i = FASTFLOOR(xs);
|
||||
int j = FASTFLOOR(ys);
|
||||
int k = FASTFLOOR(zs);
|
||||
|
||||
float t = (float)(i+j+k)*G3;
|
||||
float X0 = i-t; /* Unskew the cell origin back to (x,y,z) space */
|
||||
float Y0 = j-t;
|
||||
float Z0 = k-t;
|
||||
float x0 = x-X0; /* The x,y,z distances from the cell origin */
|
||||
float y0 = y-Y0;
|
||||
float z0 = z-Z0;
|
||||
|
||||
float x1, y1, z1, x2, y2, z2, x3, y3, z3;
|
||||
int ii, jj, kk;
|
||||
float t0, t1, t2, t3;
|
||||
|
||||
/* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
|
||||
/* Determine which simplex we are in. */
|
||||
int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
|
||||
int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
|
||||
|
||||
/* This code would benefit from a backport from the GLSL version! */
|
||||
if(x0>=y0) {
|
||||
if(y0>=z0)
|
||||
{ i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } /* X Y Z order */
|
||||
else if(x0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } /* X Z Y order */
|
||||
else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } /* Z X Y order */
|
||||
}
|
||||
else { /* x0<y0 */
|
||||
if(y0<z0) { i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; } /* Z Y X order */
|
||||
else if(x0<z0) { i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; } /* Y Z X order */
|
||||
else { i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; } /* Y X Z order */
|
||||
}
|
||||
|
||||
/* A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z), */
|
||||
/* a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and */
|
||||
/* a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where */
|
||||
/* c = 1/6. */
|
||||
|
||||
x1 = x0 - i1 + G3; /* Offsets for second corner in (x,y,z) coords */
|
||||
y1 = y0 - j1 + G3;
|
||||
z1 = z0 - k1 + G3;
|
||||
x2 = x0 - i2 + 2.0f*G3; /* Offsets for third corner in (x,y,z) coords */
|
||||
y2 = y0 - j2 + 2.0f*G3;
|
||||
z2 = z0 - k2 + 2.0f*G3;
|
||||
x3 = x0 - 1.0f + 3.0f*G3; /* Offsets for last corner in (x,y,z) coords */
|
||||
y3 = y0 - 1.0f + 3.0f*G3;
|
||||
z3 = z0 - 1.0f + 3.0f*G3;
|
||||
|
||||
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
|
||||
ii = i % 256;
|
||||
jj = j % 256;
|
||||
kk = k % 256;
|
||||
|
||||
/* Calculate the contribution from the four corners */
|
||||
t0 = 0.6f - x0*x0 - y0*y0 - z0*z0;
|
||||
if(t0 < 0.0f) n0 = 0.0f;
|
||||
else {
|
||||
t0 *= t0;
|
||||
n0 = t0 * t0 * grad3(perm[ii+perm[jj+perm[kk]]], x0, y0, z0);
|
||||
}
|
||||
|
||||
t1 = 0.6f - x1*x1 - y1*y1 - z1*z1;
|
||||
if(t1 < 0.0f) n1 = 0.0f;
|
||||
else {
|
||||
t1 *= t1;
|
||||
n1 = t1 * t1 * grad3(perm[ii+i1+perm[jj+j1+perm[kk+k1]]], x1, y1, z1);
|
||||
}
|
||||
|
||||
t2 = 0.6f - x2*x2 - y2*y2 - z2*z2;
|
||||
if(t2 < 0.0f) n2 = 0.0f;
|
||||
else {
|
||||
t2 *= t2;
|
||||
n2 = t2 * t2 * grad3(perm[ii+i2+perm[jj+j2+perm[kk+k2]]], x2, y2, z2);
|
||||
}
|
||||
|
||||
t3 = 0.6f - x3*x3 - y3*y3 - z3*z3;
|
||||
if(t3<0.0f) n3 = 0.0f;
|
||||
else {
|
||||
t3 *= t3;
|
||||
n3 = t3 * t3 * grad3(perm[ii+1+perm[jj+1+perm[kk+1]]], x3, y3, z3);
|
||||
}
|
||||
|
||||
/* Add contributions from each corner to get the final noise value. */
|
||||
/* The result is scaled to stay just inside [-1,1] */
|
||||
return 32.0f * (n0 + n1 + n2 + n3); /* TODO: The scale factor is preliminary! */
|
||||
}
|
||||
|
||||
/* 4D simplex noise */
|
||||
GLfloat _slang_library_noise4 (GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
{
|
||||
/* The skewing and unskewing factors are hairy again for the 4D case */
|
||||
#define F4 0.309016994f /* F4 = (Math.sqrt(5.0)-1.0)/4.0 */
|
||||
#define G4 0.138196601f /* G4 = (5.0-Math.sqrt(5.0))/20.0 */
|
||||
|
||||
float n0, n1, n2, n3, n4; /* Noise contributions from the five corners */
|
||||
|
||||
/* Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in */
|
||||
float s = (x + y + z + w) * F4; /* Factor for 4D skewing */
|
||||
float xs = x + s;
|
||||
float ys = y + s;
|
||||
float zs = z + s;
|
||||
float ws = w + s;
|
||||
int i = FASTFLOOR(xs);
|
||||
int j = FASTFLOOR(ys);
|
||||
int k = FASTFLOOR(zs);
|
||||
int l = FASTFLOOR(ws);
|
||||
|
||||
float t = (i + j + k + l) * G4; /* Factor for 4D unskewing */
|
||||
float X0 = i - t; /* Unskew the cell origin back to (x,y,z,w) space */
|
||||
float Y0 = j - t;
|
||||
float Z0 = k - t;
|
||||
float W0 = l - t;
|
||||
|
||||
float x0 = x - X0; /* The x,y,z,w distances from the cell origin */
|
||||
float y0 = y - Y0;
|
||||
float z0 = z - Z0;
|
||||
float w0 = w - W0;
|
||||
|
||||
/* For the 4D case, the simplex is a 4D shape I won't even try to describe. */
|
||||
/* To find out which of the 24 possible simplices we're in, we need to */
|
||||
/* determine the magnitude ordering of x0, y0, z0 and w0. */
|
||||
/* The method below is a good way of finding the ordering of x,y,z,w and */
|
||||
/* then find the correct traversal order for the simplex we're in. */
|
||||
/* First, six pair-wise comparisons are performed between each possible pair */
|
||||
/* of the four coordinates, and the results are used to add up binary bits */
|
||||
/* for an integer index. */
|
||||
int c1 = (x0 > y0) ? 32 : 0;
|
||||
int c2 = (x0 > z0) ? 16 : 0;
|
||||
int c3 = (y0 > z0) ? 8 : 0;
|
||||
int c4 = (x0 > w0) ? 4 : 0;
|
||||
int c5 = (y0 > w0) ? 2 : 0;
|
||||
int c6 = (z0 > w0) ? 1 : 0;
|
||||
int c = c1 + c2 + c3 + c4 + c5 + c6;
|
||||
|
||||
int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
|
||||
int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
|
||||
int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
|
||||
|
||||
float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
|
||||
int ii, jj, kk, ll;
|
||||
float t0, t1, t2, t3, t4;
|
||||
|
||||
/* simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. */
|
||||
/* Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w */
|
||||
/* impossible. Only the 24 indices which have non-zero entries make any sense. */
|
||||
/* We use a thresholding to set the coordinates in turn from the largest magnitude. */
|
||||
/* The number 3 in the "simplex" array is at the position of the largest coordinate. */
|
||||
i1 = simplex[c][0]>=3 ? 1 : 0;
|
||||
j1 = simplex[c][1]>=3 ? 1 : 0;
|
||||
k1 = simplex[c][2]>=3 ? 1 : 0;
|
||||
l1 = simplex[c][3]>=3 ? 1 : 0;
|
||||
/* The number 2 in the "simplex" array is at the second largest coordinate. */
|
||||
i2 = simplex[c][0]>=2 ? 1 : 0;
|
||||
j2 = simplex[c][1]>=2 ? 1 : 0;
|
||||
k2 = simplex[c][2]>=2 ? 1 : 0;
|
||||
l2 = simplex[c][3]>=2 ? 1 : 0;
|
||||
/* The number 1 in the "simplex" array is at the second smallest coordinate. */
|
||||
i3 = simplex[c][0]>=1 ? 1 : 0;
|
||||
j3 = simplex[c][1]>=1 ? 1 : 0;
|
||||
k3 = simplex[c][2]>=1 ? 1 : 0;
|
||||
l3 = simplex[c][3]>=1 ? 1 : 0;
|
||||
/* The fifth corner has all coordinate offsets = 1, so no need to look that up. */
|
||||
|
||||
x1 = x0 - i1 + G4; /* Offsets for second corner in (x,y,z,w) coords */
|
||||
y1 = y0 - j1 + G4;
|
||||
z1 = z0 - k1 + G4;
|
||||
w1 = w0 - l1 + G4;
|
||||
x2 = x0 - i2 + 2.0f*G4; /* Offsets for third corner in (x,y,z,w) coords */
|
||||
y2 = y0 - j2 + 2.0f*G4;
|
||||
z2 = z0 - k2 + 2.0f*G4;
|
||||
w2 = w0 - l2 + 2.0f*G4;
|
||||
x3 = x0 - i3 + 3.0f*G4; /* Offsets for fourth corner in (x,y,z,w) coords */
|
||||
y3 = y0 - j3 + 3.0f*G4;
|
||||
z3 = z0 - k3 + 3.0f*G4;
|
||||
w3 = w0 - l3 + 3.0f*G4;
|
||||
x4 = x0 - 1.0f + 4.0f*G4; /* Offsets for last corner in (x,y,z,w) coords */
|
||||
y4 = y0 - 1.0f + 4.0f*G4;
|
||||
z4 = z0 - 1.0f + 4.0f*G4;
|
||||
w4 = w0 - 1.0f + 4.0f*G4;
|
||||
|
||||
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
|
||||
ii = i % 256;
|
||||
jj = j % 256;
|
||||
kk = k % 256;
|
||||
ll = l % 256;
|
||||
|
||||
/* Calculate the contribution from the five corners */
|
||||
t0 = 0.6f - x0*x0 - y0*y0 - z0*z0 - w0*w0;
|
||||
if(t0 < 0.0f) n0 = 0.0f;
|
||||
else {
|
||||
t0 *= t0;
|
||||
n0 = t0 * t0 * grad4(perm[ii+perm[jj+perm[kk+perm[ll]]]], x0, y0, z0, w0);
|
||||
}
|
||||
|
||||
t1 = 0.6f - x1*x1 - y1*y1 - z1*z1 - w1*w1;
|
||||
if(t1 < 0.0f) n1 = 0.0f;
|
||||
else {
|
||||
t1 *= t1;
|
||||
n1 = t1 * t1 * grad4(perm[ii+i1+perm[jj+j1+perm[kk+k1+perm[ll+l1]]]], x1, y1, z1, w1);
|
||||
}
|
||||
|
||||
t2 = 0.6f - x2*x2 - y2*y2 - z2*z2 - w2*w2;
|
||||
if(t2 < 0.0f) n2 = 0.0f;
|
||||
else {
|
||||
t2 *= t2;
|
||||
n2 = t2 * t2 * grad4(perm[ii+i2+perm[jj+j2+perm[kk+k2+perm[ll+l2]]]], x2, y2, z2, w2);
|
||||
}
|
||||
|
||||
t3 = 0.6f - x3*x3 - y3*y3 - z3*z3 - w3*w3;
|
||||
if(t3 < 0.0f) n3 = 0.0f;
|
||||
else {
|
||||
t3 *= t3;
|
||||
n3 = t3 * t3 * grad4(perm[ii+i3+perm[jj+j3+perm[kk+k3+perm[ll+l3]]]], x3, y3, z3, w3);
|
||||
}
|
||||
|
||||
t4 = 0.6f - x4*x4 - y4*y4 - z4*z4 - w4*w4;
|
||||
if(t4 < 0.0f) n4 = 0.0f;
|
||||
else {
|
||||
t4 *= t4;
|
||||
n4 = t4 * t4 * grad4(perm[ii+1+perm[jj+1+perm[kk+1+perm[ll+1]]]], x4, y4, z4, w4);
|
||||
}
|
||||
|
||||
/* Sum up and scale the result to cover the range [-1,1] */
|
||||
return 27.0f * (n0 + n1 + n2 + n3 + n4); /* TODO: The scale factor is preliminary! */
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 2006 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_LIBRARY_NOISE_H
|
||||
#define SLANG_LIBRARY_NOISE_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GLfloat _slang_library_noise1 (GLfloat);
|
||||
GLfloat _slang_library_noise2 (GLfloat, GLfloat);
|
||||
GLfloat _slang_library_noise3 (GLfloat, GLfloat, GLfloat);
|
||||
GLfloat _slang_library_noise4 (GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
MESA_SHADER_SLANG_SOURCES = \
|
||||
slang_analyse.c \
|
||||
slang_assemble_assignment.c \
|
||||
slang_assemble.c \
|
||||
slang_assemble_conditional.c \
|
||||
slang_assemble_constructor.c \
|
||||
slang_assemble_typeinfo.c \
|
||||
slang_compile.c \
|
||||
slang_compile_function.c \
|
||||
slang_compile_operation.c \
|
||||
slang_compile_struct.c \
|
||||
slang_compile_variable.c \
|
||||
slang_execute.c \
|
||||
slang_execute_x86.c \
|
||||
slang_export.c \
|
||||
slang_library_texsample.c \
|
||||
slang_library_noise.c \
|
||||
slang_link.c \
|
||||
slang_preprocess.c \
|
||||
slang_storage.c \
|
||||
slang_utility.c
|
||||
|
||||
MESA_SHADER_SLANG_HEADERS = \
|
||||
slang_analyse.h \
|
||||
slang_assemble.h \
|
||||
slang_assemble_assignment.h \
|
||||
slang_assemble_conditional.h \
|
||||
slang_assemble_constructor.h \
|
||||
slang_assemble_typeinfo.h \
|
||||
slang_compile.h \
|
||||
slang_compile_function.h \
|
||||
slang_compile_operation.h \
|
||||
slang_compile_struct.h \
|
||||
slang_compile_variable.h \
|
||||
slang_execute.h \
|
||||
slang_export.h \
|
||||
slang_library_noise.h \
|
||||
slang_library_texsample.h \
|
||||
slang_link.h \
|
||||
slang_mesa.h \
|
||||
slang_preprocess.h \
|
||||
slang_storage.h \
|
||||
slang_utility.h \
|
||||
traverse_wrap.h
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
# List of source files in this directory used for X.org xserver build
|
||||
MESA_SHADER_SOURCES = \
|
||||
arbprogparse.c \
|
||||
arbprogram.c \
|
||||
atifragshader.c \
|
||||
nvfragparse.c \
|
||||
nvprogram.c \
|
||||
nvvertexec.c \
|
||||
nvvertparse.c \
|
||||
program.c \
|
||||
programopt.c \
|
||||
shaderobjects.c \
|
||||
shaderobjects_3dlabs.c
|
||||
|
||||
MESA_SHADER_HEADERS = \
|
||||
arbprogparse.h \
|
||||
arbprogram.h \
|
||||
arbprogram_syn.h \
|
||||
atifragshader.h \
|
||||
nvfragparse.h \
|
||||
nvprogram.h \
|
||||
nvvertexec.h \
|
||||
nvvertparse.h \
|
||||
programopt.h \
|
||||
program.h \
|
||||
program_instruction.h \
|
||||
shaderobjects.h \
|
||||
shaderobjects_3dlabs.h
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef S_DRAWPIXELS_H
|
||||
#define S_DRAWPIXELS_H
|
||||
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "swrast.h"
|
||||
|
||||
/* XXX kill this header? */
|
||||
|
||||
#endif
|
||||
@@ -1,419 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul 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, sublicense,
|
||||
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Regarding GL_NV_point_sprite:
|
||||
*
|
||||
* Portions of this software may use or implement intellectual
|
||||
* property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
|
||||
* any and all warranties with respect to such intellectual property,
|
||||
* including any use thereof or modifications thereto.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Point rendering template code.
|
||||
*
|
||||
* Set FLAGS = bitwise-OR of the following tokens:
|
||||
*
|
||||
* RGBA = do rgba instead of color index
|
||||
* SMOOTH = do antialiasing
|
||||
* ATTRIBS = general attributes (texcoords, etc)
|
||||
* SPECULAR = do separate specular color
|
||||
* LARGE = do points with diameter > 1 pixel
|
||||
* ATTENUATE = compute point size attenuation
|
||||
* SPRITE = GL_ARB_point_sprite / GL_NV_point_sprite
|
||||
*
|
||||
* Notes: LARGE and ATTENUATE are exclusive of each other.
|
||||
* ATTRIBS requires RGBA
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* NOTES on antialiased point rasterization:
|
||||
*
|
||||
* Let d = distance of fragment center from vertex.
|
||||
* if d < rmin2 then
|
||||
* fragment has 100% coverage
|
||||
* else if d > rmax2 then
|
||||
* fragment has 0% coverage
|
||||
* else
|
||||
* fragment has % coverage = (d - rmin2) / (rmax2 - rmin2)
|
||||
*/
|
||||
|
||||
|
||||
static void
|
||||
NAME ( GLcontext *ctx, const SWvertex *vert )
|
||||
{
|
||||
#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE)
|
||||
GLfloat size;
|
||||
#endif
|
||||
#if FLAGS & RGBA
|
||||
#if (FLAGS & ATTENUATE) && (FLAGS & SMOOTH)
|
||||
GLfloat alphaAtten;
|
||||
#endif
|
||||
const GLchan red = vert->color[0];
|
||||
const GLchan green = vert->color[1];
|
||||
const GLchan blue = vert->color[2];
|
||||
const GLchan alpha = vert->color[3];
|
||||
#endif
|
||||
#if FLAGS & SPECULAR
|
||||
const GLchan specRed = vert->specular[0];
|
||||
const GLchan specGreen = vert->specular[1];
|
||||
const GLchan specBlue = vert->specular[2];
|
||||
#endif
|
||||
#if FLAGS & INDEX
|
||||
const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */
|
||||
#endif
|
||||
#if FLAGS & ATTRIBS
|
||||
GLfloat attrib[FRAG_ATTRIB_MAX][4]; /* texture & varying */
|
||||
#endif
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
SWspan *span = &(swrast->PointSpan);
|
||||
|
||||
/* Cull primitives with malformed coordinates.
|
||||
*/
|
||||
{
|
||||
float tmp = vert->win[0] + vert->win[1];
|
||||
if (IS_INF_OR_NAN(tmp))
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Span init
|
||||
*/
|
||||
span->interpMask = SPAN_FOG;
|
||||
span->arrayMask = SPAN_XY | SPAN_Z;
|
||||
span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0];
|
||||
span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
|
||||
span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
|
||||
#if FLAGS & RGBA
|
||||
span->arrayMask |= SPAN_RGBA;
|
||||
#endif
|
||||
#if FLAGS & SPECULAR
|
||||
span->arrayMask |= SPAN_SPEC;
|
||||
#endif
|
||||
#if FLAGS & INDEX
|
||||
span->arrayMask |= SPAN_INDEX;
|
||||
#endif
|
||||
#if FLAGS & ATTRIBS
|
||||
span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
|
||||
if (ctx->FragmentProgram._Active) {
|
||||
/* Don't divide texture s,t,r by q (use TXP to do that) */
|
||||
ATTRIB_LOOP_BEGIN
|
||||
COPY_4V(attrib[attr], vert->attrib[attr]);
|
||||
ATTRIB_LOOP_END
|
||||
}
|
||||
else {
|
||||
/* Divide texture s,t,r by q here */
|
||||
ATTRIB_LOOP_BEGIN
|
||||
const GLfloat q = vert->attrib[attr][3];
|
||||
const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q);
|
||||
attrib[attr][0] = vert->attrib[attr][0] * invQ;
|
||||
attrib[attr][1] = vert->attrib[attr][1] * invQ;
|
||||
attrib[attr][2] = vert->attrib[attr][2] * invQ;
|
||||
attrib[attr][3] = q;
|
||||
ATTRIB_LOOP_END
|
||||
}
|
||||
/* need these for fragment programs */
|
||||
span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
|
||||
span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
|
||||
span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
|
||||
#endif
|
||||
#if FLAGS & SMOOTH
|
||||
span->arrayMask |= SPAN_COVERAGE;
|
||||
#endif
|
||||
#if FLAGS & SPRITE
|
||||
span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
|
||||
#endif
|
||||
|
||||
/* Compute point size if not known to be one */
|
||||
#if FLAGS & ATTENUATE
|
||||
/* first, clamp attenuated size to the user-specifed range */
|
||||
size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize);
|
||||
#if (FLAGS & RGBA) && (FLAGS & SMOOTH)
|
||||
/* only if multisampling, compute the fade factor */
|
||||
if (ctx->Multisample.Enabled) {
|
||||
if (vert->pointSize >= ctx->Point.Threshold) {
|
||||
alphaAtten = 1.0F;
|
||||
}
|
||||
else {
|
||||
GLfloat dsize = vert->pointSize / ctx->Point.Threshold;
|
||||
alphaAtten = dsize * dsize;
|
||||
}
|
||||
}
|
||||
else {
|
||||
alphaAtten = 1.0;
|
||||
}
|
||||
#endif
|
||||
#elif FLAGS & (LARGE | SMOOTH | SPRITE)
|
||||
/* constant, non-attenuated size */
|
||||
size = ctx->Point._Size; /* this is already clamped */
|
||||
#endif
|
||||
|
||||
|
||||
#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE)
|
||||
/***
|
||||
*** Multi-pixel points
|
||||
***/
|
||||
|
||||
/* do final clamping now */
|
||||
if (ctx->Point.SmoothFlag) {
|
||||
size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA);
|
||||
}
|
||||
else {
|
||||
size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
|
||||
}
|
||||
|
||||
{{
|
||||
GLint x, y;
|
||||
const GLfloat radius = 0.5F * size;
|
||||
const GLuint z = (GLuint) (vert->win[2] + 0.5F);
|
||||
GLuint count;
|
||||
#if FLAGS & SMOOTH
|
||||
const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
|
||||
const GLfloat rmax = radius + 0.7071F;
|
||||
const GLfloat rmin2 = MAX2(0.0F, rmin * rmin);
|
||||
const GLfloat rmax2 = rmax * rmax;
|
||||
const GLfloat cscale = 1.0F / (rmax2 - rmin2);
|
||||
const GLint xmin = (GLint) (vert->win[0] - radius);
|
||||
const GLint xmax = (GLint) (vert->win[0] + radius);
|
||||
const GLint ymin = (GLint) (vert->win[1] - radius);
|
||||
const GLint ymax = (GLint) (vert->win[1] + radius);
|
||||
#else
|
||||
/* non-smooth */
|
||||
GLint xmin, xmax, ymin, ymax;
|
||||
GLint iSize = (GLint) (size + 0.5F);
|
||||
GLint iRadius;
|
||||
iSize = MAX2(1, iSize);
|
||||
iRadius = iSize / 2;
|
||||
if (iSize & 1) {
|
||||
/* odd size */
|
||||
xmin = (GLint) (vert->win[0] - iRadius);
|
||||
xmax = (GLint) (vert->win[0] + iRadius);
|
||||
ymin = (GLint) (vert->win[1] - iRadius);
|
||||
ymax = (GLint) (vert->win[1] + iRadius);
|
||||
}
|
||||
else {
|
||||
/* even size */
|
||||
xmin = (GLint) vert->win[0] - iRadius;
|
||||
xmax = xmin + iSize - 1;
|
||||
ymin = (GLint) vert->win[1] - iRadius;
|
||||
ymax = ymin + iSize - 1;
|
||||
}
|
||||
#endif /*SMOOTH*/
|
||||
|
||||
/* check if we need to flush */
|
||||
if (span->end + (xmax-xmin+1) * (ymax-ymin+1) >= MAX_WIDTH ||
|
||||
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) {
|
||||
if (span->end > 0) {
|
||||
#if FLAGS & RGBA
|
||||
_swrast_write_rgba_span(ctx, span);
|
||||
#else
|
||||
_swrast_write_index_span(ctx, span);
|
||||
#endif
|
||||
span->end = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, generate fragments
|
||||
*/
|
||||
count = span->end;
|
||||
(void) radius;
|
||||
for (y = ymin; y <= ymax; y++) {
|
||||
/* check if we need to flush */
|
||||
if (count + (xmax-xmin+1) >= MAX_WIDTH) {
|
||||
span->end = count;
|
||||
#if FLAGS & RGBA
|
||||
_swrast_write_rgba_span(ctx, span);
|
||||
#else
|
||||
_swrast_write_index_span(ctx, span);
|
||||
#endif
|
||||
count = span->end = 0;
|
||||
}
|
||||
for (x = xmin; x <= xmax; x++) {
|
||||
#if FLAGS & SPRITE
|
||||
GLuint u;
|
||||
#endif
|
||||
|
||||
#if FLAGS & RGBA
|
||||
span->array->rgba[count][RCOMP] = red;
|
||||
span->array->rgba[count][GCOMP] = green;
|
||||
span->array->rgba[count][BCOMP] = blue;
|
||||
span->array->rgba[count][ACOMP] = alpha;
|
||||
#endif
|
||||
#if FLAGS & SPECULAR
|
||||
span->array->spec[count][RCOMP] = specRed;
|
||||
span->array->spec[count][GCOMP] = specGreen;
|
||||
span->array->spec[count][BCOMP] = specBlue;
|
||||
#endif
|
||||
#if FLAGS & INDEX
|
||||
span->array->index[count] = colorIndex;
|
||||
#endif
|
||||
#if FLAGS & ATTRIBS
|
||||
ATTRIB_LOOP_BEGIN
|
||||
COPY_4V(span->array->attribs[attr][count], attrib[attr]);
|
||||
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
|
||||
const GLuint u = attr - FRAG_ATTRIB_TEX0;
|
||||
span->array->lambda[u][count] = 0.0;
|
||||
}
|
||||
ATTRIB_LOOP_END
|
||||
#endif
|
||||
|
||||
#if FLAGS & SMOOTH
|
||||
/* compute coverage */
|
||||
{
|
||||
const GLfloat dx = x - vert->win[0] + 0.5F;
|
||||
const GLfloat dy = y - vert->win[1] + 0.5F;
|
||||
const GLfloat dist2 = dx * dx + dy * dy;
|
||||
if (dist2 < rmax2) {
|
||||
if (dist2 >= rmin2) {
|
||||
/* compute partial coverage */
|
||||
span->array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
|
||||
#if FLAGS & INDEX
|
||||
/* coverage in [0,15] */
|
||||
span->array->coverage[count] *= 15.0;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* full coverage */
|
||||
span->array->coverage[count] = 1.0F;
|
||||
}
|
||||
|
||||
span->array->x[count] = x;
|
||||
span->array->y[count] = y;
|
||||
span->array->z[count] = z;
|
||||
|
||||
#if (FLAGS & ATTENUATE) && (FLAGS & RGBA)
|
||||
span->array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
|
||||
#elif FLAGS & RGBA
|
||||
span->array->rgba[count][ACOMP] = alpha;
|
||||
#endif /*ATTENUATE*/
|
||||
count++;
|
||||
} /*if*/
|
||||
}
|
||||
|
||||
#else /*SMOOTH*/
|
||||
|
||||
/* not smooth (square points) */
|
||||
span->array->x[count] = x;
|
||||
span->array->y[count] = y;
|
||||
span->array->z[count] = z;
|
||||
|
||||
#if FLAGS & SPRITE
|
||||
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
|
||||
GLuint attr = FRAG_ATTRIB_TEX0 + u;
|
||||
if (ctx->Texture.Unit[u]._ReallyEnabled) {
|
||||
if (ctx->Point.CoordReplace[u]) {
|
||||
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
|
||||
GLfloat t, r;
|
||||
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
|
||||
t = 0.5F + (y + 0.5F - vert->win[1]) / size;
|
||||
else /* GL_UPPER_LEFT */
|
||||
t = 0.5F - (y + 0.5F - vert->win[1]) / size;
|
||||
if (ctx->Point.SpriteRMode == GL_ZERO)
|
||||
r = 0.0F;
|
||||
else if (ctx->Point.SpriteRMode == GL_S)
|
||||
r = vert->attrib[attr][0];
|
||||
else /* GL_R */
|
||||
r = vert->attrib[attr][2];
|
||||
span->array->attribs[attr][count][0] = s;
|
||||
span->array->attribs[attr][count][1] = t;
|
||||
span->array->attribs[attr][count][2] = r;
|
||||
span->array->attribs[attr][count][3] = 1.0F;
|
||||
span->array->lambda[u][count] = 0.0; /* XXX fix? */
|
||||
}
|
||||
else {
|
||||
COPY_4V(span->array->attribs[attr][count],
|
||||
vert->attrib[attr]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /*SPRITE*/
|
||||
|
||||
count++; /* square point */
|
||||
|
||||
#endif /*SMOOTH*/
|
||||
|
||||
} /*for x*/
|
||||
} /*for y*/
|
||||
span->end = count;
|
||||
}}
|
||||
|
||||
#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */
|
||||
|
||||
/***
|
||||
*** Single-pixel points
|
||||
***/
|
||||
{{
|
||||
GLuint count;
|
||||
|
||||
/* check if we need to flush */
|
||||
if (span->end >= MAX_WIDTH ||
|
||||
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) {
|
||||
#if FLAGS & RGBA
|
||||
_swrast_write_rgba_span(ctx, span);
|
||||
#else
|
||||
_swrast_write_index_span(ctx, span);
|
||||
#endif
|
||||
span->end = 0;
|
||||
}
|
||||
|
||||
count = span->end;
|
||||
|
||||
#if FLAGS & RGBA
|
||||
span->array->rgba[count][RCOMP] = red;
|
||||
span->array->rgba[count][GCOMP] = green;
|
||||
span->array->rgba[count][BCOMP] = blue;
|
||||
span->array->rgba[count][ACOMP] = alpha;
|
||||
#endif
|
||||
#if FLAGS & SPECULAR
|
||||
span->array->spec[count][RCOMP] = specRed;
|
||||
span->array->spec[count][GCOMP] = specGreen;
|
||||
span->array->spec[count][BCOMP] = specBlue;
|
||||
#endif
|
||||
#if FLAGS & INDEX
|
||||
span->array->index[count] = colorIndex;
|
||||
#endif
|
||||
#if FLAGS & ATTRIBS
|
||||
ATTRIB_LOOP_BEGIN
|
||||
COPY_4V(span->array->attribs[attr][count], attribs[attr]);
|
||||
ATTRIB_LOOP_END
|
||||
#endif
|
||||
|
||||
span->array->x[count] = (GLint) vert->win[0];
|
||||
span->array->y[count] = (GLint) vert->win[1];
|
||||
span->array->z[count] = (GLint) (vert->win[2] + 0.5F);
|
||||
span->end = count + 1;
|
||||
}}
|
||||
|
||||
#endif /* LARGE || ATTENUATE || SMOOTH */
|
||||
|
||||
ASSERT(span->end <= MAX_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
#undef FLAGS
|
||||
#undef NAME
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
# List of source files in this directory used for X.org xserver build
|
||||
MESA_SWRAST_SOURCES = \
|
||||
s_aaline.c \
|
||||
s_aatriangle.c \
|
||||
s_accum.c \
|
||||
s_alpha.c \
|
||||
s_arbshader.c \
|
||||
s_atifragshader.c \
|
||||
s_bitmap.c \
|
||||
s_blend.c \
|
||||
s_blit.c \
|
||||
s_buffers.c \
|
||||
s_context.c \
|
||||
s_copypix.c \
|
||||
s_depth.c \
|
||||
s_drawpix.c \
|
||||
s_feedback.c \
|
||||
s_fog.c \
|
||||
s_imaging.c \
|
||||
s_lines.c \
|
||||
s_logic.c \
|
||||
s_masking.c \
|
||||
s_nvfragprog.c \
|
||||
s_points.c \
|
||||
s_readpix.c \
|
||||
s_span.c \
|
||||
s_stencil.c \
|
||||
s_texcombine.c \
|
||||
s_texfilter.c \
|
||||
s_texstore.c \
|
||||
s_triangle.c \
|
||||
s_zoom.c
|
||||
|
||||
MESA_SWRAST_HEADERS = \
|
||||
s_aaline.h \
|
||||
s_aalinetemp.h \
|
||||
s_aatriangle.h \
|
||||
s_aatritemp.h \
|
||||
s_accum.h \
|
||||
s_alpha.h \
|
||||
s_arbshader.h \
|
||||
s_atifragshader.h \
|
||||
s_blend.h \
|
||||
s_context.h \
|
||||
s_depth.h \
|
||||
s_drawpix.h \
|
||||
s_feedback.h \
|
||||
s_fog.h \
|
||||
s_lines.h \
|
||||
s_linetemp.h \
|
||||
s_logic.h \
|
||||
s_masking.h \
|
||||
s_nvfragprog.h \
|
||||
s_points.h \
|
||||
s_pointtemp.h \
|
||||
s_span.h \
|
||||
s_spantemp.h \
|
||||
s_stencil.h \
|
||||
s_texcombine.h \
|
||||
s_texfilter.h \
|
||||
s_triangle.h \
|
||||
s_trispan.h \
|
||||
s_tritemp.h \
|
||||
s_zoom.h \
|
||||
swrast.h
|
||||
@@ -1,10 +0,0 @@
|
||||
MESA_SWRAST_SETUP_SOURCES = \
|
||||
ss_context.c \
|
||||
ss_triangle.c
|
||||
|
||||
MESA_SWRAST_SETUP_HEADERS = \
|
||||
ss_context.h \
|
||||
ss_triangle.h \
|
||||
ss_tritmp.h \
|
||||
ss_vb.h \
|
||||
swrast_setup.h
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
# List of source files in this directory used for X.org xserver build
|
||||
MESA_TNL_SOURCES = \
|
||||
t_context.c \
|
||||
t_pipeline.c \
|
||||
t_vb_arbprogram.c \
|
||||
t_vb_arbprogram_sse.c \
|
||||
t_vb_arbshader.c \
|
||||
t_vb_cull.c \
|
||||
t_vb_fog.c \
|
||||
t_vb_light.c \
|
||||
t_vb_normals.c \
|
||||
t_vb_points.c \
|
||||
t_vb_program.c \
|
||||
t_vb_render.c \
|
||||
t_vb_texgen.c \
|
||||
t_vb_texmat.c \
|
||||
t_vb_vertex.c \
|
||||
t_vertex.c \
|
||||
t_vertex_generic.c \
|
||||
t_vertex_sse.c \
|
||||
t_vp_build.c
|
||||
|
||||
MESA_TNL_HEADERS = \
|
||||
t_array_api.h \
|
||||
t_array_import.h \
|
||||
t_context.h \
|
||||
t_pipeline.h \
|
||||
t_vb_arbprogram.h \
|
||||
t_vb_cliptmp.h \
|
||||
t_vb_lighttmp.h \
|
||||
t_vb_rendertmp.h \
|
||||
t_vertex.h \
|
||||
t_vp_build.h \
|
||||
tnl.h
|
||||
Reference in New Issue
Block a user