Merge commit 'origin/master' into gallium-0.2

This commit is contained in:
Brian Paul 2008-12-16 15:50:14 -07:00
commit b0caa10a85
51 changed files with 5018 additions and 4223 deletions

View file

@ -15,23 +15,46 @@ OpenGL Shading Language</a>.
</p>
<p>
Last updated on 28 March 2007.
Last updated on 15 December 2008.
</p>
<p>
Contents
</p>
<ul>
<li><a href="#120">GLSL 1.20 support</a>
<li><a href="#unsup">Unsupported Features</a>
<li><a href="#notes">Implementation Notes</a>
<li><a href="#hints">Programming Hints</a>
<li><a href="#standalone">Stand-alone GLSL Compiler</a>
<li><a href="#implementation">Compiler Implementation</a>
<li><a href="#validation">Compiler Validation</a>
<li><a href="#120">GLSL 1.20 support</a>
</ul>
<a name="120">
<h2>GLSL 1.20 support</h2>
<p>
GLSL version 1.20 is supported in Mesa 7.3.
Among the features/differences of GLSL 1.20 are:
<ul>
<li><code>mat2x3, mat2x4</code>, etc. types and functions
<li><code>transpose(), outerProduct(), matrixCompMult()</code> functions
(but untested)
<li>precision qualifiers (lowp, mediump, highp)
<li><code>invariant</code> qualifier
<li><code>array.length()</code> method
<li><code>float[5] a;</code> array syntax
<li><code>centroid</code> qualifier
<li>unsized array constructors
<li>initializers for uniforms
<li>const initializers calling built-in functions
</ul>
<a name="unsup">
<h2>Unsupported Features</h2>
@ -41,15 +64,10 @@ in Mesa:
</p>
<ul>
<li>Dereferencing arrays with non-constant indexes
<li>Comparison of user-defined structs
<li>Linking of multiple shaders is not supported
<li>gl_ClipVertex
<li>The derivative functions such as dFdx() are not implemented
<li>The inverse trig functions asin(), acos(), and atan() are not implemented
<li>The gl_Color and gl_SecondaryColor varying vars are interpolated
without perspective correction
<li>Floating point literal suffixes 'f' and 'F' aren't allowed.
</ul>
<p>
@ -304,11 +322,11 @@ Extra NOP instructions will also be inserted.
<h2>Compiler Validation</h2>
<p>
A new <a href="http://glean.sf.net" target="_parent">Glean</a> test has
A <a href="http://glean.sf.net" target="_parent">Glean</a> test has
been create to exercise the GLSL compiler.
</p>
<p>
The <em>glsl1</em> test runs over 150 sub-tests to check that the language
The <em>glsl1</em> test runs over 170 sub-tests to check that the language
features and built-in functions work properly.
This test should be run frequently while working on the compiler to catch
regressions.
@ -319,39 +337,5 @@ should be added.
</p>
<a name="120">
<h2>GLSL 1.20 support</h2>
<p>
Support for GLSL version 1.20 is underway. Status as follows.
</p>
<h3>Supported</h3>
<ul>
<li><code>mat2x3, mat2x4</code>, etc. types and functions
<li><code>transpose(), outerProduct(), matrixCompMult()</code> functions
(but untested)
<li>precision qualifiers (lowp, mediump, highp)
</ul>
<h3>Partially Complete</h3>
<ul>
<li><code>invariant</code> qualifier
</ul>
<h3>Not Completed</h3>
<ul>
<li><code>array.length()</code> method
<li><code>float[5] a;</code> array syntax
<li><code>centroid</code> qualifier
<li>unsized array constructors
<li>initializers for uniforms
<li>const initializers calling built-in functions
</ul>
</BODY>
</HTML>

View file

@ -182,21 +182,41 @@ fillrate.o: fillrate.c readtex.h
floattex: floattex.o readtex.o shaderutil.o
$(CC) $(CFLAGS) $(LDFLAGS) floattex.o readtex.o shaderutil.o $(LIBS) -o $@
floattex.o: floattex.c readtex.h shaderutil.h
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) floattex.c -o $@
readtex.o: readtex.c
$(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) readtex.c -o $@
readtex.h: $(TOP)/progs/util/readtex.h
ln -s $(TOP)/progs/util/readtex.h .
readtex.c: $(TOP)/progs/util/readtex.c
ln -s $(TOP)/progs/util/readtex.c .
extfuncs.h: $(TOP)/progs/util/extfuncs.h
ln -s $(TOP)/progs/util/extfuncs.h .
shaderutil.c: $(TOP)/progs/util/shaderutil.c
cp $< .
shaderutil.h: $(TOP)/progs/util/shaderutil.h
cp $< .
shaderutil.o: shaderutil.c shaderutil.h
$(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find ../include`

View file

@ -9,32 +9,37 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "extfuncs.h"
#include "readtex.h"
#include "shaderutil.h"
/* XXX - temporary */
#ifndef GL_ARB_texture_float
#define GL_ARB_texture_float 1
#define GL_TEXTURE_RED_TYPE_ARB 0x9000
#define GL_TEXTURE_GREEN_TYPE_ARB 0x9001
#define GL_TEXTURE_BLUE_TYPE_ARB 0x9002
#define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003
#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004
#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005
#define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006
#define GL_UNSIGNED_NORMALIZED_ARB 0x9007
#define GL_RGBA32F_ARB 0x8814
#define GL_RGB32F_ARB 0x8815
#define GL_ALPHA32F_ARB 0x8816
#define GL_INTENSITY32F_ARB 0x8817
#define GL_LUMINANCE32F_ARB 0x8818
#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
#define GL_RGBA16F_ARB 0x881A
#define GL_RGB16F_ARB 0x881B
#define GL_ALPHA16F_ARB 0x881C
#define GL_INTENSITY16F_ARB 0x881D
#define GL_LUMINANCE16F_ARB 0x881E
#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
#endif
static const char *TexFile = "../images/arch.rgb";
static const char *FragShaderText =
"uniform sampler2D tex1; \n"
"void main() \n"
"{ \n"
" vec4 t = texture2D(tex1, gl_TexCoord[0].xy); \n"
" // convert from [-255,0] to [0,1] \n"
" gl_FragColor = t * (-1.0 / 255.0); \n"
"} \n";
static const char *VertShaderText =
"void main() \n"
"{ \n"
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
" gl_Position = ftransform(); \n"
"} \n";
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
static GLuint Program;
static GLboolean
@ -57,7 +62,12 @@ Draw(void)
glPushMatrix();
glutSolidCube(2.0);
glBegin(GL_POLYGON);
glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
glEnd();
glPopMatrix();
@ -74,7 +84,7 @@ Reshape(int width, int height)
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
glTranslatef(0.0, 0.0, -8.0);
}
@ -94,31 +104,43 @@ Key(unsigned char key, int x, int y)
static void
Init(void)
InitTexture(void)
{
GLfloat tex[16][16][4];
GLfloat tex2[16][16][4];
GLint i, j, t;
GLenum filter = GL_LINEAR;
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
GLfloat *ftex;
GLint i, t;
if (!glutExtensionSupported("GL_MESAX_texture_float")) {
printf("Sorry, this test requires GL_MESAX_texture_float\n");
exit(1);
image = LoadRGBImage(TexFile, &imgWidth, &imgHeight, &imgFormat);
if (!image) {
printf("Couldn't read %s\n", TexFile);
exit(0);
}
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
GLfloat s = i / 15.0;
tex[i][j][0] = s;
tex[i][j][1] = 2.0 * s;
tex[i][j][2] = -3.0 * s;
tex[i][j][3] = 4.0 * s;
}
assert(imgFormat == GL_RGB);
ftex = (float *) malloc(imgWidth * imgHeight * 4 * sizeof(float));
if (!ftex) {
printf("out of memory\n");
exit(0);
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, 16, 16, 0, GL_RGBA,
GL_FLOAT, tex);
CheckError(__LINE__);
/* convert ubytes to floats, negated */
for (i = 0; i < imgWidth * imgHeight * 3; i++) {
ftex[i] = -1.0f * image[i];
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB,
imgWidth, imgHeight, 0,
GL_RGB, GL_FLOAT, ftex);
/* sanity checks */
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t);
assert(t == GL_FLOAT);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_TYPE_ARB, &t);
@ -128,8 +150,15 @@ Init(void)
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_TYPE_ARB, &t);
assert(t == GL_FLOAT);
CheckError(__LINE__);
free(image);
free(ftex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
#if 0
/* read back the texture and make sure values are correct */
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2);
CheckError(__LINE__);
@ -147,8 +176,49 @@ Init(void)
}
}
}
#endif
}
static GLuint
CreateProgram(void)
{
GLuint fragShader, vertShader, program;
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
assert(program);
// InitUniforms(program, Uniforms);
return program;
}
static void
Init(void)
{
glClearColor(0.25, 0.25, 0.25, 0.0);
GetExtensionFuncs();
if (!ShadersSupported()) {
printf("Sorry, this test requires GLSL\n");
exit(1);
}
if (!glutExtensionSupported("GL_MESAX_texture_float")) {
printf("Sorry, this test requires GL_MESAX_texture_float\n");
exit(1);
}
InitTexture();
Program = CreateProgram();
glUseProgram_func(Program);
}

View file

@ -56,6 +56,7 @@ SOURCES = \
glut_modifier.c \
glut_mroman.c \
glut_overlay.c \
glut_ppm.c \
glut_roman.c \
glut_shapes.c \
glut_space.c \

View file

@ -51,6 +51,7 @@ int __glutInitX = -1, __glutInitY = -1;
GLboolean __glutForceDirect = GL_FALSE,
__glutTryDirect = GL_TRUE;
Atom __glutWMDeleteWindow;
char *__glutPPMFile = NULL;
/* *INDENT-ON* */
#ifdef _WIN32
@ -341,6 +342,9 @@ glutInit(int *argcp, char **argv)
__glutFPS = 5000; /* 5000 milliseconds */
}
}
/* check if GLUT_PPM_FILE env var is set */
__glutPPMFile = getenv("GLUT_PPM_FILE");
}
#ifdef _WIN32

80
src/glut/glx/glut_ppm.c Normal file
View file

@ -0,0 +1,80 @@
/*
* PPM file output
* Brian Paul
* 8 Dec 2008
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "glutint.h"
static void
write_ppm_file(const char *filename, const GLubyte *buffer,
int width, int height)
{
const int binary = 1;
FILE *f = fopen( filename, "w" );
if (f) {
const GLubyte *ptr = buffer;
int i, x, y;
if (binary) {
fprintf(f,"P6\n");
fprintf(f,"# ppm-file created by GLUT\n");
fprintf(f,"%i %i\n", width, height);
fprintf(f,"255\n");
fclose(f);
f = fopen( filename, "ab" ); /* reopen in binary append mode */
for (y = height - 1; y >= 0; y--) {
for (x = 0; x < width; x++) {
i = (y * width + x) * 4;
fputc(ptr[i], f); /* write red */
fputc(ptr[i+1], f); /* write green */
fputc(ptr[i+2], f); /* write blue */
}
}
}
else {
/*ASCII*/
int counter = 0;
fprintf(f,"P3\n");
fprintf(f,"# ascii ppm file created by GLUT\n");
fprintf(f,"%i %i\n", width, height);
fprintf(f,"255\n");
for (y = height - 1; y >= 0; y--) {
for (x = 0; x < width; x++) {
i = (y * width + x) * 4;
fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
counter++;
if (counter % 5 == 0)
fprintf(f, "\n");
}
}
}
fclose(f);
}
}
/**
* Called from SwapBuffers if the GLUT_PPM_FILE env var is set.
*/
void __glutWritePPMFile(void)
{
int w = glutGet(GLUT_WINDOW_WIDTH);
int h = glutGet(GLUT_WINDOW_HEIGHT);
GLubyte *buf;
assert(__glutPPMFile);
buf = (GLubyte *) malloc(w * h * 4);
if (buf) {
/* XXX save/restore pixel packing */
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf);
write_ppm_file(__glutPPMFile, buf, w, h);
free(buf);
}
__glutPPMFile = NULL; /* only write one file */
}

View file

@ -18,6 +18,10 @@ glutSwapBuffers(void)
{
GLUTwindow *window = __glutCurrentWindow;
if (__glutPPMFile) {
__glutWritePPMFile();
}
if (window->renderWin == window->win) {
if (__glutCurrentWindow->treatAsSingle) {
/* Pretend the double buffered window is single buffered,

View file

@ -664,6 +664,7 @@ extern unsigned int __glutModifierMask;
#ifdef _WIN32
extern void (__cdecl *__glutExitFunc)(int retval);
#endif
extern char *__glutPPMFile;
/* private variables from glut_menu.c */
extern GLUTmenuItem *__glutItemSelected;
@ -684,6 +685,9 @@ extern void __glutFreeOverlay(GLUToverlay * overlay);
extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle,
Bool * visAlloced, void **fbc);
/* private variables from glut_ppm.c */
extern void __glutWritePPMFile(void);
/* private variables from glut_mesa.c */
extern int __glutMesaSwapHackSupport;
@ -812,4 +816,5 @@ extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l);
extern HDC XHDC;
#endif
#endif /* __glutint_h__ */

View file

@ -309,12 +309,12 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (first_time || (brw->state.dirty.brw & BRW_NEW_PRIMITIVE)) {
first_time = GL_FALSE;
brw_validate_state(brw);
/* Various fallback checks: */
if (brw->intel.Fallback)
goto out;
brw_validate_state(brw);
/* Check that we can fit our state in with our existing batchbuffer, or
* flush otherwise.
*/

View file

@ -231,6 +231,7 @@ intelInitTextureFuncs(struct dd_function_table *functions)
/* compressed texture functions */
functions->CompressedTexImage2D = intelCompressedTexImage2D;
functions->CompressedTexSubImage2D = intelCompressedTexSubImage2D;
functions->GetCompressedTexImage = intelGetCompressedTexImage;
functions->NewTextureObject = intelNewTextureObject;

View file

@ -130,6 +130,16 @@ void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
void intelCompressedTexSubImage2D(GLcontext * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize,
const GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,

View file

@ -184,3 +184,18 @@ intelTexSubImage1D(GLcontext * ctx,
format, type, pixels, packing, texObj, texImage);
}
void
intelCompressedTexSubImage2D(GLcontext * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize,
const GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
fprintf(stderr, "stubbed CompressedTexSubImage2D: %dx%d@%dx%d\n",
width, height, xoffset, yoffset);
}

99
src/mesa/main/dlopen.c Normal file
View file

@ -0,0 +1,99 @@
/*
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Wrapper functions for dlopen(), dlsym(), dlclose().
* Note that the #ifdef tests for various environments should be expanded.
*/
#include "glheader.h"
#include "imports.h"
#include "dlopen.h"
#if defined(_GNU_SOURCE) && !defined(__MINGW32__)
#include <dlfcn.h>
#endif
/**
* Wrapper for dlopen().
* Note that 'flags' isn't used at this time.
*/
void *
_mesa_dlopen(const char *libname, int flags)
{
#if defined(_GNU_SOURCE)
flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
return dlopen(libname, flags);
#elif defined(__MINGW32__)
return LoadLibrary(libname);
#else
return NULL;
#endif
}
/**
* Wrapper for dlsym() that does a cast to a generic function type,
* rather than a void *. This reduces the number of warnings that are
* generated.
*/
GenericFunc
_mesa_dlsym(void *handle, const char *fname)
{
#if defined(__DJGPP__)
/* need '_' prefix on symbol names */
char fname2[1000];
fname2[0] = '_';
_mesa_strncpy(fname2 + 1, fname, 998);
fname2[999] = 0;
return (GenericFunc) dlsym(handle, fname2);
#elif defined(_GNU_SOURCE)
return (GenericFunc) dlsym(handle, fname);
#elif defined(__MINGW32__)
return (GenericFunc) GetProcAddress(handle, fname);
#else
return (GenericFunc) NULL;
#endif
}
/**
* Wrapper for dlclose().
*/
void
_mesa_dlclose(void *handle)
{
#if defined(_GNU_SOURCE)
dlclose(handle);
#elif defined(__MINGW32__)
FreeLibrary(handle);
#else
(void) handle;
#endif
}

42
src/mesa/main/dlopen.h Normal file
View file

@ -0,0 +1,42 @@
/*
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DLOPEN_H
#define DLOPEN_H
typedef void (*GenericFunc)(void);
extern void *
_mesa_dlopen(const char *libname, int flags);
extern GenericFunc
_mesa_dlsym(void *handle, const char *fname);
extern void
_mesa_dlclose(void *handle);
#endif

View file

@ -20,6 +20,7 @@ debug.c \
depth.c \
depthstencil.c \
dlist.c \
dlopen.c \
drawpix.c \
enable.c \
enums.c \
@ -100,6 +101,7 @@ debug.h \
depth.h \
depthstencil.h \
dlist.h \
dlopen.h \
drawpix.h \
enable.h \
enums.h \

View file

@ -30,7 +30,7 @@
*/
#ifndef USE_EXTERNAL_DXTN_LIB
#define USE_EXTERNAL_DXTN_LIB 0
#define USE_EXTERNAL_DXTN_LIB 1
#endif
#include "glheader.h"
@ -38,15 +38,12 @@
#include "colormac.h"
#include "context.h"
#include "convolve.h"
#include "dlopen.h"
#include "image.h"
#include "texcompress.h"
#include "texformat.h"
#include "texstore.h"
#if USE_EXTERNAL_DXTN_LIB && !defined(__MINGW32__)
#include <dlfcn.h>
#endif
#ifdef __MINGW32__
#define DXTN_LIBNAME "dxtn.dll"
#define RTLD_LAZY 0
@ -103,72 +100,6 @@ static dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL;
static void *dxtlibhandle = NULL;
typedef void (*GenericFunc)(void);
/**
* Wrapper for dlopen().
* XXX Probably move this and the following wrappers into imports.h someday.
*/
static void *
_mesa_dlopen(const char *libname, int flags)
{
#if USE_EXTERNAL_DXTN_LIB
#ifdef __MINGW32__
return LoadLibrary(libname);
#else
return dlopen(libname, flags);
#endif
#else
return NULL;
#endif /* USE_EXTERNAL_DXTN_LIB */
}
/**
* Wrapper for dlsym() that does a cast to a generic function type,
* rather than a void *. This reduces the number of warnings that are
* generated.
*/
static GenericFunc
_mesa_dlsym(void *handle, const char *fname)
{
#if USE_EXTERNAL_DXTN_LIB
#ifdef __MINGW32__
return (GenericFunc) GetProcAddress(handle, fname);
#elif defined(__DJGPP__)
/* need '_' prefix on symbol names */
char fname2[1000];
fname2[0] = '_';
_mesa_strncpy(fname2 + 1, fname, 998);
fname2[999] = 0;
return (GenericFunc) dlsym(handle, fname2);
#else
return (GenericFunc) dlsym(handle, fname);
#endif
#else
return (GenericFunc) NULL;
#endif /* USE_EXTERNAL_DXTN_LIB */
}
/**
* Wrapper for dlclose().
*/
static void
_mesa_dlclose(void *handle)
{
#if USE_EXTERNAL_DXTN_LIB
#ifdef __MINGW32__
FreeLibrary(handle);
#else
dlclose(handle);
#endif
#endif
}
void
_mesa_init_texture_s3tc( GLcontext *ctx )
{
@ -176,7 +107,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
ctx->Mesa_DXTn = GL_FALSE;
#if USE_EXTERNAL_DXTN_LIB
if (!dxtlibhandle) {
dxtlibhandle = _mesa_dlopen(DXTN_LIBNAME, RTLD_LAZY | RTLD_GLOBAL);
dxtlibhandle = _mesa_dlopen(DXTN_LIBNAME, 0);
if (!dxtlibhandle) {
_mesa_warning(ctx, "couldn't open " DXTN_LIBNAME ", software DXTn "
"compression/decompression unavailable");

View file

@ -43,7 +43,7 @@
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_print.h"
#include "shader/slang/slang_library_noise.h"
#include "prog_noise.h"
/* debug predicate */
@ -705,7 +705,7 @@ _mesa_execute_program(GLcontext * ctx,
{
GLfloat t[4];
fetch_vector4(&inst->SrcReg[0], machine, t);
machine->AddressReg[0][0] = (GLint) FLOORF(t[0]);
machine->AddressReg[0][0] = IFLOOR(t[0]);
}
break;
case OPCODE_BGNLOOP:
@ -1137,7 +1137,8 @@ _mesa_execute_program(GLcontext * ctx,
fetch_vector1(&inst->SrcReg[0], machine, a);
result[0] =
result[1] =
result[2] = result[3] = _slang_library_noise1(a[0]);
result[2] =
result[3] = _mesa_noise1(a[0]);
store_vector4(inst, machine, result);
}
break;
@ -1147,7 +1148,7 @@ _mesa_execute_program(GLcontext * ctx,
fetch_vector4(&inst->SrcReg[0], machine, a);
result[0] =
result[1] =
result[2] = result[3] = _slang_library_noise2(a[0], a[1]);
result[2] = result[3] = _mesa_noise2(a[0], a[1]);
store_vector4(inst, machine, result);
}
break;
@ -1158,7 +1159,7 @@ _mesa_execute_program(GLcontext * ctx,
result[0] =
result[1] =
result[2] =
result[3] = _slang_library_noise3(a[0], a[1], a[2]);
result[3] = _mesa_noise3(a[0], a[1], a[2]);
store_vector4(inst, machine, result);
}
break;
@ -1169,7 +1170,7 @@ _mesa_execute_program(GLcontext * ctx,
result[0] =
result[1] =
result[2] =
result[3] = _slang_library_noise4(a[0], a[1], a[2], a[3]);
result[3] = _mesa_noise4(a[0], a[1], a[2], a[3]);
store_vector4(inst, machine, result);
}
break;

View file

@ -0,0 +1,638 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* SimplexNoise1234
* Copyright (c) 2003-2005, Stefan Gustavson
*
* Contact: stegu@itn.liu.se
*/
/**
* \file
* \brief C implementation of Perlin Simplex Noise over 1, 2, 3 and 4 dims.
* \author Stefan Gustavson (stegu@itn.liu.se)
*
*
* This implementation is "Simplex Noise" as presented by
* Ken Perlin at a relatively obscure and not often cited course
* session "Real-Time Shading" at Siggraph 2001 (before real
* time shading actually took on), under the title "hardware noise".
* The 3D function is numerically equivalent to his Java reference
* code available in the PDF course notes, although I re-implemented
* it from scratch to get more readable code. The 1D, 2D and 4D cases
* were implemented from scratch by me from Ken Perlin's text.
*
* This file has no dependencies on any other file, not even its own
* header file. The header file is made for use by external code only.
*/
#include "main/imports.h"
#include "prog_noise.h"
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
/*
* ---------------------------------------------------------------------
* Static data
*/
/**
* Permutation table. This is just a random jumble of all numbers 0-255,
* repeated twice to avoid wrapping the index at 255 for each lookup.
* This needs to be exactly the same for all instances on all platforms,
* so it's easiest to just keep it as static explicit data.
* This also removes the need for any initialisation of this class.
*
* Note that making this an int[] instead of a char[] might make the
* code run faster on platforms with a high penalty for unaligned single
* byte addressing. Intel x86 is generally single-byte-friendly, but
* some other CPUs are faster with 4-aligned reads.
* However, a char[] is smaller, which avoids cache trashing, and that
* is probably the most important aspect on most architectures.
* This array is accessed a *lot* by the noise functions.
* A vector-valued noise over 3D accesses it 96 times, and a
* float-valued 4D noise 64 times. We want this to fit in the cache!
*/
unsigned char perm[512] = { 151, 160, 137, 91, 90, 15,
131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8,
99, 37, 240, 21, 10, 23,
190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35,
11, 32, 57, 177, 33,
88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71,
134, 139, 48, 27, 166,
77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41,
55, 46, 245, 40, 244,
102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89,
18, 169, 200, 196,
135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217,
226, 250, 124, 123,
5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58,
17, 182, 189, 28, 42,
223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155,
167, 43, 172, 9,
129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104,
218, 246, 97, 228,
251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235,
249, 14, 239, 107,
49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45,
127, 4, 150, 254,
138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66,
215, 61, 156, 180,
151, 160, 137, 91, 90, 15,
131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8,
99, 37, 240, 21, 10, 23,
190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35,
11, 32, 57, 177, 33,
88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71,
134, 139, 48, 27, 166,
77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41,
55, 46, 245, 40, 244,
102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89,
18, 169, 200, 196,
135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217,
226, 250, 124, 123,
5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58,
17, 182, 189, 28, 42,
223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155,
167, 43, 172, 9,
129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104,
218, 246, 97, 228,
251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235,
249, 14, 239, 107,
49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45,
127, 4, 150, 254,
138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66,
215, 61, 156, 180
};
/*
* ---------------------------------------------------------------------
*/
/*
* Helper functions to compute gradients-dot-residualvectors (1D to 4D)
* Note that these generate gradients of more than unit length. To make
* a close match with the value range of classic Perlin noise, the final
* noise values need to be rescaled to fit nicely within [-1,1].
* (The simplex noise functions as such also have different scaling.)
* Note also that these noise functions are the most practical and useful
* signed version of Perlin noise. To return values according to the
* RenderMan specification from the SL noise() and pnoise() functions,
* the noise values need to be scaled and offset to [0,1], like this:
* float SLnoise = (SimplexNoise1234::noise(x,y,z) + 1.0) * 0.5;
*/
static float
grad1(int hash, float x)
{
int h = hash & 15;
float grad = 1.0f + (h & 7); /* Gradient value 1.0, 2.0, ..., 8.0 */
if (h & 8)
grad = -grad; /* Set a random sign for the gradient */
return (grad * x); /* Multiply the gradient with the distance */
}
static float
grad2(int hash, float x, float y)
{
int h = hash & 7; /* Convert low 3 bits of hash code */
float u = h < 4 ? x : y; /* into 8 simple gradient directions, */
float v = h < 4 ? y : x; /* and compute the dot product with (x,y). */
return ((h & 1) ? -u : u) + ((h & 2) ? -2.0f * v : 2.0f * v);
}
static float
grad3(int hash, float x, float y, float z)
{
int h = hash & 15; /* Convert low 4 bits of hash code into 12 simple */
float u = h < 8 ? x : y; /* gradient directions, and compute dot product. */
float v = h < 4 ? y : h == 12 || h == 14 ? x : z; /* Fix repeats at h = 12 to 15 */
return ((h & 1) ? -u : u) + ((h & 2) ? -v : v);
}
static float
grad4(int hash, float x, float y, float z, float t)
{
int h = hash & 31; /* Convert low 5 bits of hash code into 32 simple */
float u = h < 24 ? x : y; /* gradient directions, and compute dot product. */
float v = h < 16 ? y : z;
float w = h < 8 ? z : t;
return ((h & 1) ? -u : u) + ((h & 2) ? -v : v) + ((h & 4) ? -w : w);
}
/**
* A lookup table to traverse the simplex around a given point in 4D.
* Details can be found where this table is used, in the 4D noise method.
* TODO: This should not be required, backport it from Bill's GLSL code!
*/
static unsigned char simplex[64][4] = {
{0, 1, 2, 3}, {0, 1, 3, 2}, {0, 0, 0, 0}, {0, 2, 3, 1},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 2, 3, 0},
{0, 2, 1, 3}, {0, 0, 0, 0}, {0, 3, 1, 2}, {0, 3, 2, 1},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 3, 2, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{1, 2, 0, 3}, {0, 0, 0, 0}, {1, 3, 0, 2}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {2, 3, 0, 1}, {2, 3, 1, 0},
{1, 0, 2, 3}, {1, 0, 3, 2}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {2, 0, 3, 1}, {0, 0, 0, 0}, {2, 1, 3, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{2, 0, 1, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{3, 0, 1, 2}, {3, 0, 2, 1}, {0, 0, 0, 0}, {3, 1, 2, 0},
{2, 1, 0, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{3, 1, 0, 2}, {0, 0, 0, 0}, {3, 2, 0, 1}, {3, 2, 1, 0}
};
/** 1D simplex noise */
GLfloat
_mesa_noise1(GLfloat x)
{
int i0 = FASTFLOOR(x);
int i1 = i0 + 1;
float x0 = x - i0;
float x1 = x0 - 1.0f;
float t1 = 1.0f - x1 * x1;
float n0, n1;
float t0 = 1.0f - x0 * x0;
/* if(t0 < 0.0f) t0 = 0.0f; // this never happens for the 1D case */
t0 *= t0;
n0 = t0 * t0 * grad1(perm[i0 & 0xff], x0);
/* if(t1 < 0.0f) t1 = 0.0f; // this never happens for the 1D case */
t1 *= t1;
n1 = t1 * t1 * grad1(perm[i1 & 0xff], x1);
/* The maximum value of this noise is 8*(3/4)^4 = 2.53125 */
/* A factor of 0.395 would scale to fit exactly within [-1,1], but */
/* we want to match PRMan's 1D noise, so we scale it down some more. */
return 0.25f * (n0 + n1);
}
/** 2D simplex noise */
GLfloat
_mesa_noise2(GLfloat x, GLfloat y)
{
#define F2 0.366025403f /* F2 = 0.5*(sqrt(3.0)-1.0) */
#define G2 0.211324865f /* G2 = (3.0-Math.sqrt(3.0))/6.0 */
float n0, n1, n2; /* Noise contributions from the three corners */
/* Skew the input space to determine which simplex cell we're in */
float s = (x + y) * F2; /* Hairy factor for 2D */
float xs = x + s;
float ys = y + s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
float t = (float) (i + j) * G2;
float X0 = i - t; /* Unskew the cell origin back to (x,y) space */
float Y0 = j - t;
float x0 = x - X0; /* The x,y distances from the cell origin */
float y0 = y - Y0;
float x1, y1, x2, y2;
int ii, jj;
float t0, t1, t2;
/* For the 2D case, the simplex shape is an equilateral triangle. */
/* Determine which simplex we are in. */
int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
if (x0 > y0) {
i1 = 1;
j1 = 0;
} /* lower triangle, XY order: (0,0)->(1,0)->(1,1) */
else {
i1 = 0;
j1 = 1;
} /* upper triangle, YX order: (0,0)->(0,1)->(1,1) */
/* A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and */
/* a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where */
/* c = (3-sqrt(3))/6 */
x1 = x0 - i1 + G2; /* Offsets for middle corner in (x,y) unskewed coords */
y1 = y0 - j1 + G2;
x2 = x0 - 1.0f + 2.0f * G2; /* Offsets for last corner in (x,y) unskewed coords */
y2 = y0 - 1.0f + 2.0f * G2;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
/* Calculate the contribution from the three corners */
t0 = 0.5f - x0 * x0 - y0 * y0;
if (t0 < 0.0f)
n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad2(perm[ii + perm[jj]], x0, y0);
}
t1 = 0.5f - x1 * x1 - y1 * y1;
if (t1 < 0.0f)
n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad2(perm[ii + i1 + perm[jj + j1]], x1, y1);
}
t2 = 0.5f - x2 * x2 - y2 * y2;
if (t2 < 0.0f)
n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad2(perm[ii + 1 + perm[jj + 1]], x2, y2);
}
/* Add contributions from each corner to get the final noise value. */
/* The result is scaled to return values in the interval [-1,1]. */
return 40.0f * (n0 + n1 + n2); /* TODO: The scale factor is preliminary! */
}
/** 3D simplex noise */
GLfloat
_mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
{
/* Simple skewing factors for the 3D case */
#define F3 0.333333333f
#define G3 0.166666667f
float n0, n1, n2, n3; /* Noise contributions from the four corners */
/* Skew the input space to determine which simplex cell we're in */
float s = (x + y + z) * F3; /* Very nice and simple skew factor for 3D */
float xs = x + s;
float ys = y + s;
float zs = z + s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
int k = FASTFLOOR(zs);
float t = (float) (i + j + k) * G3;
float X0 = i - t; /* Unskew the cell origin back to (x,y,z) space */
float Y0 = j - t;
float Z0 = k - t;
float x0 = x - X0; /* The x,y,z distances from the cell origin */
float y0 = y - Y0;
float z0 = z - Z0;
float x1, y1, z1, x2, y2, z2, x3, y3, z3;
int ii, jj, kk;
float t0, t1, t2, t3;
/* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
/* Determine which simplex we are in. */
int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
/* This code would benefit from a backport from the GLSL version! */
if (x0 >= y0) {
if (y0 >= z0) {
i1 = 1;
j1 = 0;
k1 = 0;
i2 = 1;
j2 = 1;
k2 = 0;
} /* X Y Z order */
else if (x0 >= z0) {
i1 = 1;
j1 = 0;
k1 = 0;
i2 = 1;
j2 = 0;
k2 = 1;
} /* X Z Y order */
else {
i1 = 0;
j1 = 0;
k1 = 1;
i2 = 1;
j2 = 0;
k2 = 1;
} /* Z X Y order */
}
else { /* x0<y0 */
if (y0 < z0) {
i1 = 0;
j1 = 0;
k1 = 1;
i2 = 0;
j2 = 1;
k2 = 1;
} /* Z Y X order */
else if (x0 < z0) {
i1 = 0;
j1 = 1;
k1 = 0;
i2 = 0;
j2 = 1;
k2 = 1;
} /* Y Z X order */
else {
i1 = 0;
j1 = 1;
k1 = 0;
i2 = 1;
j2 = 1;
k2 = 0;
} /* Y X Z order */
}
/* A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in
* (x,y,z), a step of (0,1,0) in (i,j,k) means a step of
* (-c,1-c,-c) in (x,y,z), and a step of (0,0,1) in (i,j,k) means a
* step of (-c,-c,1-c) in (x,y,z), where c = 1/6.
*/
x1 = x0 - i1 + G3; /* Offsets for second corner in (x,y,z) coords */
y1 = y0 - j1 + G3;
z1 = z0 - k1 + G3;
x2 = x0 - i2 + 2.0f * G3; /* Offsets for third corner in (x,y,z) coords */
y2 = y0 - j2 + 2.0f * G3;
z2 = z0 - k2 + 2.0f * G3;
x3 = x0 - 1.0f + 3.0f * G3;/* Offsets for last corner in (x,y,z) coords */
y3 = y0 - 1.0f + 3.0f * G3;
z3 = z0 - 1.0f + 3.0f * G3;
/* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
kk = k % 256;
/* Calculate the contribution from the four corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0;
if (t0 < 0.0f)
n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad3(perm[ii + perm[jj + perm[kk]]], x0, y0, z0);
}
t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1;
if (t1 < 0.0f)
n1 = 0.0f;
else {
t1 *= t1;
n1 =
t1 * t1 * grad3(perm[ii + i1 + perm[jj + j1 + perm[kk + k1]]], x1,
y1, z1);
}
t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2;
if (t2 < 0.0f)
n2 = 0.0f;
else {
t2 *= t2;
n2 =
t2 * t2 * grad3(perm[ii + i2 + perm[jj + j2 + perm[kk + k2]]], x2,
y2, z2);
}
t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3;
if (t3 < 0.0f)
n3 = 0.0f;
else {
t3 *= t3;
n3 =
t3 * t3 * grad3(perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]], x3, y3,
z3);
}
/* Add contributions from each corner to get the final noise value.
* The result is scaled to stay just inside [-1,1]
*/
return 32.0f * (n0 + n1 + n2 + n3); /* TODO: The scale factor is preliminary! */
}
/** 4D simplex noise */
GLfloat
_mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
/* The skewing and unskewing factors are hairy again for the 4D case */
#define F4 0.309016994f /* F4 = (Math.sqrt(5.0)-1.0)/4.0 */
#define G4 0.138196601f /* G4 = (5.0-Math.sqrt(5.0))/20.0 */
float n0, n1, n2, n3, n4; /* Noise contributions from the five corners */
/* Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in */
float s = (x + y + z + w) * F4; /* Factor for 4D skewing */
float xs = x + s;
float ys = y + s;
float zs = z + s;
float ws = w + s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
int k = FASTFLOOR(zs);
int l = FASTFLOOR(ws);
float t = (i + j + k + l) * G4; /* Factor for 4D unskewing */
float X0 = i - t; /* Unskew the cell origin back to (x,y,z,w) space */
float Y0 = j - t;
float Z0 = k - t;
float W0 = l - t;
float x0 = x - X0; /* The x,y,z,w distances from the cell origin */
float y0 = y - Y0;
float z0 = z - Z0;
float w0 = w - W0;
/* For the 4D case, the simplex is a 4D shape I won't even try to describe.
* To find out which of the 24 possible simplices we're in, we need to
* determine the magnitude ordering of x0, y0, z0 and w0.
* The method below is a good way of finding the ordering of x,y,z,w and
* then find the correct traversal order for the simplex we're in.
* First, six pair-wise comparisons are performed between each possible pair
* of the four coordinates, and the results are used to add up binary bits
* for an integer index.
*/
int c1 = (x0 > y0) ? 32 : 0;
int c2 = (x0 > z0) ? 16 : 0;
int c3 = (y0 > z0) ? 8 : 0;
int c4 = (x0 > w0) ? 4 : 0;
int c5 = (y0 > w0) ? 2 : 0;
int c6 = (z0 > w0) ? 1 : 0;
int c = c1 + c2 + c3 + c4 + c5 + c6;
int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
int ii, jj, kk, ll;
float t0, t1, t2, t3, t4;
/*
* simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some
* order. Many values of c will never occur, since e.g. x>y>z>w
* makes x<z, y<w and x<w impossible. Only the 24 indices which
* have non-zero entries make any sense. We use a thresholding to
* set the coordinates in turn from the largest magnitude. The
* number 3 in the "simplex" array is at the position of the
* largest coordinate.
*/
i1 = simplex[c][0] >= 3 ? 1 : 0;
j1 = simplex[c][1] >= 3 ? 1 : 0;
k1 = simplex[c][2] >= 3 ? 1 : 0;
l1 = simplex[c][3] >= 3 ? 1 : 0;
/* The number 2 in the "simplex" array is at the second largest coordinate. */
i2 = simplex[c][0] >= 2 ? 1 : 0;
j2 = simplex[c][1] >= 2 ? 1 : 0;
k2 = simplex[c][2] >= 2 ? 1 : 0;
l2 = simplex[c][3] >= 2 ? 1 : 0;
/* The number 1 in the "simplex" array is at the second smallest coordinate. */
i3 = simplex[c][0] >= 1 ? 1 : 0;
j3 = simplex[c][1] >= 1 ? 1 : 0;
k3 = simplex[c][2] >= 1 ? 1 : 0;
l3 = simplex[c][3] >= 1 ? 1 : 0;
/* The fifth corner has all coordinate offsets = 1, so no need to look that up. */
x1 = x0 - i1 + G4; /* Offsets for second corner in (x,y,z,w) coords */
y1 = y0 - j1 + G4;
z1 = z0 - k1 + G4;
w1 = w0 - l1 + G4;
x2 = x0 - i2 + 2.0f * G4; /* Offsets for third corner in (x,y,z,w) coords */
y2 = y0 - j2 + 2.0f * G4;
z2 = z0 - k2 + 2.0f * G4;
w2 = w0 - l2 + 2.0f * G4;
x3 = x0 - i3 + 3.0f * G4; /* Offsets for fourth corner in (x,y,z,w) coords */
y3 = y0 - j3 + 3.0f * G4;
z3 = z0 - k3 + 3.0f * G4;
w3 = w0 - l3 + 3.0f * G4;
x4 = x0 - 1.0f + 4.0f * G4; /* Offsets for last corner in (x,y,z,w) coords */
y4 = y0 - 1.0f + 4.0f * G4;
z4 = z0 - 1.0f + 4.0f * G4;
w4 = w0 - 1.0f + 4.0f * G4;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
kk = k % 256;
ll = l % 256;
/* Calculate the contribution from the five corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
if (t0 < 0.0f)
n0 = 0.0f;
else {
t0 *= t0;
n0 =
t0 * t0 * grad4(perm[ii + perm[jj + perm[kk + perm[ll]]]], x0, y0,
z0, w0);
}
t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
if (t1 < 0.0f)
n1 = 0.0f;
else {
t1 *= t1;
n1 =
t1 * t1 *
grad4(perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]],
x1, y1, z1, w1);
}
t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
if (t2 < 0.0f)
n2 = 0.0f;
else {
t2 *= t2;
n2 =
t2 * t2 *
grad4(perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]],
x2, y2, z2, w2);
}
t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
if (t3 < 0.0f)
n3 = 0.0f;
else {
t3 *= t3;
n3 =
t3 * t3 *
grad4(perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]],
x3, y3, z3, w3);
}
t4 = 0.6f - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
if (t4 < 0.0f)
n4 = 0.0f;
else {
t4 *= t4;
n4 =
t4 * t4 *
grad4(perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]], x4,
y4, z4, w4);
}
/* Sum up and scale the result to cover the range [-1,1] */
return 27.0f * (n0 + n1 + n2 + n3 + n4); /* TODO: The scale factor is preliminary! */
}

View file

@ -22,21 +22,13 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if !defined SLANG_LIBRARY_NOISE_H
#define SLANG_LIBRARY_NOISE_H
#ifndef PROG_NOISE
#define PROG_NOISE
#if defined __cplusplus
extern "C" {
#endif
GLfloat _slang_library_noise1 (GLfloat);
GLfloat _slang_library_noise2 (GLfloat, GLfloat);
GLfloat _slang_library_noise3 (GLfloat, GLfloat, GLfloat);
GLfloat _slang_library_noise4 (GLfloat, GLfloat, GLfloat, GLfloat);
#ifdef __cplusplus
}
#endif
extern GLfloat _mesa_noise1(GLfloat);
extern GLfloat _mesa_noise2(GLfloat, GLfloat);
extern GLfloat _mesa_noise3(GLfloat, GLfloat, GLfloat);
extern GLfloat _mesa_noise4(GLfloat, GLfloat, GLfloat, GLfloat);
#endif

View file

@ -187,7 +187,6 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
return pos;
}
#endif
size = 4; /** XXX fix */
return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
size, GL_NONE, values, NULL, 0x0);
}

File diff suppressed because it is too large Load diff

View file

@ -2,106 +2,107 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_builtin_120_common.gc */
4,1,90,95,0,0,26,221,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,0,26,109,0,0,1,
0,0,0,26,110,0,0,0,1,8,58,109,97,116,50,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,
18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,90,95,0,0,28,221,0,109,97,116,114,105,
120,67,111,109,112,77,117,108,116,0,1,0,0,0,28,109,0,0,1,0,0,0,28,110,0,0,0,1,8,58,109,97,116,50,
120,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,
0,57,48,0,0,0,0,1,90,95,0,0,27,221,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,
0,27,109,0,0,1,0,0,0,27,110,0,0,0,1,8,58,109,97,116,51,120,50,0,18,109,0,16,8,48,0,57,18,110,0,16,
5,1,90,95,0,0,26,0,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,0,26,0,109,0,0,1,
0,0,0,26,0,110,0,0,0,1,8,58,109,97,116,50,120,51,0,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,
48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,90,95,0,0,28,0,0,109,97,116,114,
105,120,67,111,109,112,77,117,108,116,0,1,0,0,0,28,0,109,0,0,1,0,0,0,28,0,110,0,0,0,1,8,58,109,97,
116,50,120,52,0,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,
16,10,49,0,57,48,0,0,0,0,1,90,95,0,0,27,0,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,
1,0,0,0,27,0,109,0,0,1,0,0,0,27,0,110,0,0,0,1,8,58,109,97,116,51,120,50,0,0,18,109,0,16,8,48,0,57,
18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,
57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,90,95,0,0,30,0,0,109,97,116,114,105,120,67,111,109,112,77,
117,108,116,0,1,0,0,0,30,0,109,0,0,1,0,0,0,30,0,110,0,0,0,1,8,58,109,97,116,51,120,52,0,0,18,109,0,
16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,
0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,90,95,0,0,29,0,0,109,97,116,114,105,120,67,111,
109,112,77,117,108,116,0,1,0,0,0,29,0,109,0,0,1,0,0,0,29,0,110,0,0,0,1,8,58,109,97,116,52,120,50,0,
0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,
48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,
57,48,0,0,0,0,1,90,95,0,0,31,0,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,0,31,
0,109,0,0,1,0,0,0,31,0,110,0,0,0,1,8,58,109,97,116,52,120,51,0,0,18,109,0,16,8,48,0,57,18,110,0,16,
8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,
16,10,50,0,57,48,0,0,0,0,1,90,95,0,0,30,221,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,
0,1,0,0,0,30,109,0,0,1,0,0,0,30,110,0,0,0,1,8,58,109,97,116,51,120,52,0,18,109,0,16,8,48,0,57,18,
110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,
18,110,0,16,10,50,0,57,48,0,0,0,0,1,90,95,0,0,29,221,0,109,97,116,114,105,120,67,111,109,112,77,
117,108,116,0,1,0,0,0,29,109,0,0,1,0,0,0,29,110,0,0,0,1,8,58,109,97,116,52,120,50,0,18,109,0,16,8,
48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,
10,50,0,57,18,110,0,16,10,50,0,57,48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,
90,95,0,0,31,221,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,0,31,109,0,0,1,0,0,
0,31,110,0,0,0,1,8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,
109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,
18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,90,95,0,0,13,221,0,111,117,116,101,114,
80,114,111,100,117,99,116,0,1,0,0,0,10,99,0,0,1,0,0,0,10,114,0,0,0,1,8,58,109,97,116,50,0,18,99,0,
59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,
59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,14,221,0,111,117,116,101,
114,80,114,111,100,117,99,116,0,1,0,0,0,11,99,0,0,1,0,0,0,11,114,0,0,0,1,8,58,109,97,116,51,0,18,
99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,
114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,
0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,
18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,0,0,15,221,0,111,117,
116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,12,99,0,0,1,0,0,0,12,114,0,0,0,1,8,58,109,97,116,
52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,
122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,
121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,
59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,
59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,119,0,18,114,0,59,122,0,48,0,18,
99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,18,
114,0,59,119,0,48,0,18,99,0,59,119,0,18,114,0,59,119,0,48,0,0,0,0,1,90,95,0,0,26,221,0,111,117,116,
101,114,80,114,111,100,117,99,116,0,1,0,0,0,11,99,0,0,1,0,0,0,10,114,0,0,0,1,8,58,109,97,116,50,
120,51,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,
59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,
59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,27,221,0,111,117,116,101,
114,80,114,111,100,117,99,116,0,1,0,0,0,10,99,0,0,1,0,0,0,11,114,0,0,0,1,8,58,109,97,116,51,120,50,
16,10,50,0,57,48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,90,95,0,0,13,0,0,111,
117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,10,0,99,0,0,1,0,0,0,10,0,114,0,0,0,1,8,58,109,
97,116,50,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,
99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,14,
0,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,11,0,99,0,0,1,0,0,0,11,0,114,0,0,0,1,8,
58,109,97,116,51,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,
0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,
18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,
48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,
0,0,15,0,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,12,0,99,0,0,1,0,0,0,12,0,114,0,
0,0,1,8,58,109,97,116,52,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,
120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,
59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,
59,121,0,48,0,18,99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,
99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,119,0,18,
114,0,59,122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,
0,18,99,0,59,122,0,18,114,0,59,119,0,48,0,18,99,0,59,119,0,18,114,0,59,119,0,48,0,0,0,0,1,90,95,0,
0,26,0,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,11,0,99,0,0,1,0,0,0,10,0,114,0,0,
0,1,8,58,109,97,116,50,120,51,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,
0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,
99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,27,
0,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,10,0,99,0,0,1,0,0,0,11,0,114,0,0,0,1,8,
58,109,97,116,51,120,50,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,
120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,
59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,0,0,28,0,0,
111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,12,0,99,0,0,1,0,0,0,10,0,114,0,0,0,1,8,58,
109,97,116,50,120,52,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,
0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,
120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,
121,0,48,0,18,99,0,59,119,0,18,114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,29,0,0,111,117,116,101,114,80,
114,111,100,117,99,116,0,1,0,0,0,10,0,99,0,0,1,0,0,0,12,0,114,0,0,0,1,8,58,109,97,116,52,120,50,0,
0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,
18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,
48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,0,0,28,221,0,111,117,116,101,114,80,114,
111,100,117,99,116,0,1,0,0,0,12,99,0,0,1,0,0,0,10,114,0,0,0,1,8,58,109,97,116,50,120,52,0,18,99,0,
59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,
59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,
99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,
114,0,59,121,0,48,0,0,0,0,1,90,95,0,0,29,221,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,
0,0,10,99,0,0,1,0,0,0,12,114,0,0,0,1,8,58,109,97,116,52,120,50,0,18,99,0,59,120,0,18,114,0,59,120,
0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,
121,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,
122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,0,0,0,1,
90,95,0,0,30,221,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,12,99,0,0,1,0,0,0,11,
114,0,0,0,1,8,58,109,97,116,51,120,52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,
18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,
48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,
122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,
48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,
121,0,18,114,0,59,119,0,48,0,0,0,0,1,90,95,0,0,30,0,0,111,117,116,101,114,80,114,111,100,117,99,
116,0,1,0,0,0,12,0,99,0,0,1,0,0,0,11,0,114,0,0,0,1,8,58,109,97,116,51,120,52,0,0,18,99,0,59,120,0,
18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,
48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,
121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,114,0,59,
121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,
59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,119,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,0,0,31,0,0,
111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,0,11,0,99,0,0,1,0,0,0,12,0,114,0,0,0,1,8,58,
109,97,116,52,120,51,0,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,
0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,
121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,
122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,
59,119,0,18,114,0,59,122,0,48,0,0,0,0,1,90,95,0,0,31,221,0,111,117,116,101,114,80,114,111,100,117,
99,116,0,1,0,0,0,11,99,0,0,1,0,0,0,12,114,0,0,0,1,8,58,109,97,116,52,120,51,0,18,99,0,59,120,0,18,
114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,
0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,
18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,
48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,
121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,18,114,0,59,119,0,48,0,0,0,0,1,90,95,0,0,13,221,0,
116,114,97,110,115,112,111,115,101,0,1,0,0,0,13,109,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,
0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,
49,0,57,59,121,0,0,0,0,0,1,90,95,0,0,14,221,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,14,109,
0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,
59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,18,114,0,
59,119,0,48,0,0,0,0,1,90,95,0,0,13,0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,13,0,109,0,0,0,
1,8,58,109,97,116,50,0,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,
0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,0,0,0,1,90,95,0,0,14,0,0,116,114,97,
110,115,112,111,115,101,0,1,0,0,0,14,0,109,0,0,0,1,8,58,109,97,116,51,0,0,18,109,0,16,8,48,0,57,59,
120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,
59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,8,48,0,
57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,0,0,0,1,90,95,0,
0,15,0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,15,0,109,0,0,0,1,8,58,109,97,116,52,0,0,18,
109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,
18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,
0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,
0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,
122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,57,
59,119,0,0,18,109,0,16,10,51,0,57,59,119,0,0,0,0,0,1,90,95,0,0,26,0,0,116,114,97,110,115,112,111,
115,101,0,1,0,0,0,27,0,109,0,0,0,1,8,58,109,97,116,50,120,51,0,0,18,109,0,16,8,48,0,57,59,120,0,0,
18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,
0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,0,0,0,1,90,95,0,0,27,0,0,116,
114,97,110,115,112,111,115,101,0,1,0,0,0,26,0,109,0,0,0,1,8,58,109,97,116,51,120,50,0,0,18,109,0,
16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,
0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,0,0,
0,1,90,95,0,0,28,0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,29,0,109,0,0,0,1,8,58,109,97,116,
50,120,52,0,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,
0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,
49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,0,0,0,0,0,1,90,
95,0,0,29,0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,28,0,109,0,0,0,1,8,58,109,97,116,52,120,
50,0,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,
121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,
59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,0,0,0,1,90,95,0,0,30,
0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,31,0,109,0,0,0,1,8,58,109,97,116,51,120,52,0,0,18,
109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,
18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,
0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,
0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,
122,0,0,0,0,0,1,90,95,0,0,31,0,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,30,0,109,0,0,0,1,8,
58,109,97,116,52,120,51,0,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,
109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,
18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,
0,18,109,0,16,10,50,0,57,59,122,0,0,0,0,0,1,90,95,0,0,15,221,0,116,114,97,110,115,112,111,115,101,
0,1,0,0,0,15,109,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,
57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,
0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,
51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,
10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,
16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,57,59,119,0,0,18,109,0,16,10,51,0,57,59,119,0,0,0,0,0,
1,90,95,0,0,26,221,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,27,109,0,0,0,1,8,58,109,97,116,
50,120,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,
57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,
0,57,59,121,0,0,0,0,0,1,90,95,0,0,27,221,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,26,109,0,0,
0,1,8,58,109,97,116,51,120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,
18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,
0,18,109,0,16,10,49,0,57,59,122,0,0,0,0,0,1,90,95,0,0,28,221,0,116,114,97,110,115,112,111,115,101,
0,1,0,0,0,29,109,0,0,0,1,8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,
10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,
16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,
0,16,10,51,0,57,59,121,0,0,0,0,0,1,90,95,0,0,29,221,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,
28,109,0,0,0,1,8,58,109,97,116,52,120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,
59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,
57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,
0,57,59,119,0,0,0,0,0,1,90,95,0,0,30,221,0,116,114,97,110,115,112,111,115,101,0,1,0,0,0,31,109,0,0,
0,1,8,58,109,97,116,51,120,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,
18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,
0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,
121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,
59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0,0,0,0,1,90,95,0,0,31,221,0,116,114,97,110,115,112,111,
115,101,0,1,0,0,0,30,109,0,0,0,1,8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,
109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,
18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,
0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,
0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,57,59,119,0,0,0,0,0,0
0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,
0,0,18,109,0,16,10,50,0,57,59,119,0,0,0,0,0,0

View file

@ -2,4 +2,4 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_builtin_120_fragment.gc */
4,2,2,90,95,3,0,10,221,1,103,108,95,80,111,105,110,116,67,111,111,114,100,0,0,0,0
5,2,2,90,95,3,0,10,0,1,103,108,95,80,111,105,110,116,67,111,111,114,100,0,0,0,0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,105 +2,106 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_fragment_builtin.gc */
4,2,2,90,95,6,0,12,221,1,103,108,95,70,114,97,103,67,111,111,114,100,0,0,0,2,2,90,95,6,0,1,221,1,
103,108,95,70,114,111,110,116,70,97,99,105,110,103,0,0,0,2,2,90,95,5,0,12,221,1,103,108,95,70,114,
97,103,67,111,108,111,114,0,0,0,2,2,90,95,5,0,12,221,1,103,108,95,70,114,97,103,68,97,116,97,0,3,
18,103,108,95,77,97,120,68,114,97,119,66,117,102,102,101,114,115,0,0,0,2,2,90,95,5,0,9,221,1,103,
108,95,70,114,97,103,68,101,112,116,104,0,0,0,2,2,90,95,3,0,12,221,1,103,108,95,67,111,108,111,114,
0,0,0,2,2,90,95,3,0,12,221,1,103,108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,
2,2,90,95,3,0,12,221,1,103,108,95,84,101,120,67,111,111,114,100,0,3,18,103,108,95,77,97,120,84,101,
120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,90,95,3,0,9,221,1,103,108,95,70,111,103,70,
114,97,103,67,111,111,114,100,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,0,1,1,0,
0,16,115,97,109,112,108,101,114,0,0,1,1,0,0,9,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,
1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,
111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,
52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,
18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,80,114,111,
106,0,1,1,0,0,16,115,97,109,112,108,101,114,0,0,1,1,0,0,10,99,111,111,114,100,0,0,1,1,0,0,9,98,105,
97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,
59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,
111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,
114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,
95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,115,97,109,112,108,
101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,
1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,
120,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,
115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,
109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,
114,101,50,68,0,1,1,0,0,17,115,97,109,112,108,101,114,0,0,1,1,0,0,10,99,111,111,114,100,0,0,1,1,0,
0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,
100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99,111,111,114,100,52,0,59,
119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,
97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,
116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,0,17,115,97,109,112,108,101,114,0,0,1,1,0,
0,11,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,
114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,
5,2,2,90,95,6,0,12,0,1,103,108,95,70,114,97,103,67,111,111,114,100,0,0,0,2,2,90,95,6,0,1,0,1,103,
108,95,70,114,111,110,116,70,97,99,105,110,103,0,0,0,2,2,90,95,5,0,12,0,1,103,108,95,70,114,97,103,
67,111,108,111,114,0,0,0,2,2,90,95,5,0,12,0,1,103,108,95,70,114,97,103,68,97,116,97,0,3,18,103,108,
95,77,97,120,68,114,97,119,66,117,102,102,101,114,115,0,0,0,2,2,90,95,5,0,9,0,1,103,108,95,70,114,
97,103,68,101,112,116,104,0,0,0,2,2,90,95,3,0,12,0,1,103,108,95,67,111,108,111,114,0,0,0,2,2,90,95,
3,0,12,0,1,103,108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,0,
1,103,108,95,84,101,120,67,111,111,114,100,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,
67,111,111,114,100,115,0,0,0,2,2,90,95,3,0,9,0,1,103,108,95,70,111,103,70,114,97,103,67,111,111,
114,100,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,0,1,1,0,0,16,0,115,97,109,112,
108,101,114,0,0,1,1,0,0,9,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,
12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,111,111,114,100,0,
20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,
98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,
100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,
115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,
1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,
111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,111,114,100,0,
59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,
86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,
0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,
1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,
111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,
99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,
0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,
50,68,80,114,111,106,0,1,1,0,0,17,115,97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,
1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,
111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,
0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,
101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,
111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,51,68,0,1,1,0,0,18,115,97,
109,112,108,101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,
95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,
111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,
20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,
101,51,68,80,114,111,106,0,1,1,0,0,18,115,97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,
0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,
99,111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,
100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,
52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,
18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,67,117,98,101,0,
1,1,0,0,19,115,97,109,112,108,101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,
115,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,
121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,
0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,115,104,97,100,111,119,
49,68,0,1,1,0,0,20,115,97,109,112,108,101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,98,
105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,
59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,
115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,
109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,115,104,97,100,111,
119,49,68,80,114,111,106,0,1,1,0,0,20,115,97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,
0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,
99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,119,0,49,
20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,
111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,
114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,
95,0,0,12,221,0,115,104,97,100,111,119,50,68,0,1,1,0,0,21,115,97,109,112,108,101,114,0,0,1,1,0,0,
11,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,
100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,
111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,
18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,
0,0,1,90,95,0,0,12,221,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,115,97,109,112,
108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,
221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,
100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,
18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,
0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,9,221,0,100,70,100,120,0,1,1,0,0,9,
112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,0,
59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,221,0,100,70,100,120,0,1,1,0,0,10,112,0,0,0,1,4,118,101,
99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,121,121,
0,0,0,0,1,90,95,0,0,11,221,0,100,70,100,120,0,1,1,0,0,11,112,0,0,0,1,4,118,101,99,52,95,100,100,
120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,122,0,0,0,0,1,90,
95,0,0,12,221,0,100,70,100,120,0,1,1,0,0,12,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,
114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,221,0,100,70,100,121,0,1,1,0,0,9,112,0,0,0,
1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,0,59,120,120,
120,120,0,0,0,0,1,90,95,0,0,10,221,0,100,70,100,121,0,1,1,0,0,10,112,0,0,0,1,4,118,101,99,52,95,
100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,121,121,0,0,0,0,
1,90,95,0,0,11,221,0,100,70,100,121,0,1,1,0,0,11,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,
95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,122,0,0,0,0,1,90,95,0,0,
12,221,0,100,70,100,121,0,1,1,0,0,12,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,
116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,221,0,102,119,105,100,116,104,0,1,1,0,0,9,112,0,0,0,
1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,
0,0,0,0,0,46,0,0,1,90,95,0,0,10,221,0,102,119,105,100,116,104,0,1,1,0,0,10,112,0,0,0,1,8,58,97,98,
115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,
0,0,1,90,95,0,0,11,221,0,102,119,105,100,116,104,0,1,1,0,0,11,112,0,0,0,1,8,58,97,98,115,0,58,100,
70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,
0,12,221,0,102,119,105,100,116,104,0,1,1,0,0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,
18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,0
0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
50,68,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,
0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,
52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,
18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,
0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,
120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,
0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,
100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,
111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,
4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,
0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,
116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,
112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,0,1,1,0,0,18,0,
115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,
1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,
18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,
115,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,
109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,
114,101,51,68,80,114,111,106,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,
114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,
18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,18,99,111,
111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,
118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,
101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,67,
117,98,101,0,1,1,0,0,19,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,
0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,
100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,
105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,
0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,
100,111,119,49,68,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,
0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,
111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,
0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,
108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,
104,97,100,111,119,49,68,80,114,111,106,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,
99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,
100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,
114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,
20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,
98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,
114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,0,1,1,0,0,21,0,115,97,109,112,108,
101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,
0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,
100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,
101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,
0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,
0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,
18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,
114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,
98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,
18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,9,0,0,100,70,100,
120,0,1,1,0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,
120,0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,120,0,1,1,0,0,10,0,112,0,
0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,
120,121,121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,120,0,1,1,0,0,11,0,112,0,0,0,1,4,118,101,99,
52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,
122,0,0,0,0,1,90,95,0,0,12,0,0,100,70,100,120,0,1,1,0,0,12,0,112,0,0,0,1,4,118,101,99,52,95,100,
100,120,0,18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,100,70,100,121,0,1,1,
0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,
18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,121,0,1,1,0,0,10,0,112,0,0,0,1,4,
118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,
121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,121,0,1,1,0,0,11,0,112,0,0,0,1,4,118,101,99,52,95,
100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,122,0,0,
0,0,1,90,95,0,0,12,0,0,100,70,100,121,0,1,1,0,0,12,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,
18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,102,119,105,100,116,104,0,1,1,
0,0,9,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,
100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,10,0,0,102,119,105,100,116,104,0,1,1,0,0,10,
0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,
100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,11,0,0,102,119,105,100,116,104,0,1,1,0,0,11,0,112,
0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,100,
121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,12,0,0,102,119,105,100,116,104,0,1,1,0,0,12,0,112,0,0,
0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,100,121,0,
0,18,112,0,0,0,0,0,46,0,0,0

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
* Copyright (C) 2008 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"),
@ -59,7 +59,7 @@
.syntax translation_unit;
/* revision number - increment after each change affecting emitted output */
.emtcode REVISION 4
.emtcode REVISION 5
/* external declaration (or precision or invariant stmt) */
.emtcode EXTERNAL_NULL 0
@ -83,6 +83,10 @@
.emtcode FUNCTION_CONSTRUCTOR 1
.emtcode FUNCTION_OPERATOR 2
/* function call type */
.emtcode FUNCTION_CALL_NONARRAY 0
.emtcode FUNCTION_CALL_ARRAY 1
/* operator type */
.emtcode OPERATOR_ADDASSIGN 1
.emtcode OPERATOR_SUBASSIGN 2
@ -178,9 +182,9 @@
.emtcode TYPE_SPECIFIER_MAT34 30
.emtcode TYPE_SPECIFIER_MAT43 31
/* optional array size. Ex: "float[6] myarray;" */
.emtcode TYPE_ARRAY_SIZE 220
.emtcode TYPE_NO_ARRAY_SIZE 221
/* type specifier array */
.emtcode TYPE_SPECIFIER_NONARRAY 0
.emtcode TYPE_SPECIFIER_ARRAY 1
/* structure field */
.emtcode FIELD_NONE 0
@ -403,11 +407,17 @@ function_call_header
/*
* <function_identifier> ::= <constructor_identifier>
* | <identifier>
* | <type_specifier>
*
* note: <constructor_identifier> has been deleted
* note: <constructor_identifier> and <type_specifier> have been deleted
*/
function_identifier
identifier;
identifier .and function_identifier_opt_array;
function_identifier_opt_array
function_identifier_array .emit FUNCTION_CALL_ARRAY .or
.true .emit FUNCTION_CALL_NONARRAY;
function_identifier_array
lbracket .and constant_expression .and rbracket;
/*
* <unary_expression> ::= <postfix_expression>
@ -908,22 +918,14 @@ single_declaration_6
constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
/*
* <fully_specified_type> ::= <opt_invariant> <opt_centroid> <opt_qualifer> <opt_precision> <type_specifier> <opt_array_size>
* <fully_specified_type> ::= <opt_invariant> <opt_centroid> <opt_qualifer> <opt_precision> <type_specifier>
*
* Example: "invariant varying highp vec3 [4]"
*
* Note that the *_space version doesn't parse the array size, make sure it is being invoked after the *_nospace version.
* Example: "invariant varying highp vec3"
*/
fully_specified_type_space
fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space .and .true .emit TYPE_NO_ARRAY_SIZE;
fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;
fully_specified_type_nospace
fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_array;
type_specifier_array
type_specifier_array_1 .or type_specifier_array_2;
type_specifier_array_1
type_specifier_space .and array_size;
type_specifier_array_2
type_specifier_nospace .and opt_array_size;
fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;
fully_specified_type_optinvariant
fully_specified_type_invariant .or .true .emit TYPE_VARIANT;
fully_specified_type_invariant
@ -940,11 +942,6 @@ fully_specified_type_optprec
fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;
fully_specified_type_prec
precision .and space;
opt_array_size
array_size .or .true .emit TYPE_NO_ARRAY_SIZE;
array_size
lbracket .emit TYPE_ARRAY_SIZE .and constant_expression .and rbracket;
/*
* <invariant_qualifier> ::= "invariant"
@ -976,40 +973,40 @@ type_qualifier
.if (parsing_builtin != 0) "__fixed_input" .emit TYPE_QUALIFIER_FIXEDINPUT;
/*
* <type_specifier> ::= "void"
* | "float"
* | "int"
* | "bool"
* | "vec2"
* | "vec3"
* | "vec4"
* | "bvec2"
* | "bvec3"
* | "bvec4"
* | "ivec2"
* | "ivec3"
* | "ivec4"
* | "mat2"
* | "mat3"
* | "mat4"
* | "mat2x3"
* | "mat3x2"
* | "mat2x4"
* | "mat4x2"
* | "mat3x4"
* | "mat4x3"
* | "sampler1D"
* | "sampler2D"
* | "sampler3D"
* | "samplerCube"
* | "sampler1DShadow"
* | "sampler2DShadow"
* | "sampler2DRect"
* | "sampler2DRectShadow"
* | <struct_specifier>
* | <type_name>
* <type_specifier_nonarray> ::= "void"
* | "float"
* | "int"
* | "bool"
* | "vec2"
* | "vec3"
* | "vec4"
* | "bvec2"
* | "bvec3"
* | "bvec4"
* | "ivec2"
* | "ivec3"
* | "ivec4"
* | "mat2"
* | "mat3"
* | "mat4"
* | "mat2x3"
* | "mat3x2"
* | "mat2x4"
* | "mat4x2"
* | "mat3x4"
* | "mat4x3"
* | "sampler1D"
* | "sampler2D"
* | "sampler3D"
* | "samplerCube"
* | "sampler1DShadow"
* | "sampler2DShadow"
* | "sampler2DRect"
* | "sampler2DRectShadow"
* | <struct_specifier>
* | <type_name>
*/
type_specifier_space
type_specifier_nonarray_space
"void" .emit TYPE_SPECIFIER_VOID .or
"float" .emit TYPE_SPECIFIER_FLOAT .or
"int" .emit TYPE_SPECIFIER_INT .or
@ -1041,8 +1038,23 @@ type_specifier_space
"sampler2DRect" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or
"sampler2DRectShadow" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or
type_name .emit TYPE_SPECIFIER_TYPENAME;
type_specifier_nospace
type_specifier_nonarray_nospace
struct_specifier .emit TYPE_SPECIFIER_STRUCT;
type_specifier_nonarray
type_specifier_nonarray_nospace .or type_specifier_nonarray_space;
/*
* <type_specifier> ::= <type_specifier_nonarray>
* | <type_specifier_nonarray> "[" <constant_expression> "]"
*/
type_specifier_space
type_specifier_nonarray_space .and .true .emit TYPE_SPECIFIER_NONARRAY;
type_specifier_nospace
type_specifier_nospace_array .or type_specifier_nospace_1;
type_specifier_nospace_1
type_specifier_nonarray_nospace .and .true .emit TYPE_SPECIFIER_NONARRAY;
type_specifier_nospace_array
type_specifier_nonarray .and lbracket .emit TYPE_SPECIFIER_ARRAY .and constant_expression .and rbracket;
/*
* <struct_specifier> ::= "struct" <identifier> "{" <struct_declaration_list> "}"

View file

@ -2,7 +2,7 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */
".syntax translation_unit;\n"
".emtcode REVISION 4\n"
".emtcode REVISION 5\n"
".emtcode EXTERNAL_NULL 0\n"
".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
".emtcode EXTERNAL_DECLARATION 2\n"
@ -17,6 +17,8 @@
".emtcode FUNCTION_ORDINARY 0\n"
".emtcode FUNCTION_CONSTRUCTOR 1\n"
".emtcode FUNCTION_OPERATOR 2\n"
".emtcode FUNCTION_CALL_NONARRAY 0\n"
".emtcode FUNCTION_CALL_ARRAY 1\n"
".emtcode OPERATOR_ADDASSIGN 1\n"
".emtcode OPERATOR_SUBASSIGN 2\n"
".emtcode OPERATOR_MULASSIGN 3\n"
@ -83,8 +85,8 @@
".emtcode TYPE_SPECIFIER_MAT42 29\n"
".emtcode TYPE_SPECIFIER_MAT34 30\n"
".emtcode TYPE_SPECIFIER_MAT43 31\n"
".emtcode TYPE_ARRAY_SIZE 220\n"
".emtcode TYPE_NO_ARRAY_SIZE 221\n"
".emtcode TYPE_SPECIFIER_NONARRAY 0\n"
".emtcode TYPE_SPECIFIER_ARRAY 1\n"
".emtcode FIELD_NONE 0\n"
".emtcode FIELD_NEXT 1\n"
".emtcode FIELD_ARRAY 2\n"
@ -201,7 +203,12 @@
"function_call_header\n"
" function_identifier .and lparen;\n"
"function_identifier\n"
" identifier;\n"
" identifier .and function_identifier_opt_array;\n"
"function_identifier_opt_array\n"
" function_identifier_array .emit FUNCTION_CALL_ARRAY .or\n"
" .true .emit FUNCTION_CALL_NONARRAY;\n"
"function_identifier_array\n"
" lbracket .and constant_expression .and rbracket;\n"
"unary_expression\n"
" postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or\n"
" unary_expression_4 .or unary_expression_5;\n"
@ -434,15 +441,9 @@
"single_declaration_6\n"
" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
"fully_specified_type_space\n"
" fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space .and .true .emit TYPE_NO_ARRAY_SIZE;\n"
" fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;\n"
"fully_specified_type_nospace\n"
" fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_array;\n"
"type_specifier_array\n"
" type_specifier_array_1 .or type_specifier_array_2;\n"
"type_specifier_array_1\n"
" type_specifier_space .and array_size;\n"
"type_specifier_array_2\n"
" type_specifier_nospace .and opt_array_size;\n"
" fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;\n"
"fully_specified_type_optinvariant\n"
" fully_specified_type_invariant .or .true .emit TYPE_VARIANT;\n"
"fully_specified_type_invariant\n"
@ -459,10 +460,6 @@
" fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;\n"
"fully_specified_type_prec\n"
" precision .and space;\n"
"opt_array_size\n"
" array_size .or .true .emit TYPE_NO_ARRAY_SIZE;\n"
"array_size\n"
" lbracket .emit TYPE_ARRAY_SIZE .and constant_expression .and rbracket;\n"
"invariant_qualifier\n"
" \"invariant\" .emit TYPE_INVARIANT;\n"
"centroid_qualifier\n"
@ -474,7 +471,7 @@
" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n"
" .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n"
" .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n"
"type_specifier_space\n"
"type_specifier_nonarray_space\n"
" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"
" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"
" \"int\" .emit TYPE_SPECIFIER_INT .or\n"
@ -506,8 +503,18 @@
" \"sampler2DRect\" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or\n"
" \"sampler2DRectShadow\" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or\n"
" type_name .emit TYPE_SPECIFIER_TYPENAME;\n"
"type_specifier_nospace\n"
"type_specifier_nonarray_nospace\n"
" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n"
"type_specifier_nonarray\n"
" type_specifier_nonarray_nospace .or type_specifier_nonarray_space;\n"
"type_specifier_space\n"
" type_specifier_nonarray_space .and .true .emit TYPE_SPECIFIER_NONARRAY;\n"
"type_specifier_nospace\n"
" type_specifier_nospace_array .or type_specifier_nospace_1;\n"
"type_specifier_nospace_1\n"
" type_specifier_nonarray_nospace .and .true .emit TYPE_SPECIFIER_NONARRAY;\n"
"type_specifier_nospace_array\n"
" type_specifier_nonarray .and lbracket .emit TYPE_SPECIFIER_ARRAY .and constant_expression .and rbracket;\n"
"struct_specifier\n"
" \"struct\" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and\n"
" struct_declaration_list .and rbrace .emit FIELD_NONE;\n"

View file

@ -2,104 +2,104 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_vertex_builtin.gc */
4,2,2,90,95,5,0,12,221,1,103,108,95,80,111,115,105,116,105,111,110,0,0,0,2,2,90,95,5,0,9,221,1,103,
108,95,80,111,105,110,116,83,105,122,101,0,0,0,2,2,90,95,5,0,12,221,1,103,108,95,67,108,105,112,86,
101,114,116,101,120,0,0,0,2,2,90,95,2,0,12,221,1,103,108,95,67,111,108,111,114,0,0,0,2,2,90,95,2,0,
12,221,1,103,108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,2,0,11,221,
1,103,108,95,78,111,114,109,97,108,0,0,0,2,2,90,95,2,0,12,221,1,103,108,95,86,101,114,116,101,120,
0,0,0,2,2,90,95,2,0,12,221,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,48,0,0,0,
2,2,90,95,2,0,12,221,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,49,0,0,0,2,2,90,
95,2,0,12,221,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,50,0,0,0,2,2,90,95,2,0,
12,221,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,51,0,0,0,2,2,90,95,2,0,12,221,
1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,52,0,0,0,2,2,90,95,2,0,12,221,1,103,
108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,53,0,0,0,2,2,90,95,2,0,12,221,1,103,108,95,
77,117,108,116,105,84,101,120,67,111,111,114,100,54,0,0,0,2,2,90,95,2,0,12,221,1,103,108,95,77,117,
108,116,105,84,101,120,67,111,111,114,100,55,0,0,0,2,2,90,95,2,0,9,221,1,103,108,95,70,111,103,67,
111,111,114,100,0,0,0,2,2,90,95,3,0,12,221,1,103,108,95,70,114,111,110,116,67,111,108,111,114,0,0,
0,2,2,90,95,3,0,12,221,1,103,108,95,66,97,99,107,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,221,1,
103,108,95,70,114,111,110,116,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,
3,0,12,221,1,103,108,95,66,97,99,107,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,
90,95,3,0,12,221,1,103,108,95,84,101,120,67,111,111,114,100,0,3,18,103,108,95,77,97,120,84,101,120,
116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,90,95,3,0,9,221,1,103,108,95,70,111,103,70,114,97,
103,67,111,111,114,100,0,0,0,1,90,95,0,0,12,221,0,102,116,114,97,110,115,102,111,114,109,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,18,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,
101,99,116,105,111,110,77,97,116,114,105,120,0,16,8,48,0,57,18,103,108,95,86,101,114,116,101,120,0,
59,120,120,120,120,0,48,18,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,
105,111,110,77,97,116,114,105,120,0,16,10,49,0,57,18,103,108,95,86,101,114,116,101,120,0,59,121,
121,121,121,0,48,46,18,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,
111,110,77,97,116,114,105,120,0,16,10,50,0,57,18,103,108,95,86,101,114,116,101,120,0,59,122,122,
122,122,0,48,46,18,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,
110,77,97,116,114,105,120,0,16,10,51,0,57,18,103,108,95,86,101,114,116,101,120,0,59,119,119,119,
119,0,48,46,20,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,76,111,100,0,1,1,0,0,16,
115,97,109,112,108,101,114,0,0,1,1,0,0,9,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,
90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,111,111,
114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,
101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,
111,100,0,1,1,0,0,16,115,97,109,112,108,101,114,0,0,1,1,0,0,10,99,111,111,114,100,0,0,1,1,0,0,9,
108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,
100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,
99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,
95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,
0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,
115,97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,
90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,
111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,
119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,
108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,
116,101,120,116,117,114,101,50,68,76,111,100,0,1,1,0,0,17,115,97,109,112,108,101,114,0,0,1,1,0,0,
10,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,
52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,
99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,
18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,
0,0,1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,
115,97,109,112,108,101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,
90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,
111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,
100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,
116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,
12,221,0,116,101,120,116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,115,97,109,112,
108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,
221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,
100,0,59,120,121,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,
18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,
0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,0,116,101,
120,116,117,114,101,51,68,76,111,100,0,1,1,0,0,18,115,97,109,112,108,101,114,0,0,1,1,0,0,11,99,111,
111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,
18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,
111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,
95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,
1,90,95,0,0,12,221,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1,1,0,0,18,115,
97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,
95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,
5,2,2,90,95,5,0,12,0,1,103,108,95,80,111,115,105,116,105,111,110,0,0,0,2,2,90,95,5,0,9,0,1,103,108,
95,80,111,105,110,116,83,105,122,101,0,0,0,2,2,90,95,5,0,12,0,1,103,108,95,67,108,105,112,86,101,
114,116,101,120,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,67,111,108,111,114,0,0,0,2,2,90,95,2,0,12,0,
1,103,108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,2,0,11,0,1,103,
108,95,78,111,114,109,97,108,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,86,101,114,116,101,120,0,0,0,2,
2,90,95,2,0,12,0,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,48,0,0,0,2,2,90,95,
2,0,12,0,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,49,0,0,0,2,2,90,95,2,0,12,0,
1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,50,0,0,0,2,2,90,95,2,0,12,0,1,103,
108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,51,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,
77,117,108,116,105,84,101,120,67,111,111,114,100,52,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,77,117,
108,116,105,84,101,120,67,111,111,114,100,53,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,77,117,108,116,
105,84,101,120,67,111,111,114,100,54,0,0,0,2,2,90,95,2,0,12,0,1,103,108,95,77,117,108,116,105,84,
101,120,67,111,111,114,100,55,0,0,0,2,2,90,95,2,0,9,0,1,103,108,95,70,111,103,67,111,111,114,100,0,
0,0,2,2,90,95,3,0,12,0,1,103,108,95,70,114,111,110,116,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,0,
1,103,108,95,66,97,99,107,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,0,1,103,108,95,70,114,111,110,
116,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,0,1,103,108,95,66,
97,99,107,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,90,95,3,0,12,0,1,103,108,
95,84,101,120,67,111,111,114,100,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,
114,100,115,0,0,0,2,2,90,95,3,0,9,0,1,103,108,95,70,111,103,70,114,97,103,67,111,111,114,100,0,0,0,
1,90,95,0,0,12,0,0,102,116,114,97,110,115,102,111,114,109,0,0,1,9,18,95,95,114,101,116,86,97,108,0,
18,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,
114,105,120,0,16,8,48,0,57,18,103,108,95,86,101,114,116,101,120,0,59,120,120,120,120,0,48,18,103,
108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,
120,0,16,10,49,0,57,18,103,108,95,86,101,114,116,101,120,0,59,121,121,121,121,0,48,46,18,103,108,
95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,
16,10,50,0,57,18,103,108,95,86,101,114,116,101,120,0,59,122,122,122,122,0,48,46,18,103,108,95,77,
111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,16,10,
51,0,57,18,103,108,95,86,101,114,116,101,120,0,59,119,119,119,119,0,48,46,20,0,0,1,90,95,0,0,12,0,
0,116,101,120,116,117,114,101,49,68,76,111,100,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,1,0,
0,9,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,
100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,
114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,
114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,0,115,97,
109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,
95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,
114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,
18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,
0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,
120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,
1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,
111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,
99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,
4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
50,68,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,
1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,
114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99,111,111,114,100,52,0,
59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,
97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,
116,101,120,116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,
114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,
112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
120,121,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,
111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,
115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,
116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,
0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,
111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,
18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,
20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,
101,51,68,76,111,100,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,
0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,
111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,
114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,
114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1,1,0,0,18,0,115,97,
109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,
95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,
111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,
114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,
101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,
0,0,12,221,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,1,0,0,19,115,97,109,112,108,
101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,
99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,
20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,99,
117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,
114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,115,104,97,100,111,119,49,68,76,111,100,0,1,1,0,0,20,115,
97,109,112,108,101,114,0,0,1,1,0,0,11,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,
95,0,0,12,221,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,
0,0,12,0,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,1,0,0,19,0,115,97,109,112,108,
101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,
1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,
0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,
99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,
114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,76,111,100,0,1,1,0,0,20,0,115,
97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,
90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,
111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,
95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,
99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,221,0,115,104,97,100,111,119,49,68,80,114,111,106,76,
111,100,0,1,1,0,0,20,115,97,109,112,108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,
108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,
99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,80,114,111,106,76,
111,100,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,
9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,
100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,
99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,
59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,
97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,221,
0,115,104,97,100,111,119,50,68,76,111,100,0,1,1,0,0,21,115,97,109,112,108,101,114,0,0,1,1,0,0,11,
99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,221,1,99,111,111,114,100,52,
97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,
115,104,97,100,111,119,50,68,76,111,100,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,
99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,
0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,
114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,
114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
95,0,0,12,221,0,115,104,97,100,111,119,50,68,80,114,111,106,76,111,100,0,1,1,0,0,21,115,97,109,112,
108,101,114,0,0,1,1,0,0,12,99,111,111,114,100,0,0,1,1,0,0,9,108,111,100,0,0,0,1,3,2,90,95,0,0,12,
221,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,
95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,76,111,100,0,1,1,0,0,21,0,115,97,109,112,
108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,
12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,
100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,
18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,
4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,19 @@
#include "slang_compile.h"
typedef struct slang_assemble_ctx_
{
slang_atom_pool *atoms;
slang_name_space space;
struct gl_program *program;
slang_var_table *vartable;
slang_info_log *log;
struct slang_label_ *curFuncEndLabel;
struct slang_ir_node_ *CurLoop;
struct slang_function_ *CurFunction;
} slang_assemble_ctx;
extern GLuint
_slang_sizeof_type_specifier(const slang_type_specifier *spec);

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.2
*
* Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
* Copyright (C) 2008 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"),
@ -74,18 +74,6 @@ legal_identifier(slang_atom name)
}
/**
* Allocate storage for a variable of 'size' bytes from given pool.
* Return the allocated address for the variable.
*/
static GLuint
slang_var_pool_alloc(slang_var_pool * pool, unsigned int size)
{
const GLuint addr = pool->next_addr;
pool->next_addr += size;
return addr;
}
/*
* slang_code_unit
*/
@ -120,7 +108,6 @@ _slang_code_object_ctr(slang_code_object * self)
for (i = 0; i < SLANG_BUILTIN_TOTAL; i++)
_slang_code_unit_ctr(&self->builtin[i], self);
_slang_code_unit_ctr(&self->unit, self);
self->varpool.next_addr = 0;
slang_atom_pool_construct(&self->atompool);
}
@ -156,7 +143,6 @@ typedef struct slang_output_ctx_
slang_variable_scope *vars;
slang_function_scope *funs;
slang_struct_scope *structs;
slang_var_pool *global_pool;
struct gl_program *program;
slang_var_table *vartable;
GLuint default_precision[TYPE_SPECIFIER_COUNT];
@ -251,7 +237,7 @@ parse_float(slang_parse_ctx * C, float *number)
}
/* revision number - increment after each change affecting emitted output */
#define REVISION 4
#define REVISION 5
static int
check_revision(slang_parse_ctx * C)
@ -270,6 +256,10 @@ static int parse_expression(slang_parse_ctx *, slang_output_ctx *,
slang_operation *);
static int parse_type_specifier(slang_parse_ctx *, slang_output_ctx *,
slang_type_specifier *);
static int
parse_type_array_size(slang_parse_ctx *C,
slang_output_ctx *O,
GLint *array_len);
static GLboolean
parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len)
@ -296,7 +286,7 @@ parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len)
result = GL_TRUE;
*len = (GLint) array_size.literal[0];
} else if (array_size.type == SLANG_OPER_IDENTIFIER) {
slang_variable *var = _slang_locate_variable(array_size.locals, array_size.a_id, GL_TRUE);
slang_variable *var = _slang_variable_locate(array_size.locals, array_size.a_id, GL_TRUE);
if (!var) {
slang_info_log_error(C->L, "undefined variable '%s'",
(char *) array_size.a_id);
@ -341,6 +331,20 @@ calculate_var_size(slang_parse_ctx * C, slang_output_ctx * O,
return GL_TRUE;
}
static void
promote_type_to_array(slang_parse_ctx *C,
slang_fully_specified_type *type,
GLint array_len)
{
slang_type_specifier *baseType =
slang_type_specifier_new(type->specifier.type, NULL, NULL);
type->specifier.type = SLANG_SPEC_ARRAY;
type->specifier._array = baseType;
type->array_len = array_len;
}
static GLboolean
convert_to_array(slang_parse_ctx * C, slang_variable * var,
const slang_type_specifier * sp)
@ -366,7 +370,8 @@ convert_to_array(slang_parse_ctx * C, slang_variable * var,
static GLboolean
parse_struct_field_var(slang_parse_ctx * C, slang_output_ctx * O,
slang_variable * var, slang_atom a_name,
const slang_type_specifier * sp)
const slang_type_specifier * sp,
GLuint array_len)
{
var->a_name = a_name;
if (var->a_name == SLANG_ATOM_NULL)
@ -374,10 +379,19 @@ parse_struct_field_var(slang_parse_ctx * C, slang_output_ctx * O,
switch (*C->I++) {
case FIELD_NONE:
if (!slang_type_specifier_copy(&var->type.specifier, sp))
return GL_FALSE;
if (array_len != -1) {
if (!convert_to_array(C, var, sp))
return GL_FALSE;
var->array_len = array_len;
}
else {
if (!slang_type_specifier_copy(&var->type.specifier, sp))
return GL_FALSE;
}
break;
case FIELD_ARRAY:
if (array_len != -1)
return GL_FALSE;
if (!convert_to_array(C, var, sp))
return GL_FALSE;
if (!parse_array_len(C, O, &var->array_len))
@ -395,10 +409,13 @@ parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O,
slang_struct * st, slang_type_specifier * sp)
{
slang_output_ctx o = *O;
GLint array_len;
o.structs = st->structs;
if (!parse_type_specifier(C, &o, sp))
RETURN0;
if (!parse_type_array_size(C, &o, &array_len))
RETURN0;
do {
slang_atom a_name;
@ -408,12 +425,12 @@ parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
}
a_name = parse_identifier(C);
if (_slang_locate_variable(st->fields, a_name, GL_FALSE)) {
if (_slang_variable_locate(st->fields, a_name, GL_FALSE)) {
slang_info_log_error(C->L, "duplicate field '%s'", (char *) a_name);
RETURN0;
}
if (!parse_struct_field_var(C, &o, var, a_name, sp))
if (!parse_struct_field_var(C, &o, var, a_name, sp, array_len))
RETURN0;
}
while (*C->I++ != FIELD_NONE);
@ -748,6 +765,31 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
return 1;
}
#define TYPE_SPECIFIER_NONARRAY 0
#define TYPE_SPECIFIER_ARRAY 1
static int
parse_type_array_size(slang_parse_ctx *C,
slang_output_ctx *O,
GLint *array_len)
{
GLuint size;
switch (*C->I++) {
case TYPE_SPECIFIER_NONARRAY:
*array_len = -1; /* -1 = not an array */
break;
case TYPE_SPECIFIER_ARRAY:
if (!parse_array_len(C, O, &size))
RETURN0;
*array_len = (GLint) size;
break;
default:
assert(0);
RETURN0;
}
return 1;
}
#define PRECISION_DEFAULT 0
#define PRECISION_LOW 1
@ -777,36 +819,6 @@ parse_type_precision(slang_parse_ctx *C,
}
}
#define TYPE_ARRAY_SIZE 220
#define TYPE_NO_ARRAY_SIZE 221
/*
* Parse array size (if present) in something like "uniform float [6] var;".
*/
static int
parse_type_array_size(slang_parse_ctx *C, slang_output_ctx * O,
GLint *size)
{
GLint arr = *C->I++;
GLuint sz;
switch (arr) {
case TYPE_ARRAY_SIZE:
if (!parse_array_len(C, O, &sz))
RETURN0;
*size = sz;
return 1;
case TYPE_NO_ARRAY_SIZE:
*size = -1; /* -1 = not an array */
return 1;
default:
assert(0);
RETURN0;
}
}
static int
parse_fully_specified_type(slang_parse_ctx * C, slang_output_ctx * O,
slang_fully_specified_type * type)
@ -877,6 +889,11 @@ parse_fully_specified_type(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
}
if (type->array_len >= 0) {
/* convert type to array type (ex: convert "int" to "array of int" */
promote_type_to_array(C, type, type->array_len);
}
return 1;
}
@ -978,8 +995,12 @@ static int
parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
slang_operation * oper)
{
int op;
oper->locals->outer_scope = O->vars;
switch (*C->I++) {
op = *C->I++;
switch (op) {
case OP_BLOCK_BEGIN_NO_NEW_SCOPE:
/* parse child statements, do not create new variable scope */
oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
@ -1132,6 +1153,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
}
break;
default:
/*printf("Unexpected operation %d\n", op);*/
RETURN0;
}
return 1;
@ -1179,6 +1201,9 @@ is_constructor_name(const char *name, slang_atom a_name,
return slang_struct_scope_find(structs, a_name, 1) != NULL;
}
#define FUNCTION_CALL_NONARRAY 0
#define FUNCTION_CALL_ARRAY 1
static int
parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
slang_operation * oper)
@ -1400,6 +1425,9 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
if (op->a_id == SLANG_ATOM_NULL)
RETURN0;
assert(*C->I == OP_END);
C->I++;
while (*C->I != OP_END)
if (!parse_child_operation(C, O, op, 0))
RETURN0;
@ -1419,23 +1447,73 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
#endif
break;
case OP_CALL:
op->type = SLANG_OPER_CALL;
op->a_id = parse_identifier(C);
if (op->a_id == SLANG_ATOM_NULL)
RETURN0;
while (*C->I != OP_END)
if (!parse_child_operation(C, O, op, 0))
RETURN0;
C->I++;
{
GLboolean array_constructor = GL_FALSE;
GLint array_constructor_size;
if (!C->parsing_builtin
&& !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) {
const char *id;
id = slang_atom_pool_id(C->atoms, op->a_id);
if (!is_constructor_name(id, op->a_id, O->structs)) {
slang_info_log_error(C->L, "%s: undeclared function name.", id);
op->type = SLANG_OPER_CALL;
op->a_id = parse_identifier(C);
if (op->a_id == SLANG_ATOM_NULL)
RETURN0;
switch (*C->I++) {
case FUNCTION_CALL_NONARRAY:
/* Nothing to do. */
break;
case FUNCTION_CALL_ARRAY:
/* Calling an array constructor. For example:
* float[3](1.1, 2.2, 3.3);
*/
if (!O->allow_array_types) {
slang_info_log_error(C->L,
"array constructors not allowed "
"in this GLSL version");
RETURN0;
}
else {
array_constructor = GL_TRUE;
/* parse the array constructor size */
slang_operation array_size;
slang_operation_construct(&array_size);
if (!parse_expression(C, O, &array_size)) {
slang_operation_destruct(&array_size);
return GL_FALSE;
}
if (array_size.type != SLANG_OPER_LITERAL_INT) {
slang_info_log_error(C->L,
"constructor array size is not an integer");
slang_operation_destruct(&array_size);
RETURN0;
}
array_constructor_size = (int) array_size.literal[0];
op->array_constructor = GL_TRUE;
slang_operation_destruct(&array_size);
}
break;
default:
assert(0);
RETURN0;
}
while (*C->I != OP_END)
if (!parse_child_operation(C, O, op, 0))
RETURN0;
C->I++;
if (array_constructor &&
array_constructor_size != op->num_children) {
slang_info_log_error(C->L, "number of parameters to array"
" constructor does not match array size");
RETURN0;
}
if (!C->parsing_builtin
&& !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) {
const char *id;
id = slang_atom_pool_id(C->atoms, op->a_id);
if (!is_constructor_name(id, op->a_id, O->structs)) {
slang_info_log_error(C->L, "%s: undeclared function name.", id);
RETURN0;
}
}
}
break;
@ -1528,34 +1606,59 @@ parse_parameter_declaration(slang_parse_ctx * C, slang_output_ctx * O,
/* parse parameter's type specifier and name */
if (!parse_type_specifier(C, O, &param->type.specifier))
RETURN0;
if (!parse_type_array_size(C, O, &param->type.array_len))
RETURN0;
param->a_name = parse_identifier(C);
if (param->a_name == SLANG_ATOM_NULL)
RETURN0;
/* first-class array
*/
if (param->type.array_len >= 0) {
slang_type_specifier p;
slang_type_specifier_ctr(&p);
if (!slang_type_specifier_copy(&p, &param->type.specifier)) {
slang_type_specifier_dtr(&p);
RETURN0;
}
if (!convert_to_array(C, param, &p)) {
slang_type_specifier_dtr(&p);
RETURN0;
}
slang_type_specifier_dtr(&p);
param->array_len = param->type.array_len;
}
/* if the parameter is an array, parse its size (the size must be
* explicitly defined
*/
if (*C->I++ == PARAMETER_ARRAY_PRESENT) {
slang_type_specifier p;
if (param->type.array_len >= 0) {
slang_info_log_error(C->L, "multi-dimensional arrays not allowed");
RETURN0;
}
slang_type_specifier_ctr(&p);
if (!slang_type_specifier_copy(&p, &param->type.specifier)) {
slang_type_specifier_dtr(&p);
return GL_FALSE;
RETURN0;
}
if (!convert_to_array(C, param, &p)) {
slang_type_specifier_dtr(&p);
return GL_FALSE;
RETURN0;
}
slang_type_specifier_dtr(&p);
if (!parse_array_len(C, O, &param->array_len))
return GL_FALSE;
RETURN0;
}
#if 0
/* calculate the parameter size */
if (!calculate_var_size(C, O, param))
return GL_FALSE;
RETURN0;
#endif
/* TODO: allocate the local address here? */
return 1;
}
@ -1858,7 +1961,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
a_name = parse_identifier(C);
/* check if name is already in this scope */
if (_slang_locate_variable(O->vars, a_name, GL_FALSE)) {
if (_slang_variable_locate(O->vars, a_name, GL_FALSE)) {
slang_info_log_error(C->L,
"declaration of '%s' conflicts with previous declaration",
(char *) a_name);
@ -1877,6 +1980,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
var->type.centroid = type->centroid;
var->type.precision = type->precision;
var->type.variant = type->variant;
var->type.array_len = type->array_len;
var->a_name = a_name;
if (var->a_name == SLANG_ATOM_NULL)
RETURN0;
@ -1889,8 +1993,15 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
break;
case VARIABLE_INITIALIZER:
/* initialized variable - copy the specifier and parse the expression */
if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier))
RETURN0;
if (0 && type->array_len >= 0) {
/* The type was something like "float[4]" */
convert_to_array(C, var, &type->specifier);
var->array_len = type->array_len;
}
else {
if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier))
RETURN0;
}
var->initializer =
(slang_operation *) _slang_alloc(sizeof(slang_operation));
if (var->initializer == NULL) {
@ -1908,12 +2019,21 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
break;
case VARIABLE_ARRAY_UNKNOWN:
/* unsized array - mark it as array and copy the specifier to
the array element
*/
* the array element
*/
if (type->array_len >= 0) {
slang_info_log_error(C->L, "multi-dimensional arrays not allowed");
RETURN0;
}
if (!convert_to_array(C, var, &type->specifier))
return GL_FALSE;
break;
case VARIABLE_ARRAY_EXPLICIT:
if (type->array_len >= 0) {
/* the user is trying to do something like: float[2] x[3]; */
slang_info_log_error(C->L, "multi-dimensional arrays not allowed");
RETURN0;
}
if (!convert_to_array(C, var, &type->specifier))
return GL_FALSE;
if (!parse_array_len(C, O, &var->array_len))
@ -1923,23 +2043,12 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
}
if (type->array_len >= 0) {
/* The type was something like "float[4]" */
if (var->array_len != 0) {
slang_info_log_error(C->L, "multi-dimensional arrays not allowed");
RETURN0;
}
convert_to_array(C, var, &type->specifier);
var->array_len = type->array_len;
}
/* allocate global address space for a variable with a known size */
if (C->global_scope
&& !(var->type.specifier.type == SLANG_SPEC_ARRAY
&& var->array_len == 0)) {
if (!calculate_var_size(C, O, var))
return GL_FALSE;
var->address = slang_var_pool_alloc(O->global_pool, var->size);
}
/* emit code for global var decl */
@ -2072,10 +2181,8 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
}
/* destroy the existing function declaration and replace it
* with the new one, remember to save the fixup table
* with the new one
*/
parsed_func.fixups = found_func->fixups;
slang_fixup_table_init(&found_func->fixups);
slang_function_destruct(found_func);
*found_func = parsed_func;
}
@ -2241,7 +2348,6 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
o.funs = &unit->funs;
o.structs = &unit->structs;
o.vars = &unit->vars;
o.global_pool = &unit->object->varpool;
o.program = shader ? shader->Program : NULL;
o.vartable = _slang_new_var_table(maxRegs);
_slang_push_var_table(o.vartable);

View file

@ -37,6 +37,13 @@
extern "C" {
#endif
typedef struct slang_name_space_
{
struct slang_function_scope_ *funcs;
struct slang_struct_scope_ *structs;
struct slang_variable_scope_ *vars;
} slang_name_space;
typedef enum slang_unit_type_
{
SLANG_UNIT_FRAGMENT_SHADER,
@ -46,12 +53,6 @@ typedef enum slang_unit_type_
} slang_unit_type;
typedef struct slang_var_pool_
{
GLuint next_addr;
} slang_var_pool;
typedef struct slang_code_unit_
{
slang_variable_scope vars;
@ -79,7 +80,6 @@ typedef struct slang_code_object_
{
slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
slang_code_unit unit;
slang_var_pool varpool;
slang_atom_pool atompool;
} slang_code_object;

View file

@ -32,42 +32,6 @@
#include "slang_compile.h"
#include "slang_mem.h"
/* slang_fixup_table */
void
slang_fixup_table_init(slang_fixup_table * fix)
{
fix->table = NULL;
fix->count = 0;
}
void
slang_fixup_table_free(slang_fixup_table * fix)
{
_slang_free(fix->table);
slang_fixup_table_init(fix);
}
/**
* Add a new fixup address to the table.
*/
GLboolean
slang_fixup_save(slang_fixup_table *fixups, GLuint address)
{
fixups->table = (GLuint *)
_slang_realloc(fixups->table,
fixups->count * sizeof(GLuint),
(fixups->count + 1) * sizeof(GLuint));
if (fixups->table == NULL)
return GL_FALSE;
fixups->table[fixups->count] = address;
fixups->count++;
return GL_TRUE;
}
/* slang_function */
int
slang_function_construct(slang_function * func)
@ -86,8 +50,6 @@ slang_function_construct(slang_function * func)
_slang_variable_scope_ctr(func->parameters);
func->param_count = 0;
func->body = NULL;
func->address = ~0;
slang_fixup_table_init(&func->fixups);
return 1;
}
@ -101,9 +63,22 @@ slang_function_destruct(slang_function * func)
slang_operation_destruct(func->body);
_slang_free(func->body);
}
slang_fixup_table_free(&func->fixups);
}
slang_function *
slang_function_new(slang_function_kind kind)
{
slang_function *fun = (slang_function *)
_slang_alloc(sizeof(slang_function));
if (fun) {
slang_function_construct(fun);
fun->kind = kind;
}
return fun;
}
/*
* slang_function_scope
*/
@ -214,3 +189,74 @@ slang_function_scope_find(slang_function_scope * funcs, slang_function * fun,
return slang_function_scope_find(funcs->outer_scope, fun, 1);
return NULL;
}
/**
* Lookup a function according to name and parameter count/types.
*/
slang_function *
_slang_function_locate(const slang_function_scope * funcs, slang_atom a_name,
slang_operation * args, GLuint num_args,
const slang_name_space * space, slang_atom_pool * atoms,
slang_info_log *log, GLboolean *error)
{
slang_typeinfo arg_ti[100];
GLuint i;
*error = GL_FALSE;
/* determine type of each argument */
assert(num_args < 100);
for (i = 0; i < num_args; i++) {
if (!slang_typeinfo_construct(&arg_ti[i]))
return NULL;
if (!_slang_typeof_operation(&args[i], space, &arg_ti[i], atoms, log)) {
return NULL;
}
}
/* loop over function scopes */
while (funcs) {
/* look for function with matching name and argument/param types */
for (i = 0; i < funcs->num_functions; i++) {
slang_function *f = &funcs->functions[i];
const GLuint haveRetValue = _slang_function_has_return_value(f);
GLuint j;
if (a_name != f->header.a_name)
continue;
if (f->param_count - haveRetValue != num_args)
continue;
/* compare parameter / argument types */
for (j = 0; j < num_args; j++) {
if (!slang_type_specifier_compatible(&arg_ti[j].spec,
&f->parameters->variables[j]->type.specifier)) {
/* param/arg types don't match */
break;
}
/* "out" and "inout" formal parameter requires the actual
* argument to be an l-value.
*/
if (!arg_ti[j].can_be_referenced &&
(f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT ||
f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT)) {
/* param is not an lvalue! */
*error = GL_TRUE;
return NULL;
}
}
if (j == num_args) {
/* name and args match! */
return f;
}
}
funcs = funcs->outer_scope;
}
return NULL;
}

View file

@ -26,8 +26,6 @@
#define SLANG_COMPILE_FUNCTION_H
struct slang_code_unit_;
/**
* Types of functions.
*/
@ -39,21 +37,6 @@ typedef enum slang_function_kind_
} slang_function_kind;
/**
* When we need to fill in addresses which we won't know until the future,
* we keep track of them with a fix-up table.
*/
typedef struct slang_fixup_table_
{
GLuint *table; /**< array[count] of addresses */
GLuint count;
} slang_fixup_table;
extern void slang_fixup_table_init(slang_fixup_table *);
extern void slang_fixup_table_free(slang_fixup_table *);
extern GLboolean slang_fixup_save(slang_fixup_table *fixups, GLuint address);
/**
* Description of a compiled shader function.
*/
@ -64,12 +47,14 @@ typedef struct slang_function_
slang_variable_scope *parameters; /**< formal parameters AND local vars */
unsigned int param_count; /**< number of formal params (no locals) */
slang_operation *body; /**< The instruction tree */
unsigned int address; /**< Address of this func in memory */
slang_fixup_table fixups; /**< Mem locations which need func's address */
} slang_function;
extern int slang_function_construct(slang_function *);
extern void slang_function_destruct(slang_function *);
extern slang_function *slang_function_new(slang_function_kind kind);
extern GLboolean
_slang_function_has_return_value(const slang_function *fun);
/**
@ -89,13 +74,19 @@ _slang_function_scope_ctr(slang_function_scope *);
extern void
slang_function_scope_destruct(slang_function_scope *);
extern GLboolean
_slang_function_has_return_value(const slang_function *fun);
extern int
slang_function_scope_find_by_name(slang_function_scope *, slang_atom, int);
extern slang_function *
slang_function_scope_find(slang_function_scope *, slang_function *, int);
extern struct slang_function_ *
_slang_function_locate(const struct slang_function_scope_ *funcs,
slang_atom name, struct slang_operation_ *params,
GLuint num_params,
const struct slang_name_space_ *space,
slang_atom_pool *atoms, slang_info_log *log,
GLboolean *error);
#endif /* SLANG_COMPILE_FUNCTION_H */

View file

@ -44,6 +44,7 @@ slang_operation_construct(slang_operation * oper)
oper->num_children = 0;
oper->literal[0] = 0.0;
oper->literal_size = 1;
oper->array_constructor = GL_FALSE;
oper->a_id = SLANG_ATOM_NULL;
oper->locals = _slang_variable_scope_new(NULL);
if (oper->locals == NULL)
@ -90,7 +91,7 @@ slang_replace_scope(slang_operation *oper,
if (oper->type == SLANG_OPER_VARIABLE_DECL) {
/* search/replace in the initializer */
slang_variable *var;
var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE);
var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE);
if (var && var->initializer) {
slang_replace_scope(var->initializer, oldScope, newScope);
}

View file

@ -121,6 +121,12 @@ typedef struct slang_operation_
struct slang_function_ *fun; /**< If type == SLANG_OPER_CALL */
struct slang_variable_ *var; /**< If type == slang_oper_identier */
struct slang_label_ *label; /**< If type == SLANG_OPER_LABEL */
/** If type==SLANG_OPER_CALL and we're calling an array constructor,
* for which there's no real function, we need to have a flag to
* indicate such. num_children indicates number of elements.
*/
GLboolean array_constructor;
double x;
} slang_operation;

View file

@ -33,108 +33,6 @@
#include "slang_mem.h"
typedef struct
{
const char *name;
slang_type_specifier_type type;
} type_specifier_type_name;
static const type_specifier_type_name type_specifier_type_names[] = {
{"void", SLANG_SPEC_VOID},
{"bool", SLANG_SPEC_BOOL},
{"bvec2", SLANG_SPEC_BVEC2},
{"bvec3", SLANG_SPEC_BVEC3},
{"bvec4", SLANG_SPEC_BVEC4},
{"int", SLANG_SPEC_INT},
{"ivec2", SLANG_SPEC_IVEC2},
{"ivec3", SLANG_SPEC_IVEC3},
{"ivec4", SLANG_SPEC_IVEC4},
{"float", SLANG_SPEC_FLOAT},
{"vec2", SLANG_SPEC_VEC2},
{"vec3", SLANG_SPEC_VEC3},
{"vec4", SLANG_SPEC_VEC4},
{"mat2", SLANG_SPEC_MAT2},
{"mat3", SLANG_SPEC_MAT3},
{"mat4", SLANG_SPEC_MAT4},
{"mat2x3", SLANG_SPEC_MAT23},
{"mat3x2", SLANG_SPEC_MAT32},
{"mat2x4", SLANG_SPEC_MAT24},
{"mat4x2", SLANG_SPEC_MAT42},
{"mat3x4", SLANG_SPEC_MAT34},
{"mat4x3", SLANG_SPEC_MAT43},
{"sampler1D", SLANG_SPEC_SAMPLER1D},
{"sampler2D", SLANG_SPEC_SAMPLER2D},
{"sampler3D", SLANG_SPEC_SAMPLER3D},
{"samplerCube", SLANG_SPEC_SAMPLERCUBE},
{"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW},
{"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW},
{"sampler2DRect", SLANG_SPEC_SAMPLER2DRECT},
{"sampler2DRectShadow", SLANG_SPEC_SAMPLER2DRECTSHADOW},
{NULL, SLANG_SPEC_VOID}
};
slang_type_specifier_type
slang_type_specifier_type_from_string(const char *name)
{
const type_specifier_type_name *p = type_specifier_type_names;
while (p->name != NULL) {
if (slang_string_compare(p->name, name) == 0)
break;
p++;
}
return p->type;
}
const char *
slang_type_specifier_type_to_string(slang_type_specifier_type type)
{
const type_specifier_type_name *p = type_specifier_type_names;
while (p->name != NULL) {
if (p->type == type)
break;
p++;
}
return p->name;
}
/* slang_fully_specified_type */
int
slang_fully_specified_type_construct(slang_fully_specified_type * type)
{
type->qualifier = SLANG_QUAL_NONE;
slang_type_specifier_ctr(&type->specifier);
return 1;
}
void
slang_fully_specified_type_destruct(slang_fully_specified_type * type)
{
slang_type_specifier_dtr(&type->specifier);
}
int
slang_fully_specified_type_copy(slang_fully_specified_type * x,
const slang_fully_specified_type * y)
{
slang_fully_specified_type z;
if (!slang_fully_specified_type_construct(&z))
return 0;
z.qualifier = y->qualifier;
z.precision = y->precision;
z.variant = y->variant;
z.centroid = y->centroid;
if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) {
slang_fully_specified_type_destruct(&z);
return 0;
}
slang_fully_specified_type_destruct(x);
*x = z;
return 1;
}
static slang_variable *
slang_variable_new(void)
{
@ -266,7 +164,6 @@ slang_variable_construct(slang_variable * var)
var->a_name = SLANG_ATOM_NULL;
var->array_len = 0;
var->initializer = NULL;
var->address = ~0;
var->size = 0;
var->isTemp = GL_FALSE;
var->store = NULL;
@ -321,7 +218,6 @@ slang_variable_copy(slang_variable * x, const slang_variable * y)
return 0;
}
}
z.address = y->address;
z.size = y->size;
slang_variable_destruct(x);
*x = z;
@ -334,7 +230,7 @@ slang_variable_copy(slang_variable * x, const slang_variable * y)
* \param all if true, search parent scopes too.
*/
slang_variable *
_slang_locate_variable(const slang_variable_scope * scope,
_slang_variable_locate(const slang_variable_scope * scope,
const slang_atom a_name, GLboolean all)
{
while (scope) {

View file

@ -25,79 +25,10 @@
#ifndef SLANG_COMPILE_VARIABLE_H
#define SLANG_COMPILE_VARIABLE_H
#if defined __cplusplus
extern "C" {
#endif
struct slang_ir_storage_;
typedef enum slang_type_variant_
{
SLANG_VARIANT, /* the default */
SLANG_INVARIANT /* indicates the "invariant" keyword */
} slang_type_variant;
typedef enum slang_type_centroid_
{
SLANG_CENTER, /* the default */
SLANG_CENTROID /* indicates the "centroid" keyword */
} slang_type_centroid;
typedef enum slang_type_qualifier_
{
SLANG_QUAL_NONE,
SLANG_QUAL_CONST,
SLANG_QUAL_ATTRIBUTE,
SLANG_QUAL_VARYING,
SLANG_QUAL_UNIFORM,
SLANG_QUAL_OUT,
SLANG_QUAL_INOUT,
SLANG_QUAL_FIXEDOUTPUT, /* internal */
SLANG_QUAL_FIXEDINPUT /* internal */
} slang_type_qualifier;
extern slang_type_specifier_type
slang_type_specifier_type_from_string(const char *);
extern const char *
slang_type_specifier_type_to_string(slang_type_specifier_type);
typedef enum slang_type_precision_
{
SLANG_PREC_DEFAULT,
SLANG_PREC_LOW,
SLANG_PREC_MEDIUM,
SLANG_PREC_HIGH
} slang_type_precision;
typedef struct slang_fully_specified_type_
{
slang_type_qualifier qualifier;
slang_type_specifier specifier;
slang_type_precision precision;
slang_type_variant variant;
slang_type_centroid centroid;
GLint array_len; /**< -1 if not an array type */
} slang_fully_specified_type;
extern int
slang_fully_specified_type_construct(slang_fully_specified_type *);
extern void
slang_fully_specified_type_destruct(slang_fully_specified_type *);
extern int
slang_fully_specified_type_copy(slang_fully_specified_type *,
const slang_fully_specified_type *);
/**
* A shading language program variable.
*/
@ -107,7 +38,6 @@ typedef struct slang_variable_
slang_atom a_name; /**< The variable's name (char *) */
GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */
struct slang_operation_ *initializer; /**< Optional initializer code */
GLuint address; /**< Storage location */
GLuint size; /**< Variable's size in bytes */
GLboolean isTemp; /**< a named temporary (__resultTmp) */
GLboolean declared; /**< for debug */
@ -152,12 +82,8 @@ extern int
slang_variable_copy(slang_variable *, const slang_variable *);
extern slang_variable *
_slang_locate_variable(const slang_variable_scope *, const slang_atom a_name,
_slang_variable_locate(const slang_variable_scope *, const slang_atom a_name,
GLboolean all);
#ifdef __cplusplus
}
#endif
#endif /* SLANG_COMPILE_VARIABLE_H */

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
*
* Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2008 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"),
@ -154,6 +154,28 @@ _slang_swizzle_swizzle(GLuint swz1, GLuint swz2)
}
/**
* Return the default swizzle mask for accessing a variable of the
* given size (in floats). If size = 1, comp is used to identify
* which component [0..3] of the register holds the variable.
*/
GLuint
_slang_var_swizzle(GLint size, GLint comp)
{
switch (size) {
case 1:
return MAKE_SWIZZLE4(comp, comp, comp, comp);
case 2:
return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_NIL, SWIZZLE_NIL);
case 3:
return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_NIL);
default:
return SWIZZLE_XYZW;
}
}
/**
* Allocate storage for the given node (if it hasn't already been allocated).
*
@ -1917,6 +1939,7 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
}
n->Store->Size = elemSize;
n->Store->Swizzle = _slang_var_swizzle(elemSize, 0);
return NULL; /* no instruction */
}

View file

@ -40,6 +40,10 @@ extern GLuint
_slang_swizzle_swizzle(GLuint swz1, GLuint swz2);
extern GLuint
_slang_var_swizzle(GLint size, GLint comp);
extern GLboolean
_slang_emit_code(slang_ir_node *n, slang_var_table *vartable,
struct gl_program *prog, GLboolean withEnd,

View file

@ -1,501 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* SimplexNoise1234
* Copyright (c) 2003-2005, Stefan Gustavson
*
* Contact: stegu@itn.liu.se
*/
/** \file
\brief C implementation of Perlin Simplex Noise over 1,2,3, and 4 dimensions.
\author Stefan Gustavson (stegu@itn.liu.se)
*/
/*
* This implementation is "Simplex Noise" as presented by
* Ken Perlin at a relatively obscure and not often cited course
* session "Real-Time Shading" at Siggraph 2001 (before real
* time shading actually took on), under the title "hardware noise".
* The 3D function is numerically equivalent to his Java reference
* code available in the PDF course notes, although I re-implemented
* it from scratch to get more readable code. The 1D, 2D and 4D cases
* were implemented from scratch by me from Ken Perlin's text.
*
* This file has no dependencies on any other file, not even its own
* header file. The header file is made for use by external code only.
*/
#include "main/imports.h"
#include "slang_library_noise.h"
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
/*
* ---------------------------------------------------------------------
* Static data
*/
/*
* Permutation table. This is just a random jumble of all numbers 0-255,
* repeated twice to avoid wrapping the index at 255 for each lookup.
* This needs to be exactly the same for all instances on all platforms,
* so it's easiest to just keep it as static explicit data.
* This also removes the need for any initialisation of this class.
*
* Note that making this an int[] instead of a char[] might make the
* code run faster on platforms with a high penalty for unaligned single
* byte addressing. Intel x86 is generally single-byte-friendly, but
* some other CPUs are faster with 4-aligned reads.
* However, a char[] is smaller, which avoids cache trashing, and that
* is probably the most important aspect on most architectures.
* This array is accessed a *lot* by the noise functions.
* A vector-valued noise over 3D accesses it 96 times, and a
* float-valued 4D noise 64 times. We want this to fit in the cache!
*/
unsigned char perm[512] = {151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,
151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
};
/*
* ---------------------------------------------------------------------
*/
/*
* Helper functions to compute gradients-dot-residualvectors (1D to 4D)
* Note that these generate gradients of more than unit length. To make
* a close match with the value range of classic Perlin noise, the final
* noise values need to be rescaled to fit nicely within [-1,1].
* (The simplex noise functions as such also have different scaling.)
* Note also that these noise functions are the most practical and useful
* signed version of Perlin noise. To return values according to the
* RenderMan specification from the SL noise() and pnoise() functions,
* the noise values need to be scaled and offset to [0,1], like this:
* float SLnoise = (SimplexNoise1234::noise(x,y,z) + 1.0) * 0.5;
*/
static float grad1( int hash, float x ) {
int h = hash & 15;
float grad = 1.0f + (h & 7); /* Gradient value 1.0, 2.0, ..., 8.0 */
if (h&8) grad = -grad; /* Set a random sign for the gradient */
return ( grad * x ); /* Multiply the gradient with the distance */
}
static float grad2( int hash, float x, float y ) {
int h = hash & 7; /* Convert low 3 bits of hash code */
float u = h<4 ? x : y; /* into 8 simple gradient directions, */
float v = h<4 ? y : x; /* and compute the dot product with (x,y). */
return ((h&1)? -u : u) + ((h&2)? -2.0f*v : 2.0f*v);
}
static float grad3( int hash, float x, float y , float z ) {
int h = hash & 15; /* Convert low 4 bits of hash code into 12 simple */
float u = h<8 ? x : y; /* gradient directions, and compute dot product. */
float v = h<4 ? y : h==12||h==14 ? x : z; /* Fix repeats at h = 12 to 15 */
return ((h&1)? -u : u) + ((h&2)? -v : v);
}
static float grad4( int hash, float x, float y, float z, float t ) {
int h = hash & 31; /* Convert low 5 bits of hash code into 32 simple */
float u = h<24 ? x : y; /* gradient directions, and compute dot product. */
float v = h<16 ? y : z;
float w = h<8 ? z : t;
return ((h&1)? -u : u) + ((h&2)? -v : v) + ((h&4)? -w : w);
}
/* A lookup table to traverse the simplex around a given point in 4D. */
/* Details can be found where this table is used, in the 4D noise method. */
/* TODO: This should not be required, backport it from Bill's GLSL code! */
static unsigned char simplex[64][4] = {
{0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,3,0},
{0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,3,2,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0},
{1,0,2,3},{1,0,3,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{2,0,1,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0},
{2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},{3,2,1,0}};
/* 1D simplex noise */
GLfloat _slang_library_noise1 (GLfloat x)
{
int i0 = FASTFLOOR(x);
int i1 = i0 + 1;
float x0 = x - i0;
float x1 = x0 - 1.0f;
float t1 = 1.0f - x1*x1;
float n0, n1;
float t0 = 1.0f - x0*x0;
/* if(t0 < 0.0f) t0 = 0.0f; // this never happens for the 1D case */
t0 *= t0;
n0 = t0 * t0 * grad1(perm[i0 & 0xff], x0);
/* if(t1 < 0.0f) t1 = 0.0f; // this never happens for the 1D case */
t1 *= t1;
n1 = t1 * t1 * grad1(perm[i1 & 0xff], x1);
/* The maximum value of this noise is 8*(3/4)^4 = 2.53125 */
/* A factor of 0.395 would scale to fit exactly within [-1,1], but */
/* we want to match PRMan's 1D noise, so we scale it down some more. */
return 0.25f * (n0 + n1);
}
/* 2D simplex noise */
GLfloat _slang_library_noise2 (GLfloat x, GLfloat y)
{
#define F2 0.366025403f /* F2 = 0.5*(sqrt(3.0)-1.0) */
#define G2 0.211324865f /* G2 = (3.0-Math.sqrt(3.0))/6.0 */
float n0, n1, n2; /* Noise contributions from the three corners */
/* Skew the input space to determine which simplex cell we're in */
float s = (x+y)*F2; /* Hairy factor for 2D */
float xs = x + s;
float ys = y + s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
float t = (float)(i+j)*G2;
float X0 = i-t; /* Unskew the cell origin back to (x,y) space */
float Y0 = j-t;
float x0 = x-X0; /* The x,y distances from the cell origin */
float y0 = y-Y0;
float x1, y1, x2, y2;
int ii, jj;
float t0, t1, t2;
/* For the 2D case, the simplex shape is an equilateral triangle. */
/* Determine which simplex we are in. */
int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
if(x0>y0) {i1=1; j1=0;} /* lower triangle, XY order: (0,0)->(1,0)->(1,1) */
else {i1=0; j1=1;} /* upper triangle, YX order: (0,0)->(0,1)->(1,1) */
/* A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and */
/* a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where */
/* c = (3-sqrt(3))/6 */
x1 = x0 - i1 + G2; /* Offsets for middle corner in (x,y) unskewed coords */
y1 = y0 - j1 + G2;
x2 = x0 - 1.0f + 2.0f * G2; /* Offsets for last corner in (x,y) unskewed coords */
y2 = y0 - 1.0f + 2.0f * G2;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
/* Calculate the contribution from the three corners */
t0 = 0.5f - x0*x0-y0*y0;
if(t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad2(perm[ii+perm[jj]], x0, y0);
}
t1 = 0.5f - x1*x1-y1*y1;
if(t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad2(perm[ii+i1+perm[jj+j1]], x1, y1);
}
t2 = 0.5f - x2*x2-y2*y2;
if(t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad2(perm[ii+1+perm[jj+1]], x2, y2);
}
/* Add contributions from each corner to get the final noise value. */
/* The result is scaled to return values in the interval [-1,1]. */
return 40.0f * (n0 + n1 + n2); /* TODO: The scale factor is preliminary! */
}
/* 3D simplex noise */
GLfloat _slang_library_noise3 (GLfloat x, GLfloat y, GLfloat z)
{
/* Simple skewing factors for the 3D case */
#define F3 0.333333333f
#define G3 0.166666667f
float n0, n1, n2, n3; /* Noise contributions from the four corners */
/* Skew the input space to determine which simplex cell we're in */
float s = (x+y+z)*F3; /* Very nice and simple skew factor for 3D */
float xs = x+s;
float ys = y+s;
float zs = z+s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
int k = FASTFLOOR(zs);
float t = (float)(i+j+k)*G3;
float X0 = i-t; /* Unskew the cell origin back to (x,y,z) space */
float Y0 = j-t;
float Z0 = k-t;
float x0 = x-X0; /* The x,y,z distances from the cell origin */
float y0 = y-Y0;
float z0 = z-Z0;
float x1, y1, z1, x2, y2, z2, x3, y3, z3;
int ii, jj, kk;
float t0, t1, t2, t3;
/* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
/* Determine which simplex we are in. */
int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
/* This code would benefit from a backport from the GLSL version! */
if(x0>=y0) {
if(y0>=z0)
{ i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } /* X Y Z order */
else if(x0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } /* X Z Y order */
else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } /* Z X Y order */
}
else { /* x0<y0 */
if(y0<z0) { i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; } /* Z Y X order */
else if(x0<z0) { i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; } /* Y Z X order */
else { i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; } /* Y X Z order */
}
/* A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z), */
/* a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and */
/* a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where */
/* c = 1/6. */
x1 = x0 - i1 + G3; /* Offsets for second corner in (x,y,z) coords */
y1 = y0 - j1 + G3;
z1 = z0 - k1 + G3;
x2 = x0 - i2 + 2.0f*G3; /* Offsets for third corner in (x,y,z) coords */
y2 = y0 - j2 + 2.0f*G3;
z2 = z0 - k2 + 2.0f*G3;
x3 = x0 - 1.0f + 3.0f*G3; /* Offsets for last corner in (x,y,z) coords */
y3 = y0 - 1.0f + 3.0f*G3;
z3 = z0 - 1.0f + 3.0f*G3;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
kk = k % 256;
/* Calculate the contribution from the four corners */
t0 = 0.6f - x0*x0 - y0*y0 - z0*z0;
if(t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad3(perm[ii+perm[jj+perm[kk]]], x0, y0, z0);
}
t1 = 0.6f - x1*x1 - y1*y1 - z1*z1;
if(t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad3(perm[ii+i1+perm[jj+j1+perm[kk+k1]]], x1, y1, z1);
}
t2 = 0.6f - x2*x2 - y2*y2 - z2*z2;
if(t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad3(perm[ii+i2+perm[jj+j2+perm[kk+k2]]], x2, y2, z2);
}
t3 = 0.6f - x3*x3 - y3*y3 - z3*z3;
if(t3<0.0f) n3 = 0.0f;
else {
t3 *= t3;
n3 = t3 * t3 * grad3(perm[ii+1+perm[jj+1+perm[kk+1]]], x3, y3, z3);
}
/* Add contributions from each corner to get the final noise value. */
/* The result is scaled to stay just inside [-1,1] */
return 32.0f * (n0 + n1 + n2 + n3); /* TODO: The scale factor is preliminary! */
}
/* 4D simplex noise */
GLfloat _slang_library_noise4 (GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
/* The skewing and unskewing factors are hairy again for the 4D case */
#define F4 0.309016994f /* F4 = (Math.sqrt(5.0)-1.0)/4.0 */
#define G4 0.138196601f /* G4 = (5.0-Math.sqrt(5.0))/20.0 */
float n0, n1, n2, n3, n4; /* Noise contributions from the five corners */
/* Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in */
float s = (x + y + z + w) * F4; /* Factor for 4D skewing */
float xs = x + s;
float ys = y + s;
float zs = z + s;
float ws = w + s;
int i = FASTFLOOR(xs);
int j = FASTFLOOR(ys);
int k = FASTFLOOR(zs);
int l = FASTFLOOR(ws);
float t = (i + j + k + l) * G4; /* Factor for 4D unskewing */
float X0 = i - t; /* Unskew the cell origin back to (x,y,z,w) space */
float Y0 = j - t;
float Z0 = k - t;
float W0 = l - t;
float x0 = x - X0; /* The x,y,z,w distances from the cell origin */
float y0 = y - Y0;
float z0 = z - Z0;
float w0 = w - W0;
/* For the 4D case, the simplex is a 4D shape I won't even try to describe. */
/* To find out which of the 24 possible simplices we're in, we need to */
/* determine the magnitude ordering of x0, y0, z0 and w0. */
/* The method below is a good way of finding the ordering of x,y,z,w and */
/* then find the correct traversal order for the simplex we're in. */
/* First, six pair-wise comparisons are performed between each possible pair */
/* of the four coordinates, and the results are used to add up binary bits */
/* for an integer index. */
int c1 = (x0 > y0) ? 32 : 0;
int c2 = (x0 > z0) ? 16 : 0;
int c3 = (y0 > z0) ? 8 : 0;
int c4 = (x0 > w0) ? 4 : 0;
int c5 = (y0 > w0) ? 2 : 0;
int c6 = (z0 > w0) ? 1 : 0;
int c = c1 + c2 + c3 + c4 + c5 + c6;
int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
int ii, jj, kk, ll;
float t0, t1, t2, t3, t4;
/* simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. */
/* Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w */
/* impossible. Only the 24 indices which have non-zero entries make any sense. */
/* We use a thresholding to set the coordinates in turn from the largest magnitude. */
/* The number 3 in the "simplex" array is at the position of the largest coordinate. */
i1 = simplex[c][0]>=3 ? 1 : 0;
j1 = simplex[c][1]>=3 ? 1 : 0;
k1 = simplex[c][2]>=3 ? 1 : 0;
l1 = simplex[c][3]>=3 ? 1 : 0;
/* The number 2 in the "simplex" array is at the second largest coordinate. */
i2 = simplex[c][0]>=2 ? 1 : 0;
j2 = simplex[c][1]>=2 ? 1 : 0;
k2 = simplex[c][2]>=2 ? 1 : 0;
l2 = simplex[c][3]>=2 ? 1 : 0;
/* The number 1 in the "simplex" array is at the second smallest coordinate. */
i3 = simplex[c][0]>=1 ? 1 : 0;
j3 = simplex[c][1]>=1 ? 1 : 0;
k3 = simplex[c][2]>=1 ? 1 : 0;
l3 = simplex[c][3]>=1 ? 1 : 0;
/* The fifth corner has all coordinate offsets = 1, so no need to look that up. */
x1 = x0 - i1 + G4; /* Offsets for second corner in (x,y,z,w) coords */
y1 = y0 - j1 + G4;
z1 = z0 - k1 + G4;
w1 = w0 - l1 + G4;
x2 = x0 - i2 + 2.0f*G4; /* Offsets for third corner in (x,y,z,w) coords */
y2 = y0 - j2 + 2.0f*G4;
z2 = z0 - k2 + 2.0f*G4;
w2 = w0 - l2 + 2.0f*G4;
x3 = x0 - i3 + 3.0f*G4; /* Offsets for fourth corner in (x,y,z,w) coords */
y3 = y0 - j3 + 3.0f*G4;
z3 = z0 - k3 + 3.0f*G4;
w3 = w0 - l3 + 3.0f*G4;
x4 = x0 - 1.0f + 4.0f*G4; /* Offsets for last corner in (x,y,z,w) coords */
y4 = y0 - 1.0f + 4.0f*G4;
z4 = z0 - 1.0f + 4.0f*G4;
w4 = w0 - 1.0f + 4.0f*G4;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
ii = i % 256;
jj = j % 256;
kk = k % 256;
ll = l % 256;
/* Calculate the contribution from the five corners */
t0 = 0.6f - x0*x0 - y0*y0 - z0*z0 - w0*w0;
if(t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad4(perm[ii+perm[jj+perm[kk+perm[ll]]]], x0, y0, z0, w0);
}
t1 = 0.6f - x1*x1 - y1*y1 - z1*z1 - w1*w1;
if(t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad4(perm[ii+i1+perm[jj+j1+perm[kk+k1+perm[ll+l1]]]], x1, y1, z1, w1);
}
t2 = 0.6f - x2*x2 - y2*y2 - z2*z2 - w2*w2;
if(t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad4(perm[ii+i2+perm[jj+j2+perm[kk+k2+perm[ll+l2]]]], x2, y2, z2, w2);
}
t3 = 0.6f - x3*x3 - y3*y3 - z3*z3 - w3*w3;
if(t3 < 0.0f) n3 = 0.0f;
else {
t3 *= t3;
n3 = t3 * t3 * grad4(perm[ii+i3+perm[jj+j3+perm[kk+k3+perm[ll+l3]]]], x3, y3, z3, w3);
}
t4 = 0.6f - x4*x4 - y4*y4 - z4*z4 - w4*w4;
if(t4 < 0.0f) n4 = 0.0f;
else {
t4 *= t4;
n4 = t4 * t4 * grad4(perm[ii+1+perm[jj+1+perm[kk+1+perm[ll+1]]]], x4, y4, z4, w4);
}
/* Sum up and scale the result to cover the range [-1,1] */
return 27.0f * (n0 + n1 + n2 + n3 + n4); /* TODO: The scale factor is preliminary! */
}

View file

@ -207,7 +207,7 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog)
* This is basically a list/index of all uniforms found in either/both of
* the vertex and fragment shaders.
*/
static void
static GLboolean
link_uniform_vars(struct gl_shader_program *shProg,
struct gl_program *prog,
GLuint *numSamplers)
@ -239,7 +239,10 @@ link_uniform_vars(struct gl_shader_program *shProg,
/* Allocate a new sampler index */
GLuint sampNum = *numSamplers;
GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0];
assert(oldSampNum < MAX_SAMPLERS);
if (oldSampNum >= MAX_SAMPLERS) {
link_error(shProg, "Too many texture samplers");
return GL_FALSE;
}
samplerMap[oldSampNum] = sampNum;
(*numSamplers)++;
}
@ -265,6 +268,7 @@ link_uniform_vars(struct gl_shader_program *shProg,
}
}
return GL_TRUE;
}
@ -559,10 +563,18 @@ _slang_link(GLcontext *ctx,
}
/* link uniform vars */
if (shProg->VertexProgram)
link_uniform_vars(shProg, &shProg->VertexProgram->Base, &numSamplers);
if (shProg->FragmentProgram)
link_uniform_vars(shProg, &shProg->FragmentProgram->Base, &numSamplers);
if (shProg->VertexProgram) {
if (!link_uniform_vars(shProg, &shProg->VertexProgram->Base,
&numSamplers)) {
return;
}
}
if (shProg->FragmentProgram) {
if (!link_uniform_vars(shProg, &shProg->FragmentProgram->Base,
&numSamplers)) {
return;
}
}
/*_mesa_print_uniforms(shProg->Uniforms);*/

View file

@ -278,7 +278,7 @@ slang_print_tree(const slang_operation *op, int indent)
assert(op->num_children == 0 || op->num_children == 1);
{
slang_variable *v;
v = _slang_locate_variable(op->locals, op->a_id, GL_TRUE);
v = _slang_variable_locate(op->locals, op->a_id, GL_TRUE);
if (v) {
const slang_variable_scope *scope;
spaces(indent);
@ -636,7 +636,7 @@ slang_print_tree(const slang_operation *op, int indent)
case SLANG_OPER_CALL:
#if 0
slang_function *fun
= _slang_locate_function(A->space.funcs, oper->a_id,
= _slang_function_locate(A->space.funcs, oper->a_id,
oper->children,
oper->num_children, &A->space, A->atoms);
#endif

View file

@ -135,7 +135,7 @@ _slang_simplify(slang_operation *oper,
/* look for user-defined constant */
{
slang_variable *var;
var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE);
var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE);
if (var) {
if (var->type.qualifier == SLANG_QUAL_CONST &&
var->initializer &&
@ -380,7 +380,7 @@ _slang_cast_func_params(slang_operation *callOper, const slang_function *fun,
/* Get type of arg[i] */
if (!slang_typeinfo_construct(&argType))
return GL_FALSE;
if (!_slang_typeof_operation_(&callOper->children[i], space,
if (!_slang_typeof_operation(&callOper->children[i], space,
&argType, atoms, log)) {
slang_typeinfo_destruct(&argType);
return GL_FALSE;
@ -464,7 +464,7 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
/* Get type of arg[i] */
if (!slang_typeinfo_construct(&argType))
return GL_FALSE;
if (!_slang_typeof_operation_(&callOper->children[i], space,
if (!_slang_typeof_operation(&callOper->children[i], space,
&argType, atoms, log)) {
slang_typeinfo_destruct(&argType);
return GL_FALSE;

View file

@ -26,7 +26,6 @@
#define SLANG_STORAGE_H
#include "slang_compile.h"
#include "slang_typeinfo.h"
/*

View file

@ -130,7 +130,7 @@ _slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz)
* do not have duplicated fields. Returns GL_TRUE if this is a
* swizzle mask. Returns GL_FALSE otherwise
*/
GLboolean
static GLboolean
_slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows)
{
GLuint i, c = 0;
@ -154,7 +154,7 @@ _slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows)
* Combines (multiplies) two swizzles to form single swizzle.
* Example: "vec.wzyx.yx" --> "vec.zw".
*/
GLvoid
static void
_slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left,
const slang_swizzle * right)
{
@ -166,6 +166,110 @@ _slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left,
}
typedef struct
{
const char *name;
slang_type_specifier_type type;
} type_specifier_type_name;
static const type_specifier_type_name type_specifier_type_names[] = {
{"void", SLANG_SPEC_VOID},
{"bool", SLANG_SPEC_BOOL},
{"bvec2", SLANG_SPEC_BVEC2},
{"bvec3", SLANG_SPEC_BVEC3},
{"bvec4", SLANG_SPEC_BVEC4},
{"int", SLANG_SPEC_INT},
{"ivec2", SLANG_SPEC_IVEC2},
{"ivec3", SLANG_SPEC_IVEC3},
{"ivec4", SLANG_SPEC_IVEC4},
{"float", SLANG_SPEC_FLOAT},
{"vec2", SLANG_SPEC_VEC2},
{"vec3", SLANG_SPEC_VEC3},
{"vec4", SLANG_SPEC_VEC4},
{"mat2", SLANG_SPEC_MAT2},
{"mat3", SLANG_SPEC_MAT3},
{"mat4", SLANG_SPEC_MAT4},
{"mat2x3", SLANG_SPEC_MAT23},
{"mat3x2", SLANG_SPEC_MAT32},
{"mat2x4", SLANG_SPEC_MAT24},
{"mat4x2", SLANG_SPEC_MAT42},
{"mat3x4", SLANG_SPEC_MAT34},
{"mat4x3", SLANG_SPEC_MAT43},
{"sampler1D", SLANG_SPEC_SAMPLER1D},
{"sampler2D", SLANG_SPEC_SAMPLER2D},
{"sampler3D", SLANG_SPEC_SAMPLER3D},
{"samplerCube", SLANG_SPEC_SAMPLERCUBE},
{"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW},
{"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW},
{"sampler2DRect", SLANG_SPEC_SAMPLER2DRECT},
{"sampler2DRectShadow", SLANG_SPEC_SAMPLER2DRECTSHADOW},
{NULL, SLANG_SPEC_VOID}
};
slang_type_specifier_type
slang_type_specifier_type_from_string(const char *name)
{
const type_specifier_type_name *p = type_specifier_type_names;
while (p->name != NULL) {
if (slang_string_compare(p->name, name) == 0)
break;
p++;
}
return p->type;
}
const char *
slang_type_specifier_type_to_string(slang_type_specifier_type type)
{
const type_specifier_type_name *p = type_specifier_type_names;
while (p->name != NULL) {
if (p->type == type)
break;
p++;
}
return p->name;
}
/* slang_fully_specified_type */
int
slang_fully_specified_type_construct(slang_fully_specified_type * type)
{
type->qualifier = SLANG_QUAL_NONE;
slang_type_specifier_ctr(&type->specifier);
return 1;
}
void
slang_fully_specified_type_destruct(slang_fully_specified_type * type)
{
slang_type_specifier_dtr(&type->specifier);
}
int
slang_fully_specified_type_copy(slang_fully_specified_type * x,
const slang_fully_specified_type * y)
{
slang_fully_specified_type z;
if (!slang_fully_specified_type_construct(&z))
return 0;
z.qualifier = y->qualifier;
z.precision = y->precision;
z.variant = y->variant;
z.centroid = y->centroid;
z.array_len = y->array_len;
if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) {
slang_fully_specified_type_destruct(&z);
return 0;
}
slang_fully_specified_type_destruct(x);
*x = z;
return 1;
}
GLvoid
slang_type_specifier_ctr(slang_type_specifier * self)
{
@ -187,6 +291,21 @@ slang_type_specifier_dtr(slang_type_specifier * self)
}
}
slang_type_specifier *
slang_type_specifier_new(slang_type_specifier_type type,
struct slang_struct_ *_struct,
struct slang_type_specifier_ *_array)
{
slang_type_specifier *spec =
(slang_type_specifier *) _slang_alloc(sizeof(slang_type_specifier));
if (spec) {
spec->type = type;
spec->_struct = _struct;
spec->_array = _array;
}
return spec;
}
GLboolean
slang_type_specifier_copy(slang_type_specifier * x,
const slang_type_specifier * y)
@ -250,7 +369,7 @@ slang_type_specifier_equal(const slang_type_specifier * x,
/**
* As above, but allow float/int casting.
*/
static GLboolean
GLboolean
slang_type_specifier_compatible(const slang_type_specifier * x,
const slang_type_specifier * y)
{
@ -307,7 +426,7 @@ _slang_typeof_function(slang_atom a_name,
{
GLboolean error;
*funFound = _slang_locate_function(space->funcs, a_name, params,
*funFound = _slang_function_locate(space->funcs, a_name, params,
num_params, space, atoms, log, &error);
if (error)
return GL_FALSE;
@ -362,14 +481,6 @@ typeof_math_call(const char *name, slang_operation *call,
}
}
GLboolean
_slang_typeof_operation(const slang_assemble_ctx * A,
slang_operation * op,
slang_typeinfo * ti)
{
return _slang_typeof_operation_(op, &A->space, ti, A->atoms, A->log);
}
/**
* Determine the return type of an operation.
@ -380,7 +491,7 @@ _slang_typeof_operation(const slang_assemble_ctx * A,
* \return GL_TRUE for success, GL_FALSE if failure
*/
GLboolean
_slang_typeof_operation_(slang_operation * op,
_slang_typeof_operation(slang_operation * op,
const slang_name_space * space,
slang_typeinfo * ti,
slang_atom_pool * atoms,
@ -412,7 +523,7 @@ _slang_typeof_operation_(slang_operation * op,
case SLANG_OPER_DIVASSIGN:
case SLANG_OPER_PREINCREMENT:
case SLANG_OPER_PREDECREMENT:
if (!_slang_typeof_operation_(op->children, space, ti, atoms, log))
if (!_slang_typeof_operation(op->children, space, ti, atoms, log))
return GL_FALSE;
break;
case SLANG_OPER_LITERAL_BOOL:
@ -479,7 +590,7 @@ _slang_typeof_operation_(slang_operation * op,
case SLANG_OPER_VARIABLE_DECL:
{
slang_variable *var;
var = _slang_locate_variable(op->locals, op->a_id, GL_TRUE);
var = _slang_variable_locate(op->locals, op->a_id, GL_TRUE);
if (!var) {
slang_info_log_error(log, "undefined variable '%s'",
(char *) op->a_id);
@ -490,12 +601,20 @@ _slang_typeof_operation_(slang_operation * op,
return GL_FALSE;
}
ti->can_be_referenced = GL_TRUE;
ti->array_len = var->array_len;
if (var->type.specifier.type == SLANG_SPEC_ARRAY &&
var->type.array_len >= 1) {
/* the datatype is an array, ex: float[3] x; */
ti->array_len = var->type.array_len;
}
else {
/* the variable is an array, ex: float x[3]; */
ti->array_len = var->array_len;
}
}
break;
case SLANG_OPER_SEQUENCE:
/* TODO: check [0] and [1] if they match */
if (!_slang_typeof_operation_(&op->children[1], space, ti, atoms, log)) {
if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) {
return GL_FALSE;
}
ti->can_be_referenced = GL_FALSE;
@ -509,7 +628,7 @@ _slang_typeof_operation_(slang_operation * op,
/*case SLANG_OPER_ANDASSIGN: */
case SLANG_OPER_SELECT:
/* TODO: check [1] and [2] if they match */
if (!_slang_typeof_operation_(&op->children[1], space, ti, atoms, log)) {
if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) {
return GL_FALSE;
}
ti->can_be_referenced = GL_FALSE;
@ -542,7 +661,7 @@ _slang_typeof_operation_(slang_operation * op,
break;
/*case SLANG_OPER_MODULUS: */
case SLANG_OPER_PLUS:
if (!_slang_typeof_operation_(op->children, space, ti, atoms, log))
if (!_slang_typeof_operation(op->children, space, ti, atoms, log))
return GL_FALSE;
ti->can_be_referenced = GL_FALSE;
ti->is_swizzled = GL_FALSE;
@ -559,7 +678,7 @@ _slang_typeof_operation_(slang_operation * op,
if (!slang_typeinfo_construct(&_ti))
return GL_FALSE;
if (!_slang_typeof_operation_(op->children, space, &_ti, atoms, log)) {
if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) {
slang_typeinfo_destruct(&_ti);
return GL_FALSE;
}
@ -583,7 +702,18 @@ _slang_typeof_operation_(slang_operation * op,
}
break;
case SLANG_OPER_CALL:
if (op->fun) {
if (op->array_constructor) {
/* build array typeinfo */
ti->spec.type = SLANG_SPEC_ARRAY;
ti->spec._array = (slang_type_specifier *)
_slang_alloc(sizeof(slang_type_specifier));
slang_type_specifier_ctr(ti->spec._array);
ti->spec._array->type =
slang_type_specifier_type_from_string((char *) op->a_id);
ti->array_len = op->num_children;
}
else if (op->fun) {
/* we've resolved this call before */
slang_type_specifier_copy(&ti->spec, &op->fun->header.type.specifier);
}
@ -642,14 +772,14 @@ _slang_typeof_operation_(slang_operation * op,
if (!slang_typeinfo_construct(&_ti))
return GL_FALSE;
if (!_slang_typeof_operation_(op->children, space, &_ti, atoms, log)) {
if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) {
slang_typeinfo_destruct(&_ti);
return GL_FALSE;
}
if (_ti.spec.type == SLANG_SPEC_STRUCT) {
slang_variable *field;
field = _slang_locate_variable(_ti.spec._struct->fields, op->a_id,
field = _slang_variable_locate(_ti.spec._struct->fields, op->a_id,
GL_FALSE);
if (field == NULL) {
slang_typeinfo_destruct(&_ti);
@ -748,7 +878,7 @@ _slang_typeof_operation_(slang_operation * op,
break;
case SLANG_OPER_POSTINCREMENT:
case SLANG_OPER_POSTDECREMENT:
if (!_slang_typeof_operation_(op->children, space, ti, atoms, log))
if (!_slang_typeof_operation(op->children, space, ti, atoms, log))
return GL_FALSE;
ti->can_be_referenced = GL_FALSE;
ti->is_swizzled = GL_FALSE;
@ -761,77 +891,6 @@ _slang_typeof_operation_(slang_operation * op,
}
/**
* Lookup a function according to name and parameter count/types.
*/
slang_function *
_slang_locate_function(const slang_function_scope * funcs, slang_atom a_name,
slang_operation * args, GLuint num_args,
const slang_name_space * space, slang_atom_pool * atoms,
slang_info_log *log, GLboolean *error)
{
slang_typeinfo arg_ti[100];
GLuint i;
*error = GL_FALSE;
/* determine type of each argument */
assert(num_args < 100);
for (i = 0; i < num_args; i++) {
if (!slang_typeinfo_construct(&arg_ti[i]))
return NULL;
if (!_slang_typeof_operation_(&args[i], space, &arg_ti[i], atoms, log)) {
return NULL;
}
}
/* loop over function scopes */
while (funcs) {
/* look for function with matching name and argument/param types */
for (i = 0; i < funcs->num_functions; i++) {
slang_function *f = &funcs->functions[i];
const GLuint haveRetValue = _slang_function_has_return_value(f);
GLuint j;
if (a_name != f->header.a_name)
continue;
if (f->param_count - haveRetValue != num_args)
continue;
/* compare parameter / argument types */
for (j = 0; j < num_args; j++) {
if (!slang_type_specifier_compatible(&arg_ti[j].spec,
&f->parameters->variables[j]->type.specifier)) {
/* param/arg types don't match */
break;
}
/* "out" and "inout" formal parameter requires the actual
* argument to be an l-value.
*/
if (!arg_ti[j].can_be_referenced &&
(f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT ||
f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT)) {
/* param is not an lvalue! */
*error = GL_TRUE;
return NULL;
}
}
if (j == num_args) {
/* name and args match! */
return f;
}
}
funcs = funcs->outer_scope;
}
return NULL;
}
/**
* Determine if a type is a matrix.
* \return GL_TRUE if is a matrix, GL_FALSE otherwise.

View file

@ -34,6 +34,9 @@
struct slang_operation_;
struct slang_name_space_;
/**
* Holds complete information about vector swizzle - the <swizzle>
@ -47,45 +50,45 @@ typedef struct slang_swizzle_
GLuint swizzle[4];
} slang_swizzle;
typedef struct slang_name_space_
{
struct slang_function_scope_ *funcs;
struct slang_struct_scope_ *structs;
struct slang_variable_scope_ *vars;
} slang_name_space;
typedef struct slang_assemble_ctx_
{
slang_atom_pool *atoms;
slang_name_space space;
struct gl_program *program;
slang_var_table *vartable;
slang_info_log *log;
struct slang_label_ *curFuncEndLabel;
struct slang_ir_node_ *CurLoop;
struct slang_function_ *CurFunction;
} slang_assemble_ctx;
extern struct slang_function_ *
_slang_locate_function(const struct slang_function_scope_ *funcs,
slang_atom name, struct slang_operation_ *params,
GLuint num_params,
const slang_name_space *space,
slang_atom_pool *atoms, slang_info_log *log,
GLboolean *error);
extern GLboolean
_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
extern GLboolean
_slang_is_swizzle_mask(const slang_swizzle *swz, GLuint rows);
extern GLvoid
_slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
const slang_swizzle *);
typedef enum slang_type_variant_
{
SLANG_VARIANT, /* the default */
SLANG_INVARIANT /* indicates the "invariant" keyword */
} slang_type_variant;
typedef enum slang_type_centroid_
{
SLANG_CENTER, /* the default */
SLANG_CENTROID /* indicates the "centroid" keyword */
} slang_type_centroid;
typedef enum slang_type_qualifier_
{
SLANG_QUAL_NONE,
SLANG_QUAL_CONST,
SLANG_QUAL_ATTRIBUTE,
SLANG_QUAL_VARYING,
SLANG_QUAL_UNIFORM,
SLANG_QUAL_OUT,
SLANG_QUAL_INOUT,
SLANG_QUAL_FIXEDOUTPUT, /* internal */
SLANG_QUAL_FIXEDINPUT /* internal */
} slang_type_qualifier;
typedef enum slang_type_precision_
{
SLANG_PREC_DEFAULT,
SLANG_PREC_LOW,
SLANG_PREC_MEDIUM,
SLANG_PREC_HIGH
} slang_type_precision;
/**
@ -128,14 +131,21 @@ typedef enum slang_type_specifier_type_
} slang_type_specifier_type;
extern slang_type_specifier_type
slang_type_specifier_type_from_string(const char *);
extern const char *
slang_type_specifier_type_to_string(slang_type_specifier_type);
/**
* Describes more sophisticated types, like structs and arrays.
*/
typedef struct slang_type_specifier_
{
slang_type_specifier_type type;
struct slang_struct_ *_struct; /**< used if type == spec_struct */
struct slang_type_specifier_ *_array; /**< used if type == spec_array */
struct slang_struct_ *_struct; /**< if type == SLANG_SPEC_STRUCT */
struct slang_type_specifier_ *_array; /**< if type == SLANG_SPEC_ARRAY */
} slang_type_specifier;
@ -145,6 +155,12 @@ slang_type_specifier_ctr(slang_type_specifier *);
extern GLvoid
slang_type_specifier_dtr(slang_type_specifier *);
extern slang_type_specifier *
slang_type_specifier_new(slang_type_specifier_type type,
struct slang_struct_ *_struct,
struct slang_type_specifier_ *_array);
extern GLboolean
slang_type_specifier_copy(slang_type_specifier *, const slang_type_specifier *);
@ -153,6 +169,33 @@ slang_type_specifier_equal(const slang_type_specifier *,
const slang_type_specifier *);
extern GLboolean
slang_type_specifier_compatible(const slang_type_specifier * x,
const slang_type_specifier * y);
typedef struct slang_fully_specified_type_
{
slang_type_qualifier qualifier;
slang_type_specifier specifier;
slang_type_precision precision;
slang_type_variant variant;
slang_type_centroid centroid;
GLint array_len; /**< -1 if not an array type */
} slang_fully_specified_type;
extern int
slang_fully_specified_type_construct(slang_fully_specified_type *);
extern void
slang_fully_specified_type_destruct(slang_fully_specified_type *);
extern int
slang_fully_specified_type_copy(slang_fully_specified_type *,
const slang_fully_specified_type *);
typedef struct slang_typeinfo_
{
GLboolean can_be_referenced;
@ -169,19 +212,9 @@ extern GLvoid
slang_typeinfo_destruct(slang_typeinfo *);
/**
* Retrieves type information about an operation.
* Returns GL_TRUE on success.
* Returns GL_FALSE otherwise.
*/
extern GLboolean
_slang_typeof_operation(const slang_assemble_ctx *,
struct slang_operation_ *,
slang_typeinfo *);
extern GLboolean
_slang_typeof_operation_(struct slang_operation_ *,
const slang_name_space *,
_slang_typeof_operation(struct slang_operation_ *,
const struct slang_name_space_ *,
slang_typeinfo *, slang_atom_pool *,
slang_info_log *log);

View file

@ -21,6 +21,7 @@ MAIN_SOURCES = \
main/depth.c \
main/depthstencil.c \
main/dlist.c \
main/dlopen.c \
main/drawpix.c \
main/enable.c \
main/enums.c \
@ -175,6 +176,7 @@ SHADER_SOURCES = \
shader/prog_debug.c \
shader/prog_execute.c \
shader/prog_instruction.c \
shader/prog_noise.c \
shader/prog_parameter.c \
shader/prog_print.c \
shader/prog_statevars.c \
@ -193,7 +195,6 @@ SLANG_SOURCES = \
shader/slang/slang_emit.c \
shader/slang/slang_ir.c \
shader/slang/slang_label.c \
shader/slang/slang_library_noise.c \
shader/slang/slang_link.c \
shader/slang/slang_log.c \
shader/slang/slang_mem.c \

View file

@ -337,6 +337,9 @@
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.c">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_noise.c">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.c">
</File>
@ -487,9 +490,6 @@
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.c">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_library_noise.c">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.c">
</File>
@ -926,6 +926,9 @@
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.h">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_noise.h">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.h">
</File>
@ -1079,9 +1082,6 @@
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.h">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_library_noise.h">
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.h">
</File>

View file

@ -501,6 +501,10 @@
RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.c"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_noise.c"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.c"
>
@ -769,10 +773,6 @@
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.c"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_library_noise.c"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.c"
>
@ -1358,6 +1358,10 @@
RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.h"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_noise.h"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.h"
>
@ -1566,10 +1570,6 @@
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.h"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_library_noise.h"
>
</File>
<File
RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.h"
>