Merge branch 'glsl2'

Conflicts:
	src/mesa/program/prog_optimize.c
This commit is contained in:
Ian Romanick 2010-08-16 19:08:53 -07:00
commit 6c03c576cc
474 changed files with 85891 additions and 302 deletions

View file

@ -206,28 +206,6 @@ Export('env')
# TODO: Build several variants at the same time?
# http://www.scons.org/wiki/SimultaneousVariantBuilds
if env['platform'] != common.default_platform:
# GLSL code has to be built twice -- one for the host OS, another for the target OS...
host_env = Environment(
# options are ignored
# default tool is used
tools = ['default', 'custom'],
toolpath = ['#scons'],
ENV = os.environ,
)
host_env['platform'] = common.default_platform
host_env['machine'] = common.default_machine
host_env['debug'] = env['debug']
SConscript(
'src/glsl/SConscript',
variant_dir = os.path.join(env['build'], 'host'),
duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
exports={'env':host_env},
)
SConscript(
'src/SConscript',
variant_dir = env['build'],

View file

@ -116,7 +116,7 @@ EGL_CLIENT_APIS = $(GL_LIB)
# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -ltalloc
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm

View file

@ -41,4 +41,4 @@ else
endif
LD = g++
GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -lstdc++ -ludis86
GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -ltalloc -lstdc++ -ludis86

View file

@ -463,6 +463,8 @@ xxlib|xdri|xosmesa)
;;
esac
PKG_CHECK_MODULES([TALLOC], [talloc])
dnl
dnl Driver specific build directories
dnl
@ -853,7 +855,7 @@ if test "$mesa_driver" = dri; then
[AC_MSG_ERROR([Expat required for DRI.])])
# put all the necessary libs together
DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
fi
AC_SUBST([DRI_DIRS])
AC_SUBST([EXPAT_INCLUDES])

305
include/c99/inttypes.h Normal file
View file

@ -0,0 +1,305 @@
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include "stdint.h"
// 7.8 Format conversion of integer types
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
// 7.8.1 Macros for format specifiers
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
// The fprintf macros for signed integers are:
#define PRId8 "d"
#define PRIi8 "i"
#define PRIdLEAST8 "d"
#define PRIiLEAST8 "i"
#define PRIdFAST8 "d"
#define PRIiFAST8 "i"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIdLEAST16 "hd"
#define PRIiLEAST16 "hi"
#define PRIdFAST16 "hd"
#define PRIiFAST16 "hi"
#define PRId32 "I32d"
#define PRIi32 "I32i"
#define PRIdLEAST32 "I32d"
#define PRIiLEAST32 "I32i"
#define PRIdFAST32 "I32d"
#define PRIiFAST32 "I32i"
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIdLEAST64 "I64d"
#define PRIiLEAST64 "I64i"
#define PRIdFAST64 "I64d"
#define PRIiFAST64 "I64i"
#define PRIdMAX "I64d"
#define PRIiMAX "I64i"
#define PRIdPTR "Id"
#define PRIiPTR "Ii"
// The fprintf macros for unsigned integers are:
#define PRIo8 "o"
#define PRIu8 "u"
#define PRIx8 "x"
#define PRIX8 "X"
#define PRIoLEAST8 "o"
#define PRIuLEAST8 "u"
#define PRIxLEAST8 "x"
#define PRIXLEAST8 "X"
#define PRIoFAST8 "o"
#define PRIuFAST8 "u"
#define PRIxFAST8 "x"
#define PRIXFAST8 "X"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRIoLEAST16 "ho"
#define PRIuLEAST16 "hu"
#define PRIxLEAST16 "hx"
#define PRIXLEAST16 "hX"
#define PRIoFAST16 "ho"
#define PRIuFAST16 "hu"
#define PRIxFAST16 "hx"
#define PRIXFAST16 "hX"
#define PRIo32 "I32o"
#define PRIu32 "I32u"
#define PRIx32 "I32x"
#define PRIX32 "I32X"
#define PRIoLEAST32 "I32o"
#define PRIuLEAST32 "I32u"
#define PRIxLEAST32 "I32x"
#define PRIXLEAST32 "I32X"
#define PRIoFAST32 "I32o"
#define PRIuFAST32 "I32u"
#define PRIxFAST32 "I32x"
#define PRIXFAST32 "I32X"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRIoLEAST64 "I64o"
#define PRIuLEAST64 "I64u"
#define PRIxLEAST64 "I64x"
#define PRIXLEAST64 "I64X"
#define PRIoFAST64 "I64o"
#define PRIuFAST64 "I64u"
#define PRIxFAST64 "I64x"
#define PRIXFAST64 "I64X"
#define PRIoMAX "I64o"
#define PRIuMAX "I64u"
#define PRIxMAX "I64x"
#define PRIXMAX "I64X"
#define PRIoPTR "Io"
#define PRIuPTR "Iu"
#define PRIxPTR "Ix"
#define PRIXPTR "IX"
// The fscanf macros for signed integers are:
#define SCNd8 "d"
#define SCNi8 "i"
#define SCNdLEAST8 "d"
#define SCNiLEAST8 "i"
#define SCNdFAST8 "d"
#define SCNiFAST8 "i"
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNdLEAST16 "hd"
#define SCNiLEAST16 "hi"
#define SCNdFAST16 "hd"
#define SCNiFAST16 "hi"
#define SCNd32 "ld"
#define SCNi32 "li"
#define SCNdLEAST32 "ld"
#define SCNiLEAST32 "li"
#define SCNdFAST32 "ld"
#define SCNiFAST32 "li"
#define SCNd64 "I64d"
#define SCNi64 "I64i"
#define SCNdLEAST64 "I64d"
#define SCNiLEAST64 "I64i"
#define SCNdFAST64 "I64d"
#define SCNiFAST64 "I64i"
#define SCNdMAX "I64d"
#define SCNiMAX "I64i"
#ifdef _WIN64 // [
# define SCNdPTR "I64d"
# define SCNiPTR "I64i"
#else // _WIN64 ][
# define SCNdPTR "ld"
# define SCNiPTR "li"
#endif // _WIN64 ]
// The fscanf macros for unsigned integers are:
#define SCNo8 "o"
#define SCNu8 "u"
#define SCNx8 "x"
#define SCNX8 "X"
#define SCNoLEAST8 "o"
#define SCNuLEAST8 "u"
#define SCNxLEAST8 "x"
#define SCNXLEAST8 "X"
#define SCNoFAST8 "o"
#define SCNuFAST8 "u"
#define SCNxFAST8 "x"
#define SCNXFAST8 "X"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNX16 "hX"
#define SCNoLEAST16 "ho"
#define SCNuLEAST16 "hu"
#define SCNxLEAST16 "hx"
#define SCNXLEAST16 "hX"
#define SCNoFAST16 "ho"
#define SCNuFAST16 "hu"
#define SCNxFAST16 "hx"
#define SCNXFAST16 "hX"
#define SCNo32 "lo"
#define SCNu32 "lu"
#define SCNx32 "lx"
#define SCNX32 "lX"
#define SCNoLEAST32 "lo"
#define SCNuLEAST32 "lu"
#define SCNxLEAST32 "lx"
#define SCNXLEAST32 "lX"
#define SCNoFAST32 "lo"
#define SCNuFAST32 "lu"
#define SCNxFAST32 "lx"
#define SCNXFAST32 "lX"
#define SCNo64 "I64o"
#define SCNu64 "I64u"
#define SCNx64 "I64x"
#define SCNX64 "I64X"
#define SCNoLEAST64 "I64o"
#define SCNuLEAST64 "I64u"
#define SCNxLEAST64 "I64x"
#define SCNXLEAST64 "I64X"
#define SCNoFAST64 "I64o"
#define SCNuFAST64 "I64u"
#define SCNxFAST64 "I64x"
#define SCNXFAST64 "I64X"
#define SCNoMAX "I64o"
#define SCNuMAX "I64u"
#define SCNxMAX "I64x"
#define SCNXMAX "I64X"
#ifdef _WIN64 // [
# define SCNoPTR "I64o"
# define SCNuPTR "I64u"
# define SCNxPTR "I64x"
# define SCNXPTR "I64X"
#else // _WIN64 ][
# define SCNoPTR "lo"
# define SCNuPTR "lu"
# define SCNxPTR "lx"
# define SCNXPTR "lX"
#endif // _WIN64 ]
#endif // __STDC_FORMAT_MACROS ]
// 7.8.2 Functions for greatest-width integer types
// 7.8.2.1 The imaxabs function
#define imaxabs _abs64
// 7.8.2.2 The imaxdiv function
// This is modified version of div() function from Microsoft's div.c found
// in %MSVC.NET%\crt\src\div.c
#ifdef STATIC_IMAXDIV // [
static
#else // STATIC_IMAXDIV ][
_inline
#endif // STATIC_IMAXDIV ]
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
{
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
#define strtoimax _strtoi64
#define strtoumax _strtoui64
// 7.8.2.4 The wcstoimax and wcstoumax functions
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
#endif // _MSC_INTTYPES_H_ ]

View file

@ -1,117 +1,247 @@
/**************************************************************************
*
* Copyright 2007-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 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
* THE COPYRIGHT HOLDERS, AUTHORS 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
**************************************************************************/
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
/*
* stdint.h --
*
* Portable subset of C99's stdint.h.
*
* At the moment it only supports MSVC, given all other mainstream compilers
* already support C99. If this is necessary for other compilers then it
* might be worth to replace this with
* http://www.azillionmonkeys.com/qed/pstdint.h.
*/
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _STDINT_H_
#define _STDINT_H_
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#ifndef INT8_MAX
#define INT8_MAX 127
#endif
#ifndef INT8_MIN
#define INT8_MIN -128
#endif
#ifndef UINT8_MAX
#define UINT8_MAX 255
#endif
#ifndef INT16_MAX
#define INT16_MAX 32767
#endif
#ifndef INT16_MIN
#define INT16_MIN -32768
#endif
#ifndef UINT16_MAX
#define UINT16_MAX 65535
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647
#endif
#ifndef INT32_MIN
#define INT32_MIN -2147483648
#endif
#ifndef UINT32_MAX
#define UINT32_MAX 4294967295U
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef INT8_C
#define INT8_C(__val) __val
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
#ifndef UINT8_C
#define UINT8_C(__val) __val
# include <wchar.h>
#ifdef __cplusplus
}
#endif
#ifndef INT16_C
#define INT16_C(__val) __val
#endif
#ifndef UINT16_C
#define UINT16_C(__val) __val
#endif
#ifndef INT32_C
#define INT32_C(__val) __val
#endif
#ifndef UINT32_C
#define UINT32_C(__val) __val##U
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
#if defined(_MSC_VER)
// 7.18.1 Integer types
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.1 Exact-width integer types
#if defined(_WIN64)
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef __int32 intptr_t;
typedef unsigned __int32 uintptr_t;
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define INT64_C(__val) __val##i64
#define UINT64_C(__val) __val##ui64
#else
#error "Unsupported compiler"
#endif
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
#endif /* _STDINT_H_ */
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]

View file

@ -5,6 +5,9 @@ if 'egl' in env['statetrackers']:
SConscript('egl/main/SConscript')
if 'mesa' in env['statetrackers']:
if platform == 'windows':
SConscript('talloc/SConscript')
SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript')
SConscript('mesa/SConscript')

View file

@ -1,11 +1,12 @@
# -*-makefile-*-
ifeq ($(MESA_LLVM),1)
PIPE_DRIVERS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
LDFLAGS += $(LLVM_LDFLAGS)
LD = g++
DRIVER_EXTRAS = $(LLVM_LIBS)
USE_CXX=1
else
LDFLAGS += -lstdc++
endif
MESA_MODULES = \
@ -75,15 +76,11 @@ default: depend symlinks $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
$(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
$(MKLIB) -o $@.tmp -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
$(OBJECTS) $(PIPE_DRIVERS) \
-Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
$(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
if [ "x${USE_CXX}" == "x" ]; then \
$(CC) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \
else \
$(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \
fi
$(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS);
@rm -f $@.test
mv -f $@.tmp $@

View file

@ -17,6 +17,7 @@ if env['platform'] == 'windows':
'user32',
'kernel32',
'ws2_32',
talloc,
])
sources = []

View file

@ -35,6 +35,7 @@ env.Prepend(LIBS = [
mesa,
glsl,
gallium,
'talloc'
])
sources = [

3
src/glsl/.dir-locals.el Normal file
View file

@ -0,0 +1,3 @@
((c-mode . ((c-basic-offset . 3)))
(c++-mode . ((c-basic-offset . 3)))
)

2
src/glsl/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
glsl_compiler
glsl_parser.output

View file

@ -1,15 +1,176 @@
# src/glsl/Makefile
#src/glsl/pp/Makefile
TOP = ../..
include $(TOP)/configs/current
SUBDIRS = pp cl apps
LIBNAME = glsl
default install clean:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) $@) || exit 1; \
fi \
done
LIBGLCPP_SOURCES = \
glcpp/glcpp-lex.c \
glcpp/glcpp-parse.c \
glcpp/pp.c
GLCPP_SOURCES = \
$(LIBGLCPP_SOURCES) \
glcpp/glcpp.c
C_SOURCES = \
$(LIBGLCPP_SOURCES)
CXX_SOURCES = \
ast_expr.cpp \
ast_function.cpp \
ast_to_hir.cpp \
ast_type.cpp \
builtin_function.cpp \
glsl_lexer.cpp \
glsl_parser.cpp \
glsl_parser_extras.cpp \
glsl_types.cpp \
hir_field_selection.cpp \
ir_algebraic.cpp \
ir_basic_block.cpp \
ir_clone.cpp \
ir_constant_expression.cpp \
ir_constant_folding.cpp \
ir_constant_propagation.cpp \
ir_constant_variable.cpp \
ir_copy_propagation.cpp \
ir.cpp \
ir_dead_code.cpp \
ir_dead_code_local.cpp \
ir_dead_functions.cpp \
ir_div_to_mul_rcp.cpp \
ir_explog_to_explog2.cpp \
ir_expression_flattening.cpp \
ir_function_can_inline.cpp \
ir_function.cpp \
ir_function_inlining.cpp \
ir_hierarchical_visitor.cpp \
ir_hv_accept.cpp \
ir_if_return.cpp \
ir_if_simplification.cpp \
ir_if_to_cond_assign.cpp \
ir_import_prototypes.cpp \
ir_mat_op_to_vec.cpp \
ir_mod_to_fract.cpp \
ir_noop_swizzle.cpp \
ir_print_visitor.cpp \
ir_reader.cpp \
ir_rvalue_visitor.cpp \
ir_set_program_inouts.cpp \
ir_structure_splitting.cpp \
ir_sub_to_add_neg.cpp \
ir_swizzle_swizzle.cpp \
ir_tree_grafting.cpp \
ir_validate.cpp \
ir_variable.cpp \
ir_variable_refcount.cpp \
ir_vec_index_to_cond_assign.cpp \
ir_vec_index_to_swizzle.cpp \
linker.cpp \
link_functions.cpp \
s_expression.cpp
LIBS = \
$(TOP)/src/glsl/libglsl.a \
$(shell pkg-config --libs talloc)
APPS = glsl_compiler glcpp/glcpp
GLSL2_C_SOURCES = \
../mesa/program/hash_table.c \
../mesa/program/symbol_table.c
GLSL2_CXX_SOURCES = \
main.cpp
GLSL2_OBJECTS = \
$(GLSL2_C_SOURCES:.c=.o) \
$(GLSL2_CXX_SOURCES:.cpp=.o)
### Basic defines ###
DEFINES += \
$(LIBRARY_DEFINES) \
$(API_DEFINES)
GLCPP_OBJECTS = \
$(GLCPP_SOURCES:.c=.o) \
../mesa/program/hash_table.o
OBJECTS = \
$(C_SOURCES:.c=.o) \
$(CXX_SOURCES:.cpp=.o)
INCLUDES = \
-I. \
-I../mesa \
-I../mapi \
-I../../include \
$(LIBRARY_INCLUDES)
ALL_SOURCES = \
$(C_SOURCES) \
$(CXX_SOURCES) \
$(GLSL2_CXX_SOURCES) \
$(GLSL2_C_SOURCES)
##### TARGETS #####
default: depend lib$(LIBNAME).a $(APPS)
lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
$(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS)
depend: $(ALL_SOURCES) Makefile
rm -f depend
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
# Remove .o and backup files
clean:
rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
-rm -f $(APPS)
# Dummy target
install:
@echo -n ""
##### RULES #####
glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
$(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a
$(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@
.cpp.o:
$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
glsl_lexer.cpp: glsl_lexer.lpp
flex --nounistd -o$@ $<
glsl_parser.cpp: glsl_parser.ypp
bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
flex --nounistd -o$@ $<
glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
builtins: builtin_function.cpp builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py
@echo Bootstrapping the compiler...
cp builtins/tools/builtin_function.cpp .
make glsl_compiler
@echo Regenerating builtin_function.cpp...
./builtins/tools/generate_builtins.py > builtin_function.cpp
@echo Rebuilding the real compiler...
make glsl_compiler
-include depend

75
src/glsl/Makefile.am Normal file
View file

@ -0,0 +1,75 @@
# Copyright © 2010 Intel Corporation
# 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
# on 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
# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR 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.
AUTOMAKE_OPTIONS = foreign
AM_CPPFLAGS = -I mesa
SUBDIRS = glcpp
bin_PROGRAMS = glsl
glsl_LDADD = ./glcpp/libglcpp.la
glsl_LDFLAGS = @LDFLAGS@ $(talloc_LIBS)
glsl_SOURCES = \
main.cpp \
builtin_types.h \
glsl_types.cpp \
glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \
ast_expr.cpp ast_to_hir.cpp ast_function.cpp ast_type.cpp \
ir.cpp hir_field_selection.cpp builtin_function.cpp \
ir_print_visitor.cpp ir_variable.cpp ir_function.cpp \
ir_basic_block.cpp \
ir_basic_block.h \
ir_clone.cpp \
ir_constant_expression.cpp \
ir_constant_folding.cpp \
ir_constant_variable.cpp \
ir_copy_propagation.cpp \
ir_copy_propagation.h \
ir_dead_code.cpp \
ir_dead_code.h \
ir_dead_code_local.cpp \
ir_expression_flattening.cpp \
ir_function_can_inline.cpp \
ir_function_inlining.cpp \
ir_if_simplification.cpp \
ir_optimization.h \
ir_reader.cpp s_expression.cpp \
ir_hv_accept.cpp \
ir_hierarchical_visitor.h \
ir_hierarchical_visitor.cpp \
ir_swizzle_swizzle.cpp \
ir_to_mesa.cpp \
ir_to_mesa.h \
ir_validate.cpp \
ir_vec_index_to_swizzle.cpp \
linker.cpp
BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp
CLEANFILES = $(BUILT_SOURCES)
builtin_function.cpp: builtins/*/*
./builtins/tools/generate_builtins.pl > builtin_function.cpp
glsl_parser.h: glsl_parser.cpp
.lpp.cpp:
$(LEXCOMPILE) --outfile="$@" $<

190
src/glsl/README Normal file
View file

@ -0,0 +1,190 @@
Welcome to Mesa's GLSL compiler. A brief overview of how things flow:
1) lex and yacc-based preprocessor takes the incoming shader string
and produces a new string containing the preprocessed shader. This
takes care of things like #if, #ifdef, #define, and preprocessor macro
invocations. Note that #version, #extension, and some others are
passed straight through. See glcpp/*
2) lex and yacc-based parser takes the preprocessed string and
generates the AST (abstract syntax tree). Almost no checking is
performed in this stage. See glsl_lexer.lpp and glsl_parser.ypp.
3) The AST is converted to "HIR". This is the intermediate
representation of the compiler. Constructors are generated, function
calls are resolved to particular function signatures, and all the
semantic checking is performed. See ast_*.cpp for the conversion, and
ir.h for the IR structures.
4) The driver (Mesa, or main.cpp for the standalone binary) performs
optimizations. These include copy propagation, dead code elimination,
constant folding, and others. Generally the driver will call
optimizations in a loop, as each may open up opportunities for other
optimizations to do additional work. See most files called ir_*.cpp
5) linking is performed. This does checking to ensure that the
outputs of the vertex shader match the inputs of the fragment shader,
and assigns locations to uniforms, attributes, and varyings. See
linker.cpp.
6) The driver may perform additional optimization at this point, as
for example dead code elimination previously couldn't remove functions
or global variable usage when we didn't know what other code would be
linked in.
7) The driver performs code generation out of the IR, taking a linked
shader program and producing a compiled program for each stage. See
ir_to_mesa.cpp for Mesa IR code generation.
FAQ:
Q: What is HIR versus IR versus LIR?
A: The idea behind the naming was that ast_to_hir would produce a
high-level IR ("HIR"), with things like matrix operations, structure
assignments, etc., present. A series of lowering passes would occur
that do things like break matrix multiplication into a series of dot
products/MADs, make structure assignment be a series of assignment of
components, flatten if statements into conditional moves, and such,
producing a low level IR ("LIR").
However, it now appears that each driver will have different
requirements from a LIR. A 915-generation chipset wants all functions
inlined, all loops unrolled, all ifs flattened, no variable array
accesses, and matrix multiplication broken down. The Mesa IR backend
for swrast would like matrices and structure assignment broken down,
but it can support function calls and dynamic branching. A 965 vertex
shader IR backend could potentially even handle some matrix operations
without breaking them down, but the 965 fragment shader IR backend
would want to break to have (almost) all operations down channel-wise
and perform optimization on that. As a result, there's no single
low-level IR that will make everyone happy. So that usage has fallen
out of favor, and each driver will perform a series of lowering passes
to take the HIR down to whatever restrictions it wants to impose
before doing codegen.
Q: How is the IR structured?
A: The best way to get started seeing it would be to run the
standalone compiler against a shader:
./glsl_compiler --dump-lir \
~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag
So for example one of the ir_instructions in main() contains:
(assign (constant bool (1)) (var_ref litColor) (expression vec3 * (var_ref Surf
aceColor) (var_ref __retval) ) )
Or more visually:
(assign)
/ | \
(var_ref) (expression *) (constant bool 1)
/ / \
(litColor) (var_ref) (var_ref)
/ \
(SurfaceColor) (__retval)
which came from:
litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0);
(the max call is not represented in this expression tree, as it was a
function call that got inlined but not brought into this expression
tree)
Each of those nodes is a subclass of ir_instruction. A particular
ir_instruction instance may only appear once in the whole IR tree with
the exception of ir_variables, which appear once as variable
declarations:
(declare () vec3 normDelta)
and multiple times as the targets of variable dereferences:
...
(assign (constant bool (1)) (var_ref __retval) (expression float dot
(var_ref normDelta) (var_ref LightDir) ) )
...
(assign (constant bool (1)) (var_ref __retval) (expression vec3 -
(var_ref LightDir) (expression vec3 * (constant float (2.000000))
(expression vec3 * (expression float dot (var_ref normDelta) (var_ref
LightDir) ) (var_ref normDelta) ) ) ) )
...
Each node has a type. Expressions may involve several different types:
(declare (uniform ) mat4 gl_ModelViewMatrix)
((assign (constant bool (1)) (var_ref constructor_tmp) (expression
vec4 * (var_ref gl_ModelViewMatrix) (var_ref gl_Vertex) ) )
An expression tree can be arbitrarily deep, and the compiler tries to
keep them structured like that so that things like algebraic
optimizations ((color * 1.0 == color) and ((mat1 * mat2) * vec == mat1
* (mat2 * vec))) or recognizing operation patterns for code generation
(vec1 * vec2 + vec3 == mad(vec1, vec2, vec3)) are easier. This comes
at the expense of additional trickery in implementing some
optimizations like CSE where one must navigate an expression tree.
Q: Why no SSA representation?
A: Converting an IR tree to SSA form makes dead code elmimination,
common subexpression elimination, and many other optimizations much
easier. However, in our primarily vector-based language, there's some
major questions as to how it would work. Do we do SSA on the scalar
or vector level? If we do it at the vector level, we're going to end
up with many different versions of the variable when encountering code
like:
(assign (constant bool (1)) (swiz x (var_ref __retval) ) (var_ref a) )
(assign (constant bool (1)) (swiz y (var_ref __retval) ) (var_ref b) )
(assign (constant bool (1)) (swiz z (var_ref __retval) ) (var_ref c) )
If every masked update of a component relies on the previous value of
the variable, then we're probably going to be quite limited in our
dead code elimination wins, and recognizing common expressions may
just not happen. On the other hand, if we operate channel-wise, then
we'll be prone to optimizing the operation on one of the channels at
the expense of making its instruction flow different from the other
channels, and a vector-based GPU would end up with worse code than if
we didn't optimize operations on that channel!
Once again, it appears that our optimization requirements are driven
significantly by the target architecture. For now, targeting the Mesa
IR backend, SSA does not appear to be that important to producing
excellent code, but we do expect to do some SSA-based optimizations
for the 965 fragment shader backend when that is developed.
Q: How should I expand instructions that take multiple backend instructions?
Sometimes you'll have to do the expansion in your code generation --
see, for example, ir_to_mesa.cpp's handling of ir_binop_mul for
matrices. However, in many cases you'll want to do a pass over the IR
to convert non-native instructions to a series of native instructions.
For example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because
Mesa IR (and many hardware backends) only have a reciprocal
instruction, not a divide. Implementing non-native instructions this
way gives the chance for constant folding to occur, so (a / 2.0)
becomes (a * 0.5) after codegen instead of (a * (1.0 / 2.0))
Q: How shoud I handle my special hardware instructions with respect to IR?
Our current theory is that if multiple targets have an instruction for
some operation, then we should probably be able to represent that in
the IR. Generally this is in the form of an ir_{bin,un}op expression
type. For example, we initially implemented fract() using (a -
floor(a)), but both 945 and 965 have instructions to give that result,
and it would also simplify the implementation of mod(), so
ir_unop_fract was added. The following areas need updating to add a
new expression type:
ir.h (new enum)
ir.cpp:get_num_operands() (used for ir_reader)
ir.cpp:operator_strs (used for ir_reader)
ir_constant_expression.cpp (you probably want to be able to constant fold)
You may also need to update the backends if they will see the new expr type:
../mesa/shaders/ir_to_mesa.cpp
You can then use the new expression from builtins (if all backends
would rather see it), or scan the IR and convert to use your new
expression type (see ir_mod_to_fract, for example).

View file

@ -4,23 +4,71 @@ Import('*')
env = env.Clone()
env.Prepend(CPPPATH = [
'#src/mapi',
'#src/mesa',
])
if env['platform'] == 'windows':
env.Prepend(CPPPATH = ['#src/talloc'])
sources = [
'pp/sl_pp_context.c',
'pp/sl_pp_define.c',
'pp/sl_pp_dict.c',
'pp/sl_pp_error.c',
'pp/sl_pp_expression.c',
'pp/sl_pp_extension.c',
'pp/sl_pp_if.c',
'pp/sl_pp_line.c',
'pp/sl_pp_macro.c',
'pp/sl_pp_pragma.c',
'pp/sl_pp_process.c',
'pp/sl_pp_purify.c',
'pp/sl_pp_token.c',
'pp/sl_pp_token_util.c',
'pp/sl_pp_version.c',
'cl/sl_cl_parse.c',
'glcpp/glcpp-lex.c',
'glcpp/glcpp-parse.c',
'glcpp/pp.c',
'ast_expr.cpp',
'ast_function.cpp',
'ast_to_hir.cpp',
'ast_type.cpp',
'builtin_function.cpp',
'glsl_lexer.cpp',
'glsl_parser.cpp',
'glsl_parser_extras.cpp',
'glsl_types.cpp',
'hir_field_selection.cpp',
'ir_algebraic.cpp',
'ir_basic_block.cpp',
'ir_clone.cpp',
'ir_constant_expression.cpp',
'ir_constant_folding.cpp',
'ir_constant_propagation.cpp',
'ir_constant_variable.cpp',
'ir_copy_propagation.cpp',
'ir.cpp',
'ir_dead_code.cpp',
'ir_dead_code_local.cpp',
'ir_dead_functions.cpp',
'ir_div_to_mul_rcp.cpp',
'ir_explog_to_explog2.cpp',
'ir_expression_flattening.cpp',
'ir_function_can_inline.cpp',
'ir_function.cpp',
'ir_function_inlining.cpp',
'ir_hierarchical_visitor.cpp',
'ir_hv_accept.cpp',
'ir_if_return.cpp',
'ir_if_simplification.cpp',
'ir_if_to_cond_assign.cpp',
'ir_import_prototypes.cpp',
'ir_mat_op_to_vec.cpp',
'ir_mod_to_fract.cpp',
'ir_noop_swizzle.cpp',
'ir_print_visitor.cpp',
'ir_reader.cpp',
'ir_rvalue_visitor.cpp',
'ir_set_program_inouts.cpp',
'ir_structure_splitting.cpp',
'ir_sub_to_add_neg.cpp',
'ir_swizzle_swizzle.cpp',
'ir_tree_grafting.cpp',
'ir_validate.cpp',
'ir_variable.cpp',
'ir_variable_refcount.cpp',
'ir_vec_index_to_cond_assign.cpp',
'ir_vec_index_to_swizzle.cpp',
'linker.cpp',
'link_functions.cpp',
's_expression.cpp',
]
glsl = env.ConvenienceLibrary(
@ -30,6 +78,9 @@ glsl = env.ConvenienceLibrary(
Export('glsl')
# FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa
Return()
env = env.Clone()
if env['platform'] == 'windows':
@ -37,33 +88,16 @@ if env['platform'] == 'windows':
'user32',
])
env.Prepend(LIBS = [glsl])
env.Prepend(LIBS = [glsl, talloc])
env.Program(
target = 'purify',
source = ['apps/purify.c'],
target = 'glsl2',
source = [
'main.cpp',
]
)
env.Program(
target = 'tokenise',
source = ['apps/tokenise.c'],
target = 'glcpp',
source = ['glcpp/glcpp.c'],
)
env.Program(
target = 'version',
source = ['apps/version.c'],
)
env.Program(
target = 'process',
source = ['apps/process.c'],
)
glsl_compile = env.Program(
target = 'compile',
source = ['apps/compile.c'],
)
if env['platform'] == common.default_platform:
# Only export the GLSL compiler when building for the host platform
Export('glsl_compile')

50
src/glsl/TODO Normal file
View file

@ -0,0 +1,50 @@
- Handle constant expressions of (struct == struct)
- Handle constant expressions of (struct != struct)
- Treat built-in functions with constant parameters as constant expressions.
- Rewrite all built-in functions return a single expression.
- Modify the HIR generator for functions to automatically inline built-in
functions durning translation.
- Care must be taken to handle both the 1.10 rules and the 1.20+ rules. In
1.10, built-in functions cannot be constant expressions.
- Detect code paths in non-void functions that don't reach a return statement
- Handle over-riding built-in functions
- Is the overload per-compilation unit or per-linked shader?
- Handle redeclaration of built-in variables
- Handle addition of qualifiers such as 'invariant' or 'centroid'.
- Handle resizing of arrays.
- Other? We'll have to look at the spec.
- Improve handling of constants and their initializers. Constant initializers
should never generate any code. This is trival for scalar constants. It is
also trivial for arrays, matrices, and vectors that are accessed with
constant index values. For others it is more complicated. Perhaps these
cases should be silently converted to uniforms?
1.30 features:
- Implement AST-to-HIR conversion of bit-shift operators.
- Implement AST-to-HIR conversion of bit-wise {&,|,^,!} operators.
- Implement AST-to-HIR conversion of switch-statements
- switch
- case
- Update break to correcly handle mixed nexting of switch-statements
and loops.
- Handle currently unsupported constant expression types
- ir_unop_bit_not
- ir_binop_mod
- ir_binop_lshift
- ir_binop_rshift
- ir_binop_bit_and
- ir_binop_bit_xor
- ir_binop_bit_or
- Implement support for 1.30 style shadow compares which only return a float
instead of a vec4.

664
src/glsl/ast.h Normal file
View file

@ -0,0 +1,664 @@
/* -*- c++ -*- */
/*
* Copyright © 2009 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#pragma once
#ifndef AST_H
#define AST_H
#include "list.h"
#include "glsl_parser_extras.h"
struct _mesa_glsl_parse_state;
struct YYLTYPE;
class ast_node {
public:
/* Callers of this talloc-based new need not call delete. It's
* easier to just talloc_free 'ctx' (or any of its ancestors). */
static void* operator new(size_t size, void *ctx)
{
void *node;
node = talloc_zero_size(ctx, size);
assert(node != NULL);
return node;
}
/* If the user *does* call delete, that's OK, we will just
* talloc_free in that case. */
static void operator delete(void *table)
{
talloc_free(table);
}
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
/**
* Retrieve the source location of an AST node
*
* This function is primarily used to get the source position of an AST node
* into a form that can be passed to \c _mesa_glsl_error.
*
* \sa _mesa_glsl_error, ast_node::set_location
*/
struct YYLTYPE get_location(void) const
{
struct YYLTYPE locp;
locp.source = this->location.source;
locp.first_line = this->location.line;
locp.first_column = this->location.column;
locp.last_line = locp.first_line;
locp.last_column = locp.first_column;
return locp;
}
/**
* Set the source location of an AST node from a parser location
*
* \sa ast_node::get_location
*/
void set_location(const struct YYLTYPE &locp)
{
this->location.source = locp.source;
this->location.line = locp.first_line;
this->location.column = locp.first_column;
}
struct {
unsigned source;
unsigned line;
unsigned column;
} location;
exec_node link;
protected:
ast_node(void);
};
enum ast_operators {
ast_assign,
ast_plus, /**< Unary + operator. */
ast_neg,
ast_add,
ast_sub,
ast_mul,
ast_div,
ast_mod,
ast_lshift,
ast_rshift,
ast_less,
ast_greater,
ast_lequal,
ast_gequal,
ast_equal,
ast_nequal,
ast_bit_and,
ast_bit_xor,
ast_bit_or,
ast_bit_not,
ast_logic_and,
ast_logic_xor,
ast_logic_or,
ast_logic_not,
ast_mul_assign,
ast_div_assign,
ast_mod_assign,
ast_add_assign,
ast_sub_assign,
ast_ls_assign,
ast_rs_assign,
ast_and_assign,
ast_xor_assign,
ast_or_assign,
ast_conditional,
ast_pre_inc,
ast_pre_dec,
ast_post_inc,
ast_post_dec,
ast_field_selection,
ast_array_index,
ast_function_call,
ast_identifier,
ast_int_constant,
ast_uint_constant,
ast_float_constant,
ast_bool_constant,
ast_sequence
};
class ast_expression : public ast_node {
public:
ast_expression(int oper, ast_expression *,
ast_expression *, ast_expression *);
ast_expression(const char *identifier) :
oper(ast_identifier)
{
subexpressions[0] = NULL;
subexpressions[1] = NULL;
subexpressions[2] = NULL;
primary_expression.identifier = (char *) identifier;
}
static const char *operator_string(enum ast_operators op);
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
virtual void print(void) const;
enum ast_operators oper;
ast_expression *subexpressions[3];
union {
char *identifier;
int int_constant;
float float_constant;
unsigned uint_constant;
int bool_constant;
} primary_expression;
/**
* List of expressions for an \c ast_sequence or parameters for an
* \c ast_function_call
*/
exec_list expressions;
};
class ast_expression_bin : public ast_expression {
public:
ast_expression_bin(int oper, ast_expression *, ast_expression *);
virtual void print(void) const;
};
/**
* Subclass of expressions for function calls
*/
class ast_function_expression : public ast_expression {
public:
ast_function_expression(ast_expression *callee)
: ast_expression(ast_function_call, callee,
NULL, NULL),
cons(false)
{
/* empty */
}
ast_function_expression(class ast_type_specifier *type)
: ast_expression(ast_function_call, (ast_expression *) type,
NULL, NULL),
cons(true)
{
/* empty */
}
bool is_constructor() const
{
return cons;
}
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
private:
/**
* Is this function call actually a constructor?
*/
bool cons;
};
/**
* Number of possible operators for an ast_expression
*
* This is done as a define instead of as an additional value in the enum so
* that the compiler won't generate spurious messages like "warning:
* enumeration value ast_num_operators not handled in switch"
*/
#define AST_NUM_OPERATORS (ast_sequence + 1)
class ast_compound_statement : public ast_node {
public:
ast_compound_statement(int new_scope, ast_node *statements);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
int new_scope;
exec_list statements;
};
class ast_declaration : public ast_node {
public:
ast_declaration(char *identifier, int is_array, ast_expression *array_size,
ast_expression *initializer);
virtual void print(void) const;
char *identifier;
int is_array;
ast_expression *array_size;
ast_expression *initializer;
};
enum {
ast_precision_high = 0, /**< Default precision. */
ast_precision_medium,
ast_precision_low
};
struct ast_type_qualifier {
unsigned invariant:1;
unsigned constant:1;
unsigned attribute:1;
unsigned varying:1;
unsigned in:1;
unsigned out:1;
unsigned centroid:1;
unsigned uniform:1;
unsigned smooth:1;
unsigned flat:1;
unsigned noperspective:1;
/** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */
/*@{*/
unsigned origin_upper_left:1;
unsigned pixel_center_integer:1;
/*@}*/
};
class ast_struct_specifier : public ast_node {
public:
ast_struct_specifier(char *identifier, ast_node *declarator_list);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
char *name;
exec_list declarations;
};
enum ast_types {
ast_void,
ast_float,
ast_int,
ast_uint,
ast_bool,
ast_vec2,
ast_vec3,
ast_vec4,
ast_bvec2,
ast_bvec3,
ast_bvec4,
ast_ivec2,
ast_ivec3,
ast_ivec4,
ast_uvec2,
ast_uvec3,
ast_uvec4,
ast_mat2,
ast_mat2x3,
ast_mat2x4,
ast_mat3x2,
ast_mat3,
ast_mat3x4,
ast_mat4x2,
ast_mat4x3,
ast_mat4,
ast_sampler1d,
ast_sampler2d,
ast_sampler2drect,
ast_sampler3d,
ast_samplercube,
ast_sampler1dshadow,
ast_sampler2dshadow,
ast_sampler2drectshadow,
ast_samplercubeshadow,
ast_sampler1darray,
ast_sampler2darray,
ast_sampler1darrayshadow,
ast_sampler2darrayshadow,
ast_isampler1d,
ast_isampler2d,
ast_isampler3d,
ast_isamplercube,
ast_isampler1darray,
ast_isampler2darray,
ast_usampler1d,
ast_usampler2d,
ast_usampler3d,
ast_usamplercube,
ast_usampler1darray,
ast_usampler2darray,
ast_struct,
ast_type_name
};
class ast_type_specifier : public ast_node {
public:
ast_type_specifier(int specifier);
/** Construct a type specifier from a type name */
ast_type_specifier(const char *name)
: type_specifier(ast_type_name), type_name(name), structure(NULL),
is_array(false), array_size(NULL), precision(ast_precision_high)
{
/* empty */
}
/** Construct a type specifier from a structure definition */
ast_type_specifier(ast_struct_specifier *s)
: type_specifier(ast_struct), type_name(s->name), structure(s),
is_array(false), array_size(NULL), precision(ast_precision_high)
{
/* empty */
}
const struct glsl_type *glsl_type(const char **name,
struct _mesa_glsl_parse_state *state)
const;
virtual void print(void) const;
ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
enum ast_types type_specifier;
const char *type_name;
ast_struct_specifier *structure;
int is_array;
ast_expression *array_size;
unsigned precision:2;
};
class ast_fully_specified_type : public ast_node {
public:
virtual void print(void) const;
bool has_qualifiers() const;
ast_type_qualifier qualifier;
ast_type_specifier *specifier;
};
class ast_declarator_list : public ast_node {
public:
ast_declarator_list(ast_fully_specified_type *);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_fully_specified_type *type;
exec_list declarations;
/**
* Special flag for vertex shader "invariant" declarations.
*
* Vertex shaders can contain "invariant" variable redeclarations that do
* not include a type. For example, "invariant gl_Position;". This flag
* is used to note these cases when no type is specified.
*/
int invariant;
};
class ast_parameter_declarator : public ast_node {
public:
ast_parameter_declarator()
{
this->identifier = NULL;
this->is_array = false;
this->array_size = 0;
}
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_fully_specified_type *type;
char *identifier;
int is_array;
ast_expression *array_size;
static void parameters_to_hir(exec_list *ast_parameters,
bool formal, exec_list *ir_parameters,
struct _mesa_glsl_parse_state *state);
private:
/** Is this parameter declaration part of a formal parameter list? */
bool formal_parameter;
/**
* Is this parameter 'void' type?
*
* This field is set by \c ::hir.
*/
bool is_void;
};
class ast_function : public ast_node {
public:
ast_function(void);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_fully_specified_type *return_type;
char *identifier;
exec_list parameters;
private:
/**
* Is this prototype part of the function definition?
*
* Used by ast_function_definition::hir to process the parameters, etc.
* of the function.
*
* \sa ::hir
*/
bool is_definition;
/**
* Function signature corresponding to this function prototype instance
*
* Used by ast_function_definition::hir to process the parameters, etc.
* of the function.
*
* \sa ::hir
*/
class ir_function_signature *signature;
friend class ast_function_definition;
};
class ast_declaration_statement : public ast_node {
public:
ast_declaration_statement(void);
enum {
ast_function,
ast_declaration,
ast_precision
} mode;
union {
class ast_function *function;
ast_declarator_list *declarator;
ast_type_specifier *type;
ast_node *node;
} declaration;
};
class ast_expression_statement : public ast_node {
public:
ast_expression_statement(ast_expression *);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_expression *expression;
};
class ast_case_label : public ast_node {
public:
/**
* An expression of NULL means 'default'.
*/
ast_expression *expression;
};
class ast_selection_statement : public ast_node {
public:
ast_selection_statement(ast_expression *condition,
ast_node *then_statement,
ast_node *else_statement);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_expression *condition;
ast_node *then_statement;
ast_node *else_statement;
};
class ast_switch_statement : public ast_node {
public:
ast_expression *expression;
exec_list statements;
};
class ast_iteration_statement : public ast_node {
public:
ast_iteration_statement(int mode, ast_node *init, ast_node *condition,
ast_expression *rest_expression, ast_node *body);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
enum ast_iteration_modes {
ast_for,
ast_while,
ast_do_while
} mode;
ast_node *init_statement;
ast_node *condition;
ast_expression *rest_expression;
ast_node *body;
private:
/**
* Generate IR from the condition of a loop
*
* This is factored out of ::hir because some loops have the condition
* test at the top (for and while), and others have it at the end (do-while).
*/
void condition_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *);
};
class ast_jump_statement : public ast_node {
public:
ast_jump_statement(int mode, ast_expression *return_value);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
enum ast_jump_modes {
ast_continue,
ast_break,
ast_return,
ast_discard
} mode;
ast_expression *opt_return_value;
};
class ast_function_definition : public ast_node {
public:
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
ast_function *prototype;
ast_compound_statement *body;
};
extern void
_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state);
extern ir_rvalue *
_mesa_ast_field_selection_to_hir(const ast_expression *expr,
exec_list *instructions,
struct _mesa_glsl_parse_state *state);
#endif /* AST_H */

96
src/glsl/ast_expr.cpp Normal file
View file

@ -0,0 +1,96 @@
/*
* Copyright © 2010 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include <cstdio>
#include <cassert>
#include "ast.h"
const char *
ast_expression::operator_string(enum ast_operators op)
{
static const char *const operators[] = {
"=",
"+",
"-",
"+",
"-",
"*",
"/",
"%",
"<<",
">>",
"<",
">",
"<=",
">=",
"==",
"!=",
"&",
"^",
"|",
"~",
"&&",
"^^",
"||",
"!",
"*=",
"/=",
"%=",
"+=",
"-=",
"<<=",
">>=",
"&=",
"^=",
"|=",
"?:",
"++",
"--",
"++",
"--",
".",
};
assert((unsigned int)op < sizeof(operators) / sizeof(operators[0]));
return operators[op];
}
ast_expression_bin::ast_expression_bin(int oper, ast_expression *ex0,
ast_expression *ex1) :
ast_expression(oper, ex0, ex1, NULL)
{
assert((oper >= ast_plus) && (oper <= ast_logic_not));
}
void
ast_expression_bin::print(void) const
{
subexpressions[0]->print();
printf("%s ", operator_string(oper));
subexpressions[1]->print();
}

1247
src/glsl/ast_function.cpp Normal file

File diff suppressed because it is too large Load diff

2607
src/glsl/ast_to_hir.cpp Normal file

File diff suppressed because it is too large Load diff

122
src/glsl/ast_type.cpp Normal file
View file

@ -0,0 +1,122 @@
/*
* Copyright © 2010 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include <cstdio>
#include "ast.h"
extern "C" {
#include "program/symbol_table.h"
}
void
ast_type_specifier::print(void) const
{
if (type_specifier == ast_struct) {
structure->print();
} else {
printf("%s ", type_name);
}
if (is_array) {
printf("[ ");
if (array_size) {
array_size->print();
}
printf("] ");
}
}
ast_type_specifier::ast_type_specifier(int specifier)
: type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL),
is_array(false), array_size(NULL), precision(ast_precision_high)
{
static const char *const names[] = {
"void",
"float",
"int",
"uint",
"bool",
"vec2",
"vec3",
"vec4",
"bvec2",
"bvec3",
"bvec4",
"ivec2",
"ivec3",
"ivec4",
"uvec2",
"uvec3",
"uvec4",
"mat2",
"mat2x3",
"mat2x4",
"mat3x2",
"mat3",
"mat3x4",
"mat4x2",
"mat4x3",
"mat4",
"sampler1D",
"sampler2D",
"sampler2DRect",
"sampler3D",
"samplerCube",
"sampler1DShadow",
"sampler2DShadow",
"sampler2DRectShadow",
"samplerCubeShadow",
"sampler1DArray",
"sampler2DArray",
"sampler1DArrayShadow",
"sampler2DArrayShadow",
"isampler1D",
"isampler2D",
"isampler3D",
"isamplerCube",
"isampler1DArray",
"isampler2DArray",
"usampler1D",
"usampler2D",
"usampler3D",
"usamplerCube",
"usampler1DArray",
"usampler2DArray",
NULL, /* ast_struct */
NULL /* ast_type_name */
};
type_name = names[specifier];
}
bool
ast_fully_specified_type::has_qualifiers() const
{
return qualifier.invariant || qualifier.constant || qualifier.attribute
|| qualifier.varying || qualifier.in
|| qualifier.out || qualifier.centroid
|| qualifier.uniform || qualifier.smooth
|| qualifier.flat || qualifier.noperspective;
}

12
src/glsl/autogen.sh Executable file
View file

@ -0,0 +1,12 @@
#! /bin/sh
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd $srcdir
autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?
$srcdir/configure --enable-maintainer-mode "$@"

24404
src/glsl/builtin_function.cpp Normal file

File diff suppressed because it is too large Load diff

290
src/glsl/builtin_types.h Normal file
View file

@ -0,0 +1,290 @@
/*
* Copyright © 2009 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
const glsl_type glsl_type::_error_type =
glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, "");
const glsl_type glsl_type::void_type =
glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void");
const glsl_type *const glsl_type::error_type = & glsl_type::_error_type;
/** \name Core built-in types
*
* These types exist in all versions of GLSL.
*/
/*@{*/
const glsl_type glsl_type::builtin_core_types[] = {
glsl_type(GL_BOOL, GLSL_TYPE_BOOL, 1, 1, "bool"),
glsl_type(GL_BOOL_VEC2, GLSL_TYPE_BOOL, 2, 1, "bvec2"),
glsl_type(GL_BOOL_VEC3, GLSL_TYPE_BOOL, 3, 1, "bvec3"),
glsl_type(GL_BOOL_VEC4, GLSL_TYPE_BOOL, 4, 1, "bvec4"),
glsl_type(GL_INT, GLSL_TYPE_INT, 1, 1, "int"),
glsl_type(GL_INT_VEC2, GLSL_TYPE_INT, 2, 1, "ivec2"),
glsl_type(GL_INT_VEC3, GLSL_TYPE_INT, 3, 1, "ivec3"),
glsl_type(GL_INT_VEC4, GLSL_TYPE_INT, 4, 1, "ivec4"),
glsl_type(GL_FLOAT, GLSL_TYPE_FLOAT, 1, 1, "float"),
glsl_type(GL_FLOAT_VEC2, GLSL_TYPE_FLOAT, 2, 1, "vec2"),
glsl_type(GL_FLOAT_VEC3, GLSL_TYPE_FLOAT, 3, 1, "vec3"),
glsl_type(GL_FLOAT_VEC4, GLSL_TYPE_FLOAT, 4, 1, "vec4"),
glsl_type(GL_FLOAT_MAT2, GLSL_TYPE_FLOAT, 2, 2, "mat2"),
glsl_type(GL_FLOAT_MAT3, GLSL_TYPE_FLOAT, 3, 3, "mat3"),
glsl_type(GL_FLOAT_MAT4, GLSL_TYPE_FLOAT, 4, 4, "mat4"),
glsl_type(GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT,
"sampler1D"),
glsl_type(GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT,
"sampler1DShadow"),
glsl_type(GL_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT,
"sampler2D"),
glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT,
"sampler2DShadow"),
glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT,
"sampler3D"),
glsl_type(GL_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT,
"samplerCube"),
};
const glsl_type *const glsl_type::bool_type = & builtin_core_types[0];
const glsl_type *const glsl_type::int_type = & builtin_core_types[4];
const glsl_type *const glsl_type::ivec4_type = & builtin_core_types[7];
const glsl_type *const glsl_type::float_type = & builtin_core_types[8];
const glsl_type *const glsl_type::vec2_type = & builtin_core_types[9];
const glsl_type *const glsl_type::vec3_type = & builtin_core_types[10];
const glsl_type *const glsl_type::vec4_type = & builtin_core_types[11];
const glsl_type *const glsl_type::mat2_type = & builtin_core_types[12];
const glsl_type *const glsl_type::mat3_type = & builtin_core_types[13];
const glsl_type *const glsl_type::mat4_type = & builtin_core_types[14];
/*@}*/
/** \name GLSL structures that have not been deprecated.
*/
/*@{*/
static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
{ glsl_type::float_type, "near" },
{ glsl_type::float_type, "far" },
{ glsl_type::float_type, "diff" },
};
const glsl_type glsl_type::builtin_structure_types[] = {
glsl_type(gl_DepthRangeParameters_fields,
Elements(gl_DepthRangeParameters_fields),
"gl_DepthRangeParameters"),
};
/*@}*/
/** \name GLSL 1.00 / 1.10 structures that are deprecated in GLSL 1.30
*/
/*@{*/
static const struct glsl_struct_field gl_PointParameters_fields[] = {
{ glsl_type::float_type, "size" },
{ glsl_type::float_type, "sizeMin" },
{ glsl_type::float_type, "sizeMax" },
{ glsl_type::float_type, "fadeThresholdSize" },
{ glsl_type::float_type, "distanceConstantAttenuation" },
{ glsl_type::float_type, "distanceLinearAttenuation" },
{ glsl_type::float_type, "distanceQuadraticAttenuation" },
};
static const struct glsl_struct_field gl_MaterialParameters_fields[] = {
{ glsl_type::vec4_type, "emission" },
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
{ glsl_type::float_type, "shininess" },
};
static const struct glsl_struct_field gl_LightSourceParameters_fields[] = {
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
{ glsl_type::vec4_type, "position" },
{ glsl_type::vec4_type, "halfVector" },
{ glsl_type::vec3_type, "spotDirection" },
{ glsl_type::float_type, "spotExponent" },
{ glsl_type::float_type, "spotCutoff" },
{ glsl_type::float_type, "spotCosCutoff" },
{ glsl_type::float_type, "constantAttenuation" },
{ glsl_type::float_type, "linearAttenuation" },
{ glsl_type::float_type, "quadraticAttenuation" },
};
static const struct glsl_struct_field gl_LightModelParameters_fields[] = {
{ glsl_type::vec4_type, "ambient" },
};
static const struct glsl_struct_field gl_LightModelProducts_fields[] = {
{ glsl_type::vec4_type, "sceneColor" },
};
static const struct glsl_struct_field gl_LightProducts_fields[] = {
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
};
static const struct glsl_struct_field gl_FogParameters_fields[] = {
{ glsl_type::vec4_type, "color" },
{ glsl_type::float_type, "density" },
{ glsl_type::float_type, "start" },
{ glsl_type::float_type, "end" },
{ glsl_type::float_type, "scale" },
};
const glsl_type glsl_type::builtin_110_deprecated_structure_types[] = {
glsl_type(gl_PointParameters_fields,
Elements(gl_PointParameters_fields),
"gl_PointParameters"),
glsl_type(gl_MaterialParameters_fields,
Elements(gl_MaterialParameters_fields),
"gl_MaterialParameters"),
glsl_type(gl_LightSourceParameters_fields,
Elements(gl_LightSourceParameters_fields),
"gl_LightSourceParameters"),
glsl_type(gl_LightModelParameters_fields,
Elements(gl_LightModelParameters_fields),
"gl_LightModelParameters"),
glsl_type(gl_LightModelProducts_fields,
Elements(gl_LightModelProducts_fields),
"gl_LightModelProducts"),
glsl_type(gl_LightProducts_fields,
Elements(gl_LightProducts_fields),
"gl_LightProducts"),
glsl_type(gl_FogParameters_fields,
Elements(gl_FogParameters_fields),
"gl_FogParameters"),
};
/*@}*/
/** \name Types added in GLSL 1.20
*/
/*@{*/
const glsl_type glsl_type::builtin_120_types[] = {
glsl_type(GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2, "mat2x3"),
glsl_type(GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2, "mat2x4"),
glsl_type(GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3, "mat3x2"),
glsl_type(GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3, "mat3x4"),
glsl_type(GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4, "mat4x2"),
glsl_type(GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4, "mat4x3"),
};
const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0];
const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1];
const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2];
const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3];
const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4];
const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5];
/*@}*/
/** \name Types added in GLSL 1.30
*/
/*@{*/
const glsl_type glsl_type::builtin_130_types[] = {
glsl_type(GL_UNSIGNED_INT, GLSL_TYPE_UINT, 1, 1, "uint"),
glsl_type(GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1, "uvec2"),
glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"),
glsl_type(GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1, "uvec4"),
/* 1D and 2D texture arrays - several of these are included only in
* builtin_EXT_texture_array_types.
*/
glsl_type(GL_INT_SAMPLER_1D_ARRAY,
GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,
GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"),
glsl_type(GL_INT_SAMPLER_2D_ARRAY,
GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"),
/* cube shadow samplers */
glsl_type(GL_SAMPLER_CUBE_SHADOW,
GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"),
/* signed and unsigned integer samplers */
glsl_type(GL_INT_SAMPLER_1D,
GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_1D,
GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"),
glsl_type(GL_INT_SAMPLER_2D,
GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_2D,
GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"),
glsl_type(GL_INT_SAMPLER_3D,
GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_3D,
GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"),
glsl_type(GL_INT_SAMPLER_CUBE,
GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"),
glsl_type(GL_INT_SAMPLER_CUBE,
GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"),
};
const glsl_type *const glsl_type::uint_type = & builtin_130_types[0];
const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
/*@}*/
/** \name Sampler types added by GL_ARB_texture_rectangle
*/
/*@{*/
const glsl_type glsl_type::builtin_ARB_texture_rectangle_types[] = {
glsl_type(GL_SAMPLER_2D_RECT,
GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"),
glsl_type(GL_SAMPLER_2D_RECT_SHADOW,
GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"),
};
/*@}*/
/** \name Sampler types added by GL_EXT_texture_array
*/
/*@{*/
const glsl_type glsl_type::builtin_EXT_texture_array_types[] = {
glsl_type(GL_SAMPLER_1D_ARRAY,
GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"),
glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW,
GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"),
glsl_type(GL_SAMPLER_2D_ARRAY,
GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"),
glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW,
GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"),
};
/*@}*/
/** \name Sampler types added by GL_EXT_texture_buffer_object
*/
/*@{*/
const glsl_type glsl_type::builtin_EXT_texture_buffer_object_types[] = {
glsl_type(GL_SAMPLER_BUFFER,
GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"),
glsl_type(GL_INT_SAMPLER_BUFFER,
GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"),
glsl_type(GL_UNSIGNED_INT_SAMPLER_BUFFER,
GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"),
};
/*@}*/

View file

@ -0,0 +1,98 @@
/*
* Copyright © 2010 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include "main/mtypes.h"
struct builtin_variable {
enum ir_variable_mode mode;
int slot;
const char *type;
const char *name;
};
static const builtin_variable builtin_core_vs_variables[] = {
{ ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" },
{ ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" },
};
static const builtin_variable builtin_core_fs_variables[] = {
{ ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" },
{ ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" },
{ ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" },
{ ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" },
};
static const builtin_variable builtin_110_deprecated_fs_variables[] = {
{ ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" },
{ ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" },
{ ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" },
};
static const builtin_variable builtin_110_deprecated_vs_variables[] = {
{ ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" },
{ ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" },
{ ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" },
{ ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" },
{ ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" },
{ ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" },
{ ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" },
{ ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" },
{ ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" },
{ ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" },
{ ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" },
{ ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" },
{ ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" },
{ ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_ClipVertex" },
{ ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" },
{ ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" },
{ ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" },
{ ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" },
{ ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" },
};
static const builtin_variable builtin_120_fs_variables[] = {
{ ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" },
};
static const builtin_variable builtin_130_vs_variables[] = {
{ ir_var_in, -1, "int", "gl_VertexID" },
};
static const builtin_variable builtin_110_deprecated_uniforms[] = {
{ ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" },
{ ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" },
{ ir_var_uniform, -1, "mat3", "gl_NormalMatrix" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" },
{ ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" },
{ ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" },
{ ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" },
{ ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" },
{ ir_var_uniform, -1, "float", "gl_NormalScale" },
{ ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"},
};

21
src/glsl/builtins/ir/abs Normal file
View file

@ -0,0 +1,21 @@
((function abs
(signature float
(parameters
(declare (in) float arg0))
((return (expression float abs (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 abs (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 abs (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 abs (var_ref arg0)))))
))

22
src/glsl/builtins/ir/acos Normal file
View file

@ -0,0 +1,22 @@
((function acos
(signature float
(parameters
(declare (in) float x))
((return (expression float - (constant float (1.5707963))
(call asin ((var_ref x)))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 - (constant float (1.5707963))
(call asin ((var_ref x)))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 - (constant float (1.5707963))
(call asin ((var_ref x)))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 - (constant float (1.5707963))
(call asin ((var_ref x)))))))
))

16
src/glsl/builtins/ir/all Normal file
View file

@ -0,0 +1,16 @@
((function all
(signature bool
(parameters
(declare (in) bvec2 arg0))
((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))
(signature bool
(parameters
(declare (in) bvec3 arg0))
((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))
(signature bool
(parameters
(declare (in) bvec4 arg0))
((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))
))

16
src/glsl/builtins/ir/any Normal file
View file

@ -0,0 +1,16 @@
((function any
(signature bool
(parameters
(declare (in) bvec2 arg0))
((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))
(signature bool
(parameters
(declare (in) bvec3 arg0))
((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))
(signature bool
(parameters
(declare (in) bvec4 arg0))
((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))
))

97
src/glsl/builtins/ir/asin Normal file
View file

@ -0,0 +1,97 @@
((function asin
(signature float
(parameters
(declare (in) float x))
((return (expression float *
(expression float sign (var_ref x))
(expression float -
(expression float *
(constant float (3.1415926))
(constant float (0.5)))
(expression float *
(expression float sqrt
(expression float -
(constant float (1.0))
(expression float abs (var_ref x))))
(expression float +
(constant float (1.5707288))
(expression float *
(expression float abs (var_ref x))
(expression float +
(constant float (-0.2121144))
(expression float *
(constant float (0.0742610))
(expression float abs (var_ref x))))))))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 *
(expression vec2 sign (var_ref x))
(expression vec2 -
(expression float *
(constant float (3.1415926))
(constant float (0.5)))
(expression vec2 *
(expression vec2 sqrt
(expression vec2 -
(constant float (1.0))
(expression vec2 abs (var_ref x))))
(expression vec2 +
(constant float (1.5707288))
(expression vec2 *
(expression vec2 abs (var_ref x))
(expression vec2 +
(constant float (-0.2121144))
(expression vec2 *
(constant float (0.0742610))
(expression vec2 abs (var_ref x))))))))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 *
(expression vec3 sign (var_ref x))
(expression vec3 -
(expression float *
(constant float (3.1415926))
(constant float (0.5)))
(expression vec3 *
(expression vec3 sqrt
(expression vec3 -
(constant float (1.0))
(expression vec3 abs (var_ref x))))
(expression vec3 +
(constant float (1.5707288))
(expression vec3 *
(expression vec3 abs (var_ref x))
(expression vec3 +
(constant float (-0.2121144))
(expression vec3 *
(constant float (0.0742610))
(expression vec3 abs (var_ref x))))))))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 *
(expression vec4 sign (var_ref x))
(expression vec4 -
(expression float *
(constant float (3.1415926))
(constant float (0.5)))
(expression vec4 *
(expression vec4 sqrt
(expression vec4 -
(constant float (1.0))
(expression vec4 abs (var_ref x))))
(expression vec4 +
(constant float (1.5707288))
(expression vec4 *
(expression vec4 abs (var_ref x))
(expression vec4 +
(constant float (-0.2121144))
(expression vec4 *
(constant float (0.0742610))
(expression vec4 abs (var_ref x))))))))))))
))

154
src/glsl/builtins/ir/atan Normal file
View file

@ -0,0 +1,154 @@
((function atan
(signature float
(parameters
(declare (in) float x))
((return (call asin ((expression float *
(var_ref x)
(expression float rsq
(expression float +
(expression float *
(var_ref x)
(var_ref x))
(constant float (1.0))))))))))
(signature vec2
(parameters
(declare (in) vec2 y_over_x))
((return (call asin ((expression vec2 *
(var_ref y_over_x)
(expression vec2 rsq
(expression vec2 +
(expression vec2 *
(var_ref y_over_x)
(var_ref y_over_x))
(constant float (1.0))))))))))
(signature vec3
(parameters
(declare (in) vec3 y_over_x))
((return (call asin ((expression vec3 *
(var_ref y_over_x)
(expression vec3 rsq
(expression vec3 +
(expression vec3 *
(var_ref y_over_x)
(var_ref y_over_x))
(constant float (1.0))))))))))
(signature vec4
(parameters
(declare (in) vec4 y_over_x))
((return (call asin ((expression vec4 *
(var_ref y_over_x)
(expression vec4 rsq
(expression vec4 +
(expression vec4 *
(var_ref y_over_x)
(var_ref y_over_x))
(constant float (1.0))))))))))
(signature float
(parameters
(declare (in ) float y)
(declare (in ) float x)
)
(
(declare () float r)
(declare ( ) float abs_retval)
(assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))
)
(if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (
(declare ( ) float atan_retval)
(assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))
)
(assign (constant bool (1)) (var_ref r) (var_ref atan_retval) )
(if (expression bool < (var_ref x) (constant float (0.000000)) ) (
(if (expression bool >= (var_ref y) (constant float (0.000000)) ) (
(declare ( ) float assignment_tmp)
(assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )
(assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
)
(
(declare ( ) float assignment_tmp)
(assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )
(assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
))
)
(
))
)
(
(if (expression bool >= (var_ref y) (constant float (0.000000)) ) (
(assign (constant bool (1)) (var_ref r) (constant float (1.570796)) )
)
(
(assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) )
))
))
(return (var_ref r) )
))
(signature vec2
(parameters
(declare (in) vec2 y)
(declare (in) vec2 x))
((declare () vec2 r)
(assign (constant bool (1))
(swiz x (var_ref r))
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
(assign (constant bool (1))
(swiz y (var_ref r))
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
(return (var_ref r))))
(signature vec3
(parameters
(declare (in) vec3 y)
(declare (in) vec3 x))
((declare () vec3 r)
(assign (constant bool (1))
(swiz x (var_ref r))
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
(assign (constant bool (1))
(swiz y (var_ref r))
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
(assign (constant bool (1))
(swiz z (var_ref r))
(call atan ((swiz z (var_ref y))
(swiz z (var_ref x)))))
(return (var_ref r))))
(signature vec4
(parameters
(declare (in) vec4 y)
(declare (in) vec4 x))
((declare () vec4 r)
(assign (constant bool (1))
(swiz x (var_ref r))
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
(assign (constant bool (1))
(swiz y (var_ref r))
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
(assign (constant bool (1))
(swiz z (var_ref r))
(call atan ((swiz z (var_ref y))
(swiz z (var_ref x)))))
(assign (constant bool (1))
(swiz w (var_ref r))
(call atan ((swiz w (var_ref y))
(swiz w (var_ref x)))))
(return (var_ref r)))))
))

21
src/glsl/builtins/ir/ceil Normal file
View file

@ -0,0 +1,21 @@
((function ceil
(signature float
(parameters
(declare (in) float arg0))
((return (expression float ceil (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 ceil (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 ceil (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 ceil (var_ref arg0)))))
))

148
src/glsl/builtins/ir/clamp Normal file
View file

@ -0,0 +1,148 @@
((function clamp
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1)
(declare (in) float arg2))
((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1)
(declare (in) vec2 arg2))
((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1)
(declare (in) vec3 arg2))
((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1)
(declare (in) vec4 arg2))
((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) float arg1)
(declare (in) float arg2))
((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) float arg1)
(declare (in) float arg2))
((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) float arg1)
(declare (in) float arg2))
((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature int
(parameters
(declare (in) int arg0)
(declare (in) int arg1)
(declare (in) int arg2))
((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1)
(declare (in) ivec2 arg2))
((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1)
(declare (in) ivec3 arg2))
((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1)
(declare (in) ivec4 arg2))
((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) int arg1)
(declare (in) int arg2))
((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) int arg1)
(declare (in) int arg2))
((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) int arg1)
(declare (in) int arg2))
((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uint
(parameters
(declare (in) uint arg0)
(declare (in) uint arg1)
(declare (in) uint arg2))
((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1)
(declare (in) uvec2 arg2))
((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1)
(declare (in) uvec3 arg2))
((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1)
(declare (in) uvec4 arg2))
((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uint arg1)
(declare (in) uint arg2))
((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uint arg1)
(declare (in) uint arg2))
((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uint arg1)
(declare (in) uint arg2))
((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))
))

21
src/glsl/builtins/ir/cos Normal file
View file

@ -0,0 +1,21 @@
((function cos
(signature float
(parameters
(declare (in) float angle))
((return (expression float cos (var_ref angle)))))
(signature vec2
(parameters
(declare (in) vec2 angle))
((return (expression vec2 cos (var_ref angle)))))
(signature vec3
(parameters
(declare (in) vec3 angle))
((return (expression vec3 cos (var_ref angle)))))
(signature vec4
(parameters
(declare (in) vec4 angle))
((return (expression vec4 cos (var_ref angle)))))
))

30
src/glsl/builtins/ir/cosh Normal file
View file

@ -0,0 +1,30 @@
((function cosh
(signature float
(parameters
(declare (in) float x))
((return (expression float * (constant float (0.5))
(expression float +
(expression float exp (var_ref x))
(expression float exp (expression float neg (var_ref x))))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 * (constant vec2 (0.5))
(expression vec2 +
(expression vec2 exp (var_ref x))
(expression vec2 exp (expression vec2 neg (var_ref x))))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 * (constant vec3 (0.5))
(expression vec3 +
(expression vec3 exp (var_ref x))
(expression vec3 exp (expression vec3 neg (var_ref x))))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 * (constant vec4 (0.5))
(expression vec4 +
(expression vec4 exp (var_ref x))
(expression vec4 exp (expression vec4 neg (var_ref x))))))))
))

View file

@ -0,0 +1,7 @@
((function cross
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))
))

21
src/glsl/builtins/ir/dFdx Normal file
View file

@ -0,0 +1,21 @@
((function dFdx
(signature float
(parameters
(declare (in) float p))
((return (expression float dFdx (var_ref p)))))
(signature vec2
(parameters
(declare (in) vec2 p))
((return (expression vec2 dFdx (var_ref p)))))
(signature vec3
(parameters
(declare (in) vec3 p))
((return (expression vec3 dFdx (var_ref p)))))
(signature vec4
(parameters
(declare (in) vec4 p))
((return (expression vec4 dFdx (var_ref p)))))
))

21
src/glsl/builtins/ir/dFdy Normal file
View file

@ -0,0 +1,21 @@
((function dFdy
(signature float
(parameters
(declare (in) float p))
((return (expression float dFdy (var_ref p)))))
(signature vec2
(parameters
(declare (in) vec2 p))
((return (expression vec2 dFdy (var_ref p)))))
(signature vec3
(parameters
(declare (in) vec3 p))
((return (expression vec3 dFdy (var_ref p)))))
(signature vec4
(parameters
(declare (in) vec4 p))
((return (expression vec4 dFdy (var_ref p)))))
))

View file

@ -0,0 +1,21 @@
((function degrees
(signature float
(parameters
(declare (in) float arg0))
((return (expression float * (var_ref arg0) (constant float (57.295780))))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))
))

View file

@ -0,0 +1,33 @@
((function distance
(signature float
(parameters
(declare (in) float p0)
(declare (in) float p1))
((declare () float p)
(assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
(signature float
(parameters
(declare (in) vec2 p0)
(declare (in) vec2 p1))
((declare () vec2 p)
(assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
(signature float
(parameters
(declare (in) vec3 p0)
(declare (in) vec3 p1))
((declare () vec3 p)
(assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
(signature float
(parameters
(declare (in) vec4 p0)
(declare (in) vec4 p1))
((declare () vec4 p)
(assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
))

25
src/glsl/builtins/ir/dot Normal file
View file

@ -0,0 +1,25 @@
((function dot
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
((return (expression float dot (var_ref arg0) (var_ref arg1)))))
(signature float
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression float dot (var_ref arg0) (var_ref arg1)))))
(signature float
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression float dot (var_ref arg0) (var_ref arg1)))))
(signature float
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression float dot (var_ref arg0) (var_ref arg1)))))
))

View file

@ -0,0 +1,91 @@
((function equal
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

21
src/glsl/builtins/ir/exp Normal file
View file

@ -0,0 +1,21 @@
((function exp
(signature float
(parameters
(declare (in) float arg0))
((return (expression float exp (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 exp (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 exp (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 exp (var_ref arg0)))))
))

21
src/glsl/builtins/ir/exp2 Normal file
View file

@ -0,0 +1,21 @@
((function exp2
(signature float
(parameters
(declare (in) float arg0))
((return (expression float exp2 (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 exp2 (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 exp2 (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 exp2 (var_ref arg0)))))
))

View file

@ -0,0 +1,37 @@
((function faceforward
(signature float
(parameters
(declare (in) float N)
(declare (in) float I)
(declare (in) float Nref))
((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))
((return (var_ref N)))
((return (expression float neg (var_ref N)))))))
(signature vec2
(parameters
(declare (in) vec2 N)
(declare (in) vec2 I)
(declare (in) vec2 Nref))
((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))
((return (var_ref N)))
((return (expression vec2 neg (var_ref N)))))))
(signature vec3
(parameters
(declare (in) vec3 N)
(declare (in) vec3 I)
(declare (in) vec3 Nref))
((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))
((return (var_ref N)))
((return (expression vec3 neg (var_ref N)))))))
(signature vec4
(parameters
(declare (in) vec4 N)
(declare (in) vec4 I)
(declare (in) vec4 Nref))
((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))
((return (var_ref N)))
((return (expression vec4 neg (var_ref N)))))))
))

View file

@ -0,0 +1,21 @@
((function floor
(signature float
(parameters
(declare (in) float arg0))
((return (expression float floor (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 floor (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 floor (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 floor (var_ref arg0)))))
))

View file

@ -0,0 +1,22 @@
((function fract
(signature float
(parameters
(declare (in) float x))
((return (expression float fract (var_ref x)))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 fract (var_ref x)))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 fract (var_ref x)))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 fract (var_ref x)))))
))

View file

@ -0,0 +1,9 @@
((declare (uniform) mat4 gl_ModelViewProjectionMatrix)
(declare (in) vec4 gl_Vertex)
(function ftransform
(signature vec4
(parameters)
((return (expression vec4 *
(var_ref gl_ModelViewProjectionMatrix)
(var_ref gl_Vertex)))))
))

View file

@ -0,0 +1,29 @@
((function fwidth
(signature float
(parameters
(declare (in) float p))
((return (expression float +
(expression float abs (expression float dFdx (var_ref p)))
(expression float abs (expression float dFdy (var_ref p)))))))
(signature vec2
(parameters
(declare (in) vec2 p))
((return (expression vec2 +
(expression vec2 abs (expression vec2 dFdx (var_ref p)))
(expression vec2 abs (expression vec2 dFdy (var_ref p)))))))
(signature vec3
(parameters
(declare (in) vec3 p))
((return (expression vec3 +
(expression vec3 abs (expression vec3 dFdx (var_ref p)))
(expression vec3 abs (expression vec3 dFdy (var_ref p)))))))
(signature vec4
(parameters
(declare (in) vec4 p))
((return (expression vec4 +
(expression vec4 abs (expression vec4 dFdx (var_ref p)))
(expression vec4 abs (expression vec4 dFdy (var_ref p)))))))
))

View file

@ -0,0 +1,91 @@
((function greaterThan
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

View file

@ -0,0 +1,91 @@
((function greaterThanEqual
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

View file

@ -0,0 +1,21 @@
((function inversesqrt
(signature float
(parameters
(declare (in) float arg0))
((return (expression float rsq (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 rsq (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 rsq (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 rsq (var_ref arg0)))))
))

View file

@ -0,0 +1,21 @@
((function length
(signature float
(parameters
(declare (in) float arg0))
((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))
(signature float
(parameters
(declare (in) vec2 arg0))
((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))
(signature float
(parameters
(declare (in) vec3 arg0))
((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))
(signature float
(parameters
(declare (in) vec4 arg0))
((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))
))

View file

@ -0,0 +1,91 @@
((function lessThan
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

View file

@ -0,0 +1,91 @@
((function lessThanEqual
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

21
src/glsl/builtins/ir/log Normal file
View file

@ -0,0 +1,21 @@
((function log
(signature float
(parameters
(declare (in) float arg0))
((return (expression float log (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 log (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 log (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 log (var_ref arg0)))))
))

21
src/glsl/builtins/ir/log2 Normal file
View file

@ -0,0 +1,21 @@
((function log2
(signature float
(parameters
(declare (in) float arg0))
((return (expression float log2 (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 log2 (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 log2 (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 log2 (var_ref arg0)))))
))

View file

@ -0,0 +1,91 @@
((function matrixCompMult
(signature mat2
(parameters
(declare (in) mat2 x)
(declare (in) mat2 y))
((declare () mat2 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat3
(parameters
(declare (in) mat3 x)
(declare (in) mat3 y))
((declare () mat3 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat4
(parameters
(declare (in) mat4 x)
(declare (in) mat4 y))
((declare () mat4 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
(signature mat2x3
(parameters
(declare (in) mat2x3 x)
(declare (in) mat2x3 y))
((declare () mat2x3 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat3x2
(parameters
(declare (in) mat3x2 x)
(declare (in) mat3x2 y))
((declare () mat3x2 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat2x4
(parameters
(declare (in) mat2x4 x)
(declare (in) mat2x4 y))
((declare () mat2x4 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat4x2
(parameters
(declare (in) mat4x2 x)
(declare (in) mat4x2 y))
((declare () mat4x2 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
(signature mat3x4
(parameters
(declare (in) mat3x4 x)
(declare (in) mat3x4 y))
((declare () mat3x4 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat4x3
(parameters
(declare (in) mat4x3 x)
(declare (in) mat4x3 y))
((declare () mat4x3 z)
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
))

127
src/glsl/builtins/ir/max Normal file
View file

@ -0,0 +1,127 @@
((function max
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
((return (expression float max (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) float arg1))
((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) float arg1))
((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) float arg1))
((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))
(signature int
(parameters
(declare (in) int arg0)
(declare (in) int arg1))
((return (expression int max (var_ref arg0) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) int arg1))
((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) int arg1))
((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) int arg1))
((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))
(signature uint
(parameters
(declare (in) uint arg0)
(declare (in) uint arg1))
((return (expression uint max (var_ref arg0) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uint arg1))
((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uint arg1))
((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uint arg1))
((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))
))

127
src/glsl/builtins/ir/min Normal file
View file

@ -0,0 +1,127 @@
((function min
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
((return (expression float min (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) float arg1))
((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) float arg1))
((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) float arg1))
((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))
(signature int
(parameters
(declare (in) int arg0)
(declare (in) int arg1))
((return (expression int min (var_ref arg0) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))
(signature ivec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) int arg1))
((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))
(signature ivec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) int arg1))
((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))
(signature ivec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) int arg1))
((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))
(signature uint
(parameters
(declare (in) uint arg0)
(declare (in) uint arg1))
((return (expression uint min (var_ref arg0) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))
(signature uvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uint arg1))
((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))
(signature uvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uint arg1))
((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))
(signature uvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uint arg1))
((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))
))

88
src/glsl/builtins/ir/mix Normal file
View file

@ -0,0 +1,88 @@
((function mix
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1)
(declare (in) float arg2))
((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1)
(declare (in) vec2 arg2))
((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1)
(declare (in) vec3 arg2))
((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1)
(declare (in) vec4 arg2))
((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1)
(declare (in) float arg2))
((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1)
(declare (in) float arg2))
((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1)
(declare (in) float arg2))
((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))
(signature float
(parameters
(declare (in) float v1)
(declare (in) float v2)
(declare (in) bool a))
((assign (var_ref a) (var_ref v1) (var_ref v2))
(return (var_ref v1))))
(signature vec2
(parameters
(declare (in) vec2 v1)
(declare (in) vec2 v2)
(declare (in) bvec2 a))
((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
(assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
(return (var_ref v1))))
(signature vec3
(parameters
(declare (in) vec3 v1)
(declare (in) vec3 v2)
(declare (in) bvec3 a))
((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
(assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
(assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))
(return (var_ref v1))))
(signature vec4
(parameters
(declare (in) vec4 v1)
(declare (in) vec4 v2)
(declare (in) bvec4 a))
((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
(assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
(assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))
(assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))
(return (var_ref v1))))
))

43
src/glsl/builtins/ir/mod Normal file
View file

@ -0,0 +1,43 @@
((function mod
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
((return (expression float % (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) float arg1))
((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) float arg1))
((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) float arg1))
((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))
))

View file

@ -0,0 +1,18 @@
((function noise1
(signature float
(parameters
(declare (in) float x))
((return (constant float (0)))))
(signature float
(parameters
(declare (in) vec2 x))
((return (constant float (0)))))
(signature float
(parameters
(declare (in) vec3 x))
((return (constant float (0)))))
(signature float
(parameters
(declare (in) vec4 x))
((return (constant float (0)))))
))

View file

@ -0,0 +1,18 @@
((function noise2
(signature vec2
(parameters
(declare (in) float x))
((return (constant vec2 (0 0)))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (constant vec2 (0 0)))))
(signature vec2
(parameters
(declare (in) vec3 x))
((return (constant vec2 (0 0)))))
(signature vec2
(parameters
(declare (in) vec4 x))
((return (constant vec2 (0 0)))))
))

View file

@ -0,0 +1,18 @@
((function noise3
(signature vec3
(parameters
(declare (in) float x))
((return (constant vec3 (0 0 0)))))
(signature vec3
(parameters
(declare (in) vec2 x))
((return (constant vec3 (0 0 0)))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (constant vec3 (0 0 0)))))
(signature vec3
(parameters
(declare (in) vec4 x))
((return (constant vec3 (0 0 0)))))
))

View file

@ -0,0 +1,18 @@
((function noise4
(signature vec4
(parameters
(declare (in) float x))
((return (constant vec4 (0 0 0 0)))))
(signature vec4
(parameters
(declare (in) vec2 x))
((return (constant vec4 (0 0 0 0)))))
(signature vec4
(parameters
(declare (in) vec3 x))
((return (constant vec4 (0 0 0 0)))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (constant vec4 (0 0 0 0)))))
))

View file

@ -0,0 +1,21 @@
((function normalize
(signature float
(parameters
(declare (in) float arg0))
((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))
))

16
src/glsl/builtins/ir/not Normal file
View file

@ -0,0 +1,16 @@
((function not
(signature bvec2
(parameters
(declare (in) bvec2 arg0))
((return (expression bvec2 ! (var_ref arg0)))))
(signature bvec3
(parameters
(declare (in) bvec3 arg0))
((return (expression bvec3 ! (var_ref arg0)))))
(signature bvec4
(parameters
(declare (in) bvec4 arg0))
((return (expression bvec4 ! (var_ref arg0)))))
))

View file

@ -0,0 +1,91 @@
((function notEqual
(signature bvec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))

View file

@ -0,0 +1,92 @@
((function outerProduct
(signature mat2
(parameters
(declare (in) vec2 u)
(declare (in) vec2 v))
((declare () mat2 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat2x3
(parameters
(declare (in) vec3 u)
(declare (in) vec2 v))
((declare () mat2x3 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat2x4
(parameters
(declare (in) vec4 u)
(declare (in) vec2 v))
((declare () mat2x4 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat3x2
(parameters
(declare (in) vec2 u)
(declare (in) vec3 v))
((declare () mat3x2 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))
))
(signature mat3
(parameters
(declare (in) vec3 u)
(declare (in) vec3 v))
((declare () mat3 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))))
(signature mat3x4
(parameters
(declare (in) vec4 u)
(declare (in) vec3 v))
((declare () mat3x4 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))))
(signature mat4x2
(parameters
(declare (in) vec2 u)
(declare (in) vec4 v))
((declare () mat4x2 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
(signature mat4x3
(parameters
(declare (in) vec3 u)
(declare (in) vec4 v))
((declare () mat4x3 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
(signature mat4
(parameters
(declare (in) vec4 u)
(declare (in) vec4 v))
((declare () mat4 m)
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
(assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
))

25
src/glsl/builtins/ir/pow Normal file
View file

@ -0,0 +1,25 @@
((function pow
(signature float
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
((return (expression float pow (var_ref arg0) (var_ref arg1)))))
(signature vec2
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))
(signature vec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))
(signature vec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))
))

View file

@ -0,0 +1,21 @@
((function radians
(signature float
(parameters
(declare (in) float arg0))
((return (expression float * (var_ref arg0) (constant float (0.017453))))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))
))

View file

@ -0,0 +1,58 @@
((function reflect
(signature float
(parameters
(declare (in) float i)
(declare (in) float n))
((return (expression float -
(var_ref i)
(expression float *
(constant float (2.0))
(expression float *
(expression float dot
(var_ref n)
(var_ref i))
(var_ref n)))))))
(signature vec2
(parameters
(declare (in) vec2 i)
(declare (in) vec2 n))
((return (expression vec2 -
(var_ref i)
(expression vec2 *
(constant float (2.0))
(expression vec2 *
(expression float dot
(var_ref n)
(var_ref i))
(var_ref n)))))))
(signature vec3
(parameters
(declare (in) vec3 i)
(declare (in) vec3 n))
((return (expression vec3 -
(var_ref i)
(expression vec3 *
(constant float (2.0))
(expression vec3 *
(expression float dot
(var_ref n)
(var_ref i))
(var_ref n)))))))
(signature vec4
(parameters
(declare (in) vec4 i)
(declare (in) vec4 n))
((return (expression vec4 -
(var_ref i)
(expression vec4 *
(constant float (2.0))
(expression vec4 *
(expression float dot
(var_ref n)
(var_ref i))
(var_ref n)))))))
))

View file

@ -0,0 +1,102 @@
((function refract
(signature float
(parameters
(declare (in) float i)
(declare (in) float n)
(declare (in) float eta))
((declare () float k)
(assign (constant bool (1)) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
(expression float - (constant float (1.0))
(expression float *
(expression float dot (var_ref n) (var_ref i))
(expression float dot (var_ref n) (var_ref i))))))))
(if (expression bool < (var_ref k) (constant float (0.0)))
((return (constant float (0.0))))
((return (expression float -
(expression float * (var_ref eta) (var_ref i))
(expression float *
(expression float +
(expression float * (var_ref eta)
(expression float dot (var_ref n) (var_ref i)))
(expression float sqrt (var_ref k)))
(var_ref n))))))))
(signature vec2
(parameters
(declare (in) vec2 i)
(declare (in) vec2 n)
(declare (in) float eta))
((declare () float k)
(assign (constant bool (1)) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
(expression float - (constant float (1.0))
(expression float *
(expression float dot (var_ref n) (var_ref i))
(expression float dot (var_ref n) (var_ref i))))))))
(if (expression bool < (var_ref k) (constant float (0.0)))
((return (constant vec2 (0.0 0.0))))
((return (expression vec2 -
(expression vec2 * (var_ref eta) (var_ref i))
(expression vec2 *
(expression float +
(expression float * (var_ref eta)
(expression float dot (var_ref n) (var_ref i)))
(expression float sqrt (var_ref k)))
(var_ref n))))))))
(signature vec3
(parameters
(declare (in) vec3 i)
(declare (in) vec3 n)
(declare (in) float eta))
((declare () float k)
(assign (constant bool (1)) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
(expression float - (constant float (1.0))
(expression float *
(expression float dot (var_ref n) (var_ref i))
(expression float dot (var_ref n) (var_ref i))))))))
(if (expression bool < (var_ref k) (constant float (0.0)))
((return (constant vec3 (0.0 0.0 0.0))))
((return (expression vec3 -
(expression vec3 * (var_ref eta) (var_ref i))
(expression vec3 *
(expression float +
(expression float * (var_ref eta)
(expression float dot (var_ref n) (var_ref i)))
(expression float sqrt (var_ref k)))
(var_ref n))))))))
(signature vec4
(parameters
(declare (in) vec4 i)
(declare (in) vec4 n)
(declare (in) float eta))
((declare () float k)
(assign (constant bool (1)) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
(expression float - (constant float (1.0))
(expression float *
(expression float dot (var_ref n) (var_ref i))
(expression float dot (var_ref n) (var_ref i))))))))
(if (expression bool < (var_ref k) (constant float (0.0)))
((return (constant vec4 (0.0 0.0 0.0 0.0))))
((return (expression vec4 -
(expression vec4 * (var_ref eta) (var_ref i))
(expression vec4 *
(expression float +
(expression float * (var_ref eta)
(expression float dot (var_ref n) (var_ref i)))
(expression float sqrt (var_ref k)))
(var_ref n))))))))
))

42
src/glsl/builtins/ir/sign Normal file
View file

@ -0,0 +1,42 @@
((function sign
(signature float
(parameters
(declare (in) float x))
((return (expression float sign (var_ref x)))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 sign (var_ref x)))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 sign (var_ref x)))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 sign (var_ref x)))))
(signature int
(parameters
(declare (in) int x))
((return (expression int sign (var_ref x)))))
(signature ivec2
(parameters
(declare (in) ivec2 x))
((return (expression ivec2 sign (var_ref x)))))
(signature ivec3
(parameters
(declare (in) ivec3 x))
((return (expression ivec3 sign (var_ref x)))))
(signature ivec4
(parameters
(declare (in) ivec4 x))
((return (expression ivec4 sign (var_ref x)))))
))

21
src/glsl/builtins/ir/sin Normal file
View file

@ -0,0 +1,21 @@
((function sin
(signature float
(parameters
(declare (in) float angle))
((return (expression float sin (var_ref angle)))))
(signature vec2
(parameters
(declare (in) vec2 angle))
((return (expression vec2 sin (var_ref angle)))))
(signature vec3
(parameters
(declare (in) vec3 angle))
((return (expression vec3 sin (var_ref angle)))))
(signature vec4
(parameters
(declare (in) vec4 angle))
((return (expression vec4 sin (var_ref angle)))))
))

30
src/glsl/builtins/ir/sinh Normal file
View file

@ -0,0 +1,30 @@
((function sinh
(signature float
(parameters
(declare (in) float x))
((return (expression float * (constant float (0.5))
(expression float -
(expression float exp (var_ref x))
(expression float exp (expression float neg (var_ref x))))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 * (constant vec2 (0.5))
(expression vec2 -
(expression vec2 exp (var_ref x))
(expression vec2 exp (expression vec2 neg (var_ref x))))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 * (constant vec3 (0.5))
(expression vec3 -
(expression vec3 exp (var_ref x))
(expression vec3 exp (expression vec3 neg (var_ref x))))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 * (constant vec4 (0.5))
(expression vec4 -
(expression vec4 exp (var_ref x))
(expression vec4 exp (expression vec4 neg (var_ref x))))))))
))

View file

@ -0,0 +1,153 @@
((function smoothstep
(signature float
(parameters
(declare (in) float edge0)
(declare (in) float edge1)
(declare (in) float x))
((declare () float t)
(assign (constant bool (1)) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))
(signature vec2
(parameters
(declare (in) float edge0)
(declare (in) float edge1)
(declare (in) vec2 x))
((declare () vec2 t)
(declare () vec2 retval)
(assign (constant bool (1)) (swiz x (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
(assign (constant bool (1)) (swiz y (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
(return (var_ref retval))
))
(signature vec3
(parameters
(declare (in) float edge0)
(declare (in) float edge1)
(declare (in) vec3 x))
((declare () vec3 t)
(declare () vec3 retval)
(assign (constant bool (1)) (swiz x (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
(assign (constant bool (1)) (swiz y (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
(assign (constant bool (1)) (swiz z (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
(return (var_ref retval))
))
(signature vec4
(parameters
(declare (in) float edge0)
(declare (in) float edge1)
(declare (in) vec4 x))
((declare () vec4 t)
(declare () vec4 retval)
(assign (constant bool (1)) (swiz x (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
(assign (constant bool (1)) (swiz y (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
(assign (constant bool (1)) (swiz z (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
(assign (constant bool (1)) (swiz w (var_ref t))
(expression float max
(expression float min
(expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
(assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))
(return (var_ref retval))
))
(signature vec2
(parameters
(declare (in) vec2 edge0)
(declare (in) vec2 edge1)
(declare (in) vec2 x))
((return (expression vec2 max
(expression vec2 min
(expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))
(constant vec2 (1.0 1.0)))
(constant vec2 (0.0 0.0))))))
(signature vec3
(parameters
(declare (in) vec3 edge0)
(declare (in) vec3 edge1)
(declare (in) vec3 x))
((return (expression vec3 max
(expression vec3 min
(expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))
(constant vec3 (1.0 1.0 1.0)))
(constant vec3 (0.0 0.0 0.0))))))
(signature vec4
(parameters
(declare (in) vec4 edge0)
(declare (in) vec4 edge1)
(declare (in) vec4 x))
((return (expression vec4 max
(expression vec4 min
(expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))
(constant vec4 (1.0 1.0 1.0 1.0)))
(constant vec4 (0.0 0.0 0.0 0.0))))))
))

21
src/glsl/builtins/ir/sqrt Normal file
View file

@ -0,0 +1,21 @@
((function sqrt
(signature float
(parameters
(declare (in) float arg0))
((return (expression float sqrt (var_ref arg0)))))
(signature vec2
(parameters
(declare (in) vec2 arg0))
((return (expression vec2 sqrt (var_ref arg0)))))
(signature vec3
(parameters
(declare (in) vec3 arg0))
((return (expression vec3 sqrt (var_ref arg0)))))
(signature vec4
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 sqrt (var_ref arg0)))))
))

68
src/glsl/builtins/ir/step Normal file
View file

@ -0,0 +1,68 @@
((function step
(signature float
(parameters
(declare (in) float edge)
(declare (in) float x))
((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))
(signature vec2
(parameters
(declare (in) float edge)
(declare (in) vec2 x))
((declare () vec2 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec3
(parameters
(declare (in) float edge)
(declare (in) vec3 x))
((declare () vec3 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec4
(parameters
(declare (in) float edge)
(declare (in) vec4 x))
((declare () vec4 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
(assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec2
(parameters
(declare (in) vec2 edge)
(declare (in) vec2 x))
((declare () vec2 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
(return (var_ref t))))
(signature vec3
(parameters
(declare (in) vec3 edge)
(declare (in) vec3 x))
((declare () vec3 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
(assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
(return (var_ref t))))
(signature vec4
(parameters
(declare (in) vec4 edge)
(declare (in) vec4 x))
((declare () vec4 t)
(assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
(assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
(assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))
(assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
(return (var_ref t))))
))

21
src/glsl/builtins/ir/tan Normal file
View file

@ -0,0 +1,21 @@
((function tan
(signature float
(parameters
(declare (in) float angle))
((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))
(signature vec2
(parameters
(declare (in) vec2 angle))
((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))
(signature vec3
(parameters
(declare (in) vec3 angle))
((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))
(signature vec4
(parameters
(declare (in) vec4 angle))
((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))
))

42
src/glsl/builtins/ir/tanh Normal file
View file

@ -0,0 +1,42 @@
((function tanh
(signature float
(parameters
(declare (in) float x))
((return (expression float /
(expression float -
(expression float exp (var_ref x))
(expression float exp (expression float neg (var_ref x))))
(expression float +
(expression float exp (var_ref x))
(expression float exp (expression float neg (var_ref x))))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 /
(expression vec2 -
(expression vec2 exp (var_ref x))
(expression vec2 exp (expression vec2 neg (var_ref x))))
(expression vec2 +
(expression vec2 exp (var_ref x))
(expression vec2 exp (expression vec2 neg (var_ref x))))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 /
(expression vec3 -
(expression vec3 exp (var_ref x))
(expression vec3 exp (expression vec3 neg (var_ref x))))
(expression vec3 +
(expression vec3 exp (var_ref x))
(expression vec3 exp (expression vec3 neg (var_ref x))))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 /
(expression vec4 -
(expression vec4 exp (var_ref x))
(expression vec4 exp (expression vec4 neg (var_ref x))))
(expression vec4 +
(expression vec4 exp (var_ref x))
(expression vec4 exp (expression vec4 neg (var_ref x))))))))
))

View file

@ -0,0 +1,139 @@
((function transpose
(signature mat2
(parameters
(declare (in) mat2 m))
((declare () mat2 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat3x2
(parameters
(declare (in) mat2x3 m))
((declare () mat3x2 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat4x2
(parameters
(declare (in) mat2x4 m))
((declare () mat4x2 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat2x3
(parameters
(declare (in) mat3x2 m))
((declare () mat2x3 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat3
(parameters
(declare (in) mat3 m))
((declare () mat3 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat4x3
(parameters
(declare (in) mat3x4 m))
((declare () mat4x3 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat2x4
(parameters
(declare (in) mat4x2 m))
((declare () mat2x4 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
(signature mat3x4
(parameters
(declare (in) mat4x3 m))
((declare () mat3x4 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
(signature mat4
(parameters
(declare (in) mat4 m))
((declare () mat4 t)
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3)))))
(assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
)
)

View file

@ -0,0 +1,364 @@
#version 110
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1D (sampler1D sampler, float coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3D (sampler3D sampler, vec3 coord, float bias);
vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCube (samplerCube sampler, vec3 coord, float bias);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias);
/*
* 8.8 - Fragment Processing Functions
*/
float dFdx(float p);
vec2 dFdx(vec2 p);
vec3 dFdx(vec3 p);
vec4 dFdx(vec4 p);
float dFdy(float p);
vec2 dFdy(vec2 p);
vec3 dFdy(vec3 p);
vec4 dFdy(vec4 p);
float fwidth(float p);
vec2 fwidth(vec2 p);
vec3 fwidth(vec3 p);
vec4 fwidth(vec4 p);
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,351 @@
#version 110
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
vec4 ftransform();
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1DLod (sampler1D sampler, float coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod);
vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod);
vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
/*
* 8.8 - Fragment Processing Functions (none in vertex shader)
*/
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,396 @@
#version 120
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
mat2 outerProduct(vec2 c, vec2 r);
mat3 outerProduct(vec3 c, vec3 r);
mat4 outerProduct(vec4 c, vec4 r);
mat2x3 outerProduct(vec3 c, vec2 r);
mat3x2 outerProduct(vec2 c, vec3 r);
mat2x4 outerProduct(vec4 c, vec2 r);
mat4x2 outerProduct(vec2 c, vec4 r);
mat3x4 outerProduct(vec4 c, vec3 r);
mat4x3 outerProduct(vec3 c, vec4 r);
mat2 transpose(mat2 m);
mat3 transpose(mat3 m);
mat4 transpose(mat4 m);
mat2x3 transpose(mat3x2 m);
mat3x2 transpose(mat2x3 m);
mat2x4 transpose(mat4x2 m);
mat4x2 transpose(mat2x4 m);
mat3x4 transpose(mat4x3 m);
mat4x3 transpose(mat3x4 m);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1D (sampler1D sampler, float coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3D (sampler3D sampler, vec3 coord, float bias);
vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCube (samplerCube sampler, vec3 coord, float bias);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias);
/*
* 8.8 - Fragment Processing Functions
*/
float dFdx(float p);
vec2 dFdx(vec2 p);
vec3 dFdx(vec3 p);
vec4 dFdx(vec4 p);
float dFdy(float p);
vec2 dFdy(vec2 p);
vec3 dFdy(vec3 p);
vec4 dFdy(vec4 p);
float fwidth(float p);
vec2 fwidth(vec2 p);
vec3 fwidth(vec3 p);
vec4 fwidth(vec4 p);
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,383 @@
#version 120
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
vec4 ftransform();
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
mat2 outerProduct(vec2 c, vec2 r);
mat3 outerProduct(vec3 c, vec3 r);
mat4 outerProduct(vec4 c, vec4 r);
mat2x3 outerProduct(vec3 c, vec2 r);
mat3x2 outerProduct(vec2 c, vec3 r);
mat2x4 outerProduct(vec4 c, vec2 r);
mat4x2 outerProduct(vec2 c, vec4 r);
mat3x4 outerProduct(vec4 c, vec3 r);
mat4x3 outerProduct(vec3 c, vec4 r);
mat2 transpose(mat2 m);
mat3 transpose(mat3 m);
mat4 transpose(mat4 m);
mat2x3 transpose(mat3x2 m);
mat3x2 transpose(mat2x3 m);
mat2x4 transpose(mat4x2 m);
mat4x2 transpose(mat2x4 m);
mat3x4 transpose(mat4x3 m);
mat4x3 transpose(mat3x4 m);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1DLod (sampler1D sampler, float coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod);
vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod);
vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
/*
* 8.8 - Fragment Processing Functions (none in vertex shader)
*/
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,999 @@
#version 130
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
int abs(int x);
ivec2 abs(ivec2 x);
ivec3 abs(ivec3 x);
ivec4 abs(ivec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
int sign(int x);
ivec2 sign(ivec2 x);
ivec3 sign(ivec3 x);
ivec4 sign(ivec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
int min(int x, int y);
ivec2 min(ivec2 x, ivec2 y);
ivec3 min(ivec3 x, ivec3 y);
ivec4 min(ivec4 x, ivec4 y);
ivec2 min(ivec2 x, int y);
ivec3 min(ivec3 x, int y);
ivec4 min(ivec4 x, int y);
uint min(uint x, uint y);
uvec2 min(uvec2 x, uvec2 y);
uvec3 min(uvec3 x, uvec3 y);
uvec4 min(uvec4 x, uvec4 y);
uvec2 min(uvec2 x, uint y);
uvec3 min(uvec3 x, uint y);
uvec4 min(uvec4 x, uint y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
int max(int x, int y);
ivec2 max(ivec2 x, ivec2 y);
ivec3 max(ivec3 x, ivec3 y);
ivec4 max(ivec4 x, ivec4 y);
ivec2 max(ivec2 x, int y);
ivec3 max(ivec3 x, int y);
ivec4 max(ivec4 x, int y);
uint max(uint x, uint y);
uvec2 max(uvec2 x, uvec2 y);
uvec3 max(uvec3 x, uvec3 y);
uvec4 max(uvec4 x, uvec4 y);
uvec2 max(uvec2 x, uint y);
uvec3 max(uvec3 x, uint y);
uvec4 max(uvec4 x, uint y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
int clamp(int x, int minVal, int maxVal);
ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal);
ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal);
ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal);
ivec2 clamp(ivec2 x, int minVal, int maxVal);
ivec3 clamp(ivec3 x, int minVal, int maxVal);
ivec4 clamp(ivec4 x, int minVal, int maxVal);
uint clamp(uint x, uint minVal, uint maxVal);
uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal);
uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal);
uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal);
uvec2 clamp(uvec2 x, uint minVal, uint maxVal);
uvec3 clamp(uvec3 x, uint minVal, uint maxVal);
uvec4 clamp(uvec4 x, uint minVal, uint maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
#if 0
bool isnan(float x);
bvec2 isnan(vec2 x);
bvec3 isnan(vec3 x);
bvec4 isnan(vec4 x);
bool isinf(float x);
bvec2 isinf(vec2 x);
bvec3 isinf(vec3 x);
bvec4 isinf(vec4 x);
#endif
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
mat2 outerProduct(vec2 c, vec2 r);
mat3 outerProduct(vec3 c, vec3 r);
mat4 outerProduct(vec4 c, vec4 r);
mat2x3 outerProduct(vec3 c, vec2 r);
mat3x2 outerProduct(vec2 c, vec3 r);
mat2x4 outerProduct(vec4 c, vec2 r);
mat4x2 outerProduct(vec2 c, vec4 r);
mat3x4 outerProduct(vec4 c, vec3 r);
mat4x3 outerProduct(vec3 c, vec4 r);
mat2 transpose(mat2 m);
mat3 transpose(mat3 m);
mat4 transpose(mat4 m);
mat2x3 transpose(mat3x2 m);
mat3x2 transpose(mat2x3 m);
mat2x4 transpose(mat4x2 m);
mat4x2 transpose(mat2x4 m);
mat3x4 transpose(mat4x3 m);
mat4x3 transpose(mat3x4 m);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThan(uvec2 x, uvec2 y);
bvec3 lessThan(uvec3 x, uvec3 y);
bvec4 lessThan(uvec4 x, uvec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 lessThanEqual(uvec2 x, uvec2 y);
bvec3 lessThanEqual(uvec3 x, uvec3 y);
bvec4 lessThanEqual(uvec4 x, uvec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThan(uvec2 x, uvec2 y);
bvec3 greaterThan(uvec3 x, uvec3 y);
bvec4 greaterThan(uvec4 x, uvec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThanEqual(uvec2 x, uvec2 y);
bvec3 greaterThanEqual(uvec3 x, uvec3 y);
bvec4 greaterThanEqual(uvec4 x, uvec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(uvec2 x, uvec2 y);
bvec3 equal(uvec3 x, uvec3 y);
bvec4 equal(uvec4 x, uvec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(uvec2 x, uvec2 y);
bvec3 notEqual(uvec3 x, uvec3 y);
bvec4 notEqual(uvec4 x, uvec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
#if 0
/* textureSize */
int textureSize( sampler1D sampler, int lod);
int textureSize(isampler1D sampler, int lod);
int textureSize(usampler1D sampler, int lod);
ivec2 textureSize( sampler2D sampler, int lod);
ivec2 textureSize(isampler2D sampler, int lod);
ivec2 textureSize(usampler2D sampler, int lod);
ivec3 textureSize( sampler3D sampler, int lod);
ivec3 textureSize(isampler3D sampler, int lod);
ivec3 textureSize(usampler3D sampler, int lod);
ivec2 textureSize( samplerCube sampler, int lod);
ivec2 textureSize(isamplerCube sampler, int lod);
ivec2 textureSize(usamplerCube sampler, int lod);
int textureSize(sampler1DShadow sampler, int lod);
ivec2 textureSize(sampler2DShadow sampler, int lod);
ivec2 textureSize(samplerCubeShadow sampler, int lod);
ivec2 textureSize( sampler1DArray sampler, int lod);
ivec2 textureSize(isampler1DArray sampler, int lod);
ivec2 textureSize(usampler1DArray sampler, int lod);
ivec3 textureSize( sampler2DArray sampler, int lod);
ivec2 textureSize(isampler2DArray sampler, int lod);
ivec2 textureSize(usampler2DArray sampler, int lod);
ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
#endif
/* texture - no bias */
vec4 texture( sampler1D sampler, float P);
ivec4 texture(isampler1D sampler, float P);
uvec4 texture(usampler1D sampler, float P);
vec4 texture( sampler2D sampler, vec2 P);
ivec4 texture(isampler2D sampler, vec2 P);
uvec4 texture(usampler2D sampler, vec2 P);
vec4 texture( sampler3D sampler, vec3 P);
ivec4 texture(isampler3D sampler, vec3 P);
uvec4 texture(usampler3D sampler, vec3 P);
vec4 texture( samplerCube sampler, vec3 P);
ivec4 texture(isamplerCube sampler, vec3 P);
uvec4 texture(usamplerCube sampler, vec3 P);
float texture(sampler1DShadow sampler, vec3 P);
float texture(sampler2DShadow sampler, vec3 P);
float texture(samplerCubeShadow sampler, vec4 P);
vec4 texture( sampler1DArray sampler, vec2 P);
ivec4 texture(isampler1DArray sampler, vec2 P);
uvec4 texture(usampler1DArray sampler, vec2 P);
vec4 texture( sampler2DArray sampler, vec3 P);
ivec4 texture(isampler2DArray sampler, vec3 P);
uvec4 texture(usampler2DArray sampler, vec3 P);
float texture(sampler1DArrayShadow sampler, vec3 P);
float texture(sampler2DArrayShadow sampler, vec4 P);
/* texture - bias variants */
vec4 texture( sampler1D sampler, float P, float bias);
ivec4 texture(isampler1D sampler, float P, float bias);
uvec4 texture(usampler1D sampler, float P, float bias);
vec4 texture( sampler2D sampler, vec2 P, float bias);
ivec4 texture(isampler2D sampler, vec2 P, float bias);
uvec4 texture(usampler2D sampler, vec2 P, float bias);
vec4 texture( sampler3D sampler, vec3 P, float bias);
ivec4 texture(isampler3D sampler, vec3 P, float bias);
uvec4 texture(usampler3D sampler, vec3 P, float bias);
vec4 texture( samplerCube sampler, vec3 P, float bias);
ivec4 texture(isamplerCube sampler, vec3 P, float bias);
uvec4 texture(usamplerCube sampler, vec3 P, float bias);
float texture(sampler1DShadow sampler, vec3 P, float bias);
float texture(sampler2DShadow sampler, vec3 P, float bias);
float texture(samplerCubeShadow sampler, vec4 P, float bias);
vec4 texture( sampler1DArray sampler, vec2 P, float bias);
ivec4 texture(isampler1DArray sampler, vec2 P, float bias);
uvec4 texture(usampler1DArray sampler, vec2 P, float bias);
vec4 texture( sampler2DArray sampler, vec3 P, float bias);
ivec4 texture(isampler2DArray sampler, vec3 P, float bias);
uvec4 texture(usampler2DArray sampler, vec3 P, float bias);
float texture(sampler1DArrayShadow sampler, vec3 P, float bias);
/* textureProj - no bias */
vec4 textureProj( sampler1D sampler, vec2 P);
ivec4 textureProj(isampler1D sampler, vec2 P);
uvec4 textureProj(usampler1D sampler, vec2 P);
vec4 textureProj( sampler1D sampler, vec4 P);
ivec4 textureProj(isampler1D sampler, vec4 P);
uvec4 textureProj(usampler1D sampler, vec4 P);
vec4 textureProj( sampler2D sampler, vec3 P);
ivec4 textureProj(isampler2D sampler, vec3 P);
uvec4 textureProj(usampler2D sampler, vec3 P);
vec4 textureProj( sampler2D sampler, vec4 P);
ivec4 textureProj(isampler2D sampler, vec4 P);
uvec4 textureProj(usampler2D sampler, vec4 P);
vec4 textureProj( sampler3D sampler, vec4 P);
ivec4 textureProj(isampler3D sampler, vec4 P);
uvec4 textureProj(usampler3D sampler, vec4 P);
float textureProj(sampler1DShadow sampler, vec4 P);
float textureProj(sampler2DShadow sampler, vec4 P);
/* textureProj - bias variants */
vec4 textureProj( sampler1D sampler, vec2 P, float bias);
ivec4 textureProj(isampler1D sampler, vec2 P, float bias);
uvec4 textureProj(usampler1D sampler, vec2 P, float bias);
vec4 textureProj( sampler1D sampler, vec4 P, float bias);
ivec4 textureProj(isampler1D sampler, vec4 P, float bias);
uvec4 textureProj(usampler1D sampler, vec4 P, float bias);
vec4 textureProj( sampler2D sampler, vec3 P, float bias);
ivec4 textureProj(isampler2D sampler, vec3 P, float bias);
uvec4 textureProj(usampler2D sampler, vec3 P, float bias);
vec4 textureProj( sampler2D sampler, vec4 P, float bias);
ivec4 textureProj(isampler2D sampler, vec4 P, float bias);
uvec4 textureProj(usampler2D sampler, vec4 P, float bias);
vec4 textureProj( sampler3D sampler, vec4 P, float bias);
ivec4 textureProj(isampler3D sampler, vec4 P, float bias);
uvec4 textureProj(usampler3D sampler, vec4 P, float bias);
float textureProj(sampler1DShadow sampler, vec4 P, float bias);
float textureProj(sampler2DShadow sampler, vec4 P, float bias);
/* textureLod */
vec4 textureLod( sampler1D sampler, float P, float lod);
ivec4 textureLod(isampler1D sampler, float P, float lod);
uvec4 textureLod(usampler1D sampler, float P, float lod);
vec4 textureLod( sampler2D sampler, vec2 P, float lod);
ivec4 textureLod(isampler2D sampler, vec2 P, float lod);
uvec4 textureLod(usampler2D sampler, vec2 P, float lod);
vec4 textureLod( sampler3D sampler, vec3 P, float lod);
ivec4 textureLod(isampler3D sampler, vec3 P, float lod);
uvec4 textureLod(usampler3D sampler, vec3 P, float lod);
vec4 textureLod( samplerCube sampler, vec3 P, float lod);
ivec4 textureLod(isamplerCube sampler, vec3 P, float lod);
uvec4 textureLod(usamplerCube sampler, vec3 P, float lod);
float textureLod(sampler1DShadow sampler, vec3 P, float lod);
float textureLod(sampler2DShadow sampler, vec3 P, float lod);
vec4 textureLod( sampler1DArray sampler, vec2 P, float lod);
ivec4 textureLod(isampler1DArray sampler, vec2 P, float lod);
uvec4 textureLod(usampler1DArray sampler, vec2 P, float lod);
vec4 textureLod( sampler2DArray sampler, vec3 P, float lod);
ivec4 textureLod(isampler2DArray sampler, vec3 P, float lod);
uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod);
float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod);
#if 0
/* textureOffset - no bias */
vec4 textureOffset( sampler1D sampler, float P, int offset);
ivec4 textureOffset(isampler1D sampler, float P, int offset);
uvec4 textureOffset(usampler1D sampler, float P, int offset);
vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset);
ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset);
uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset);
vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset);
ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset);
uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset);
float textureOffset(sampler1DShadow sampler, vec3 P, int offset);
float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset);
vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset);
ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset);
uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset);
vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset);
ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset);
uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset);
float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset);
/* textureOffset - bias variants */
vec4 textureOffset( sampler1D sampler, float P, int offset, float bias);
ivec4 textureOffset(isampler1D sampler, float P, int offset, float bias);
uvec4 textureOffset(usampler1D sampler, float P, int offset, float bias);
vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset, float bias);
ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset, float bias);
uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset, float bias);
vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset, float bias);
ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias);
uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias);
float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias);
float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias);
vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset, float bias);
ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset, float bias);
uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset, float bias);
vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset, float bias);
ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias);
uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias);
float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias);
#endif
/* texelFetch */
vec4 texelFetch( sampler1D sampler, int P, int lod);
ivec4 texelFetch(isampler1D sampler, int P, int lod);
uvec4 texelFetch(usampler1D sampler, int P, int lod);
vec4 texelFetch( sampler2D sampler, ivec2 P, int lod);
ivec4 texelFetch(isampler2D sampler, ivec2 P, int lod);
uvec4 texelFetch(usampler2D sampler, ivec2 P, int lod);
vec4 texelFetch( sampler3D sampler, ivec3 P, int lod);
ivec4 texelFetch(isampler3D sampler, ivec3 P, int lod);
uvec4 texelFetch(usampler3D sampler, ivec3 P, int lod);
vec4 texelFetch( sampler1DArray sampler, ivec2 P, int lod);
ivec4 texelFetch(isampler1DArray sampler, ivec2 P, int lod);
uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod);
vec4 texelFetch( sampler2DArray sampler, ivec3 P, int lod);
ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod);
uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod);
#if 0
/* texelFetchOffset */
vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset);
ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset);
uvec4 texelFetchOffset(usampler1D sampler, int P, int lod, int offset);
vec4 texelFetchOffset( sampler2D sampler, ivec2 P, int lod, ivec2 offset);
ivec4 texelFetchOffset(isampler2D sampler, ivec2 P, int lod, ivec2 offset);
uvec4 texelFetchOffset(usampler2D sampler, ivec2 P, int lod, ivec2 offset);
vec4 texelFetchOffset( sampler3D sampler, ivec3 P, int lod, ivec3 offset);
ivec4 texelFetchOffset(isampler3D sampler, ivec3 P, int lod, ivec3 offset);
uvec4 texelFetchOffset(usampler3D sampler, ivec3 P, int lod, ivec3 offset);
vec4 texelFetchOffset( sampler1DArray sampler, ivec2 P, int lod, int offset);
ivec4 texelFetchOffset(isampler1DArray sampler, ivec2 P, int lod, int offset);
uvec4 texelFetchOffset(usampler1DArray sampler, ivec2 P, int lod, int offset);
vec4 texelFetchOffset( sampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
ivec4 texelFetchOffset(isampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
uvec4 texelFetchOffset(usampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
/* textureProjOffset - no bias */
vec4 textureProj( sampler1D sampler, vec2 P, int offset);
ivec4 textureProj(isampler1D sampler, vec2 P, int offset);
uvec4 textureProj(usampler1D sampler, vec2 P, int offset);
vec4 textureProj( sampler1D sampler, vec4 P, int offset);
ivec4 textureProj(isampler1D sampler, vec4 P, int offset);
uvec4 textureProj(usampler1D sampler, vec4 P, int offset);
vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset);
ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset);
uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset);
vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset);
ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset);
uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset);
vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset);
ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset);
uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset);
float textureProj(sampler1DShadow sampler, vec4 P, int offset);
float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset);
/* textureProjOffset - bias variants */
vec4 textureProj( sampler1D sampler, vec2 P, int offset, float bias);
ivec4 textureProj(isampler1D sampler, vec2 P, int offset, float bias);
uvec4 textureProj(usampler1D sampler, vec2 P, int offset, float bias);
vec4 textureProj( sampler1D sampler, vec4 P, int offset, float bias);
ivec4 textureProj(isampler1D sampler, vec4 P, int offset, float bias);
uvec4 textureProj(usampler1D sampler, vec4 P, int offset, float bias);
vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset, float bias);
ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset, float bias);
uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset, float bias);
vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset, float bias);
ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset, float bias);
uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset, float bias);
vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset, float bias);
ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset, float bias);
uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset, float bias);
float textureProj(sampler1DShadow sampler, vec4 P, int offset, float bias);
float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias);
/* textureLodOffset */
vec4 textureLodOffset( sampler1D sampler, float P, float lod, int offset);
ivec4 textureLodOffset(isampler1D sampler, float P, float lod, int offset);
uvec4 textureLodOffset(usampler1D sampler, float P, float lod, int offset);
vec4 textureLodOffset( sampler2D sampler, vec2 P, float lod, ivec2 offset);
ivec4 textureLodOffset(isampler2D sampler, vec2 P, float lod, ivec2 offset);
uvec4 textureLodOffset(usampler2D sampler, vec2 P, float lod, ivec2 offset);
vec4 textureLodOffset( sampler3D sampler, vec3 P, float lod, ivec3 offset);
ivec4 textureLodOffset(isampler3D sampler, vec3 P, float lod, ivec3 offset);
uvec4 textureLodOffset(usampler3D sampler, vec3 P, float lod, ivec3 offset);
float textureLodOffset(sampler1DShadow samp, vec3 P, float lod, int offset);
float textureLodOffset(sampler2DShadow samp, vec3 P, float lod, ivec2 offset);
vec4 textureLodOffset( sampler1DArray sampler, vec2 P, float lod, int offset);
ivec4 textureLodOffset(isampler1DArray sampler, vec2 P, float lod, int offset);
uvec4 textureLodOffset(usampler1DArray sampler, vec2 P, float lod, int offset);
vec4 textureLodOffset( sampler2DArray samp, vec3 P, float lod, ivec2 offset);
ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset);
uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset);
float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset);
#endif
/* textureProjLod */
vec4 textureProjLod( sampler1D sampler, vec2 P, float lod);
ivec4 textureProjLod(isampler1D sampler, vec2 P, float lod);
uvec4 textureProjLod(usampler1D sampler, vec2 P, float lod);
vec4 textureProjLod( sampler1D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler1D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler1D sampler, vec4 P, float lod);
vec4 textureProjLod( sampler2D sampler, vec3 P, float lod);
ivec4 textureProjLod(isampler2D sampler, vec3 P, float lod);
uvec4 textureProjLod(usampler2D sampler, vec3 P, float lod);
vec4 textureProjLod( sampler2D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler2D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler2D sampler, vec4 P, float lod);
vec4 textureProjLod( sampler3D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler3D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod);
float textureProjLod(sampler1DShadow sampler, vec4 P, float lod);
float textureProjLod(sampler2DShadow sampler, vec4 P, float lod);
#if 0
/* textureProjLodOffset */
vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset);
ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset);
uvec4 textureProjLodOffset(usampler1D sampler, vec2 P, float lod, int offset);
vec4 textureProjLodOffset( sampler1D sampler, vec4 P, float lod, int offset);
ivec4 textureProjLodOffset(isampler1D sampler, vec4 P, float lod, int offset);
uvec4 textureProjLodOffset(usampler1D sampler, vec4 P, float lod, int offset);
vec4 textureProjLodOffset( sampler2D sampler, vec3 P, float lod, ivec2 offset);
ivec4 textureProjLodOffset(isampler2D sampler, vec3 P, float lod, ivec2 offset);
uvec4 textureProjLodOffset(usampler2D sampler, vec3 P, float lod, ivec2 offset);
vec4 textureProjLodOffset( sampler2D sampler, vec4 P, float lod, ivec2 offset);
ivec4 textureProjLodOffset(isampler2D sampler, vec4 P, float lod, ivec2 offset);
uvec4 textureProjLodOffset(usampler2D sampler, vec4 P, float lod, ivec2 offset);
vec4 textureProjLodOffset( sampler3D sampler, vec4 P, float lod, ivec3 offset);
ivec4 textureProjLodOffset(isampler3D sampler, vec4 P, float lod, ivec3 offset);
uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset);
float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset);
float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset);
#endif
/* textureGrad */
vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy);
ivec4 textureGrad(isampler1D sampler, float P, float dPdx, float dPdy);
uvec4 textureGrad(usampler1D sampler, float P, float dPdx, float dPdy);
vec4 textureGrad( sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
ivec4 textureGrad(isampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
uvec4 textureGrad(usampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
vec4 textureGrad( sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
ivec4 textureGrad(isampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
uvec4 textureGrad(usampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
vec4 textureGrad( samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
ivec4 textureGrad(isamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
uvec4 textureGrad(usamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy);
float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy);
vec4 textureGrad( sampler1DArray sampler, vec2 P, float dPdx, float dPdy);
ivec4 textureGrad(isampler1DArray sampler, vec2 P, float dPdx, float dPdy);
uvec4 textureGrad(usampler1DArray sampler, vec2 P, float dPdx, float dPdy);
vec4 textureGrad( sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
ivec4 textureGrad(isampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy);
float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
#if 0
/* textureGradOffset */
vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off);
ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset);
uvec4 textureGradOffset(usampler1D s, float P, float dx, float dy, int offset);
vec4 textureGradOffset( sampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
ivec4 textureGradOffset(isampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
uvec4 textureGradOffset(usampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
vec4 textureGradOffset( sampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
ivec4 textureGradOffset(isampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
uvec4 textureGradOffset(usampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
vec4 textureGradOffset( samplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
ivec4 textureGradOffset(isamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
uvec4 textureGradOffset(usamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
float textureGradOffset(sampler1DShadow s, vec3 P, float dx, float dy, int off);
float textureGradOffset(sampler2DShadow s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureGradOffset( sampler1DArray s, vec2 P, float dx, float dy, int off);
ivec4 textureGradOffset(isampler1DArray s, vec2 P, float dx, float dy, int off);
uvec4 textureGradOffset(usampler1DArray s, vec2 P, float dx, float dy, int off);
vec4 textureGradOffset( sampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureGradOffset(isampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o);
float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o);
#endif
/* textureProjGrad */
vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy);
ivec4 textureProjGrad(isampler1D sampler, vec2 P, float dPdx, float dPdy);
uvec4 textureProjGrad(usampler1D sampler, vec2 P, float dPdx, float dPdy);
vec4 textureProjGrad( sampler1D sampler, vec4 P, float dPdx, float dPdy);
ivec4 textureProjGrad(isampler1D sampler, vec4 P, float dPdx, float dPdy);
uvec4 textureProjGrad(usampler1D sampler, vec4 P, float dPdx, float dPdy);
vec4 textureProjGrad( sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
ivec4 textureProjGrad(isampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
uvec4 textureProjGrad(usampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
vec4 textureProjGrad( sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
ivec4 textureProjGrad(isampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
uvec4 textureProjGrad(usampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
vec4 textureProjGrad( sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
ivec4 textureProjGrad(isampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy);
float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
#if 0
/* textureProjGradOffset */
vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off);
ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off);
uvec4 textureProjGradOffset(usampler1D s, vec2 P, float dx, float dy, int off);
vec4 textureProjGradOffset( sampler1D s, vec4 P, float dx, float dy, int off);
ivec4 textureProjGradOffset(isampler1D s, vec4 P, float dx, float dy, int off);
uvec4 textureProjGradOffset(usampler1D s, vec4 P, float dx, float dy, int off);
vec4 textureProjGradOffset( sampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureProjGradOffset(isampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureProjGradOffset(usampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureProjGradOffset( sampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureProjGradOffset(isampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureProjGradOffset(usampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureProjGradOffset( sampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
ivec4 textureProjGradOffset(isampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o);
float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o);
#endif
/*
* The following texture functions are deprecated:
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1D (sampler1D sampler, float coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias);
vec4 texture1DLod (sampler1D sampler, float coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);
vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3D (sampler3D sampler, vec3 coord, float bias);
vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias);
vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCube (samplerCube sampler, vec3 coord, float bias);
vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias);
vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod);
vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod);
vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
/*
* 8.8 - Fragment Processing Functions
*/
float dFdx(float p);
vec2 dFdx(vec2 p);
vec3 dFdx(vec3 p);
vec4 dFdx(vec4 p);
float dFdy(float p);
vec2 dFdy(vec2 p);
vec3 dFdy(vec3 p);
vec4 dFdy(vec4 p);
float fwidth(float p);
vec2 fwidth(vec2 p);
vec3 fwidth(vec3 p);
vec4 fwidth(vec4 p);
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,987 @@
#version 130
/*
* 8.1 - Angle and Trigonometry Functions
*/
float radians(float degrees);
vec2 radians(vec2 degrees);
vec3 radians(vec3 degrees);
vec4 radians(vec4 degrees);
float degrees(float radians);
vec2 degrees(vec2 radians);
vec3 degrees(vec3 radians);
vec4 degrees(vec4 radians);
float sin(float angle);
vec2 sin(vec2 angle);
vec3 sin(vec3 angle);
vec4 sin(vec4 angle);
float cos(float angle);
vec2 cos(vec2 angle);
vec3 cos(vec3 angle);
vec4 cos(vec4 angle);
float tan(float angle);
vec2 tan(vec2 angle);
vec3 tan(vec3 angle);
vec4 tan(vec4 angle);
float asin(float angle);
vec2 asin(vec2 angle);
vec3 asin(vec3 angle);
vec4 asin(vec4 angle);
float acos(float angle);
vec2 acos(vec2 angle);
vec3 acos(vec3 angle);
vec4 acos(vec4 angle);
float atan(float y, float x);
vec2 atan(vec2 y, vec2 x);
vec3 atan(vec3 y, vec3 x);
vec4 atan(vec4 y, vec4 x);
float atan(float y_over_x);
vec2 atan(vec2 y_over_x);
vec3 atan(vec3 y_over_x);
vec4 atan(vec4 y_over_x);
/*
* 8.2 - Exponential Functions
*/
float pow(float x, float y);
vec2 pow(vec2 x, vec2 y);
vec3 pow(vec3 x, vec3 y);
vec4 pow(vec4 x, vec4 y);
float exp(float x);
vec2 exp(vec2 x);
vec3 exp(vec3 x);
vec4 exp(vec4 x);
float log(float x);
vec2 log(vec2 x);
vec3 log(vec3 x);
vec4 log(vec4 x);
float exp2(float x);
vec2 exp2(vec2 x);
vec3 exp2(vec3 x);
vec4 exp2(vec4 x);
float log2(float x);
vec2 log2(vec2 x);
vec3 log2(vec3 x);
vec4 log2(vec4 x);
float sqrt(float x);
vec2 sqrt(vec2 x);
vec3 sqrt(vec3 x);
vec4 sqrt(vec4 x);
float inversesqrt(float x);
vec2 inversesqrt(vec2 x);
vec3 inversesqrt(vec3 x);
vec4 inversesqrt(vec4 x);
/*
* 8.3 - Common Functions
*/
float abs(float x);
vec2 abs(vec2 x);
vec3 abs(vec3 x);
vec4 abs(vec4 x);
int abs(int x);
ivec2 abs(ivec2 x);
ivec3 abs(ivec3 x);
ivec4 abs(ivec4 x);
float sign(float x);
vec2 sign(vec2 x);
vec3 sign(vec3 x);
vec4 sign(vec4 x);
int sign(int x);
ivec2 sign(ivec2 x);
ivec3 sign(ivec3 x);
ivec4 sign(ivec4 x);
float floor(float x);
vec2 floor(vec2 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec4 ceil(vec4 x);
float fract(float x);
vec2 fract(vec2 x);
vec3 fract(vec3 x);
vec4 fract(vec4 x);
float mod(float x, float y);
vec2 mod(vec2 x, float y);
vec3 mod(vec3 x, float y);
vec4 mod(vec4 x, float y);
vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
vec4 min(vec4 x, vec4 y);
vec2 min(vec2 x, float y);
vec3 min(vec3 x, float y);
vec4 min(vec4 x, float y);
int min(int x, int y);
ivec2 min(ivec2 x, ivec2 y);
ivec3 min(ivec3 x, ivec3 y);
ivec4 min(ivec4 x, ivec4 y);
ivec2 min(ivec2 x, int y);
ivec3 min(ivec3 x, int y);
ivec4 min(ivec4 x, int y);
uint min(uint x, uint y);
uvec2 min(uvec2 x, uvec2 y);
uvec3 min(uvec3 x, uvec3 y);
uvec4 min(uvec4 x, uvec4 y);
uvec2 min(uvec2 x, uint y);
uvec3 min(uvec3 x, uint y);
uvec4 min(uvec4 x, uint y);
float max(float x, float y);
vec2 max(vec2 x, vec2 y);
vec3 max(vec3 x, vec3 y);
vec4 max(vec4 x, vec4 y);
vec2 max(vec2 x, float y);
vec3 max(vec3 x, float y);
vec4 max(vec4 x, float y);
int max(int x, int y);
ivec2 max(ivec2 x, ivec2 y);
ivec3 max(ivec3 x, ivec3 y);
ivec4 max(ivec4 x, ivec4 y);
ivec2 max(ivec2 x, int y);
ivec3 max(ivec3 x, int y);
ivec4 max(ivec4 x, int y);
uint max(uint x, uint y);
uvec2 max(uvec2 x, uvec2 y);
uvec3 max(uvec3 x, uvec3 y);
uvec4 max(uvec4 x, uvec4 y);
uvec2 max(uvec2 x, uint y);
uvec3 max(uvec3 x, uint y);
uvec4 max(uvec4 x, uint y);
float clamp(float x, float minVal, float maxVal);
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
vec2 clamp(vec2 x, float minVal, float maxVal);
vec3 clamp(vec3 x, float minVal, float maxVal);
vec4 clamp(vec4 x, float minVal, float maxVal);
int clamp(int x, int minVal, int maxVal);
ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal);
ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal);
ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal);
ivec2 clamp(ivec2 x, int minVal, int maxVal);
ivec3 clamp(ivec3 x, int minVal, int maxVal);
ivec4 clamp(ivec4 x, int minVal, int maxVal);
uint clamp(uint x, uint minVal, uint maxVal);
uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal);
uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal);
uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal);
uvec2 clamp(uvec2 x, uint minVal, uint maxVal);
uvec3 clamp(uvec3 x, uint minVal, uint maxVal);
uvec4 clamp(uvec4 x, uint minVal, uint maxVal);
float mix(float x, float y, float a);
vec2 mix(vec2 x, vec2 y, vec2 a);
vec3 mix(vec3 x, vec3 y, vec3 a);
vec4 mix(vec4 x, vec4 y, vec4 a);
vec2 mix(vec2 x, vec2 y, float a);
vec3 mix(vec3 x, vec3 y, float a);
vec4 mix(vec4 x, vec4 y, float a);
float step(float edge, float x);
vec2 step(vec2 edge, vec2 x);
vec3 step(vec3 edge, vec3 x);
vec4 step(vec4 edge, vec4 x);
vec2 step(float edge, vec2 x);
vec3 step(float edge, vec3 x);
vec4 step(float edge, vec4 x);
float smoothstep(float edge0, float edge1, float x);
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
vec2 smoothstep(float edge0, float edge1, vec2 x);
vec3 smoothstep(float edge0, float edge1, vec3 x);
vec4 smoothstep(float edge0, float edge1, vec4 x);
#if 0
bool isnan(float x);
bvec2 isnan(vec2 x);
bvec3 isnan(vec3 x);
bvec4 isnan(vec4 x);
bool isinf(float x);
bvec2 isinf(vec2 x);
bvec3 isinf(vec3 x);
bvec4 isinf(vec4 x);
#endif
/*
* 8.4 - Geometric Functions
*/
float length(float x);
float length(vec2 x);
float length(vec3 x);
float length(vec4 x);
float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
float distance(vec3 p0, vec3 p1);
float distance(vec4 p0, vec4 p1);
float dot(float x, float y);
float dot(vec2 x, vec2 y);
float dot(vec3 x, vec3 y);
float dot(vec4 x, vec4 y);
vec3 cross(vec3 x, vec3 y);
float normalize(float x);
vec2 normalize(vec2 x);
vec3 normalize(vec3 x);
vec4 normalize(vec4 x);
vec4 ftransform();
float faceforward(float N, float I, float Nref);
vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
float reflect(float I, float N);
vec2 reflect(vec2 I, vec2 N);
vec3 reflect(vec3 I, vec3 N);
vec4 reflect(vec4 I, vec4 N);
float refract(float I, float N, float eta);
vec2 refract(vec2 I, vec2 N, float eta);
vec3 refract(vec3 I, vec3 N, float eta);
vec4 refract(vec4 I, vec4 N, float eta);
/*
* 8.5 - Matrix Functions
*/
mat2 matrixCompMult(mat2 x, mat2 y);
mat3 matrixCompMult(mat3 x, mat3 y);
mat4 matrixCompMult(mat4 x, mat4 y);
mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
mat2 outerProduct(vec2 c, vec2 r);
mat3 outerProduct(vec3 c, vec3 r);
mat4 outerProduct(vec4 c, vec4 r);
mat2x3 outerProduct(vec3 c, vec2 r);
mat3x2 outerProduct(vec2 c, vec3 r);
mat2x4 outerProduct(vec4 c, vec2 r);
mat4x2 outerProduct(vec2 c, vec4 r);
mat3x4 outerProduct(vec4 c, vec3 r);
mat4x3 outerProduct(vec3 c, vec4 r);
mat2 transpose(mat2 m);
mat3 transpose(mat3 m);
mat4 transpose(mat4 m);
mat2x3 transpose(mat3x2 m);
mat3x2 transpose(mat2x3 m);
mat2x4 transpose(mat4x2 m);
mat4x2 transpose(mat2x4 m);
mat3x4 transpose(mat4x3 m);
mat4x3 transpose(mat3x4 m);
/*
* 8.6 - Vector Relational Functions
*/
bvec2 lessThan( vec2 x, vec2 y);
bvec3 lessThan( vec3 x, vec3 y);
bvec4 lessThan( vec4 x, vec4 y);
bvec2 lessThan(ivec2 x, ivec2 y);
bvec3 lessThan(ivec3 x, ivec3 y);
bvec4 lessThan(ivec4 x, ivec4 y);
bvec2 lessThan(uvec2 x, uvec2 y);
bvec3 lessThan(uvec3 x, uvec3 y);
bvec4 lessThan(uvec4 x, uvec4 y);
bvec2 lessThanEqual( vec2 x, vec2 y);
bvec3 lessThanEqual( vec3 x, vec3 y);
bvec4 lessThanEqual( vec4 x, vec4 y);
bvec2 lessThanEqual(ivec2 x, ivec2 y);
bvec3 lessThanEqual(ivec3 x, ivec3 y);
bvec4 lessThanEqual(ivec4 x, ivec4 y);
bvec2 lessThanEqual(uvec2 x, uvec2 y);
bvec3 lessThanEqual(uvec3 x, uvec3 y);
bvec4 lessThanEqual(uvec4 x, uvec4 y);
bvec2 greaterThan( vec2 x, vec2 y);
bvec3 greaterThan( vec3 x, vec3 y);
bvec4 greaterThan( vec4 x, vec4 y);
bvec2 greaterThan(ivec2 x, ivec2 y);
bvec3 greaterThan(ivec3 x, ivec3 y);
bvec4 greaterThan(ivec4 x, ivec4 y);
bvec2 greaterThan(uvec2 x, uvec2 y);
bvec3 greaterThan(uvec3 x, uvec3 y);
bvec4 greaterThan(uvec4 x, uvec4 y);
bvec2 greaterThanEqual( vec2 x, vec2 y);
bvec3 greaterThanEqual( vec3 x, vec3 y);
bvec4 greaterThanEqual( vec4 x, vec4 y);
bvec2 greaterThanEqual(ivec2 x, ivec2 y);
bvec3 greaterThanEqual(ivec3 x, ivec3 y);
bvec4 greaterThanEqual(ivec4 x, ivec4 y);
bvec2 greaterThanEqual(uvec2 x, uvec2 y);
bvec3 greaterThanEqual(uvec3 x, uvec3 y);
bvec4 greaterThanEqual(uvec4 x, uvec4 y);
bvec2 equal( vec2 x, vec2 y);
bvec3 equal( vec3 x, vec3 y);
bvec4 equal( vec4 x, vec4 y);
bvec2 equal(ivec2 x, ivec2 y);
bvec3 equal(ivec3 x, ivec3 y);
bvec4 equal(ivec4 x, ivec4 y);
bvec2 equal(uvec2 x, uvec2 y);
bvec3 equal(uvec3 x, uvec3 y);
bvec4 equal(uvec4 x, uvec4 y);
bvec2 equal(bvec2 x, bvec2 y);
bvec3 equal(bvec3 x, bvec3 y);
bvec4 equal(bvec4 x, bvec4 y);
bvec2 notEqual( vec2 x, vec2 y);
bvec3 notEqual( vec3 x, vec3 y);
bvec4 notEqual( vec4 x, vec4 y);
bvec2 notEqual(ivec2 x, ivec2 y);
bvec3 notEqual(ivec3 x, ivec3 y);
bvec4 notEqual(ivec4 x, ivec4 y);
bvec2 notEqual(uvec2 x, uvec2 y);
bvec3 notEqual(uvec3 x, uvec3 y);
bvec4 notEqual(uvec4 x, uvec4 y);
bvec2 notEqual(bvec2 x, bvec2 y);
bvec3 notEqual(bvec3 x, bvec3 y);
bvec4 notEqual(bvec4 x, bvec4 y);
bool any(bvec2 x);
bool any(bvec3 x);
bool any(bvec4 x);
bool all(bvec2 x);
bool all(bvec3 x);
bool all(bvec4 x);
bvec2 not(bvec2 x);
bvec3 not(bvec3 x);
bvec4 not(bvec4 x);
/*
* 8.7 - Texture Lookup Functions
*/
#if 0
/* textureSize */
int textureSize( sampler1D sampler, int lod);
int textureSize(isampler1D sampler, int lod);
int textureSize(usampler1D sampler, int lod);
ivec2 textureSize( sampler2D sampler, int lod);
ivec2 textureSize(isampler2D sampler, int lod);
ivec2 textureSize(usampler2D sampler, int lod);
ivec3 textureSize( sampler3D sampler, int lod);
ivec3 textureSize(isampler3D sampler, int lod);
ivec3 textureSize(usampler3D sampler, int lod);
ivec2 textureSize( samplerCube sampler, int lod);
ivec2 textureSize(isamplerCube sampler, int lod);
ivec2 textureSize(usamplerCube sampler, int lod);
int textureSize(sampler1DShadow sampler, int lod);
ivec2 textureSize(sampler2DShadow sampler, int lod);
ivec2 textureSize(samplerCubeShadow sampler, int lod);
ivec2 textureSize( sampler1DArray sampler, int lod);
ivec2 textureSize(isampler1DArray sampler, int lod);
ivec2 textureSize(usampler1DArray sampler, int lod);
ivec3 textureSize( sampler2DArray sampler, int lod);
ivec2 textureSize(isampler2DArray sampler, int lod);
ivec2 textureSize(usampler2DArray sampler, int lod);
ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
#endif
/* texture - no bias */
vec4 texture( sampler1D sampler, float P);
ivec4 texture(isampler1D sampler, float P);
uvec4 texture(usampler1D sampler, float P);
vec4 texture( sampler2D sampler, vec2 P);
ivec4 texture(isampler2D sampler, vec2 P);
uvec4 texture(usampler2D sampler, vec2 P);
vec4 texture( sampler3D sampler, vec3 P);
ivec4 texture(isampler3D sampler, vec3 P);
uvec4 texture(usampler3D sampler, vec3 P);
vec4 texture( samplerCube sampler, vec3 P);
ivec4 texture(isamplerCube sampler, vec3 P);
uvec4 texture(usamplerCube sampler, vec3 P);
float texture(sampler1DShadow sampler, vec3 P);
float texture(sampler2DShadow sampler, vec3 P);
float texture(samplerCubeShadow sampler, vec4 P);
vec4 texture( sampler1DArray sampler, vec2 P);
ivec4 texture(isampler1DArray sampler, vec2 P);
uvec4 texture(usampler1DArray sampler, vec2 P);
vec4 texture( sampler2DArray sampler, vec3 P);
ivec4 texture(isampler2DArray sampler, vec3 P);
uvec4 texture(usampler2DArray sampler, vec3 P);
float texture(sampler1DArrayShadow sampler, vec3 P);
float texture(sampler2DArrayShadow sampler, vec4 P);
/* texture - bias variants */
vec4 texture( sampler1D sampler, float P, float bias);
ivec4 texture(isampler1D sampler, float P, float bias);
uvec4 texture(usampler1D sampler, float P, float bias);
vec4 texture( sampler2D sampler, vec2 P, float bias);
ivec4 texture(isampler2D sampler, vec2 P, float bias);
uvec4 texture(usampler2D sampler, vec2 P, float bias);
vec4 texture( sampler3D sampler, vec3 P, float bias);
ivec4 texture(isampler3D sampler, vec3 P, float bias);
uvec4 texture(usampler3D sampler, vec3 P, float bias);
vec4 texture( samplerCube sampler, vec3 P, float bias);
ivec4 texture(isamplerCube sampler, vec3 P, float bias);
uvec4 texture(usamplerCube sampler, vec3 P, float bias);
float texture(sampler1DShadow sampler, vec3 P, float bias);
float texture(sampler2DShadow sampler, vec3 P, float bias);
float texture(samplerCubeShadow sampler, vec4 P, float bias);
vec4 texture( sampler1DArray sampler, vec2 P, float bias);
ivec4 texture(isampler1DArray sampler, vec2 P, float bias);
uvec4 texture(usampler1DArray sampler, vec2 P, float bias);
vec4 texture( sampler2DArray sampler, vec3 P, float bias);
ivec4 texture(isampler2DArray sampler, vec3 P, float bias);
uvec4 texture(usampler2DArray sampler, vec3 P, float bias);
float texture(sampler1DArrayShadow sampler, vec3 P, float bias);
/* textureProj - no bias */
vec4 textureProj( sampler1D sampler, vec2 P);
ivec4 textureProj(isampler1D sampler, vec2 P);
uvec4 textureProj(usampler1D sampler, vec2 P);
vec4 textureProj( sampler1D sampler, vec4 P);
ivec4 textureProj(isampler1D sampler, vec4 P);
uvec4 textureProj(usampler1D sampler, vec4 P);
vec4 textureProj( sampler2D sampler, vec3 P);
ivec4 textureProj(isampler2D sampler, vec3 P);
uvec4 textureProj(usampler2D sampler, vec3 P);
vec4 textureProj( sampler2D sampler, vec4 P);
ivec4 textureProj(isampler2D sampler, vec4 P);
uvec4 textureProj(usampler2D sampler, vec4 P);
vec4 textureProj( sampler3D sampler, vec4 P);
ivec4 textureProj(isampler3D sampler, vec4 P);
uvec4 textureProj(usampler3D sampler, vec4 P);
float textureProj(sampler1DShadow sampler, vec4 P);
float textureProj(sampler2DShadow sampler, vec4 P);
/* textureProj - bias variants */
vec4 textureProj( sampler1D sampler, vec2 P, float bias);
ivec4 textureProj(isampler1D sampler, vec2 P, float bias);
uvec4 textureProj(usampler1D sampler, vec2 P, float bias);
vec4 textureProj( sampler1D sampler, vec4 P, float bias);
ivec4 textureProj(isampler1D sampler, vec4 P, float bias);
uvec4 textureProj(usampler1D sampler, vec4 P, float bias);
vec4 textureProj( sampler2D sampler, vec3 P, float bias);
ivec4 textureProj(isampler2D sampler, vec3 P, float bias);
uvec4 textureProj(usampler2D sampler, vec3 P, float bias);
vec4 textureProj( sampler2D sampler, vec4 P, float bias);
ivec4 textureProj(isampler2D sampler, vec4 P, float bias);
uvec4 textureProj(usampler2D sampler, vec4 P, float bias);
vec4 textureProj( sampler3D sampler, vec4 P, float bias);
ivec4 textureProj(isampler3D sampler, vec4 P, float bias);
uvec4 textureProj(usampler3D sampler, vec4 P, float bias);
float textureProj(sampler1DShadow sampler, vec4 P, float bias);
float textureProj(sampler2DShadow sampler, vec4 P, float bias);
/* textureLod */
vec4 textureLod( sampler1D sampler, float P, float lod);
ivec4 textureLod(isampler1D sampler, float P, float lod);
uvec4 textureLod(usampler1D sampler, float P, float lod);
vec4 textureLod( sampler2D sampler, vec2 P, float lod);
ivec4 textureLod(isampler2D sampler, vec2 P, float lod);
uvec4 textureLod(usampler2D sampler, vec2 P, float lod);
vec4 textureLod( sampler3D sampler, vec3 P, float lod);
ivec4 textureLod(isampler3D sampler, vec3 P, float lod);
uvec4 textureLod(usampler3D sampler, vec3 P, float lod);
vec4 textureLod( samplerCube sampler, vec3 P, float lod);
ivec4 textureLod(isamplerCube sampler, vec3 P, float lod);
uvec4 textureLod(usamplerCube sampler, vec3 P, float lod);
float textureLod(sampler1DShadow sampler, vec3 P, float lod);
float textureLod(sampler2DShadow sampler, vec3 P, float lod);
vec4 textureLod( sampler1DArray sampler, vec2 P, float lod);
ivec4 textureLod(isampler1DArray sampler, vec2 P, float lod);
uvec4 textureLod(usampler1DArray sampler, vec2 P, float lod);
vec4 textureLod( sampler2DArray sampler, vec3 P, float lod);
ivec4 textureLod(isampler2DArray sampler, vec3 P, float lod);
uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod);
float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod);
#if 0
/* textureOffset - no bias */
vec4 textureOffset( sampler1D sampler, float P, int offset);
ivec4 textureOffset(isampler1D sampler, float P, int offset);
uvec4 textureOffset(usampler1D sampler, float P, int offset);
vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset);
ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset);
uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset);
vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset);
ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset);
uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset);
float textureOffset(sampler1DShadow sampler, vec3 P, int offset);
float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset);
vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset);
ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset);
uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset);
vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset);
ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset);
uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset);
float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset);
/* textureOffset - bias variants */
vec4 textureOffset( sampler1D sampler, float P, int offset, float bias);
ivec4 textureOffset(isampler1D sampler, float P, int offset, float bias);
uvec4 textureOffset(usampler1D sampler, float P, int offset, float bias);
vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset, float bias);
ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset, float bias);
uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset, float bias);
vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset, float bias);
ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias);
uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias);
float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias);
float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias);
vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset, float bias);
ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset, float bias);
uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset, float bias);
vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset, float bias);
ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias);
uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias);
float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias);
#endif
/* texelFetch */
vec4 texelFetch( sampler1D sampler, int P, int lod);
ivec4 texelFetch(isampler1D sampler, int P, int lod);
uvec4 texelFetch(usampler1D sampler, int P, int lod);
vec4 texelFetch( sampler2D sampler, ivec2 P, int lod);
ivec4 texelFetch(isampler2D sampler, ivec2 P, int lod);
uvec4 texelFetch(usampler2D sampler, ivec2 P, int lod);
vec4 texelFetch( sampler3D sampler, ivec3 P, int lod);
ivec4 texelFetch(isampler3D sampler, ivec3 P, int lod);
uvec4 texelFetch(usampler3D sampler, ivec3 P, int lod);
vec4 texelFetch( sampler1DArray sampler, ivec2 P, int lod);
ivec4 texelFetch(isampler1DArray sampler, ivec2 P, int lod);
uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod);
vec4 texelFetch( sampler2DArray sampler, ivec3 P, int lod);
ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod);
uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod);
#if 0
/* texelFetchOffset */
vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset);
ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset);
uvec4 texelFetchOffset(usampler1D sampler, int P, int lod, int offset);
vec4 texelFetchOffset( sampler2D sampler, ivec2 P, int lod, ivec2 offset);
ivec4 texelFetchOffset(isampler2D sampler, ivec2 P, int lod, ivec2 offset);
uvec4 texelFetchOffset(usampler2D sampler, ivec2 P, int lod, ivec2 offset);
vec4 texelFetchOffset( sampler3D sampler, ivec3 P, int lod, ivec3 offset);
ivec4 texelFetchOffset(isampler3D sampler, ivec3 P, int lod, ivec3 offset);
uvec4 texelFetchOffset(usampler3D sampler, ivec3 P, int lod, ivec3 offset);
vec4 texelFetchOffset( sampler1DArray sampler, ivec2 P, int lod, int offset);
ivec4 texelFetchOffset(isampler1DArray sampler, ivec2 P, int lod, int offset);
uvec4 texelFetchOffset(usampler1DArray sampler, ivec2 P, int lod, int offset);
vec4 texelFetchOffset( sampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
ivec4 texelFetchOffset(isampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
uvec4 texelFetchOffset(usampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
/* textureProjOffset - no bias */
vec4 textureProj( sampler1D sampler, vec2 P, int offset);
ivec4 textureProj(isampler1D sampler, vec2 P, int offset);
uvec4 textureProj(usampler1D sampler, vec2 P, int offset);
vec4 textureProj( sampler1D sampler, vec4 P, int offset);
ivec4 textureProj(isampler1D sampler, vec4 P, int offset);
uvec4 textureProj(usampler1D sampler, vec4 P, int offset);
vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset);
ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset);
uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset);
vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset);
ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset);
uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset);
vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset);
ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset);
uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset);
float textureProj(sampler1DShadow sampler, vec4 P, int offset);
float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset);
/* textureProjOffset - bias variants */
vec4 textureProj( sampler1D sampler, vec2 P, int offset, float bias);
ivec4 textureProj(isampler1D sampler, vec2 P, int offset, float bias);
uvec4 textureProj(usampler1D sampler, vec2 P, int offset, float bias);
vec4 textureProj( sampler1D sampler, vec4 P, int offset, float bias);
ivec4 textureProj(isampler1D sampler, vec4 P, int offset, float bias);
uvec4 textureProj(usampler1D sampler, vec4 P, int offset, float bias);
vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset, float bias);
ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset, float bias);
uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset, float bias);
vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset, float bias);
ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset, float bias);
uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset, float bias);
vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset, float bias);
ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset, float bias);
uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset, float bias);
float textureProj(sampler1DShadow sampler, vec4 P, int offset, float bias);
float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias);
/* textureLodOffset */
vec4 textureLodOffset( sampler1D sampler, float P, float lod, int offset);
ivec4 textureLodOffset(isampler1D sampler, float P, float lod, int offset);
uvec4 textureLodOffset(usampler1D sampler, float P, float lod, int offset);
vec4 textureLodOffset( sampler2D sampler, vec2 P, float lod, ivec2 offset);
ivec4 textureLodOffset(isampler2D sampler, vec2 P, float lod, ivec2 offset);
uvec4 textureLodOffset(usampler2D sampler, vec2 P, float lod, ivec2 offset);
vec4 textureLodOffset( sampler3D sampler, vec3 P, float lod, ivec3 offset);
ivec4 textureLodOffset(isampler3D sampler, vec3 P, float lod, ivec3 offset);
uvec4 textureLodOffset(usampler3D sampler, vec3 P, float lod, ivec3 offset);
float textureLodOffset(sampler1DShadow samp, vec3 P, float lod, int offset);
float textureLodOffset(sampler2DShadow samp, vec3 P, float lod, ivec2 offset);
vec4 textureLodOffset( sampler1DArray sampler, vec2 P, float lod, int offset);
ivec4 textureLodOffset(isampler1DArray sampler, vec2 P, float lod, int offset);
uvec4 textureLodOffset(usampler1DArray sampler, vec2 P, float lod, int offset);
vec4 textureLodOffset( sampler2DArray samp, vec3 P, float lod, ivec2 offset);
ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset);
uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset);
float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset);
#endif
/* textureProjLod */
vec4 textureProjLod( sampler1D sampler, vec2 P, float lod);
ivec4 textureProjLod(isampler1D sampler, vec2 P, float lod);
uvec4 textureProjLod(usampler1D sampler, vec2 P, float lod);
vec4 textureProjLod( sampler1D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler1D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler1D sampler, vec4 P, float lod);
vec4 textureProjLod( sampler2D sampler, vec3 P, float lod);
ivec4 textureProjLod(isampler2D sampler, vec3 P, float lod);
uvec4 textureProjLod(usampler2D sampler, vec3 P, float lod);
vec4 textureProjLod( sampler2D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler2D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler2D sampler, vec4 P, float lod);
vec4 textureProjLod( sampler3D sampler, vec4 P, float lod);
ivec4 textureProjLod(isampler3D sampler, vec4 P, float lod);
uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod);
float textureProjLod(sampler1DShadow sampler, vec4 P, float lod);
float textureProjLod(sampler2DShadow sampler, vec4 P, float lod);
#if 0
/* textureProjLodOffset */
vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset);
ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset);
uvec4 textureProjLodOffset(usampler1D sampler, vec2 P, float lod, int offset);
vec4 textureProjLodOffset( sampler1D sampler, vec4 P, float lod, int offset);
ivec4 textureProjLodOffset(isampler1D sampler, vec4 P, float lod, int offset);
uvec4 textureProjLodOffset(usampler1D sampler, vec4 P, float lod, int offset);
vec4 textureProjLodOffset( sampler2D sampler, vec3 P, float lod, ivec2 offset);
ivec4 textureProjLodOffset(isampler2D sampler, vec3 P, float lod, ivec2 offset);
uvec4 textureProjLodOffset(usampler2D sampler, vec3 P, float lod, ivec2 offset);
vec4 textureProjLodOffset( sampler2D sampler, vec4 P, float lod, ivec2 offset);
ivec4 textureProjLodOffset(isampler2D sampler, vec4 P, float lod, ivec2 offset);
uvec4 textureProjLodOffset(usampler2D sampler, vec4 P, float lod, ivec2 offset);
vec4 textureProjLodOffset( sampler3D sampler, vec4 P, float lod, ivec3 offset);
ivec4 textureProjLodOffset(isampler3D sampler, vec4 P, float lod, ivec3 offset);
uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset);
float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset);
float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset);
#endif
/* textureGrad */
vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy);
ivec4 textureGrad(isampler1D sampler, float P, float dPdx, float dPdy);
uvec4 textureGrad(usampler1D sampler, float P, float dPdx, float dPdy);
vec4 textureGrad( sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
ivec4 textureGrad(isampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
uvec4 textureGrad(usampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
vec4 textureGrad( sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
ivec4 textureGrad(isampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
uvec4 textureGrad(usampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
vec4 textureGrad( samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
ivec4 textureGrad(isamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
uvec4 textureGrad(usamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy);
float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy);
vec4 textureGrad( sampler1DArray sampler, vec2 P, float dPdx, float dPdy);
ivec4 textureGrad(isampler1DArray sampler, vec2 P, float dPdx, float dPdy);
uvec4 textureGrad(usampler1DArray sampler, vec2 P, float dPdx, float dPdy);
vec4 textureGrad( sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
ivec4 textureGrad(isampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy);
float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
#if 0
/* textureGradOffset */
vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off);
ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset);
uvec4 textureGradOffset(usampler1D s, float P, float dx, float dy, int offset);
vec4 textureGradOffset( sampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
ivec4 textureGradOffset(isampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
uvec4 textureGradOffset(usampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset);
vec4 textureGradOffset( sampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
ivec4 textureGradOffset(isampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
uvec4 textureGradOffset(usampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
vec4 textureGradOffset( samplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
ivec4 textureGradOffset(isamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
uvec4 textureGradOffset(usamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset);
float textureGradOffset(sampler1DShadow s, vec3 P, float dx, float dy, int off);
float textureGradOffset(sampler2DShadow s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureGradOffset( sampler1DArray s, vec2 P, float dx, float dy, int off);
ivec4 textureGradOffset(isampler1DArray s, vec2 P, float dx, float dy, int off);
uvec4 textureGradOffset(usampler1DArray s, vec2 P, float dx, float dy, int off);
vec4 textureGradOffset( sampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureGradOffset(isampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o);
float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o);
#endif
/* textureProjGrad */
vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy);
ivec4 textureProjGrad(isampler1D sampler, vec2 P, float dPdx, float dPdy);
uvec4 textureProjGrad(usampler1D sampler, vec2 P, float dPdx, float dPdy);
vec4 textureProjGrad( sampler1D sampler, vec4 P, float dPdx, float dPdy);
ivec4 textureProjGrad(isampler1D sampler, vec4 P, float dPdx, float dPdy);
uvec4 textureProjGrad(usampler1D sampler, vec4 P, float dPdx, float dPdy);
vec4 textureProjGrad( sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
ivec4 textureProjGrad(isampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
uvec4 textureProjGrad(usampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
vec4 textureProjGrad( sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
ivec4 textureProjGrad(isampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
uvec4 textureProjGrad(usampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
vec4 textureProjGrad( sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
ivec4 textureProjGrad(isampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy);
float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
#if 0
/* textureProjGradOffset */
vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off);
ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off);
uvec4 textureProjGradOffset(usampler1D s, vec2 P, float dx, float dy, int off);
vec4 textureProjGradOffset( sampler1D s, vec4 P, float dx, float dy, int off);
ivec4 textureProjGradOffset(isampler1D s, vec4 P, float dx, float dy, int off);
uvec4 textureProjGradOffset(usampler1D s, vec4 P, float dx, float dy, int off);
vec4 textureProjGradOffset( sampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureProjGradOffset(isampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureProjGradOffset(usampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureProjGradOffset( sampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
ivec4 textureProjGradOffset(isampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
uvec4 textureProjGradOffset(usampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
vec4 textureProjGradOffset( sampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
ivec4 textureProjGradOffset(isampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off);
float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o);
float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o);
#endif
/*
* The following texture functions are deprecated:
*/
vec4 texture1D (sampler1D sampler, float coord);
vec4 texture1DProj (sampler1D sampler, vec2 coord);
vec4 texture1DProj (sampler1D sampler, vec4 coord);
vec4 texture1D (sampler1D sampler, float coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias);
vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias);
vec4 texture1DLod (sampler1D sampler, float coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
vec4 texture2D (sampler2D sampler, vec2 coord);
vec4 texture2DProj (sampler2D sampler, vec3 coord);
vec4 texture2DProj (sampler2D sampler, vec4 coord);
vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);
vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
vec4 texture3D (sampler3D sampler, vec3 coord);
vec4 texture3DProj (sampler3D sampler, vec4 coord);
vec4 texture3D (sampler3D sampler, vec3 coord, float bias);
vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias);
vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
vec4 textureCube (samplerCube sampler, vec3 coord);
vec4 textureCube (samplerCube sampler, vec3 coord, float bias);
vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord);
vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias);
vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias);
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias);
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias);
vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod);
vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod);
vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
/*
* 8.8 - Fragment Processing Functions (none in vertex shader)
*/
/*
* 8.9 - Noise Functions
*/
float noise1(float x);
float noise1(vec2 x);
float noise1(vec3 x);
float noise1(vec4 x);
vec2 noise2(float x);
vec2 noise2(vec2 x);
vec2 noise2(vec3 x);
vec2 noise2(vec4 x);
vec3 noise3(float x);
vec3 noise3(vec2 x);
vec3 noise3(vec3 x);
vec3 noise3(vec4 x);
vec4 noise4(float x);
vec4 noise4(vec2 x);
vec4 noise4(vec3 x);
vec4 noise4(vec4 x);

View file

@ -0,0 +1,7 @@
#extension GL_ARB_texture_rectangle : enable
vec4 texture2DRect(sampler2DRect sampler, vec2 coord);
vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord);
vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord);
vec4 shadow2DRect(sampler2DRectShadow sampler, vec3 coord);
vec4 shadow2DRectProj(sampler2DRectShadow sampler, vec4 coord);

View file

@ -0,0 +1,7 @@
#extension GL_ARB_texture_rectangle : enable
vec4 texture2DRect(sampler2DRect sampler, vec2 coord);
vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord);
vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord);
vec4 shadow2DRect(sampler2DRectShadow sampler, vec3 coord);
vec4 shadow2DRectProj(sampler2DRectShadow sampler, vec4 coord);

View file

@ -0,0 +1,11 @@
#extension GL_EXT_texture_array : enable
vec4 texture1DArray(sampler1DArray sampler, vec2 coord);
vec4 texture1DArray(sampler1DArray sampler, vec2 coord, float bias);
vec4 texture2DArray(sampler1DArray sampler, vec2 coord);
vec4 texture2DArray(sampler1DArray sampler, vec2 coord, float bias);
vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord);
vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord, float bias);
vec4 shadow2DArray(sampler2DArrayShadow sampler, vec4 coord);

View file

@ -0,0 +1,11 @@
#extension GL_EXT_texture_array : enable
vec4 texture1DArray(sampler1DArray sampler, vec2 coord);
vec4 texture1DArrayLod(sampler1DArray sampler, vec2 coord, float lod);
vec4 texture2DArray(sampler1DArray sampler, vec2 coord);
vec4 texture2DArrayLod(sampler1DArray sampler, vec2 coord, float lod);
vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord);
vec4 shadow1DArrayLod(sampler1DArrayShadow sampler, vec3 coord, float lod);
vec4 shadow2DArray(sampler2DArrayShadow sampler, vec4 coord);

View file

@ -0,0 +1,39 @@
/*
* Copyright © 2010 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include <stdio.h>
#include "glsl_parser_extras.h"
/* A dummy file. When compiling prototypes, we don't care about builtins.
* We really don't want to half-compile builtin_functions.cpp and fail, though.
*/
void
_mesa_glsl_release_functions(void)
{
}
void
_mesa_glsl_initialize_functions(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
}

View file

@ -0,0 +1,207 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re, glob, sys
from os import path
from subprocess import Popen, PIPE
# Local module: generator for texture lookup builtins
from texture_builtins import generate_texture_functions
builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..")
# Read the files in builtins/ir/*...add them to the supplied dictionary.
def read_ir_files(fs):
for filename in glob.glob(path.join(path.join(builtins_dir, 'ir'), '*')):
with open(filename) as f:
fs[path.basename(filename)] = f.read()
# Return a dictionary containing all builtin definitions (even generated)
def get_builtin_definitions():
fs = {}
generate_texture_functions(fs)
read_ir_files(fs)
return fs
def stringify(s):
t = s.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n"\n "')
return ' "' + t + '"\n'
def write_function_definitions():
fs = get_builtin_definitions()
for k, v in fs.iteritems():
print 'static const char *builtin_' + k + ' ='
print stringify(v), ';'
def run_compiler(args):
compiler_path = path.join(path.join(builtins_dir, '..'), 'glsl_compiler')
command = [compiler_path, '--dump-lir'] + args
p = Popen(command, 1, stdout=PIPE, shell=False)
output = p.communicate()[0]
return (output, p.returncode)
def write_profile(filename, profile):
(proto_ir, returncode) = run_compiler([filename])
if returncode != 0:
print '#error builtins profile', profile, 'failed to compile'
return
# Kill any global variable declarations. We don't want them.
kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE);
proto_ir = kill_globals.sub('', proto_ir)
print 'static const char *prototypes_for_' + profile + ' ='
print stringify(proto_ir), ';'
# Print a table of all the functions (not signatures) referenced.
# This is done so we can avoid bothering with a hash table in the C++ code.
function_names = set()
for func in re.finditer(r'\(function (.+)\n', proto_ir):
function_names.add(func.group(1))
print 'static const char *functions_for_' + profile + ' [] = {'
for func in function_names:
print ' builtin_' + func + ','
print '};'
def write_profiles():
profiles = get_profile_list()
for (filename, profile) in profiles:
write_profile(filename, profile)
def get_profile_list():
profiles = []
for pfile in glob.glob(path.join(path.join(builtins_dir, 'profiles'), '*')):
profiles.append((pfile, path.basename(pfile).replace('.', '_')))
return profiles
if __name__ == "__main__":
print """/* DO NOT MODIFY - automatically generated by generate_builtins.py */
/*
* Copyright © 2010 Intel Corporation
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include <stdio.h>
#include "main/compiler.h"
#include "glsl_parser_extras.h"
#include "ir_reader.h"
#include "program.h"
#include "ast.h"
extern "C" struct gl_shader *
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
new(sh) _mesa_glsl_parse_state(NULL, target, sh);
st->language_version = 130;
st->ARB_texture_rectangle_enable = true;
st->EXT_texture_array_enable = true;
_mesa_glsl_initialize_types(st);
sh->ir = new(sh) exec_list;
sh->symbols = st->symbols;
/* Read the IR containing the prototypes */
_mesa_glsl_read_ir(st, sh->ir, protos, true);
/* Read ALL the function bodies, telling the IR reader not to scan for
* prototypes (we've already created them). The IR reader will skip any
* signature that does not already exist as a prototype.
*/
for (unsigned i = 0; i < count; i++) {
_mesa_glsl_read_ir(st, sh->ir, functions[i], false);
if (st->error) {
printf("error reading builtin: %.35s ...\\n", functions[i]);
talloc_free(sh);
return NULL;
}
}
reparent_ir(sh->ir, sh);
delete st;
return sh;
}
"""
write_function_definitions()
write_profiles()
print """
void *builtin_mem_ctx = NULL;
void
_mesa_glsl_release_functions(void)
{
talloc_free(builtin_mem_ctx);
}
void
_mesa_glsl_initialize_functions(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (builtin_mem_ctx == NULL)
builtin_mem_ctx = talloc_init("GLSL built-in functions");
state->num_builtins_to_link = 0;
"""
profiles = get_profile_list()
for (filename, profile) in profiles:
if profile.endswith('_vert'):
check = 'state->target == vertex_shader && '
elif profile.endswith('_frag'):
check = 'state->target == fragment_shader && '
version = re.sub(r'_(vert|frag)$', '', profile)
if version.isdigit():
check += 'state->language_version == ' + version
else: # an extension name
check += 'state->' + version + '_enable'
print ' if (' + check + ') {'
print ' static gl_shader *sh = NULL;'
print ' if (sh == NULL) {'
print ' sh = read_builtins(GL_VERTEX_SHADER,'
print ' prototypes_for_' + profile + ','
print ' functions_for_' + profile + ','
print ' Elements(functions_for_' + profile,
print '));'
print ' talloc_steal(builtin_mem_ctx, sh);'
print ' }'
print
print ' import_prototypes(sh->ir, instructions, state->symbols,'
print ' state);'
print ' state->builtins_to_link[state->num_builtins_to_link] = sh;'
print ' state->num_builtins_to_link++;'
print ' }'
print
print '}'

View file

@ -0,0 +1,28 @@
#!/usr/bin/python
def gen_matrix(x, y = 0):
if y == 0:
y = x
type = "mat" + str(x)
if x != y:
type = type + "x" + str(y)
print type + " matrixCompMult(" + type + " x, " + type + " y)\n{"
print " " + type + " z;"
for i in range(x):
print " z[" + str(i) + "] = x[" + str(i) + "] * y[" + str(i) + "];"
print " return z;\n}"
print "#version 120"
# 1.10
gen_matrix(2)
gen_matrix(3)
gen_matrix(4)
# 1.20
gen_matrix(2,3) # mat2x3 means 2 columns, 3 rows
gen_matrix(3,2)
gen_matrix(2,4)
gen_matrix(4,2)
gen_matrix(3,4)
gen_matrix(4,3)

View file

@ -0,0 +1,23 @@
#!/usr/bin/python
def gen(x, y):
type = "mat" + str(x)
if x != y:
type = type + "x" + str(y)
print type + " outerProduct(vec" + str(y) + " u, vec" + str(x) + " v)\n{"
print " " + type + " m;"
for i in range(x):
print " m[" + str(i) + "] = u * v[" + str(i) + "];"
print " return m;\n}"
print "#version 120"
gen(2,2)
gen(2,3) # mat2x3 means 2 columns, 3 rows
gen(2,4)
gen(3,2)
gen(3,3)
gen(3,4)
gen(4,2)
gen(4,3)
gen(4,4)

View file

@ -0,0 +1,28 @@
#!/usr/bin/python
def gen(x, y):
origtype = "mat" + str(x)
trantype = "mat" + str(y)
if x != y:
origtype = origtype + "x" + str(y)
trantype = trantype + "x" + str(x)
print trantype + " transpose(" + origtype + " m)\n{"
print " " + trantype + " t;"
# The obvious implementation of transpose
for i in range(x):
for j in range(y):
print " t[" + str(j) + "][" + str(i) + "] =",
print "m[" + str(i) + "][" + str(j) + "];"
print " return t;\n}"
print "#version 120"
gen(2,2)
gen(2,3) # mat2x3 means 2 columns, 3 rows
gen(2,4)
gen(3,2)
gen(3,3)
gen(3,4)
gen(4,2)
gen(4,3)
gen(4,4)

View file

@ -0,0 +1,349 @@
#!/usr/bin/python
import sys
import StringIO
def vec_type(g, size):
if size == 1:
if g == "i":
return "int"
elif g == "u":
return "uint"
return "float"
return g + "vec" + str(size)
# Get the base dimension - i.e. sampler3D gives 3
# Array samplers also get +1 here since the layer is really an extra coordinate
def get_coord_dim(sampler_type):
if sampler_type[0].isdigit():
coord_dim = int(sampler_type[0])
elif sampler_type.startswith("Cube"):
coord_dim = 3
else:
assert False ("coord_dim: invalid sampler_type: " + sampler_type)
if sampler_type.find("Array") != -1:
coord_dim += 1
return coord_dim
# Get the number of extra vector components (i.e. shadow comparitor)
def get_extra_dim(sampler_type, use_proj, unused_fields):
extra_dim = unused_fields
if sampler_type.find("Shadow") != -1:
extra_dim += 1
if use_proj:
extra_dim += 1
return extra_dim
def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0):
coord_dim = get_coord_dim(sampler_type)
extra_dim = get_extra_dim(sampler_type, use_proj, unused_fields)
# Print parameters
print " (signature " + g + "vec4"
print " (parameters"
print " (declare (in) " + g + "sampler" + sampler_type + " sampler)"
print " (declare (in) " + vec_type("i" if tex_inst == "txf" else "", coord_dim + extra_dim) + " P)",
if tex_inst == "txb":
print "\n (declare (in) float bias)",
elif tex_inst == "txl":
print "\n (declare (in) float lod)",
elif tex_inst == "txf":
print "\n (declare (in) int lod)",
elif tex_inst == "txd":
grad_type = vec_type("", coord_dim)
print "\n (declare (in) " + grad_type + " dPdx)",
print "\n (declare (in) " + grad_type + " dPdy)",
print ")\n ((return (" + tex_inst + " (var_ref sampler)",
# Coordinate
if extra_dim > 0:
print "(swiz " + "xyzw"[:coord_dim] + " (var_ref P))",
else:
print "(var_ref P)",
# Offset
print "(0 0 0)",
if tex_inst != "txf":
# Projective divisor
if use_proj:
print "(swiz " + "xyzw"[coord_dim + extra_dim-1] + " (var_ref P))",
else:
print "1",
# Shadow comparitor
if sampler_type == "2DArrayShadow": # a special case:
print "(swiz w (var_ref P))", # ...array layer is z; shadow is w
elif sampler_type.endswith("Shadow"):
print "(swiz z (var_ref P))",
else:
print "()",
# Bias/explicit LOD/gradient:
if tex_inst == "txb":
print "(var_ref bias)",
elif tex_inst == "txl" or tex_inst == "txf":
print "(var_ref lod)",
elif tex_inst == "txd":
print "((var_ref dPdx) (var_ref dPdy))",
print "))))\n"
def generate_fiu_sigs(tex_inst, sampler_type, use_proj = False, unused_fields = 0):
generate_sigs("", tex_inst, sampler_type, use_proj, unused_fields)
generate_sigs("i", tex_inst, sampler_type, use_proj, unused_fields)
generate_sigs("u", tex_inst, sampler_type, use_proj, unused_fields)
def start_function(name):
sys.stdout = StringIO.StringIO()
print "((function " + name
def end_function(fs, name):
print "))"
fs[name] = sys.stdout.getvalue();
sys.stdout.close()
# Generate all the functions and store them in the supplied dictionary.
# This is better than writing them to actual files since they should never be
# edited; it'd also be easy to confuse them with the many hand-generated files.
#
# Takes a dictionary as an argument.
def generate_texture_functions(fs):
start_function("texture")
generate_fiu_sigs("tex", "1D")
generate_fiu_sigs("tex", "2D")
generate_fiu_sigs("tex", "3D")
generate_fiu_sigs("tex", "Cube")
generate_fiu_sigs("tex", "1DArray")
generate_fiu_sigs("tex", "2DArray")
generate_fiu_sigs("txb", "1D")
generate_fiu_sigs("txb", "2D")
generate_fiu_sigs("txb", "3D")
generate_fiu_sigs("txb", "Cube")
generate_fiu_sigs("txb", "1DArray")
generate_fiu_sigs("txb", "2DArray")
end_function(fs, "texture")
start_function("textureProj")
generate_fiu_sigs("tex", "1D", True)
generate_fiu_sigs("tex", "1D", True, 2)
generate_fiu_sigs("tex", "2D", True)
generate_fiu_sigs("tex", "2D", True, 1)
generate_fiu_sigs("tex", "3D", True)
generate_fiu_sigs("txb", "1D", True)
generate_fiu_sigs("txb", "1D", True, 2)
generate_fiu_sigs("txb", "2D", True)
generate_fiu_sigs("txb", "2D", True, 1)
generate_fiu_sigs("txb", "3D", True)
end_function(fs, "textureProj")
start_function("textureLod")
generate_fiu_sigs("txl", "1D")
generate_fiu_sigs("txl", "2D")
generate_fiu_sigs("txl", "3D")
generate_fiu_sigs("txl", "Cube")
generate_fiu_sigs("txl", "1DArray")
generate_fiu_sigs("txl", "2DArray")
end_function(fs, "textureLod")
start_function("texelFetch")
generate_fiu_sigs("txf", "1D")
generate_fiu_sigs("txf", "2D")
generate_fiu_sigs("txf", "3D")
generate_fiu_sigs("txf", "1DArray")
generate_fiu_sigs("txf", "2DArray")
end_function(fs, "texelFetch")
start_function("textureProjLod")
generate_fiu_sigs("txl", "1D", True)
generate_fiu_sigs("txl", "1D", True, 2)
generate_fiu_sigs("txl", "2D", True)
generate_fiu_sigs("txl", "2D", True, 1)
generate_fiu_sigs("txl", "3D", True)
end_function(fs, "textureProjLod")
start_function("textureGrad")
generate_fiu_sigs("txd", "1D")
generate_fiu_sigs("txd", "2D")
generate_fiu_sigs("txd", "3D")
generate_fiu_sigs("txd", "Cube")
generate_fiu_sigs("txd", "1DArray")
generate_fiu_sigs("txd", "2DArray")
end_function(fs, "textureGrad")
start_function("textureProjGrad")
generate_fiu_sigs("txd", "1D", True)
generate_fiu_sigs("txd", "1D", True, 2)
generate_fiu_sigs("txd", "2D", True)
generate_fiu_sigs("txd", "2D", True, 1)
generate_fiu_sigs("txd", "3D", True)
end_function(fs, "textureProjGrad")
# ARB_texture_rectangle extension
start_function("texture2DRect")
generate_sigs("", "tex", "2DRect")
end_function(fs, "texture2DRect")
start_function("texture2DRectProj")
generate_sigs("", "tex", "2DRect", True)
generate_sigs("", "tex", "2DRect", True, 1)
end_function(fs, "texture2DRectProj")
start_function("shadow2DRect")
generate_sigs("", "tex", "2DRectShadow")
end_function(fs, "shadow2DRect")
start_function("shadow2DRectProj")
generate_sigs("", "tex", "2DRectShadow", True)
end_function(fs, "shadow2DRectProj")
# EXT_texture_array extension
start_function("texture1DArray")
generate_sigs("", "tex", "1DArray")
generate_sigs("", "txb", "1DArray")
end_function(fs, "texture1DArray")
start_function("texture1DArrayLod")
generate_sigs("", "txl", "1DArray")
end_function(fs, "texture1DArrayLod")
start_function("texture2DArray")
generate_sigs("", "tex", "2DArray")
generate_sigs("", "txb", "2DArray")
end_function(fs, "texture2DArray")
start_function("texture2DArrayLod")
generate_sigs("", "txl", "2DArray")
end_function(fs, "texture2DArrayLod")
start_function("shadow1DArray")
generate_sigs("", "tex", "1DArrayShadow")
generate_sigs("", "txb", "1DArrayShadow")
end_function(fs, "shadow1DArray")
start_function("shadow1DArrayLod")
generate_sigs("", "txl", "1DArrayShadow")
end_function(fs, "shadow1DArrayLod")
start_function("shadow2DArray")
generate_sigs("", "tex", "2DArrayShadow")
end_function(fs, "shadow2DArray")
# Deprecated (110/120 style) functions with silly names:
start_function("texture1D")
generate_sigs("", "tex", "1D")
generate_sigs("", "txb", "1D")
end_function(fs, "texture1D")
start_function("texture1DLod")
generate_sigs("", "txl", "1D")
end_function(fs, "texture1DLod")
start_function("texture1DProj")
generate_sigs("", "tex", "1D", True)
generate_sigs("", "tex", "1D", True, 2)
generate_sigs("", "txb", "1D", True)
generate_sigs("", "txb", "1D", True, 2)
end_function(fs, "texture1DProj")
start_function("texture1DProjLod")
generate_sigs("", "txl", "1D", True)
generate_sigs("", "txl", "1D", True, 2)
end_function(fs, "texture1DProjLod")
start_function("texture2D")
generate_sigs("", "tex", "2D")
generate_sigs("", "txb", "2D")
end_function(fs, "texture2D")
start_function("texture2DLod")
generate_sigs("", "txl", "2D")
end_function(fs, "texture2DLod")
start_function("texture2DProj")
generate_sigs("", "tex", "2D", True)
generate_sigs("", "tex", "2D", True, 1)
generate_sigs("", "txb", "2D", True)
generate_sigs("", "txb", "2D", True, 1)
end_function(fs, "texture2DProj")
start_function("texture2DProjLod")
generate_sigs("", "txl", "2D", True)
generate_sigs("", "txl", "2D", True, 1)
end_function(fs, "texture2DProjLod")
start_function("texture3D")
generate_sigs("", "tex", "3D")
generate_sigs("", "txb", "3D")
end_function(fs, "texture3D")
start_function("texture3DLod")
generate_sigs("", "txl", "3D")
end_function(fs, "texture3DLod")
start_function("texture3DProj")
generate_sigs("", "tex", "3D", True)
generate_sigs("", "txb", "3D", True)
end_function(fs, "texture3DProj")
start_function("texture3DProjLod")
generate_sigs("", "txl", "3D", True)
end_function(fs, "texture3DProjLod")
start_function("textureCube")
generate_sigs("", "tex", "Cube")
generate_sigs("", "txb", "Cube")
end_function(fs, "textureCube")
start_function("textureCubeLod")
generate_sigs("", "txl", "Cube")
end_function(fs, "textureCubeLod")
start_function("shadow1D")
generate_sigs("", "tex", "1DShadow", False, 1)
generate_sigs("", "txb", "1DShadow", False, 1)
end_function(fs, "shadow1D")
start_function("shadow1DLod")
generate_sigs("", "txl", "1DShadow", False, 1)
end_function(fs, "shadow1DLod")
start_function("shadow1DProj")
generate_sigs("", "tex", "1DShadow", True, 1)
generate_sigs("", "txb", "1DShadow", True, 1)
end_function(fs, "shadow1DProj")
start_function("shadow1DProjLod")
generate_sigs("", "txl", "1DShadow", True, 1)
end_function(fs, "shadow1DProjLod")
start_function("shadow2D")
generate_sigs("", "tex", "2DShadow")
generate_sigs("", "txb", "2DShadow")
end_function(fs, "shadow2D")
start_function("shadow2DLod")
generate_sigs("", "txl", "2DShadow")
end_function(fs, "shadow2DLod")
start_function("shadow2DProj")
generate_sigs("", "tex", "2DShadow", True)
generate_sigs("", "txb", "2DShadow", True)
end_function(fs, "shadow2DProj")
start_function("shadow2DProjLod")
generate_sigs("", "txl", "2DShadow", True)
end_function(fs, "shadow2DProjLod")
sys.stdout = sys.__stdout__
return fs
# If you actually run this script, it'll print out all the functions.
if __name__ == "__main__":
fs = {}
generate_texture_functions(fs);
for k, v in fs.iteritems():
print v

Some files were not shown because too many files have changed in this diff Show more