aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-12-04 21:45:33 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-12-04 21:45:33 +0100
commitc893ad65ca612962e59697b0174c74afb89cbe78 (patch)
tree90906f572923256f08220d6c6d34286832dfba40 /nx-X11
parentb38d5b97dbd6c6b61c3ef0d046a4ba1c183a74f9 (diff)
parent4e33fd4bef7c3254d53eb04a0d8f4312622f2092 (diff)
downloadnx-libs-c893ad65ca612962e59697b0174c74afb89cbe78.tar.gz
nx-libs-c893ad65ca612962e59697b0174c74afb89cbe78.tar.bz2
nx-libs-c893ad65ca612962e59697b0174c74afb89cbe78.zip
Merge branch 'sunweaver-pr/drop-glx-ansic' into 3.6.x
Attributes GH PR #270: https://github.com/ArcticaProject/nx-libs/pull/270
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h1
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h1
-rw-r--r--nx-X11/extras/Mesa/src/mesa/main/hint.c26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c2104
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h80
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h3130
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h1516
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h128
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c2416
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h290
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c374
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h90
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c970
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h134
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c678
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h160
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c860
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h134
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h38
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c704
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h114
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c174
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h78
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c146
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h102
-rw-r--r--nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h224
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxcmds.c56
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c9
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxext.c27
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxfb.c4
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glximports.c17
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxpix.c4
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxscreens.c22
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxserver.h1
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxutil.c98
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxutil.h6
-rw-r--r--nx-X11/programs/Xserver/GL/glx/single2.c53
-rw-r--r--nx-X11/programs/Xserver/GL/glx/single2swap.c5
-rw-r--r--nx-X11/programs/Xserver/GL/glx/xfont.c4
-rw-r--r--nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h110
-rw-r--r--nx-X11/programs/Xserver/GL/include/GL/xf86glx.h38
-rw-r--r--nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c69
-rw-r--r--nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXglxext.c8
46 files changed, 7497 insertions, 7741 deletions
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c
index bb1c82794..7d4d06ab8 100644
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c
+++ b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c
@@ -31,31 +31,17 @@
* \author Ian Romanick <idr@us.ibm.com>
*/
-#if defined(IN_MINI_GLX)
# include <stdlib.h>
# include <string.h>
+
+#if defined(IN_MINI_GLX)
# include <GL/gl.h>
# include "GL/internal/dri_interface.h"
# include "imports.h"
-# define __glXMemset memset
#else
# include <nx-X11/X.h>
# include <GL/glx.h>
# include "GL/glxint.h"
-
-# ifdef XFree86Server
-void *memset( void * ptr, int val, size_t size);
-# include "GL/glx_ansic.h"
-extern void * __glXMalloc( size_t size );
-extern void __glXFree( void * ptr );
-# define _mesa_malloc(b) __glXMalloc(b)
-# define _mesa_free(m) __glXFree(m)
-# else
-# include <nx-X11/Xlibint.h>
-# define __glXMemset memset
-# define _mesa_malloc(b) Xmalloc(b)
-# define _mesa_free(m) Xfree(m)
-# endif /* XFree86Server */
#endif /* !defined(IN_MINI_GLX) */
#include "glcontextmodes.h"
@@ -127,7 +113,7 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
{
__GLcontextModes * const next = mode->next;
- (void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
+ (void) memset( mode, 0, sizeof( __GLcontextModes ) );
mode->next = next;
mode->visualID = config->vid;
@@ -361,14 +347,14 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
next = & base;
for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) _mesa_malloc( size );
+ *next = (__GLcontextModes *) malloc( size );
if ( *next == NULL ) {
_gl_context_modes_destroy( base );
base = NULL;
break;
}
- (void) __glXMemset( *next, 0, size );
+ (void) memset( *next, 0, size );
(*next)->visualID = GLX_DONT_CARE;
(*next)->visualType = GLX_DONT_CARE;
(*next)->visualRating = GLX_NONE;
@@ -402,7 +388,7 @@ _gl_context_modes_destroy( __GLcontextModes * modes )
while ( modes != NULL ) {
__GLcontextModes * const next = modes->next;
- _mesa_free( modes );
+ free( modes );
modes = next;
}
}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h b/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h
index 33d937f1c..6a1f2ed20 100644
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h
+++ b/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h
@@ -38,7 +38,6 @@
# include "resource.h"
# include "windowstr.h"
# include "gcstruct.h"
-# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#else
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h b/nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h
index 26255ae56..c5037e619 100644
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h
+++ b/nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h
@@ -28,7 +28,6 @@
#ifdef XFree86Server
-# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#elif defined(USE_XSHM)
# include <X11/extensions/XShm.h>
diff --git a/nx-X11/extras/Mesa/src/mesa/main/hint.c b/nx-X11/extras/Mesa/src/mesa/main/hint.c
index 6680edd16..dcfa9c736 100644
--- a/nx-X11/extras/Mesa/src/mesa/main/hint.c
+++ b/nx-X11/extras/Mesa/src/mesa/main/hint.c
@@ -109,18 +109,18 @@ _mesa_Hint( GLenum target, GLenum mode )
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.GenerateMipmap = mode;
- break;
-
- /* GL_ARB_fragment_shader */
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
- if (!ctx->Extensions.ARB_fragment_shader) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return;
- }
- if (ctx->Hint.FragmentShaderDerivative == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_HINT);
- ctx->Hint.FragmentShaderDerivative = mode;
+ break;
+
+ /* GL_ARB_fragment_shader */
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
+ if (!ctx->Extensions.ARB_fragment_shader) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return;
+ }
+ if (ctx->Hint.FragmentShaderDerivative == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.FragmentShaderDerivative = mode;
break;
default:
@@ -148,6 +148,6 @@ void _mesa_init_hint( GLcontext * ctx )
ctx->Hint.Fog = GL_DONT_CARE;
ctx->Hint.ClipVolumeClipping = GL_DONT_CARE;
ctx->Hint.TextureCompression = GL_DONT_CARE;
- ctx->Hint.GenerateMipmap = GL_DONT_CARE;
+ ctx->Hint.GenerateMipmap = GL_DONT_CARE;
ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE;
}
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h
index 7f0f0706a..29747ca85 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h
@@ -155,14 +155,14 @@ extern void GLAPIENTRY
_mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
extern GLint GLAPIENTRY
-_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *);
-
+_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *);
+
#endif
-extern void
+extern void
_mesa_init_shaderobjects (GLcontext *ctx);
#endif
#endif
-
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c
index f03f65d70..112ff0506 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c
@@ -1,1052 +1,1052 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file shaderobjects_3dlabs.c
- * shader objects definitions for 3dlabs compiler
- * \author Michal Krol
- */
-
-/* Set this to 1 when we are ready to use 3dlabs' front-end */
-#define USE_3DLABS_FRONTEND 0
-
-#include "glheader.h"
-#include "shaderobjects.h"
-#include "shaderobjects_3dlabs.h"
-#include "context.h"
-#include "macros.h"
-#include "hash.h"
-
-#if USE_3DLABS_FRONTEND
-#include "slang_mesa.h"
-#include "Public/ShaderLang.h"
-#else
-#include "slang_compile.h"
-#endif
-
-struct gl2_unknown_obj
-{
- GLuint reference_count;
- void (* _destructor) (struct gl2_unknown_intf **);
-};
-
-struct gl2_unknown_impl
-{
- struct gl2_unknown_intf *_vftbl;
- struct gl2_unknown_obj _obj;
-};
-
-static void
-_unknown_destructor (struct gl2_unknown_intf **intf)
-{
-}
-
-static void
-_unknown_AddRef (struct gl2_unknown_intf **intf)
-{
- struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;
-
- impl->_obj.reference_count++;
-}
-
-static void
-_unknown_Release (struct gl2_unknown_intf **intf)
-{
- struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;
-
- impl->_obj.reference_count--;
- if (impl->_obj.reference_count == 0)
- {
- impl->_obj._destructor (intf);
- _mesa_free ((void *) intf);
- }
-}
-
-static struct gl2_unknown_intf **
-_unknown_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_UNKNOWN)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return NULL;
-}
-
-static struct gl2_unknown_intf _unknown_vftbl = {
- _unknown_AddRef,
- _unknown_Release,
- _unknown_QueryInterface
-};
-
-static void
-_unknown_constructor (struct gl2_unknown_impl *impl)
-{
- impl->_vftbl = &_unknown_vftbl;
- impl->_obj.reference_count = 1;
- impl->_obj._destructor = _unknown_destructor;
-}
-
-struct gl2_unkinner_obj
-{
- struct gl2_unknown_intf **unkouter;
-};
-
-struct gl2_unkinner_impl
-{
- struct gl2_unknown_intf *_vftbl;
- struct gl2_unkinner_obj _obj;
-};
-
-static void
-_unkinner_destructor (struct gl2_unknown_intf **intf)
-{
-}
-
-static void
-_unkinner_AddRef (struct gl2_unknown_intf **intf)
-{
- struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
-
- (**impl->_obj.unkouter).AddRef (impl->_obj.unkouter);
-}
-
-static void
-_unkinner_Release (struct gl2_unknown_intf **intf)
-{
- struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
-
- (**impl->_obj.unkouter).Release (impl->_obj.unkouter);
-}
-
-static struct gl2_unknown_intf **
-_unkinner_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
-
- return (**impl->_obj.unkouter).QueryInterface (impl->_obj.unkouter, uiid);
-}
-
-static struct gl2_unknown_intf _unkinner_vftbl = {
- _unkinner_AddRef,
- _unkinner_Release,
- _unkinner_QueryInterface
-};
-
-static void
-_unkinner_constructor (struct gl2_unkinner_impl *impl, struct gl2_unknown_intf **outer)
-{
- impl->_vftbl = &_unkinner_vftbl;
- impl->_obj.unkouter = outer;
-}
-
-struct gl2_generic_obj
-{
- struct gl2_unknown_obj _unknown;
- GLhandleARB name;
- GLboolean delete_status;
- GLcharARB *info_log;
-};
-
-struct gl2_generic_impl
-{
- struct gl2_generic_intf *_vftbl;
- struct gl2_generic_obj _obj;
-};
-
-static void
-_generic_destructor (struct gl2_unknown_intf **intf)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
-
- _mesa_free ((void *) impl->_obj.info_log);
-
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
- _mesa_HashRemove (ctx->Shared->GL2Objects, impl->_obj.name);
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
-
- _unknown_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_generic_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_GENERIC)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return _unknown_QueryInterface (intf, uiid);
-}
-
-static void
-_generic_Delete (struct gl2_generic_intf **intf)
-{
- struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
-
- if (impl->_obj.delete_status == GL_FALSE)
- {
- impl->_obj.delete_status = GL_TRUE;
- (**intf)._unknown.Release ((struct gl2_unknown_intf **) intf);
- }
-}
-
-static GLhandleARB
-_generic_GetName (struct gl2_generic_intf **intf)
-{
- struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
-
- return impl->_obj.name;
-}
-
-static GLboolean
-_generic_GetDeleteStatus (struct gl2_generic_intf **intf)
-{
- struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
-
- return impl->_obj.delete_status;
-}
-
-static const GLcharARB *
-_generic_GetInfoLog (struct gl2_generic_intf **intf)
-{
- struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
-
- return impl->_obj.info_log;
-}
-
-static struct gl2_generic_intf _generic_vftbl = {
- {
- _unknown_AddRef,
- _unknown_Release,
- _generic_QueryInterface
- },
- _generic_Delete,
- NULL, /* abstract GetType */
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
-};
-
-static void
-_generic_constructor (struct gl2_generic_impl *impl)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- _unknown_constructor ((struct gl2_unknown_impl *) impl);
- impl->_vftbl = &_generic_vftbl;
- impl->_obj._unknown._destructor = _generic_destructor;
- impl->_obj.delete_status = GL_FALSE;
- impl->_obj.info_log = NULL;
-
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
- impl->_obj.name = _mesa_HashFindFreeKeyBlock (ctx->Shared->GL2Objects, 1);
- _mesa_HashInsert (ctx->Shared->GL2Objects, impl->_obj.name, (void *) impl);
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
-}
-
-struct gl2_container_obj
-{
- struct gl2_generic_obj _generic;
- struct gl2_generic_intf ***attached;
- GLuint attached_count;
-};
-
-struct gl2_container_impl
-{
- struct gl2_container_intf *_vftbl;
- struct gl2_container_obj _obj;
-};
-
-static void
-_container_destructor (struct gl2_unknown_intf **intf)
-{
- struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
- GLuint i;
-
- for (i = 0; i < impl->_obj.attached_count; i++)
- {
- struct gl2_generic_intf **x = impl->_obj.attached[i];
- (**x)._unknown.Release ((struct gl2_unknown_intf **) x);
- }
-
- _generic_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_container_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_CONTAINER)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return _generic_QueryInterface (intf, uiid);
-}
-
-static GLboolean
-_container_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
- GLuint i;
-
- for (i = 0; i < impl->_obj.attached_count; i++)
- if (impl->_obj.attached[i] == att)
- {
- _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Attach");
- return GL_FALSE;
- }
-
- impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,
- impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count + 1) *
- sizeof (*impl->_obj.attached));
- if (impl->_obj.attached == NULL)
- return GL_FALSE;
-
- impl->_obj.attached[impl->_obj.attached_count] = att;
- impl->_obj.attached_count++;
- (**att)._unknown.AddRef ((struct gl2_unknown_intf **) att);
- return GL_TRUE;
-}
-
-static GLboolean
-_container_Detach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
- GLuint i, j;
-
- for (i = 0; i < impl->_obj.attached_count; i++)
- if (impl->_obj.attached[i] == att)
- {
- for (j = i; j < impl->_obj.attached_count - 1; j++)
- impl->_obj.attached[j] = impl->_obj.attached[j + 1];
- impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,
- impl->_obj.attached_count * sizeof (*impl->_obj.attached),
- (impl->_obj.attached_count - 1) * sizeof (*impl->_obj.attached));
- impl->_obj.attached_count--;
- (**att)._unknown.Release ((struct gl2_unknown_intf **) att);
- return GL_TRUE;
- }
-
- _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Detach");
- return GL_FALSE;
-}
-
-static GLsizei
-_container_GetAttachedCount (struct gl2_container_intf **intf)
-{
- struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
-
- return impl->_obj.attached_count;
-}
-
-static struct gl2_generic_intf **
-_container_GetAttached (struct gl2_container_intf **intf, GLuint index)
-{
- struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
-
- (**impl->_obj.attached[index])._unknown.AddRef (
- (struct gl2_unknown_intf **)impl->_obj.attached[index]);
- return impl->_obj.attached[index];
-}
-
-static struct gl2_container_intf _container_vftbl = {
- {
- {
- _unknown_AddRef,
- _unknown_Release,
- _container_QueryInterface
- },
- _generic_Delete,
- NULL, /* abstract GetType */
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
- },
- _container_Attach,
- _container_Detach,
- _container_GetAttachedCount,
- _container_GetAttached
-};
-
-static void
-_container_constructor (struct gl2_container_impl *impl)
-{
- _generic_constructor ((struct gl2_generic_impl *) impl);
- impl->_vftbl = &_container_vftbl;
- impl->_obj._generic._unknown._destructor = _container_destructor;
- impl->_obj.attached = NULL;
- impl->_obj.attached_count = 0;
-}
-
-struct gl2_3dlabs_shhandle_obj
-{
- struct gl2_unkinner_obj _unknown;
-#if USE_3DLABS_FRONTEND
- ShHandle handle;
-#endif
-};
-
-struct gl2_3dlabs_shhandle_impl
-{
- struct gl2_3dlabs_shhandle_intf *_vftbl;
- struct gl2_3dlabs_shhandle_obj _obj;
-};
-
-static void
-_3dlabs_shhandle_destructor (struct gl2_unknown_intf **intf)
-{
-#if USE_3DLABS_FRONTEND
- struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;
- ShDestruct (impl->_obj.handle);
-#endif
- _unkinner_destructor (intf);
-}
-
-static GLvoid *
-_3dlabs_shhandle_GetShHandle (struct gl2_3dlabs_shhandle_intf **intf)
-{
-#if USE_3DLABS_FRONTEND
- struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;
- return impl->_obj.handle;
-#else
- return NULL;
-#endif
-}
-
-static struct gl2_3dlabs_shhandle_intf _3dlabs_shhandle_vftbl = {
- {
- _unkinner_AddRef,
- _unkinner_Release,
- _unkinner_QueryInterface
- },
- _3dlabs_shhandle_GetShHandle
-};
-
-static void
-_3dlabs_shhandle_constructor (struct gl2_3dlabs_shhandle_impl *impl, struct gl2_unknown_intf **outer)
-{
- _unkinner_constructor ((struct gl2_unkinner_impl *) impl, outer);
- impl->_vftbl = &_3dlabs_shhandle_vftbl;
-#if USE_3DLABS_FRONTEND
- impl->_obj.handle = NULL;
-#endif
-}
-
-struct gl2_shader_obj
-{
- struct gl2_generic_obj _generic;
- struct gl2_3dlabs_shhandle_impl _3dlabs_shhandle;
- GLboolean compile_status;
- GLcharARB *source;
- GLint *offsets;
- GLsizei offset_count;
-};
-
-struct gl2_shader_impl
-{
- struct gl2_shader_intf *_vftbl;
- struct gl2_shader_obj _obj;
-};
-
-static void
-_shader_destructor (struct gl2_unknown_intf **intf)
-{
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-
- _mesa_free ((void *) impl->_obj.source);
- _mesa_free ((void *) impl->_obj.offsets);
- _3dlabs_shhandle_destructor ((struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl);
- _generic_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
-#if USE_3DLABS_FRONTEND
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-#endif
-
- if (uiid == UIID_SHADER)
- {
- (**intf).AddRef (intf);
- return intf;
- }
-#if USE_3DLABS_FRONTEND
- if (uiid == UIID_3DLABS_SHHANDLE)
- {
- (**intf).AddRef (intf);
- return (struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl;
- }
-#endif
- return _generic_QueryInterface (intf, uiid);
-}
-
-static GLenum
-_shader_GetType (struct gl2_generic_intf **intf)
-{
- return GL_SHADER_OBJECT_ARB;
-}
-
-static GLboolean
-_shader_GetCompileStatus (struct gl2_shader_intf **intf)
-{
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-
- return impl->_obj.compile_status;
-}
-
-static GLvoid
-_shader_SetSource (struct gl2_shader_intf **intf, GLcharARB *src, GLint *off, GLsizei cnt)
-{
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-
- _mesa_free ((void *) impl->_obj.source);
- impl->_obj.source = src;
- _mesa_free ((void *) impl->_obj.offsets);
- impl->_obj.offsets = off;
- impl->_obj.offset_count = cnt;
-}
-
-static const GLcharARB *
-_shader_GetSource (struct gl2_shader_intf **intf)
-{
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-
- return impl->_obj.source;
-}
-
-static GLvoid
-_shader_Compile (struct gl2_shader_intf **intf)
-{
- struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
-#if USE_3DLABS_FRONTEND
- char **strings;
- TBuiltInResource res;
-#else
- slang_translation_unit unit;
- slang_unit_type type;
- slang_info_log info_log;
-#endif
-
- impl->_obj.compile_status = GL_FALSE;
- _mesa_free ((void *) impl->_obj._generic.info_log);
- impl->_obj._generic.info_log = NULL;
-
-#if USE_3DLABS_FRONTEND
- /* 3dlabs compiler expects us to feed it with null-terminated string array,
- we've got only one big string with offsets, so we must split it; but when
- there's only one string to deal with, we pass its address directly */
-
- if (impl->_obj.offset_count <= 1)
- strings = &impl->_obj.source;
- else
- {
- GLsizei i, offset = 0;
-
- strings = (char **) _mesa_malloc (impl->_obj.offset_count * sizeof (char *));
- if (strings == NULL)
- return;
-
- for (i = 0; i < impl->_obj.offset_count; i++)
- {
- GLsizei size = impl->_obj.offsets[i] - offset;
-
- strings[i] = (char *) _mesa_malloc ((size + 1) * sizeof (char));
- if (strings[i] == NULL)
- {
- GLsizei j;
-
- for (j = 0; j < i; j++)
- _mesa_free (strings[j]);
- _mesa_free (strings);
- return;
- }
-
- _mesa_memcpy (strings[i], impl->_obj.source + offset, size * sizeof (char));
- strings[i][size] = '\0';
- offset = impl->_obj.offsets[i];
- }
- }
-
- /* TODO set these fields to some REAL numbers */
- res.maxLights = 8;
- res.maxClipPlanes = 6;
- res.maxTextureUnits = 2;
- res.maxTextureCoords = 2;
- res.maxVertexAttribs = 8;
- res.maxVertexUniformComponents = 64;
- res.maxVaryingFloats = 8;
- res.maxVertexTextureImageUnits = 2;
- res.maxCombinedTextureImageUnits = 2;
- res.maxTextureImageUnits = 2;
- res.maxFragmentUniformComponents = 64;
- res.maxDrawBuffers = 1;
-
- if (ShCompile (impl->_obj._3dlabs_shhandle._obj.handle, strings, impl->_obj.offset_count,
- EShOptFull, &res, 0))
- impl->_obj.compile_status = GL_TRUE;
- if (impl->_obj.offset_count > 1)
- {
- GLsizei i;
-
- for (i = 0; i < impl->_obj.offset_count; i++)
- _mesa_free (strings[i]);
- _mesa_free (strings);
- }
-
- impl->_obj._generic.info_log = _mesa_strdup (ShGetInfoLog (
- impl->_obj._3dlabs_shhandle._obj.handle));
-#else
- if (impl->_vftbl->GetSubType (intf) == GL_FRAGMENT_SHADER)
- type = slang_unit_fragment_shader;
- else
- type = slang_unit_vertex_shader;
- slang_info_log_construct (&info_log);
- if (_slang_compile (impl->_obj.source, &unit, type, &info_log))
- {
- impl->_obj.compile_status = GL_TRUE;
- }
- if (info_log.text != NULL)
- impl->_obj._generic.info_log = _mesa_strdup (info_log.text);
- else
- impl->_obj._generic.info_log = _mesa_strdup ("");
- slang_info_log_destruct (&info_log);
-#endif
-}
-
-static struct gl2_shader_intf _shader_vftbl = {
- {
- {
- _unknown_AddRef,
- _unknown_Release,
- _shader_QueryInterface
- },
- _generic_Delete,
- _shader_GetType,
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
- },
- NULL, /* abstract GetSubType */
- _shader_GetCompileStatus,
- _shader_SetSource,
- _shader_GetSource,
- _shader_Compile
-};
-
-static void
-_shader_constructor (struct gl2_shader_impl *impl)
-{
- _generic_constructor ((struct gl2_generic_impl *) impl);
- _3dlabs_shhandle_constructor (&impl->_obj._3dlabs_shhandle, (struct gl2_unknown_intf **)
- &impl->_vftbl);
- impl->_vftbl = &_shader_vftbl;
- impl->_obj._generic._unknown._destructor = _shader_destructor;
- impl->_obj.compile_status = GL_FALSE;
- impl->_obj.source = NULL;
- impl->_obj.offsets = NULL;
- impl->_obj.offset_count = 0;
-}
-
-struct gl2_program_obj
-{
- struct gl2_container_obj _container;
- GLboolean link_status;
- GLboolean validate_status;
-#if USE_3DLABS_FRONTEND
- ShHandle linker;
- ShHandle uniforms;
-#endif
-};
-
-struct gl2_program_impl
-{
- struct gl2_program_intf *_vftbl;
- struct gl2_program_obj _obj;
-};
-
-static void
-_program_destructor (struct gl2_unknown_intf **intf)
-{
-#if USE_3DLABS_FRONTEND
- struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
-
- ShDestruct (impl->_obj.linker);
- ShDestruct (impl->_obj.uniforms);
-#endif
- _container_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_program_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_PROGRAM)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return _container_QueryInterface (intf, uiid);
-}
-
-static GLenum
-_program_GetType (struct gl2_generic_intf **intf)
-{
- return GL_PROGRAM_OBJECT_ARB;
-}
-
-static GLboolean
-_program_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl2_unknown_intf **sha;
-
- sha = (**att)._unknown.QueryInterface ((struct gl2_unknown_intf **) att, UIID_SHADER);
- if (sha == NULL)
- {
- _mesa_error (ctx, GL_INVALID_OPERATION, "_program_Attach");
- return GL_FALSE;
- }
-
- (**sha).Release (sha);
- return _container_Attach (intf, att);
-}
-
-static GLboolean
-_program_GetLinkStatus (struct gl2_program_intf **intf)
-{
- struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
-
- return impl->_obj.link_status;
-}
-
-static GLboolean
-_program_GetValidateStatus (struct gl2_program_intf **intf)
-{
- struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
-
- return impl->_obj.validate_status;
-}
-
-static GLvoid
-_program_Link (struct gl2_program_intf **intf)
-{
- struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
-#if USE_3DLABS_FRONTEND
- ShHandle *handles;
- GLuint i;
-#endif
-
- impl->_obj.link_status = GL_FALSE;
- _mesa_free ((void *) impl->_obj._container._generic.info_log);
- impl->_obj._container._generic.info_log = NULL;
-
-#if USE_3DLABS_FRONTEND
- handles = (ShHandle *) _mesa_malloc (impl->_obj._container.attached_count * sizeof (ShHandle));
- if (handles == NULL)
- return;
-
- for (i = 0; i < impl->_obj._container.attached_count; i++)
- {
- struct gl2_generic_intf **gen = impl->_obj._container.attached[i];
- struct gl2_3dlabs_shhandle_intf **sh;
-
- sh = (struct gl2_3dlabs_shhandle_intf **) (**gen)._unknown.QueryInterface (
- (struct gl2_unknown_intf **) gen, UIID_3DLABS_SHHANDLE);
- if (sh != NULL)
- {
- handles[i] = (**sh).GetShHandle (sh);
- (**sh)._unknown.Release ((struct gl2_unknown_intf **) sh);
- }
- else
- {
- _mesa_free (handles);
- return;
- }
- }
-
- if (ShLink (impl->_obj.linker, handles, impl->_obj._container.attached_count,
- impl->_obj.uniforms, NULL, NULL))
- impl->_obj.link_status = GL_TRUE;
-
- impl->_obj._container._generic.info_log = _mesa_strdup (ShGetInfoLog (impl->_obj.linker));
-#endif
-}
-
-static GLvoid
-_program_Validate (struct gl2_program_intf **intf)
-{
- struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
-
- impl->_obj.validate_status = GL_FALSE;
- _mesa_free ((void *) impl->_obj._container._generic.info_log);
- impl->_obj._container._generic.info_log = NULL;
-
- /* TODO validate */
-}
-
-static struct gl2_program_intf _program_vftbl = {
- {
- {
- {
- _unknown_AddRef,
- _unknown_Release,
- _program_QueryInterface
- },
- _generic_Delete,
- _program_GetType,
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
- },
- _program_Attach,
- _container_Detach,
- _container_GetAttachedCount,
- _container_GetAttached
- },
- _program_GetLinkStatus,
- _program_GetValidateStatus,
- _program_Link,
- _program_Validate
-};
-
-static void
-_program_constructor (struct gl2_program_impl *impl)
-{
- _container_constructor ((struct gl2_container_impl *) impl);
- impl->_vftbl = &_program_vftbl;
- impl->_obj._container._generic._unknown._destructor = _program_destructor;
- impl->_obj.link_status = GL_FALSE;
- impl->_obj.validate_status = GL_FALSE;
-#if USE_3DLABS_FRONTEND
- impl->_obj.linker = ShConstructLinker (EShExVertexFragment, 0);
- impl->_obj.uniforms = ShConstructUniformMap ();
-#endif
-}
-
-struct gl2_fragment_shader_obj
-{
- struct gl2_shader_obj _shader;
-};
-
-struct gl2_fragment_shader_impl
-{
- struct gl2_fragment_shader_intf *_vftbl;
- struct gl2_fragment_shader_obj _obj;
-};
-
-static void
-_fragment_shader_destructor (struct gl2_unknown_intf **intf)
-{
- struct gl2_fragment_shader_impl *impl = (struct gl2_fragment_shader_impl *) intf;
-
- (void) impl;
- /* TODO free fragment shader data */
-
- _shader_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_fragment_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_FRAGMENT_SHADER)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return _shader_QueryInterface (intf, uiid);
-}
-
-static GLenum
-_fragment_shader_GetSubType (struct gl2_shader_intf **intf)
-{
- return GL_FRAGMENT_SHADER_ARB;
-}
-
-static struct gl2_fragment_shader_intf _fragment_shader_vftbl = {
- {
- {
- {
- _unknown_AddRef,
- _unknown_Release,
- _fragment_shader_QueryInterface
- },
- _generic_Delete,
- _shader_GetType,
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
- },
- _fragment_shader_GetSubType,
- _shader_GetCompileStatus,
- _shader_SetSource,
- _shader_GetSource,
- _shader_Compile
- }
-};
-
-static void
-_fragment_shader_constructor (struct gl2_fragment_shader_impl *impl)
-{
- _shader_constructor ((struct gl2_shader_impl *) impl);
- impl->_vftbl = &_fragment_shader_vftbl;
- impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor;
-#if USE_3DLABS_FRONTEND
- impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangFragment, 0);
-#endif
-}
-
-struct gl2_vertex_shader_obj
-{
- struct gl2_shader_obj _shader;
-};
-
-struct gl2_vertex_shader_impl
-{
- struct gl2_vertex_shader_intf *_vftbl;
- struct gl2_vertex_shader_obj _obj;
-};
-
-static void
-_vertex_shader_destructor (struct gl2_unknown_intf **intf)
-{
- struct gl2_vertex_shader_impl *impl = (struct gl2_vertex_shader_impl *) intf;
-
- (void) impl;
- /* TODO free vertex shader data */
-
- _shader_destructor (intf);
-}
-
-static struct gl2_unknown_intf **
-_vertex_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
-{
- if (uiid == UIID_VERTEX_SHADER)
- {
- (**intf).AddRef (intf);
- return intf;
- }
- return _shader_QueryInterface (intf, uiid);
-}
-
-static GLenum
-_vertex_shader_GetSubType (struct gl2_shader_intf **intf)
-{
- return GL_VERTEX_SHADER_ARB;
-}
-
-static struct gl2_vertex_shader_intf _vertex_shader_vftbl = {
- {
- {
- {
- _unknown_AddRef,
- _unknown_Release,
- _vertex_shader_QueryInterface
- },
- _generic_Delete,
- _shader_GetType,
- _generic_GetName,
- _generic_GetDeleteStatus,
- _generic_GetInfoLog
- },
- _vertex_shader_GetSubType,
- _shader_GetCompileStatus,
- _shader_SetSource,
- _shader_GetSource,
- _shader_Compile
- }
-};
-
-static void
-_vertex_shader_constructor (struct gl2_vertex_shader_impl *impl)
-{
- _shader_constructor ((struct gl2_shader_impl *) impl);
- impl->_vftbl = &_vertex_shader_vftbl;
- impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor;
-#if USE_3DLABS_FRONTEND
- impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangVertex, 0);
-#endif
-}
-
-GLhandleARB
-_mesa_3dlabs_create_shader_object (GLenum shaderType)
-{
- switch (shaderType)
- {
- case GL_FRAGMENT_SHADER_ARB:
- {
- struct gl2_fragment_shader_impl *x = (struct gl2_fragment_shader_impl *)
- _mesa_malloc (sizeof (struct gl2_fragment_shader_impl));
-
- if (x != NULL)
- {
- _fragment_shader_constructor (x);
- return x->_obj._shader._generic.name;
- }
- }
- break;
- case GL_VERTEX_SHADER_ARB:
- {
- struct gl2_vertex_shader_impl *x = (struct gl2_vertex_shader_impl *)
- _mesa_malloc (sizeof (struct gl2_vertex_shader_impl));
-
- if (x != NULL)
- {
- _vertex_shader_constructor (x);
- return x->_obj._shader._generic.name;
- }
- }
- break;
- }
-
- return 0;
-}
-
-GLhandleARB
-_mesa_3dlabs_create_program_object (void)
-{
- struct gl2_program_impl *x = (struct gl2_program_impl *)
- _mesa_malloc (sizeof (struct gl2_program_impl));
-
- if (x != NULL)
- {
- _program_constructor (x);
- return x->_obj._container._generic.name;
- }
-
- return 0;
-}
-
-void
-_mesa_init_shaderobjects_3dlabs (GLcontext *ctx)
-{
-#if USE_3DLABS_FRONTEND
- _glslang_3dlabs_InitProcess ();
- _glslang_3dlabs_ShInitialize ();
-#endif
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file shaderobjects_3dlabs.c
+ * shader objects definitions for 3dlabs compiler
+ * \author Michal Krol
+ */
+
+/* Set this to 1 when we are ready to use 3dlabs' front-end */
+#define USE_3DLABS_FRONTEND 0
+
+#include "glheader.h"
+#include "shaderobjects.h"
+#include "shaderobjects_3dlabs.h"
+#include "context.h"
+#include "macros.h"
+#include "hash.h"
+
+#if USE_3DLABS_FRONTEND
+#include "slang_mesa.h"
+#include "Public/ShaderLang.h"
+#else
+#include "slang_compile.h"
+#endif
+
+struct gl2_unknown_obj
+{
+ GLuint reference_count;
+ void (* _destructor) (struct gl2_unknown_intf **);
+};
+
+struct gl2_unknown_impl
+{
+ struct gl2_unknown_intf *_vftbl;
+ struct gl2_unknown_obj _obj;
+};
+
+static void
+_unknown_destructor (struct gl2_unknown_intf **intf)
+{
+}
+
+static void
+_unknown_AddRef (struct gl2_unknown_intf **intf)
+{
+ struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;
+
+ impl->_obj.reference_count++;
+}
+
+static void
+_unknown_Release (struct gl2_unknown_intf **intf)
+{
+ struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;
+
+ impl->_obj.reference_count--;
+ if (impl->_obj.reference_count == 0)
+ {
+ impl->_obj._destructor (intf);
+ _mesa_free ((void *) intf);
+ }
+}
+
+static struct gl2_unknown_intf **
+_unknown_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_UNKNOWN)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return NULL;
+}
+
+static struct gl2_unknown_intf _unknown_vftbl = {
+ _unknown_AddRef,
+ _unknown_Release,
+ _unknown_QueryInterface
+};
+
+static void
+_unknown_constructor (struct gl2_unknown_impl *impl)
+{
+ impl->_vftbl = &_unknown_vftbl;
+ impl->_obj.reference_count = 1;
+ impl->_obj._destructor = _unknown_destructor;
+}
+
+struct gl2_unkinner_obj
+{
+ struct gl2_unknown_intf **unkouter;
+};
+
+struct gl2_unkinner_impl
+{
+ struct gl2_unknown_intf *_vftbl;
+ struct gl2_unkinner_obj _obj;
+};
+
+static void
+_unkinner_destructor (struct gl2_unknown_intf **intf)
+{
+}
+
+static void
+_unkinner_AddRef (struct gl2_unknown_intf **intf)
+{
+ struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
+
+ (**impl->_obj.unkouter).AddRef (impl->_obj.unkouter);
+}
+
+static void
+_unkinner_Release (struct gl2_unknown_intf **intf)
+{
+ struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
+
+ (**impl->_obj.unkouter).Release (impl->_obj.unkouter);
+}
+
+static struct gl2_unknown_intf **
+_unkinner_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf;
+
+ return (**impl->_obj.unkouter).QueryInterface (impl->_obj.unkouter, uiid);
+}
+
+static struct gl2_unknown_intf _unkinner_vftbl = {
+ _unkinner_AddRef,
+ _unkinner_Release,
+ _unkinner_QueryInterface
+};
+
+static void
+_unkinner_constructor (struct gl2_unkinner_impl *impl, struct gl2_unknown_intf **outer)
+{
+ impl->_vftbl = &_unkinner_vftbl;
+ impl->_obj.unkouter = outer;
+}
+
+struct gl2_generic_obj
+{
+ struct gl2_unknown_obj _unknown;
+ GLhandleARB name;
+ GLboolean delete_status;
+ GLcharARB *info_log;
+};
+
+struct gl2_generic_impl
+{
+ struct gl2_generic_intf *_vftbl;
+ struct gl2_generic_obj _obj;
+};
+
+static void
+_generic_destructor (struct gl2_unknown_intf **intf)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
+
+ _mesa_free ((void *) impl->_obj.info_log);
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ _mesa_HashRemove (ctx->Shared->GL2Objects, impl->_obj.name);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ _unknown_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_generic_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_GENERIC)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return _unknown_QueryInterface (intf, uiid);
+}
+
+static void
+_generic_Delete (struct gl2_generic_intf **intf)
+{
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
+
+ if (impl->_obj.delete_status == GL_FALSE)
+ {
+ impl->_obj.delete_status = GL_TRUE;
+ (**intf)._unknown.Release ((struct gl2_unknown_intf **) intf);
+ }
+}
+
+static GLhandleARB
+_generic_GetName (struct gl2_generic_intf **intf)
+{
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
+
+ return impl->_obj.name;
+}
+
+static GLboolean
+_generic_GetDeleteStatus (struct gl2_generic_intf **intf)
+{
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
+
+ return impl->_obj.delete_status;
+}
+
+static const GLcharARB *
+_generic_GetInfoLog (struct gl2_generic_intf **intf)
+{
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;
+
+ return impl->_obj.info_log;
+}
+
+static struct gl2_generic_intf _generic_vftbl = {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _generic_QueryInterface
+ },
+ _generic_Delete,
+ NULL, /* abstract GetType */
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+};
+
+static void
+_generic_constructor (struct gl2_generic_impl *impl)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ _unknown_constructor ((struct gl2_unknown_impl *) impl);
+ impl->_vftbl = &_generic_vftbl;
+ impl->_obj._unknown._destructor = _generic_destructor;
+ impl->_obj.delete_status = GL_FALSE;
+ impl->_obj.info_log = NULL;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ impl->_obj.name = _mesa_HashFindFreeKeyBlock (ctx->Shared->GL2Objects, 1);
+ _mesa_HashInsert (ctx->Shared->GL2Objects, impl->_obj.name, (void *) impl);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+}
+
+struct gl2_container_obj
+{
+ struct gl2_generic_obj _generic;
+ struct gl2_generic_intf ***attached;
+ GLuint attached_count;
+};
+
+struct gl2_container_impl
+{
+ struct gl2_container_intf *_vftbl;
+ struct gl2_container_obj _obj;
+};
+
+static void
+_container_destructor (struct gl2_unknown_intf **intf)
+{
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
+ GLuint i;
+
+ for (i = 0; i < impl->_obj.attached_count; i++)
+ {
+ struct gl2_generic_intf **x = impl->_obj.attached[i];
+ (**x)._unknown.Release ((struct gl2_unknown_intf **) x);
+ }
+
+ _generic_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_container_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_CONTAINER)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return _generic_QueryInterface (intf, uiid);
+}
+
+static GLboolean
+_container_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
+ GLuint i;
+
+ for (i = 0; i < impl->_obj.attached_count; i++)
+ if (impl->_obj.attached[i] == att)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Attach");
+ return GL_FALSE;
+ }
+
+ impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,
+ impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count + 1) *
+ sizeof (*impl->_obj.attached));
+ if (impl->_obj.attached == NULL)
+ return GL_FALSE;
+
+ impl->_obj.attached[impl->_obj.attached_count] = att;
+ impl->_obj.attached_count++;
+ (**att)._unknown.AddRef ((struct gl2_unknown_intf **) att);
+ return GL_TRUE;
+}
+
+static GLboolean
+_container_Detach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
+ GLuint i, j;
+
+ for (i = 0; i < impl->_obj.attached_count; i++)
+ if (impl->_obj.attached[i] == att)
+ {
+ for (j = i; j < impl->_obj.attached_count - 1; j++)
+ impl->_obj.attached[j] = impl->_obj.attached[j + 1];
+ impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,
+ impl->_obj.attached_count * sizeof (*impl->_obj.attached),
+ (impl->_obj.attached_count - 1) * sizeof (*impl->_obj.attached));
+ impl->_obj.attached_count--;
+ (**att)._unknown.Release ((struct gl2_unknown_intf **) att);
+ return GL_TRUE;
+ }
+
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Detach");
+ return GL_FALSE;
+}
+
+static GLsizei
+_container_GetAttachedCount (struct gl2_container_intf **intf)
+{
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
+
+ return impl->_obj.attached_count;
+}
+
+static struct gl2_generic_intf **
+_container_GetAttached (struct gl2_container_intf **intf, GLuint index)
+{
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;
+
+ (**impl->_obj.attached[index])._unknown.AddRef (
+ (struct gl2_unknown_intf **)impl->_obj.attached[index]);
+ return impl->_obj.attached[index];
+}
+
+static struct gl2_container_intf _container_vftbl = {
+ {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _container_QueryInterface
+ },
+ _generic_Delete,
+ NULL, /* abstract GetType */
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+ },
+ _container_Attach,
+ _container_Detach,
+ _container_GetAttachedCount,
+ _container_GetAttached
+};
+
+static void
+_container_constructor (struct gl2_container_impl *impl)
+{
+ _generic_constructor ((struct gl2_generic_impl *) impl);
+ impl->_vftbl = &_container_vftbl;
+ impl->_obj._generic._unknown._destructor = _container_destructor;
+ impl->_obj.attached = NULL;
+ impl->_obj.attached_count = 0;
+}
+
+struct gl2_3dlabs_shhandle_obj
+{
+ struct gl2_unkinner_obj _unknown;
+#if USE_3DLABS_FRONTEND
+ ShHandle handle;
+#endif
+};
+
+struct gl2_3dlabs_shhandle_impl
+{
+ struct gl2_3dlabs_shhandle_intf *_vftbl;
+ struct gl2_3dlabs_shhandle_obj _obj;
+};
+
+static void
+_3dlabs_shhandle_destructor (struct gl2_unknown_intf **intf)
+{
+#if USE_3DLABS_FRONTEND
+ struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;
+ ShDestruct (impl->_obj.handle);
+#endif
+ _unkinner_destructor (intf);
+}
+
+static GLvoid *
+_3dlabs_shhandle_GetShHandle (struct gl2_3dlabs_shhandle_intf **intf)
+{
+#if USE_3DLABS_FRONTEND
+ struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;
+ return impl->_obj.handle;
+#else
+ return NULL;
+#endif
+}
+
+static struct gl2_3dlabs_shhandle_intf _3dlabs_shhandle_vftbl = {
+ {
+ _unkinner_AddRef,
+ _unkinner_Release,
+ _unkinner_QueryInterface
+ },
+ _3dlabs_shhandle_GetShHandle
+};
+
+static void
+_3dlabs_shhandle_constructor (struct gl2_3dlabs_shhandle_impl *impl, struct gl2_unknown_intf **outer)
+{
+ _unkinner_constructor ((struct gl2_unkinner_impl *) impl, outer);
+ impl->_vftbl = &_3dlabs_shhandle_vftbl;
+#if USE_3DLABS_FRONTEND
+ impl->_obj.handle = NULL;
+#endif
+}
+
+struct gl2_shader_obj
+{
+ struct gl2_generic_obj _generic;
+ struct gl2_3dlabs_shhandle_impl _3dlabs_shhandle;
+ GLboolean compile_status;
+ GLcharARB *source;
+ GLint *offsets;
+ GLsizei offset_count;
+};
+
+struct gl2_shader_impl
+{
+ struct gl2_shader_intf *_vftbl;
+ struct gl2_shader_obj _obj;
+};
+
+static void
+_shader_destructor (struct gl2_unknown_intf **intf)
+{
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+
+ _mesa_free ((void *) impl->_obj.source);
+ _mesa_free ((void *) impl->_obj.offsets);
+ _3dlabs_shhandle_destructor ((struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl);
+ _generic_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+#if USE_3DLABS_FRONTEND
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+#endif
+
+ if (uiid == UIID_SHADER)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+#if USE_3DLABS_FRONTEND
+ if (uiid == UIID_3DLABS_SHHANDLE)
+ {
+ (**intf).AddRef (intf);
+ return (struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl;
+ }
+#endif
+ return _generic_QueryInterface (intf, uiid);
+}
+
+static GLenum
+_shader_GetType (struct gl2_generic_intf **intf)
+{
+ return GL_SHADER_OBJECT_ARB;
+}
+
+static GLboolean
+_shader_GetCompileStatus (struct gl2_shader_intf **intf)
+{
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+
+ return impl->_obj.compile_status;
+}
+
+static GLvoid
+_shader_SetSource (struct gl2_shader_intf **intf, GLcharARB *src, GLint *off, GLsizei cnt)
+{
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+
+ _mesa_free ((void *) impl->_obj.source);
+ impl->_obj.source = src;
+ _mesa_free ((void *) impl->_obj.offsets);
+ impl->_obj.offsets = off;
+ impl->_obj.offset_count = cnt;
+}
+
+static const GLcharARB *
+_shader_GetSource (struct gl2_shader_intf **intf)
+{
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+
+ return impl->_obj.source;
+}
+
+static GLvoid
+_shader_Compile (struct gl2_shader_intf **intf)
+{
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;
+#if USE_3DLABS_FRONTEND
+ char **strings;
+ TBuiltInResource res;
+#else
+ slang_translation_unit unit;
+ slang_unit_type type;
+ slang_info_log info_log;
+#endif
+
+ impl->_obj.compile_status = GL_FALSE;
+ _mesa_free ((void *) impl->_obj._generic.info_log);
+ impl->_obj._generic.info_log = NULL;
+
+#if USE_3DLABS_FRONTEND
+ /* 3dlabs compiler expects us to feed it with null-terminated string array,
+ we've got only one big string with offsets, so we must split it; but when
+ there's only one string to deal with, we pass its address directly */
+
+ if (impl->_obj.offset_count <= 1)
+ strings = &impl->_obj.source;
+ else
+ {
+ GLsizei i, offset = 0;
+
+ strings = (char **) _mesa_malloc (impl->_obj.offset_count * sizeof (char *));
+ if (strings == NULL)
+ return;
+
+ for (i = 0; i < impl->_obj.offset_count; i++)
+ {
+ GLsizei size = impl->_obj.offsets[i] - offset;
+
+ strings[i] = (char *) _mesa_malloc ((size + 1) * sizeof (char));
+ if (strings[i] == NULL)
+ {
+ GLsizei j;
+
+ for (j = 0; j < i; j++)
+ _mesa_free (strings[j]);
+ _mesa_free (strings);
+ return;
+ }
+
+ _mesa_memcpy (strings[i], impl->_obj.source + offset, size * sizeof (char));
+ strings[i][size] = '\0';
+ offset = impl->_obj.offsets[i];
+ }
+ }
+
+ /* TODO set these fields to some REAL numbers */
+ res.maxLights = 8;
+ res.maxClipPlanes = 6;
+ res.maxTextureUnits = 2;
+ res.maxTextureCoords = 2;
+ res.maxVertexAttribs = 8;
+ res.maxVertexUniformComponents = 64;
+ res.maxVaryingFloats = 8;
+ res.maxVertexTextureImageUnits = 2;
+ res.maxCombinedTextureImageUnits = 2;
+ res.maxTextureImageUnits = 2;
+ res.maxFragmentUniformComponents = 64;
+ res.maxDrawBuffers = 1;
+
+ if (ShCompile (impl->_obj._3dlabs_shhandle._obj.handle, strings, impl->_obj.offset_count,
+ EShOptFull, &res, 0))
+ impl->_obj.compile_status = GL_TRUE;
+ if (impl->_obj.offset_count > 1)
+ {
+ GLsizei i;
+
+ for (i = 0; i < impl->_obj.offset_count; i++)
+ _mesa_free (strings[i]);
+ _mesa_free (strings);
+ }
+
+ impl->_obj._generic.info_log = _mesa_strdup (ShGetInfoLog (
+ impl->_obj._3dlabs_shhandle._obj.handle));
+#else
+ if (impl->_vftbl->GetSubType (intf) == GL_FRAGMENT_SHADER)
+ type = slang_unit_fragment_shader;
+ else
+ type = slang_unit_vertex_shader;
+ slang_info_log_construct (&info_log);
+ if (_slang_compile (impl->_obj.source, &unit, type, &info_log))
+ {
+ impl->_obj.compile_status = GL_TRUE;
+ }
+ if (info_log.text != NULL)
+ impl->_obj._generic.info_log = _mesa_strdup (info_log.text);
+ else
+ impl->_obj._generic.info_log = _mesa_strdup ("");
+ slang_info_log_destruct (&info_log);
+#endif
+}
+
+static struct gl2_shader_intf _shader_vftbl = {
+ {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _shader_QueryInterface
+ },
+ _generic_Delete,
+ _shader_GetType,
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+ },
+ NULL, /* abstract GetSubType */
+ _shader_GetCompileStatus,
+ _shader_SetSource,
+ _shader_GetSource,
+ _shader_Compile
+};
+
+static void
+_shader_constructor (struct gl2_shader_impl *impl)
+{
+ _generic_constructor ((struct gl2_generic_impl *) impl);
+ _3dlabs_shhandle_constructor (&impl->_obj._3dlabs_shhandle, (struct gl2_unknown_intf **)
+ &impl->_vftbl);
+ impl->_vftbl = &_shader_vftbl;
+ impl->_obj._generic._unknown._destructor = _shader_destructor;
+ impl->_obj.compile_status = GL_FALSE;
+ impl->_obj.source = NULL;
+ impl->_obj.offsets = NULL;
+ impl->_obj.offset_count = 0;
+}
+
+struct gl2_program_obj
+{
+ struct gl2_container_obj _container;
+ GLboolean link_status;
+ GLboolean validate_status;
+#if USE_3DLABS_FRONTEND
+ ShHandle linker;
+ ShHandle uniforms;
+#endif
+};
+
+struct gl2_program_impl
+{
+ struct gl2_program_intf *_vftbl;
+ struct gl2_program_obj _obj;
+};
+
+static void
+_program_destructor (struct gl2_unknown_intf **intf)
+{
+#if USE_3DLABS_FRONTEND
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
+
+ ShDestruct (impl->_obj.linker);
+ ShDestruct (impl->_obj.uniforms);
+#endif
+ _container_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_program_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_PROGRAM)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return _container_QueryInterface (intf, uiid);
+}
+
+static GLenum
+_program_GetType (struct gl2_generic_intf **intf)
+{
+ return GL_PROGRAM_OBJECT_ARB;
+}
+
+static GLboolean
+_program_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **sha;
+
+ sha = (**att)._unknown.QueryInterface ((struct gl2_unknown_intf **) att, UIID_SHADER);
+ if (sha == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_program_Attach");
+ return GL_FALSE;
+ }
+
+ (**sha).Release (sha);
+ return _container_Attach (intf, att);
+}
+
+static GLboolean
+_program_GetLinkStatus (struct gl2_program_intf **intf)
+{
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
+
+ return impl->_obj.link_status;
+}
+
+static GLboolean
+_program_GetValidateStatus (struct gl2_program_intf **intf)
+{
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
+
+ return impl->_obj.validate_status;
+}
+
+static GLvoid
+_program_Link (struct gl2_program_intf **intf)
+{
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
+#if USE_3DLABS_FRONTEND
+ ShHandle *handles;
+ GLuint i;
+#endif
+
+ impl->_obj.link_status = GL_FALSE;
+ _mesa_free ((void *) impl->_obj._container._generic.info_log);
+ impl->_obj._container._generic.info_log = NULL;
+
+#if USE_3DLABS_FRONTEND
+ handles = (ShHandle *) _mesa_malloc (impl->_obj._container.attached_count * sizeof (ShHandle));
+ if (handles == NULL)
+ return;
+
+ for (i = 0; i < impl->_obj._container.attached_count; i++)
+ {
+ struct gl2_generic_intf **gen = impl->_obj._container.attached[i];
+ struct gl2_3dlabs_shhandle_intf **sh;
+
+ sh = (struct gl2_3dlabs_shhandle_intf **) (**gen)._unknown.QueryInterface (
+ (struct gl2_unknown_intf **) gen, UIID_3DLABS_SHHANDLE);
+ if (sh != NULL)
+ {
+ handles[i] = (**sh).GetShHandle (sh);
+ (**sh)._unknown.Release ((struct gl2_unknown_intf **) sh);
+ }
+ else
+ {
+ _mesa_free (handles);
+ return;
+ }
+ }
+
+ if (ShLink (impl->_obj.linker, handles, impl->_obj._container.attached_count,
+ impl->_obj.uniforms, NULL, NULL))
+ impl->_obj.link_status = GL_TRUE;
+
+ impl->_obj._container._generic.info_log = _mesa_strdup (ShGetInfoLog (impl->_obj.linker));
+#endif
+}
+
+static GLvoid
+_program_Validate (struct gl2_program_intf **intf)
+{
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;
+
+ impl->_obj.validate_status = GL_FALSE;
+ _mesa_free ((void *) impl->_obj._container._generic.info_log);
+ impl->_obj._container._generic.info_log = NULL;
+
+ /* TODO validate */
+}
+
+static struct gl2_program_intf _program_vftbl = {
+ {
+ {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _program_QueryInterface
+ },
+ _generic_Delete,
+ _program_GetType,
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+ },
+ _program_Attach,
+ _container_Detach,
+ _container_GetAttachedCount,
+ _container_GetAttached
+ },
+ _program_GetLinkStatus,
+ _program_GetValidateStatus,
+ _program_Link,
+ _program_Validate
+};
+
+static void
+_program_constructor (struct gl2_program_impl *impl)
+{
+ _container_constructor ((struct gl2_container_impl *) impl);
+ impl->_vftbl = &_program_vftbl;
+ impl->_obj._container._generic._unknown._destructor = _program_destructor;
+ impl->_obj.link_status = GL_FALSE;
+ impl->_obj.validate_status = GL_FALSE;
+#if USE_3DLABS_FRONTEND
+ impl->_obj.linker = ShConstructLinker (EShExVertexFragment, 0);
+ impl->_obj.uniforms = ShConstructUniformMap ();
+#endif
+}
+
+struct gl2_fragment_shader_obj
+{
+ struct gl2_shader_obj _shader;
+};
+
+struct gl2_fragment_shader_impl
+{
+ struct gl2_fragment_shader_intf *_vftbl;
+ struct gl2_fragment_shader_obj _obj;
+};
+
+static void
+_fragment_shader_destructor (struct gl2_unknown_intf **intf)
+{
+ struct gl2_fragment_shader_impl *impl = (struct gl2_fragment_shader_impl *) intf;
+
+ (void) impl;
+ /* TODO free fragment shader data */
+
+ _shader_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_fragment_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_FRAGMENT_SHADER)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return _shader_QueryInterface (intf, uiid);
+}
+
+static GLenum
+_fragment_shader_GetSubType (struct gl2_shader_intf **intf)
+{
+ return GL_FRAGMENT_SHADER_ARB;
+}
+
+static struct gl2_fragment_shader_intf _fragment_shader_vftbl = {
+ {
+ {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _fragment_shader_QueryInterface
+ },
+ _generic_Delete,
+ _shader_GetType,
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+ },
+ _fragment_shader_GetSubType,
+ _shader_GetCompileStatus,
+ _shader_SetSource,
+ _shader_GetSource,
+ _shader_Compile
+ }
+};
+
+static void
+_fragment_shader_constructor (struct gl2_fragment_shader_impl *impl)
+{
+ _shader_constructor ((struct gl2_shader_impl *) impl);
+ impl->_vftbl = &_fragment_shader_vftbl;
+ impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor;
+#if USE_3DLABS_FRONTEND
+ impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangFragment, 0);
+#endif
+}
+
+struct gl2_vertex_shader_obj
+{
+ struct gl2_shader_obj _shader;
+};
+
+struct gl2_vertex_shader_impl
+{
+ struct gl2_vertex_shader_intf *_vftbl;
+ struct gl2_vertex_shader_obj _obj;
+};
+
+static void
+_vertex_shader_destructor (struct gl2_unknown_intf **intf)
+{
+ struct gl2_vertex_shader_impl *impl = (struct gl2_vertex_shader_impl *) intf;
+
+ (void) impl;
+ /* TODO free vertex shader data */
+
+ _shader_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_vertex_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+ if (uiid == UIID_VERTEX_SHADER)
+ {
+ (**intf).AddRef (intf);
+ return intf;
+ }
+ return _shader_QueryInterface (intf, uiid);
+}
+
+static GLenum
+_vertex_shader_GetSubType (struct gl2_shader_intf **intf)
+{
+ return GL_VERTEX_SHADER_ARB;
+}
+
+static struct gl2_vertex_shader_intf _vertex_shader_vftbl = {
+ {
+ {
+ {
+ _unknown_AddRef,
+ _unknown_Release,
+ _vertex_shader_QueryInterface
+ },
+ _generic_Delete,
+ _shader_GetType,
+ _generic_GetName,
+ _generic_GetDeleteStatus,
+ _generic_GetInfoLog
+ },
+ _vertex_shader_GetSubType,
+ _shader_GetCompileStatus,
+ _shader_SetSource,
+ _shader_GetSource,
+ _shader_Compile
+ }
+};
+
+static void
+_vertex_shader_constructor (struct gl2_vertex_shader_impl *impl)
+{
+ _shader_constructor ((struct gl2_shader_impl *) impl);
+ impl->_vftbl = &_vertex_shader_vftbl;
+ impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor;
+#if USE_3DLABS_FRONTEND
+ impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangVertex, 0);
+#endif
+}
+
+GLhandleARB
+_mesa_3dlabs_create_shader_object (GLenum shaderType)
+{
+ switch (shaderType)
+ {
+ case GL_FRAGMENT_SHADER_ARB:
+ {
+ struct gl2_fragment_shader_impl *x = (struct gl2_fragment_shader_impl *)
+ _mesa_malloc (sizeof (struct gl2_fragment_shader_impl));
+
+ if (x != NULL)
+ {
+ _fragment_shader_constructor (x);
+ return x->_obj._shader._generic.name;
+ }
+ }
+ break;
+ case GL_VERTEX_SHADER_ARB:
+ {
+ struct gl2_vertex_shader_impl *x = (struct gl2_vertex_shader_impl *)
+ _mesa_malloc (sizeof (struct gl2_vertex_shader_impl));
+
+ if (x != NULL)
+ {
+ _vertex_shader_constructor (x);
+ return x->_obj._shader._generic.name;
+ }
+ }
+ break;
+ }
+
+ return 0;
+}
+
+GLhandleARB
+_mesa_3dlabs_create_program_object (void)
+{
+ struct gl2_program_impl *x = (struct gl2_program_impl *)
+ _mesa_malloc (sizeof (struct gl2_program_impl));
+
+ if (x != NULL)
+ {
+ _program_constructor (x);
+ return x->_obj._container._generic.name;
+ }
+
+ return 0;
+}
+
+void
+_mesa_init_shaderobjects_3dlabs (GLcontext *ctx)
+{
+#if USE_3DLABS_FRONTEND
+ _glslang_3dlabs_InitProcess ();
+ _glslang_3dlabs_ShInitialize ();
+#endif
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h
index 4cb8cf454..5deff2f6a 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h
@@ -1,40 +1,40 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 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 SHADEROBJECTS_3DLABS_H
-#define SHADEROBJECTS_3DLABS_H
-
-#include "mtypes.h"
-
-extern GLhandleARB
-_mesa_3dlabs_create_shader_object (GLenum);
-
-extern GLhandleARB
-_mesa_3dlabs_create_program_object (void);
-
-extern void
-_mesa_init_shaderobjects_3dlabs (GLcontext *ctx);
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 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 SHADEROBJECTS_3DLABS_H
+#define SHADEROBJECTS_3DLABS_H
+
+#include "mtypes.h"
+
+extern GLhandleARB
+_mesa_3dlabs_create_shader_object (GLenum);
+
+extern GLhandleARB
+_mesa_3dlabs_create_program_object (void);
+
+extern void
+_mesa_init_shaderobjects_3dlabs (GLcontext *ctx);
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h
index c7f3d368a..f838859bb 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h
@@ -1,1565 +1,1565 @@
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"int __constructor (const float _f) {\n"
-" int _i;\n"
-" __asm float_to_int _i, _f;\n"
-" return _i;\n"
-"}\n"
-"\n"
-"bool __constructor (const int _i) {\n"
-" return _i != 0;\n"
-"}\n"
-"\n"
-"bool __constructor (const float _f) {\n"
-" return _f != 0.0;\n"
-"}\n"
-"\n"
-"int __constructor (const bool _b) {\n"
-" return _b ? 1 : 0;\n"
-"}\n"
-"\n"
-"float __constructor (const bool _b) {\n"
-" return _b ? 1.0 : 0.0;\n"
-"}\n"
-"\n"
-"float __constructor (const int _i) {\n"
-" float _f;\n"
-" __asm int_to_float _f, _i;\n"
-" return _f;\n"
-"}\n"
-"\n"
-"bool __constructor (const bool _b) {\n"
-" return _b;\n"
-"}\n"
-"\n"
-"int __constructor (const int _i) {\n"
-" return _i;\n"
-"}\n"
-"\n"
-"float __constructor (const float _f) {\n"
-" return _f;\n"
-"}\n"
-"\n"
-"vec2 __constructor (const float _f) {\n"
-" return vec2 (_f, _f);\n"
-"}\n"
-"\n"
-"vec2 __constructor (const int _i) {\n"
-" return vec2 (_i, _i);\n"
-"}\n"
-"\n"
-"vec2 __constructor (const bool _b) {\n"
-" return vec2 (_b, _b);\n"
-"}\n"
-"\n"
-"vec3 __constructor (const float _f) {\n"
-" return vec3 (_f, _f, _f);\n"
-"}\n"
-"\n"
-"vec3 __constructor (const int _i) {\n"
-" return vec3 (_i, _i, _i);\n"
-"}\n"
-"\n"
-"vec3 __constructor (const bool _b) {\n"
-" return vec3 (_b, _b, _b);\n"
-"}\n"
-"\n"
-"vec4 __constructor (const float _f) {\n"
-" return vec4 (_f, _f, _f, _f);\n"
-"}\n"
-"\n"
-"vec4 __constructor (const int _i) {\n"
-" return vec4 (_i, _i, _i, _i);\n"
-"}\n"
-"\n"
-"vec4 __constructor (const bool _b) {\n"
-" return vec4 (_b, _b, _b, _b);\n"
-"}\n"
-"\n"
-"ivec2 __constructor (const int _i) {\n"
-" return ivec2 (_i, _i);\n"
-"}\n"
-"\n"
-"ivec2 __constructor (const float _f) {\n"
-" return ivec2 (_f, _f);\n"
-"}\n"
-"\n"
-"ivec2 __constructor (const bool _b) {\n"
-" return ivec2 (_b, _b);\n"
-"}\n"
-"\n"
-"ivec3 __constructor (const int _i) {\n"
-" return ivec3 (_i, _i, _i);\n"
-"}\n"
-"\n"
-"ivec3 __constructor (const float _f) {\n"
-" return ivec3 (_f, _f, _f);\n"
-"}\n"
-"\n"
-"ivec3 __constructor (const bool _b) {\n"
-" return ivec3 (_b, _b, _b);\n"
-"}\n"
-"\n"
-"ivec4 __constructor (const int _i) {\n"
-" return ivec4 (_i, _i, _i, _i);\n"
-"}\n"
-"\n"
-"ivec4 __constructor (const float _f) {\n"
-" return ivec4 (_f, _f, _f, _f);\n"
-"}\n"
-"\n"
-"ivec4 __constructor (const bool _b) {\n"
-" return ivec4 (_b, _b, _b, _b);\n"
-"}\n"
-"\n"
-"bvec2 __constructor (const bool _b) {\n"
-" return bvec2 (_b, _b);\n"
-"}\n"
-"\n"
-"bvec2 __constructor (const float _f) {\n"
-" return bvec2 (_f, _f);\n"
-"}\n"
-"\n"
-"bvec2 __constructor (const int _i) {\n"
-" return bvec2 (_i, _i);\n"
-"}\n"
-"\n"
-"bvec3 __constructor (const bool _b) {\n"
-" return bvec3 (_b, _b, _b);\n"
-"}\n"
-"\n"
-"bvec3 __constructor (const float _f) {\n"
-" return bvec3 (_f, _f, _f);\n"
-"}\n"
-"\n"
-"bvec3 __constructor (const int _i) {\n"
-" return bvec3 (_i, _i, _i);\n"
-"}\n"
-"\n"
-"bvec4 __constructor (const bool _b) {\n"
-" return bvec4 (_b, _b, _b, _b);\n"
-"}\n"
-"\n"
-"bvec4 __constructor (const float _f) {\n"
-" return bvec4 (_f, _f, _f, _f);\n"
-"}\n"
-"\n"
-"bvec4 __constructor (const int _i) {\n"
-" return bvec4 (_i, _i, _i, _i);\n"
-"}\n"
-"\n"
-"mat2 __constructor (const float _f) {\n"
-" return mat2 (\n"
-" _f, .0,\n"
-" .0, _f\n"
-" );\n"
-"}\n"
-"\n"
-"mat2 __constructor (const int _i) {\n"
-" return mat2 (\n"
-" _i, .0,\n"
-" .0, _i\n"
-" );\n"
-"}\n"
-"\n"
-"mat2 __constructor (const bool _b) {\n"
-" return mat2 (\n"
-" _b, .0,\n"
-" .0, _b\n"
-" );\n"
-"}\n"
-"\n"
-"mat3 __constructor (const float _f) {\n"
-" return mat3 (\n"
-" _f, .0, .0,\n"
-" .0, _f, .0,\n"
-" .0, .0, _f\n"
-" );\n"
-"}\n"
-"\n"
-"mat3 __constructor (const int _i) {\n"
-" return mat3 (\n"
-" _i, .0, .0,\n"
-" .0, _i, .0,\n"
-" .0, .0, _i\n"
-" );\n"
-"}\n"
-"\n"
-"mat3 __constructor (const bool _b) {\n"
-" return mat3 (\n"
-" _b, .0, .0,\n"
-" .0, _b, .0,\n"
-" .0, .0, _b\n"
-" );\n"
-"}\n"
-"\n"
-"mat4 __constructor (const float _f) {\n"
-" return mat4 (\n"
-" _f, .0, .0, .0,\n"
-" .0, _f, .0, .0,\n"
-" .0, .0, _f, .0,\n"
-" .0, .0, .0, _f\n"
-" );\n"
-"}\n"
-"\n"
-"mat4 __constructor (const int _i) {\n"
-" return mat4 (\n"
-" _i, .0, .0, .0,\n"
-" .0, _i, .0, .0,\n"
-" .0, .0, _i, .0,\n"
-" .0, .0, .0, _i\n"
-" );\n"
-"}\n"
-"\n"
-"mat4 __constructor (const bool _b) {\n"
-" return mat4 (\n"
-" _b, .0, .0, .0,\n"
-" .0, _b, .0, .0,\n"
-" .0, .0, _b, .0,\n"
-" .0, .0, .0, _b\n"
-" );\n"
-"}\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"void __operator += (inout float a, const float b) {\n"
-" __asm float_add a, a, b;\n"
-"}\n"
-"\n"
-"float __operator - (const float a) {\n"
-" float c;\n"
-" __asm float_negate c, a;\n"
-" return c;\n"
-"}\n"
-"\n"
-"void __operator -= (inout float a, const float b) {\n"
-" a += -b;\n"
-"}\n"
-"\n"
-"void __operator *= (inout float a, const float b) {\n"
-" __asm float_multiply a, a, b;\n"
-"}\n"
-"\n"
-"void __operator /= (inout float a, const float b) {\n"
-" __asm float_divide a, a, b;\n"
-"}\n"
-"\n"
-"float __operator + (const float a, const float b) {\n"
-" float c;\n"
-" c = a;\n"
-" return c += b;\n"
-"}\n"
-"\n"
-"void __operator += (inout int a, const int b) {\n"
-" a = int (float (a) + float (b));\n"
-"}\n"
-"\n"
-"int __operator - (const int a) {\n"
-" return int (-float (a));\n"
-"}\n"
-"\n"
-"void __operator -= (inout int a, const int b) {\n"
-" a += -b;\n"
-"}\n"
-"\n"
-"float __operator * (const float a, const float b) {\n"
-" float c;\n"
-" c = a;\n"
-" return c *= b;\n"
-"}\n"
-"\n"
-"void __operator *= (inout int a, const int b) {\n"
-" a = int (float (a) * float (b));\n"
-"}\n"
-"\n"
-"float __operator / (const float a, const float b) {\n"
-" float c;\n"
-" c = a;\n"
-" return c /= b;\n"
-"}\n"
-"\n"
-"void __operator /= (inout int a, const int b) {\n"
-" a = int (float (a) / float (b));\n"
-"}\n"
-"\n"
-"void __operator += (inout vec2 v, const vec2 u) {\n"
-" v.x += u.x, v.y += u.y;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec2 v, const vec2 u) {\n"
-" v.x -= u.x, v.y -= u.y;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec2 v, const vec2 u) {\n"
-" v.x *= u.x, v.y *= u.y;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec2 v, const vec2 u) {\n"
-" v.x /= u.x, v.y /= u.y;\n"
-"}\n"
-"\n"
-"void __operator += (inout vec3 v, const vec3 u) {\n"
-" v.x += u.x, v.y += u.y, v.z += u.z;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec3 v, const vec3 u) {\n"
-" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec3 v, const vec3 u) {\n"
-" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec3 v, const vec3 u) {\n"
-" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n"
-"}\n"
-"\n"
-"void __operator += (inout vec4 v, const vec4 u) {\n"
-" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec4 v, const vec4 u) {\n"
-" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec4 v, const vec4 u) {\n"
-" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec4 v, const vec4 u) {\n"
-" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n"
-"}\n"
-"\n"
-"void __operator += (inout ivec2 v, const ivec2 u) {\n"
-" v.x += u.x, v.y += u.y;\n"
-"}\n"
-"\n"
-"void __operator -= (inout ivec2 v, const ivec2 u) {\n"
-" v.x -= u.x, v.y -= u.y;\n"
-"}\n"
-"\n"
-"void __operator *= (inout ivec2 v, const ivec2 u) {\n"
-" v.x *= u.x, v.y *= u.y;\n"
-"}\n"
-"\n"
-"void __operator /= (inout ivec2 v, const ivec2 u) {\n"
-" v.x /= u.x, v.y /= u.y;\n"
-"}\n"
-"\n"
-"void __operator += (inout ivec3 v, const ivec3 u) {\n"
-" v.x += u.x, v.y += u.y, v.z += u.z;\n"
-"}\n"
-"\n"
-"void __operator -= (inout ivec3 v, const ivec3 u) {\n"
-" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n"
-"}\n"
-"\n"
-"void __operator *= (inout ivec3 v, const ivec3 u) {\n"
-" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n"
-"}\n"
-"\n"
-"void __operator /= (inout ivec3 v, const ivec3 u) {\n"
-" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n"
-"}\n"
-"\n"
-"void __operator += (inout ivec4 v, const ivec4 u) {\n"
-" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n"
-"}\n"
-"\n"
-"void __operator -= (inout ivec4 v, const ivec4 u) {\n"
-" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n"
-"}\n"
-"\n"
-"void __operator *= (inout ivec4 v, const ivec4 u) {\n"
-" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n"
-"}\n"
-"\n"
-"void __operator /= (inout ivec4 v, const ivec4 u) {\n"
-" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n"
-"}\n"
-"\n"
-"void __operator += (inout mat2 m, const mat2 n) {\n"
-" m[0] += n[0], m[1] += n[1];\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat2 m, const mat2 n) {\n"
-" m[0] -= n[0], m[1] -= n[1];\n"
-"}\n"
-"\n"
-"vec2 __operator * (const mat2 m, const vec2 v) {\n"
-" return vec2 (\n"
-" v.x * m[0].x + v.y * m[1].x,\n"
-" v.x * m[0].y + v.y * m[1].y\n"
-" );\n"
-"}\n"
-"\n"
-"mat2 __operator * (const mat2 m, const mat2 n) {\n"
-" return mat2 (m * n[0], m * n[1]);\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat2 m, const mat2 n) {\n"
-" m = m * n;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat2 m, const mat2 n) {\n"
-" m[0] /= n[0], m[1] /= n[1];\n"
-"}\n"
-"\n"
-"void __operator += (inout mat3 m, const mat3 n) {\n"
-" m[0] += n[0], m[1] += n[1], m[2] += n[2];\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat3 m, const mat3 n) {\n"
-" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2];\n"
-"}\n"
-"\n"
-"vec3 __operator * (const mat3 m, const vec3 v) {\n"
-" return vec3 (\n"
-" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n"
-" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n"
-" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n"
-" );\n"
-"}\n"
-"\n"
-"mat3 __operator * (const mat3 m, const mat3 n) {\n"
-" return mat3 (m * n[0], m * n[1], m * n[2]);\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat3 m, const mat3 n) {\n"
-" m = m * n;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat3 m, const mat3 n) {\n"
-" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2];\n"
-"}\n"
-"\n"
-"void __operator += (inout mat4 m, const mat4 n) {\n"
-" m[0] += n[0], m[1] += n[1], m[2] += n[2], m[3] += n[3];\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat4 m, const mat4 n) {\n"
-" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2], m[3] -= n[3];\n"
-"}\n"
-"\n"
-"vec4 __operator * (const mat4 m, const vec4 v) {\n"
-" return vec4 (\n"
-" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n"
-" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n"
-" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n"
-" v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n"
-" );\n"
-"}\n"
-"\n"
-"mat4 __operator * (const mat4 m, const mat4 n) {\n"
-" return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat4 m, const mat4 n) {\n"
-" m = m * n;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat4 m, const mat4 n) {\n"
-" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2], m[3] /= n[3];\n"
-"}\n"
-"\n"
-"void __operator += (inout vec2 v, const float a) {\n"
-" v.x += a, v.y += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec2 v, const float a) {\n"
-" v.x -= a, v.y -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec2 v, const float a) {\n"
-" v.x *= a, v.y *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec2 v, const float a) {\n"
-" v.x /= a, v.y /= a;\n"
-"}\n"
-"\n"
-"void __operator += (inout vec3 v, const float a) {\n"
-" v.x += a, v.y += a, v.z += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec3 v, const float a) {\n"
-" v.x -= a, v.y -= a, v.z -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec3 v, const float a) {\n"
-" v.x *= a, v.y *= a, v.z *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec3 v, const float a) {\n"
-" v.x /= a, v.y /= a, v.z /= a;\n"
-"}\n"
-"\n"
-"void __operator += (inout vec4 v, const float a) {\n"
-" v.x += a, v.y += a, v.z += a, v.w += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout vec4 v, const float a) {\n"
-" v.x -= a, v.y -= a, v.z -= a, v.w -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec4 v, const float a) {\n"
-" v.x *= a, v.y *= a, v.z *= a, v.w *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout vec4 v, const float a) {\n"
-" v.x /= a, v.y /= a, v.z /= a, v.w /= a;\n"
-"}\n"
-"\n"
-"void __operator += (inout mat2 m, const float a) {\n"
-" m[0] += a, m[1] += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat2 m, const float a) {\n"
-" m[0] -= a, m[1] -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat2 m, const float a) {\n"
-" m[0] *= a, m[1] *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat2 m, const float a) {\n"
-" m[0] /= a, m[1] /= a;\n"
-"}\n"
-"\n"
-"void __operator += (inout mat3 m, const float a) {\n"
-" m[0] += a, m[1] += a, m[2] += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat3 m, const float a) {\n"
-" m[0] -= a, m[1] -= a, m[2] -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat3 m, const float a) {\n"
-" m[0] *= a, m[1] *= a, m[2] *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat3 m, const float a) {\n"
-" m[0] /= a, m[1] /= a, m[2] /= a;\n"
-"}\n"
-"\n"
-"void __operator += (inout mat4 m, const float a) {\n"
-" m[0] += a, m[1] += a, m[2] += a, m[3] += a;\n"
-"}\n"
-"\n"
-"void __operator -= (inout mat4 m, const float a) {\n"
-" m[0] -= a, m[1] -= a, m[2] -= a, m[3] -= a;\n"
-"}\n"
-"\n"
-"void __operator *= (inout mat4 m, const float a) {\n"
-" m[0] *= a, m[1] *= a, m[2] *= a, m[3] *= a;\n"
-"}\n"
-"\n"
-"void __operator /= (inout mat4 m, const float a) {\n"
-" m[0] /= a, m[1] /= a, m[2] /= a, m[3] /= a;\n"
-"}\n"
-"\n"
-"vec2 __operator * (const vec2 v, const mat2 m) {\n"
-" return vec2 (\n"
-" v.x * m[0].x + v.y * m[0].y,\n"
-" v.x * m[1].x + v.y * m[1].y\n"
-" );\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec2 v, const mat2 m) {\n"
-" v = v * m;\n"
-"}\n"
-"\n"
-"vec3 __operator * (const vec3 v, const mat3 m) {\n"
-" return vec3 (\n"
-" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n"
-" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n"
-" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n"
-" );\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec3 v, const mat3 m) {\n"
-" v = v * m;\n"
-"}\n"
-"\n"
-"vec4 __operator * (const vec4 v, const mat4 m) {\n"
-" return vec4 (\n"
-" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n"
-" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n"
-" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n"
-" v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n"
-" );\n"
-"}\n"
-"\n"
-"void __operator *= (inout vec4 v, const mat4 m) {\n"
-" v = v * m;\n"
-"}\n"
-"\n"
-"float __operator - (const float a, const float b) {\n"
-" return a + -b;\n"
-"}\n"
-"\n"
-"int __operator + (const int a, const int b) {\n"
-" int c;\n"
-" c = a;\n"
-" return c += b;\n"
-"}\n"
-"\n"
-"int __operator - (const int a, const int b) {\n"
-" return a + -b;\n"
-"}\n"
-"\n"
-"int __operator * (const int a, const int b) {\n"
-" int c;\n"
-" return (c = a) *= b;\n"
-"}\n"
-"\n"
-"int __operator / (const int a, const int b) {\n"
-" int c;\n"
-" return (c = a) /= b;\n"
-"}\n"
-"\n"
-"vec2 __operator + (const vec2 v, const vec2 u) {\n"
-" return vec2 (v.x + u.x, v.y + u.y);\n"
-"}\n"
-"\n"
-"vec2 __operator - (const vec2 v, const vec2 u) {\n"
-" return vec2 (v.x - u.x, v.y - u.y);\n"
-"}\n"
-"\n"
-"vec3 __operator + (const vec3 v, const vec3 u) {\n"
-" return vec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n"
-"}\n"
-"\n"
-"vec3 __operator - (const vec3 v, const vec3 u) {\n"
-" return vec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n"
-"}\n"
-"\n"
-"vec4 __operator + (const vec4 v, const vec4 u) {\n"
-" return vec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n"
-"}\n"
-"\n"
-"vec4 __operator - (const vec4 v, const vec4 u) {\n"
-" return vec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n"
-"}\n"
-"\n"
-"ivec2 __operator + (const ivec2 v, const ivec2 u) {\n"
-" return ivec2 (v.x + u.x, v.y + u.y);\n"
-"}\n"
-"\n"
-"ivec2 __operator - (const ivec2 v, const ivec2 u) {\n"
-" return ivec2 (v.x - u.x, v.y - u.y);\n"
-"}\n"
-"\n"
-"ivec3 __operator + (const ivec3 v, const ivec3 u) {\n"
-" return ivec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n"
-"}\n"
-"\n"
-"ivec3 __operator - (const ivec3 v, const ivec3 u) {\n"
-" return ivec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n"
-"}\n"
-"\n"
-"ivec4 __operator + (const ivec4 v, const ivec4 u) {\n"
-" return ivec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n"
-"}\n"
-"\n"
-"ivec4 __operator - (const ivec4 v, const ivec4 u) {\n"
-" return ivec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n"
-"}\n"
-"\n"
-"mat2 __operator + (const mat2 m, const mat2 n) {\n"
-" return mat2 (m[0] + n[0], m[1] + n[1]);\n"
-"}\n"
-"\n"
-"mat2 __operator - (const mat2 m, const mat2 n) {\n"
-" return mat2 (m[0] - n[0], m[1] - n[1]);\n"
-"}\n"
-"\n"
-"mat3 __operator + (const mat3 m, const mat3 n) {\n"
-" return mat3 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);\n"
-"}\n"
-"\n"
-"mat3 __operator - (const mat3 m, const mat3 n) {\n"
-" return mat3 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);\n"
-"}\n"
-"\n"
-"mat4 __operator + (const mat4 m, const mat4 n) {\n"
-" return mat4 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);\n"
-"}\n"
-"\n"
-"mat4 __operator - (const mat4 m, const mat4 n) {\n"
-" return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);\n"
-"}\n"
-"\n"
-"vec2 __operator + (const float a, const vec2 u) {\n"
-" return vec2 (a + u.x, a + u.y);\n"
-"}\n"
-"\n"
-"vec2 __operator + (const vec2 v, const float b) {\n"
-" return vec2 (v.x + b, v.y + b);\n"
-"}\n"
-"\n"
-"vec2 __operator - (const float a, const vec2 u) {\n"
-" return vec2 (a - u.x, a - u.y);\n"
-"}\n"
-"\n"
-"vec2 __operator - (const vec2 v, const float b) {\n"
-" return vec2 (v.x - b, v.y - b);\n"
-"}\n"
-"\n"
-"vec2 __operator * (const float a, const vec2 u) {\n"
-" return vec2 (a * u.x, a * u.y);\n"
-"}\n"
-"\n"
-"vec2 __operator * (const vec2 v, const float b) {\n"
-" return vec2 (v.x * b, v.y * b);\n"
-"}\n"
-"\n"
-"vec2 __operator / (const float a, const vec2 u) {\n"
-" return vec2 (a / u.x, a / u.y);\n"
-"}\n"
-"\n"
-"vec2 __operator / (const vec2 v, const float b) {\n"
-" return vec2 (v.x / b, v.y / b);\n"
-"}\n"
-"\n"
-"vec3 __operator + (const float a, const vec3 u) {\n"
-" return vec3 (a + u.x, a + u.y, a + u.z);\n"
-"}\n"
-"\n"
-"vec3 __operator + (const vec3 v, const float b) {\n"
-" return vec3 (v.x + b, v.y + b, v.z + b);\n"
-"}\n"
-"\n"
-"vec3 __operator - (const float a, const vec3 u) {\n"
-" return vec3 (a - u.x, a - u.y, a - u.z);\n"
-"}\n"
-"\n"
-"vec3 __operator - (const vec3 v, const float b) {\n"
-" return vec3 (v.x - b, v.y - b, v.z - b);\n"
-"}\n"
-"\n"
-"vec3 __operator * (const float a, const vec3 u) {\n"
-" return vec3 (a * u.x, a * u.y, a * u.z);\n"
-"}\n"
-"\n"
-"vec3 __operator * (const vec3 v, const float b) {\n"
-" return vec3 (v.x * b, v.y * b, v.z * b);\n"
-"}\n"
-"\n"
-"vec3 __operator / (const float a, const vec3 u) {\n"
-" return vec3 (a / u.x, a / u.y, a / u.z);\n"
-"}\n"
-"\n"
-"vec3 __operator / (const vec3 v, const float b) {\n"
-" return vec3 (v.x / b, v.y / b, v.z / b);\n"
-"}\n"
-"\n"
-"vec4 __operator + (const float a, const vec4 u) {\n"
-" return vec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n"
-"}\n"
-"\n"
-"vec4 __operator + (const vec4 v, const float b) {\n"
-" return vec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n"
-"}\n"
-"\n"
-"vec4 __operator - (const float a, const vec4 u) {\n"
-" return vec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n"
-"}\n"
-"\n"
-"vec4 __operator - (const vec4 v, const float b) {\n"
-" return vec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n"
-"}\n"
-"\n"
-"vec4 __operator * (const float a, const vec4 u) {\n"
-" return vec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n"
-"}\n"
-"\n"
-"vec4 __operator * (const vec4 v, const float b) {\n"
-" return vec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n"
-"}\n"
-"\n"
-"vec4 __operator / (const float a, const vec4 u) {\n"
-" return vec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n"
-"}\n"
-"\n"
-"vec4 __operator / (const vec4 v, const float b) {\n"
-" return vec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n"
-"}\n"
-"\n"
-"mat2 __operator + (const float a, const mat2 n) {\n"
-" return mat2 (a + n[0], a + n[1]);\n"
-"}\n"
-"\n"
-"mat2 __operator + (const mat2 m, const float b) {\n"
-" return mat2 (m[0] + b, m[1] + b);\n"
-"}\n"
-"\n"
-"mat2 __operator - (const float a, const mat2 n) {\n"
-" return mat2 (a - n[0], a - n[1]);\n"
-"}\n"
-"\n"
-"mat2 __operator - (const mat2 m, const float b) {\n"
-" return mat2 (m[0] - b, m[1] - b);\n"
-"}\n"
-"\n"
-"mat2 __operator * (const float a, const mat2 n) {\n"
-" return mat2 (a * n[0], a * n[1]);\n"
-"}\n"
-"\n"
-"mat2 __operator * (const mat2 m, const float b) {\n"
-" return mat2 (m[0] * b, m[1] * b);\n"
-"}\n"
-"\n"
-"mat2 __operator / (const float a, const mat2 n) {\n"
-" return mat2 (a / n[0], a / n[1]);\n"
-"}\n"
-"\n"
-"mat2 __operator / (const mat2 m, const float b) {\n"
-" return mat2 (m[0] / b, m[1] / b);\n"
-"}\n"
-"\n"
-"mat3 __operator + (const float a, const mat3 n) {\n"
-" return mat3 (a + n[0], a + n[1], a + n[2]);\n"
-"}\n"
-"\n"
-"mat3 __operator + (const mat3 m, const float b) {\n"
-" return mat3 (m[0] + b, m[1] + b, m[2] + b);\n"
-"}\n"
-"\n"
-"mat3 __operator - (const float a, const mat3 n) {\n"
-" return mat3 (a - n[0], a - n[1], a - n[2]);\n"
-"}\n"
-"\n"
-"mat3 __operator - (const mat3 m, const float b) {\n"
-" return mat3 (m[0] - b, m[1] - b, m[2] - b);\n"
-"}\n"
-"\n"
-"mat3 __operator * (const float a, const mat3 n) {\n"
-" return mat3 (a * n[0], a * n[1], a * n[2]);\n"
-"}\n"
-"\n"
-"mat3 __operator * (const mat3 m, const float b) {\n"
-" return mat3 (m[0] * b, m[1] * b, m[2] * b);\n"
-"}\n"
-"\n"
-"mat3 __operator / (const float a, const mat3 n) {\n"
-" return mat3 (a / n[0], a / n[1], a / n[2]);\n"
-"}\n"
-"\n"
-"mat3 __operator / (const mat3 m, const float b) {\n"
-" return mat3 (m[0] / b, m[1] / b, m[2] / b);\n"
-"}\n"
-"\n"
-"mat4 __operator + (const float a, const mat4 n) {\n"
-" return mat4 (a + n[0], a + n[1], a + n[2], a + n[3]);\n"
-"}\n"
-"\n"
-"mat4 __operator + (const mat4 m, const float b) {\n"
-" return mat4 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);\n"
-"}\n"
-"\n"
-"mat4 __operator - (const float a, const mat4 n) {\n"
-" return mat4 (a - n[0], a - n[1], a - n[2], a - n[3]);\n"
-"}\n"
-"\n"
-"mat4 __operator - (const mat4 m, const float b) {\n"
-" return mat4 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);\n"
-"}\n"
-"\n"
-"mat4 __operator * (const float a, const mat4 n) {\n"
-" return mat4 (a * n[0], a * n[1], a * n[2], a * n[3]);\n"
-"}\n"
-"\n"
-"mat4 __operator * (const mat4 m, const float b) {\n"
-" return mat4 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);\n"
-"}\n"
-"\n"
-"mat4 __operator / (const float a, const mat4 n) {\n"
-" return mat4 (a / n[0], a / n[1], a / n[2], a / n[3]);\n"
-"}\n"
-"\n"
-"mat4 __operator / (const mat4 m, const float b) {\n"
-" return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);\n"
-"}\n"
-"\n"
-"ivec2 __operator + (const int a, const ivec2 u) {\n"
-" return ivec2 (a + u.x, a + u.y);\n"
-"}\n"
-"\n"
-"ivec2 __operator + (const ivec2 v, const int b) {\n"
-" return ivec2 (v.x + b, v.y + b);\n"
-"}\n"
-"\n"
-"ivec2 __operator - (const int a, const ivec2 u) {\n"
-" return ivec2 (a - u.x, a - u.y);\n"
-"}\n"
-"\n"
-"ivec2 __operator - (const ivec2 v, const int b) {\n"
-" return ivec2 (v.x - b, v.y - b);\n"
-"}\n"
-"\n"
-"ivec2 __operator * (const int a, const ivec2 u) {\n"
-" return ivec2 (a * u.x, a * u.y);\n"
-"}\n"
-"\n"
-"ivec2 __operator * (const ivec2 v, const int b) {\n"
-" return ivec2 (v.x * b, v.y * b);\n"
-"}\n"
-"\n"
-"ivec2 __operator / (const int a, const ivec2 u) {\n"
-" return ivec2 (a / u.x, a / u.y);\n"
-"}\n"
-"\n"
-"ivec2 __operator / (const ivec2 v, const int b) {\n"
-" return ivec2 (v.x / b, v.y / b);\n"
-"}\n"
-"\n"
-"ivec3 __operator + (const int a, const ivec3 u) {\n"
-" return ivec3 (a + u.x, a + u.y, a + u.z);\n"
-"}\n"
-"\n"
-"ivec3 __operator + (const ivec3 v, const int b) {\n"
-" return ivec3 (v.x + b, v.y + b, v.z + b);\n"
-"}\n"
-"\n"
-"ivec3 __operator - (const int a, const ivec3 u) {\n"
-" return ivec3 (a - u.x, a - u.y, a - u.z);\n"
-"}\n"
-"\n"
-"ivec3 __operator - (const ivec3 v, const int b) {\n"
-" return ivec3 (v.x - b, v.y - b, v.z - b);\n"
-"}\n"
-"\n"
-"ivec3 __operator * (const int a, const ivec3 u) {\n"
-" return ivec3 (a * u.x, a * u.y, a * u.z);\n"
-"}\n"
-"\n"
-"ivec3 __operator * (const ivec3 v, const int b) {\n"
-" return ivec3 (v.x * b, v.y * b, v.z * b);\n"
-"}\n"
-"\n"
-"ivec3 __operator / (const int a, const ivec3 u) {\n"
-" return ivec3 (a / u.x, a / u.y, a / u.z);\n"
-"}\n"
-"\n"
-"ivec3 __operator / (const ivec3 v, const int b) {\n"
-" return ivec3 (v.x / b, v.y / b, v.z / b);\n"
-"}\n"
-"\n"
-"ivec4 __operator + (const int a, const ivec4 u) {\n"
-" return ivec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n"
-"}\n"
-"\n"
-"ivec4 __operator + (const ivec4 v, const int b) {\n"
-" return ivec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n"
-"}\n"
-"\n"
-"ivec4 __operator - (const int a, const ivec4 u) {\n"
-" return ivec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n"
-"}\n"
-"\n"
-"ivec4 __operator - (const ivec4 v, const int b) {\n"
-" return ivec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n"
-"}\n"
-"\n"
-"ivec4 __operator * (const int a, const ivec4 u) {\n"
-" return ivec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n"
-"}\n"
-"\n"
-"ivec4 __operator * (const ivec4 v, const int b) {\n"
-" return ivec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n"
-"}\n"
-"\n"
-"ivec4 __operator / (const int a, const ivec4 u) {\n"
-" return ivec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n"
-"}\n"
-"\n"
-"ivec4 __operator / (const ivec4 v, const int b) {\n"
-" return ivec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n"
-"}\n"
-"\n"
-"vec2 __operator * (const vec2 v, const vec2 u) {\n"
-" return vec2 (v.x * u.x, v.y * u.y);\n"
-"}\n"
-"\n"
-"vec3 __operator * (const vec3 v, const vec3 u) {\n"
-" return vec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n"
-"}\n"
-"\n"
-"vec4 __operator * (const vec4 v, const vec4 u) {\n"
-" return vec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n"
-"}\n"
-"\n"
-"ivec2 __operator * (const ivec2 v, const ivec2 u) {\n"
-" return ivec2 (v.x * u.x, v.y * u.y);\n"
-"}\n"
-"\n"
-"ivec3 __operator * (const ivec3 v, const ivec3 u) {\n"
-" return ivec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n"
-"}\n"
-"\n"
-"ivec4 __operator * (const ivec4 v, const ivec4 u) {\n"
-" return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n"
-"}\n"
-"\n"
-"vec2 __operator / (const vec2 v, const vec2 u) {\n"
-" return vec2 (v.x / u.x, v.y / u.y);\n"
-"}\n"
-"\n"
-"vec3 __operator / (const vec3 v, const vec3 u) {\n"
-" return vec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n"
-"}\n"
-"\n"
-"vec4 __operator / (const vec4 v, const vec4 u) {\n"
-" return vec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n"
-"}\n"
-"\n"
-"ivec2 __operator / (const ivec2 v, const ivec2 u) {\n"
-" return ivec2 (v.x / u.x, v.y / u.y);\n"
-"}\n"
-"\n"
-"ivec3 __operator / (const ivec3 v, const ivec3 u) {\n"
-" return ivec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n"
-"}\n"
-"\n"
-"ivec4 __operator / (const ivec4 v, const ivec4 u) {\n"
-" return ivec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n"
-"}\n"
-"\n"
-"mat2 __operator / (const mat2 m, const mat2 n) {\n"
-" return mat2 (m[0] / n[0], m[1] / n[1]);\n"
-"}\n"
-"\n"
-"mat3 __operator / (const mat3 m, const mat3 n) {\n"
-" return mat3 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);\n"
-"}\n"
-"\n"
-"mat4 __operator / (const mat4 m, const mat4 n) {\n"
-" return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);\n"
-"}\n"
-"\n"
-"vec2 __operator - (const vec2 v) {\n"
-" return vec2 (-v.x, -v.y);\n"
-"}\n"
-"\n"
-"vec3 __operator - (const vec3 v) {\n"
-" return vec3 (-v.x, -v.y, -v.z);\n"
-"}\n"
-"\n"
-"vec4 __operator - (const vec4 v) {\n"
-" return vec4 (-v.x, -v.y, -v.z, -v.w);\n"
-"}\n"
-"\n"
-"ivec2 __operator - (const ivec2 v) {\n"
-" return ivec2 (-v.x, -v.y);\n"
-"}\n"
-"\n"
-"ivec3 __operator - (const ivec3 v) {\n"
-" return ivec3 (-v.x, -v.y, -v.z);\n"
-"}\n"
-"\n"
-"ivec4 __operator - (const ivec4 v) {\n"
-" return ivec4 (-v.x, -v.y, -v.z, -v.w);\n"
-"}\n"
-"\n"
-"mat2 __operator - (const mat2 m) {\n"
-" return mat2 (-m[0], -m[1]);\n"
-"}\n"
-"\n"
-"mat3 __operator - (const mat3 m) {\n"
-" return mat3 (-m[0], -m[1], -m[2]);\n"
-"}\n"
-"\n"
-"mat4 __operator - (const mat4 m) {\n"
-" return mat4 (-m[0], -m[1], -m[2], -m[3]);\n"
-"}\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"void __operator -- (inout float a) {\n"
-" a -= 1.0;\n"
-"}\n"
-"\n"
-"void __operator -- (inout int a) {\n"
-" a -= 1;\n"
-"}\n"
-"\n"
-"void __operator -- (inout vec2 v) {\n"
-" --v.x, --v.y;\n"
-"}\n"
-"\n"
-"void __operator -- (inout vec3 v) {\n"
-" --v.x, --v.y, --v.z;\n"
-"}\n"
-"\n"
-"void __operator -- (inout vec4 v) {\n"
-" --v.x, --v.y, --v.z, --v.w;\n"
-"}\n"
-"\n"
-"void __operator -- (inout ivec2 v) {\n"
-" --v.x, --v.y;\n"
-"}\n"
-"\n"
-"void __operator -- (inout ivec3 v) {\n"
-" --v.x, --v.y, --v.z;\n"
-"}\n"
-"\n"
-"void __operator -- (inout ivec4 v) {\n"
-" --v.x, --v.y, --v.z, --v.w;\n"
-"}\n"
-"\n"
-"void __operator -- (inout mat2 m) {\n"
-" --m[0], --m[1];\n"
-"}\n"
-"\n"
-"void __operator -- (inout mat3 m) {\n"
-" --m[0], --m[1], --m[2];\n"
-"}\n"
-"\n"
-"void __operator -- (inout mat4 m) {\n"
-" --m[0], --m[1], --m[2], --m[3];\n"
-"}\n"
-"\n"
-"void __operator ++ (inout float a) {\n"
-" a += 1.0;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout int a) {\n"
-" a += 1;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout vec2 v) {\n"
-" ++v.x, ++v.y;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout vec3 v) {\n"
-" ++v.x, ++v.y, ++v.z;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout vec4 v) {\n"
-" ++v.x, ++v.y, ++v.z, ++v.w;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout ivec2 v) {\n"
-" ++v.x, ++v.y;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout ivec3 v) {\n"
-" ++v.x, ++v.y, ++v.z;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout ivec4 v) {\n"
-" ++v.x, ++v.y, ++v.z, ++v.w;\n"
-"}\n"
-"\n"
-"void __operator ++ (inout mat2 m) {\n"
-" ++m[0], ++m[1];\n"
-"}\n"
-"\n"
-"void __operator ++ (inout mat3 m) {\n"
-" ++m[0], ++m[1], ++m[2];\n"
-"}\n"
-"\n"
-"void __operator ++ (inout mat4 m) {\n"
-" ++m[0], ++m[1], ++m[2], ++m[3];\n"
-"}\n"
-"\n"
-"float __operator -- (inout float a, const int) {\n"
-" float c;\n"
-" c = a;\n"
-" --a;\n"
-" return c;\n"
-"}\n"
-"\n"
-"int __operator -- (inout int a, const int) {\n"
-" int c;\n"
-" c = a;\n"
-" --a;\n"
-" return c;\n"
-"}\n"
-"\n"
-"vec2 __operator -- (inout vec2 v, const int) {\n"
-" return vec2 (v.x--, v.y--);\n"
-"}\n"
-"\n"
-"vec3 __operator -- (inout vec3 v, const int) {\n"
-" return vec3 (v.x--, v.y--, v.z--);\n"
-"}\n"
-"\n"
-"vec4 __operator -- (inout vec4 v, const int) {\n"
-" return vec4 (v.x--, v.y--, v.z--, v.w--);\n"
-"}\n"
-"\n"
-"ivec2 __operator -- (inout ivec2 v, const int) {\n"
-" return ivec2 (v.x--, v.y--);\n"
-"}\n"
-"\n"
-"ivec3 __operator -- (inout ivec3 v, const int) {\n"
-" return ivec3 (v.x--, v.y--, v.z--);\n"
-"}\n"
-"\n"
-"ivec4 __operator -- (inout ivec4 v, const int) {\n"
-" return ivec4 (v.x--, v.y--, v.z--, v.w--);\n"
-"}\n"
-"\n"
-"mat2 __operator -- (inout mat2 m, const int) {\n"
-" return mat2 (m[0]--, m[1]--);\n"
-"}\n"
-"\n"
-"mat3 __operator -- (inout mat3 m, const int) {\n"
-" return mat3 (m[0]--, m[1]--, m[2]--);\n"
-"}\n"
-"\n"
-"mat4 __operator -- (inout mat4 m, const int) {\n"
-" return mat4 (m[0]--, m[1]--, m[2]--, m[3]--);\n"
-"}\n"
-"\n"
-"float __operator ++ (inout float a, const int) {\n"
-" float c;\n"
-" c = a;\n"
-" ++a;\n"
-" return c;\n"
-"}\n"
-"\n"
-"int __operator ++ (inout int a, const int) {\n"
-" int c;\n"
-" c = a;\n"
-" ++a;\n"
-" return c;\n"
-"}\n"
-"\n"
-"vec2 __operator ++ (inout vec2 v, const int) {\n"
-" return vec2 (v.x++, v.y++);\n"
-"}\n"
-"\n"
-"vec3 __operator ++ (inout vec3 v, const int) {\n"
-" return vec3 (v.x++, v.y++, v.z++);\n"
-"}\n"
-"\n"
-"vec4 __operator ++ (inout vec4 v, const int) {\n"
-" return vec4 (v.x++, v.y++, v.z++, v.w++);\n"
-"}\n"
-"\n"
-"ivec2 __operator ++ (inout ivec2 v, const int) {\n"
-" return ivec2 (v.x++, v.y++);\n"
-"}\n"
-"\n"
-"ivec3 __operator ++ (inout ivec3 v, const int) {\n"
-" return ivec3 (v.x++, v.y++, v.z++);\n"
-"}\n"
-"\n"
-"ivec4 __operator ++ (inout ivec4 v, const int) {\n"
-" return ivec4 (v.x++, v.y++, v.z++, v.w++);\n"
-"}\n"
-"\n"
-"mat2 __operator ++ (inout mat2 m, const int) {\n"
-" return mat2 (m[0]++, m[1]++);\n"
-"}\n"
-"\n"
-"mat3 __operator ++ (inout mat3 m, const int) {\n"
-" return mat3 (m[0]++, m[1]++, m[2]++);\n"
-"}\n"
-"\n"
-"mat4 __operator ++ (inout mat4 m, const int) {\n"
-" return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);\n"
-"}\n"
-"\n"
-"bool __operator < (const float a, const float b) {\n"
-" bool c;\n"
-" __asm float_less c, a, b;\n"
-" return c;\n"
-"}\n"
-"\n"
-"bool __operator < (const int a, const int b) {\n"
-" return float (a) < float (b);\n"
-"}\n"
-"\n"
-"bool __operator > (const float a, const float b) {\n"
-" return b < a;\n"
-"}\n"
-"\n"
-"bool __operator > (const int a, const int b) {\n"
-" return b < a;\n"
-"}\n"
-"\n"
-"bool __operator >= (const float a, const float b) {\n"
-" return a > b || a == b;\n"
-"}\n"
-"\n"
-"bool __operator >= (const int a, const int b) {\n"
-" return a > b || a == b;\n"
-"}\n"
-"\n"
-"bool __operator <= (const float a, const float b) {\n"
-" return a < b || a == b;\n"
-"}\n"
-"\n"
-"bool __operator <= (const int a, const int b) {\n"
-" return a < b || a == b;\n"
-"}\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"bool __operator ^^ (const bool a, const bool b) {\n"
-" return a != b;\n"
-"}\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"bool __operator ! (const bool a) {\n"
-" return a == false;\n"
-"}\n"
-"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"int __constructor (const float _f) {\n"
+" int _i;\n"
+" __asm float_to_int _i, _f;\n"
+" return _i;\n"
+"}\n"
+"\n"
+"bool __constructor (const int _i) {\n"
+" return _i != 0;\n"
+"}\n"
+"\n"
+"bool __constructor (const float _f) {\n"
+" return _f != 0.0;\n"
+"}\n"
+"\n"
+"int __constructor (const bool _b) {\n"
+" return _b ? 1 : 0;\n"
+"}\n"
+"\n"
+"float __constructor (const bool _b) {\n"
+" return _b ? 1.0 : 0.0;\n"
+"}\n"
+"\n"
+"float __constructor (const int _i) {\n"
+" float _f;\n"
+" __asm int_to_float _f, _i;\n"
+" return _f;\n"
+"}\n"
+"\n"
+"bool __constructor (const bool _b) {\n"
+" return _b;\n"
+"}\n"
+"\n"
+"int __constructor (const int _i) {\n"
+" return _i;\n"
+"}\n"
+"\n"
+"float __constructor (const float _f) {\n"
+" return _f;\n"
+"}\n"
+"\n"
+"vec2 __constructor (const float _f) {\n"
+" return vec2 (_f, _f);\n"
+"}\n"
+"\n"
+"vec2 __constructor (const int _i) {\n"
+" return vec2 (_i, _i);\n"
+"}\n"
+"\n"
+"vec2 __constructor (const bool _b) {\n"
+" return vec2 (_b, _b);\n"
+"}\n"
+"\n"
+"vec3 __constructor (const float _f) {\n"
+" return vec3 (_f, _f, _f);\n"
+"}\n"
+"\n"
+"vec3 __constructor (const int _i) {\n"
+" return vec3 (_i, _i, _i);\n"
+"}\n"
+"\n"
+"vec3 __constructor (const bool _b) {\n"
+" return vec3 (_b, _b, _b);\n"
+"}\n"
+"\n"
+"vec4 __constructor (const float _f) {\n"
+" return vec4 (_f, _f, _f, _f);\n"
+"}\n"
+"\n"
+"vec4 __constructor (const int _i) {\n"
+" return vec4 (_i, _i, _i, _i);\n"
+"}\n"
+"\n"
+"vec4 __constructor (const bool _b) {\n"
+" return vec4 (_b, _b, _b, _b);\n"
+"}\n"
+"\n"
+"ivec2 __constructor (const int _i) {\n"
+" return ivec2 (_i, _i);\n"
+"}\n"
+"\n"
+"ivec2 __constructor (const float _f) {\n"
+" return ivec2 (_f, _f);\n"
+"}\n"
+"\n"
+"ivec2 __constructor (const bool _b) {\n"
+" return ivec2 (_b, _b);\n"
+"}\n"
+"\n"
+"ivec3 __constructor (const int _i) {\n"
+" return ivec3 (_i, _i, _i);\n"
+"}\n"
+"\n"
+"ivec3 __constructor (const float _f) {\n"
+" return ivec3 (_f, _f, _f);\n"
+"}\n"
+"\n"
+"ivec3 __constructor (const bool _b) {\n"
+" return ivec3 (_b, _b, _b);\n"
+"}\n"
+"\n"
+"ivec4 __constructor (const int _i) {\n"
+" return ivec4 (_i, _i, _i, _i);\n"
+"}\n"
+"\n"
+"ivec4 __constructor (const float _f) {\n"
+" return ivec4 (_f, _f, _f, _f);\n"
+"}\n"
+"\n"
+"ivec4 __constructor (const bool _b) {\n"
+" return ivec4 (_b, _b, _b, _b);\n"
+"}\n"
+"\n"
+"bvec2 __constructor (const bool _b) {\n"
+" return bvec2 (_b, _b);\n"
+"}\n"
+"\n"
+"bvec2 __constructor (const float _f) {\n"
+" return bvec2 (_f, _f);\n"
+"}\n"
+"\n"
+"bvec2 __constructor (const int _i) {\n"
+" return bvec2 (_i, _i);\n"
+"}\n"
+"\n"
+"bvec3 __constructor (const bool _b) {\n"
+" return bvec3 (_b, _b, _b);\n"
+"}\n"
+"\n"
+"bvec3 __constructor (const float _f) {\n"
+" return bvec3 (_f, _f, _f);\n"
+"}\n"
+"\n"
+"bvec3 __constructor (const int _i) {\n"
+" return bvec3 (_i, _i, _i);\n"
+"}\n"
+"\n"
+"bvec4 __constructor (const bool _b) {\n"
+" return bvec4 (_b, _b, _b, _b);\n"
+"}\n"
+"\n"
+"bvec4 __constructor (const float _f) {\n"
+" return bvec4 (_f, _f, _f, _f);\n"
+"}\n"
+"\n"
+"bvec4 __constructor (const int _i) {\n"
+" return bvec4 (_i, _i, _i, _i);\n"
+"}\n"
+"\n"
+"mat2 __constructor (const float _f) {\n"
+" return mat2 (\n"
+" _f, .0,\n"
+" .0, _f\n"
+" );\n"
+"}\n"
+"\n"
+"mat2 __constructor (const int _i) {\n"
+" return mat2 (\n"
+" _i, .0,\n"
+" .0, _i\n"
+" );\n"
+"}\n"
+"\n"
+"mat2 __constructor (const bool _b) {\n"
+" return mat2 (\n"
+" _b, .0,\n"
+" .0, _b\n"
+" );\n"
+"}\n"
+"\n"
+"mat3 __constructor (const float _f) {\n"
+" return mat3 (\n"
+" _f, .0, .0,\n"
+" .0, _f, .0,\n"
+" .0, .0, _f\n"
+" );\n"
+"}\n"
+"\n"
+"mat3 __constructor (const int _i) {\n"
+" return mat3 (\n"
+" _i, .0, .0,\n"
+" .0, _i, .0,\n"
+" .0, .0, _i\n"
+" );\n"
+"}\n"
+"\n"
+"mat3 __constructor (const bool _b) {\n"
+" return mat3 (\n"
+" _b, .0, .0,\n"
+" .0, _b, .0,\n"
+" .0, .0, _b\n"
+" );\n"
+"}\n"
+"\n"
+"mat4 __constructor (const float _f) {\n"
+" return mat4 (\n"
+" _f, .0, .0, .0,\n"
+" .0, _f, .0, .0,\n"
+" .0, .0, _f, .0,\n"
+" .0, .0, .0, _f\n"
+" );\n"
+"}\n"
+"\n"
+"mat4 __constructor (const int _i) {\n"
+" return mat4 (\n"
+" _i, .0, .0, .0,\n"
+" .0, _i, .0, .0,\n"
+" .0, .0, _i, .0,\n"
+" .0, .0, .0, _i\n"
+" );\n"
+"}\n"
+"\n"
+"mat4 __constructor (const bool _b) {\n"
+" return mat4 (\n"
+" _b, .0, .0, .0,\n"
+" .0, _b, .0, .0,\n"
+" .0, .0, _b, .0,\n"
+" .0, .0, .0, _b\n"
+" );\n"
+"}\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"void __operator += (inout float a, const float b) {\n"
+" __asm float_add a, a, b;\n"
+"}\n"
+"\n"
+"float __operator - (const float a) {\n"
+" float c;\n"
+" __asm float_negate c, a;\n"
+" return c;\n"
+"}\n"
+"\n"
+"void __operator -= (inout float a, const float b) {\n"
+" a += -b;\n"
+"}\n"
+"\n"
+"void __operator *= (inout float a, const float b) {\n"
+" __asm float_multiply a, a, b;\n"
+"}\n"
+"\n"
+"void __operator /= (inout float a, const float b) {\n"
+" __asm float_divide a, a, b;\n"
+"}\n"
+"\n"
+"float __operator + (const float a, const float b) {\n"
+" float c;\n"
+" c = a;\n"
+" return c += b;\n"
+"}\n"
+"\n"
+"void __operator += (inout int a, const int b) {\n"
+" a = int (float (a) + float (b));\n"
+"}\n"
+"\n"
+"int __operator - (const int a) {\n"
+" return int (-float (a));\n"
+"}\n"
+"\n"
+"void __operator -= (inout int a, const int b) {\n"
+" a += -b;\n"
+"}\n"
+"\n"
+"float __operator * (const float a, const float b) {\n"
+" float c;\n"
+" c = a;\n"
+" return c *= b;\n"
+"}\n"
+"\n"
+"void __operator *= (inout int a, const int b) {\n"
+" a = int (float (a) * float (b));\n"
+"}\n"
+"\n"
+"float __operator / (const float a, const float b) {\n"
+" float c;\n"
+" c = a;\n"
+" return c /= b;\n"
+"}\n"
+"\n"
+"void __operator /= (inout int a, const int b) {\n"
+" a = int (float (a) / float (b));\n"
+"}\n"
+"\n"
+"void __operator += (inout vec2 v, const vec2 u) {\n"
+" v.x += u.x, v.y += u.y;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec2 v, const vec2 u) {\n"
+" v.x -= u.x, v.y -= u.y;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec2 v, const vec2 u) {\n"
+" v.x *= u.x, v.y *= u.y;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec2 v, const vec2 u) {\n"
+" v.x /= u.x, v.y /= u.y;\n"
+"}\n"
+"\n"
+"void __operator += (inout vec3 v, const vec3 u) {\n"
+" v.x += u.x, v.y += u.y, v.z += u.z;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec3 v, const vec3 u) {\n"
+" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec3 v, const vec3 u) {\n"
+" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec3 v, const vec3 u) {\n"
+" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n"
+"}\n"
+"\n"
+"void __operator += (inout vec4 v, const vec4 u) {\n"
+" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec4 v, const vec4 u) {\n"
+" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec4 v, const vec4 u) {\n"
+" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec4 v, const vec4 u) {\n"
+" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n"
+"}\n"
+"\n"
+"void __operator += (inout ivec2 v, const ivec2 u) {\n"
+" v.x += u.x, v.y += u.y;\n"
+"}\n"
+"\n"
+"void __operator -= (inout ivec2 v, const ivec2 u) {\n"
+" v.x -= u.x, v.y -= u.y;\n"
+"}\n"
+"\n"
+"void __operator *= (inout ivec2 v, const ivec2 u) {\n"
+" v.x *= u.x, v.y *= u.y;\n"
+"}\n"
+"\n"
+"void __operator /= (inout ivec2 v, const ivec2 u) {\n"
+" v.x /= u.x, v.y /= u.y;\n"
+"}\n"
+"\n"
+"void __operator += (inout ivec3 v, const ivec3 u) {\n"
+" v.x += u.x, v.y += u.y, v.z += u.z;\n"
+"}\n"
+"\n"
+"void __operator -= (inout ivec3 v, const ivec3 u) {\n"
+" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n"
+"}\n"
+"\n"
+"void __operator *= (inout ivec3 v, const ivec3 u) {\n"
+" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n"
+"}\n"
+"\n"
+"void __operator /= (inout ivec3 v, const ivec3 u) {\n"
+" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n"
+"}\n"
+"\n"
+"void __operator += (inout ivec4 v, const ivec4 u) {\n"
+" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n"
+"}\n"
+"\n"
+"void __operator -= (inout ivec4 v, const ivec4 u) {\n"
+" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n"
+"}\n"
+"\n"
+"void __operator *= (inout ivec4 v, const ivec4 u) {\n"
+" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n"
+"}\n"
+"\n"
+"void __operator /= (inout ivec4 v, const ivec4 u) {\n"
+" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n"
+"}\n"
+"\n"
+"void __operator += (inout mat2 m, const mat2 n) {\n"
+" m[0] += n[0], m[1] += n[1];\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat2 m, const mat2 n) {\n"
+" m[0] -= n[0], m[1] -= n[1];\n"
+"}\n"
+"\n"
+"vec2 __operator * (const mat2 m, const vec2 v) {\n"
+" return vec2 (\n"
+" v.x * m[0].x + v.y * m[1].x,\n"
+" v.x * m[0].y + v.y * m[1].y\n"
+" );\n"
+"}\n"
+"\n"
+"mat2 __operator * (const mat2 m, const mat2 n) {\n"
+" return mat2 (m * n[0], m * n[1]);\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat2 m, const mat2 n) {\n"
+" m = m * n;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat2 m, const mat2 n) {\n"
+" m[0] /= n[0], m[1] /= n[1];\n"
+"}\n"
+"\n"
+"void __operator += (inout mat3 m, const mat3 n) {\n"
+" m[0] += n[0], m[1] += n[1], m[2] += n[2];\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat3 m, const mat3 n) {\n"
+" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2];\n"
+"}\n"
+"\n"
+"vec3 __operator * (const mat3 m, const vec3 v) {\n"
+" return vec3 (\n"
+" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n"
+" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n"
+" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n"
+" );\n"
+"}\n"
+"\n"
+"mat3 __operator * (const mat3 m, const mat3 n) {\n"
+" return mat3 (m * n[0], m * n[1], m * n[2]);\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat3 m, const mat3 n) {\n"
+" m = m * n;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat3 m, const mat3 n) {\n"
+" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2];\n"
+"}\n"
+"\n"
+"void __operator += (inout mat4 m, const mat4 n) {\n"
+" m[0] += n[0], m[1] += n[1], m[2] += n[2], m[3] += n[3];\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat4 m, const mat4 n) {\n"
+" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2], m[3] -= n[3];\n"
+"}\n"
+"\n"
+"vec4 __operator * (const mat4 m, const vec4 v) {\n"
+" return vec4 (\n"
+" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n"
+" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n"
+" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n"
+" v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n"
+" );\n"
+"}\n"
+"\n"
+"mat4 __operator * (const mat4 m, const mat4 n) {\n"
+" return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat4 m, const mat4 n) {\n"
+" m = m * n;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat4 m, const mat4 n) {\n"
+" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2], m[3] /= n[3];\n"
+"}\n"
+"\n"
+"void __operator += (inout vec2 v, const float a) {\n"
+" v.x += a, v.y += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec2 v, const float a) {\n"
+" v.x -= a, v.y -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec2 v, const float a) {\n"
+" v.x *= a, v.y *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec2 v, const float a) {\n"
+" v.x /= a, v.y /= a;\n"
+"}\n"
+"\n"
+"void __operator += (inout vec3 v, const float a) {\n"
+" v.x += a, v.y += a, v.z += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec3 v, const float a) {\n"
+" v.x -= a, v.y -= a, v.z -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec3 v, const float a) {\n"
+" v.x *= a, v.y *= a, v.z *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec3 v, const float a) {\n"
+" v.x /= a, v.y /= a, v.z /= a;\n"
+"}\n"
+"\n"
+"void __operator += (inout vec4 v, const float a) {\n"
+" v.x += a, v.y += a, v.z += a, v.w += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout vec4 v, const float a) {\n"
+" v.x -= a, v.y -= a, v.z -= a, v.w -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec4 v, const float a) {\n"
+" v.x *= a, v.y *= a, v.z *= a, v.w *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout vec4 v, const float a) {\n"
+" v.x /= a, v.y /= a, v.z /= a, v.w /= a;\n"
+"}\n"
+"\n"
+"void __operator += (inout mat2 m, const float a) {\n"
+" m[0] += a, m[1] += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat2 m, const float a) {\n"
+" m[0] -= a, m[1] -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat2 m, const float a) {\n"
+" m[0] *= a, m[1] *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat2 m, const float a) {\n"
+" m[0] /= a, m[1] /= a;\n"
+"}\n"
+"\n"
+"void __operator += (inout mat3 m, const float a) {\n"
+" m[0] += a, m[1] += a, m[2] += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat3 m, const float a) {\n"
+" m[0] -= a, m[1] -= a, m[2] -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat3 m, const float a) {\n"
+" m[0] *= a, m[1] *= a, m[2] *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat3 m, const float a) {\n"
+" m[0] /= a, m[1] /= a, m[2] /= a;\n"
+"}\n"
+"\n"
+"void __operator += (inout mat4 m, const float a) {\n"
+" m[0] += a, m[1] += a, m[2] += a, m[3] += a;\n"
+"}\n"
+"\n"
+"void __operator -= (inout mat4 m, const float a) {\n"
+" m[0] -= a, m[1] -= a, m[2] -= a, m[3] -= a;\n"
+"}\n"
+"\n"
+"void __operator *= (inout mat4 m, const float a) {\n"
+" m[0] *= a, m[1] *= a, m[2] *= a, m[3] *= a;\n"
+"}\n"
+"\n"
+"void __operator /= (inout mat4 m, const float a) {\n"
+" m[0] /= a, m[1] /= a, m[2] /= a, m[3] /= a;\n"
+"}\n"
+"\n"
+"vec2 __operator * (const vec2 v, const mat2 m) {\n"
+" return vec2 (\n"
+" v.x * m[0].x + v.y * m[0].y,\n"
+" v.x * m[1].x + v.y * m[1].y\n"
+" );\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec2 v, const mat2 m) {\n"
+" v = v * m;\n"
+"}\n"
+"\n"
+"vec3 __operator * (const vec3 v, const mat3 m) {\n"
+" return vec3 (\n"
+" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n"
+" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n"
+" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n"
+" );\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec3 v, const mat3 m) {\n"
+" v = v * m;\n"
+"}\n"
+"\n"
+"vec4 __operator * (const vec4 v, const mat4 m) {\n"
+" return vec4 (\n"
+" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n"
+" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n"
+" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n"
+" v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n"
+" );\n"
+"}\n"
+"\n"
+"void __operator *= (inout vec4 v, const mat4 m) {\n"
+" v = v * m;\n"
+"}\n"
+"\n"
+"float __operator - (const float a, const float b) {\n"
+" return a + -b;\n"
+"}\n"
+"\n"
+"int __operator + (const int a, const int b) {\n"
+" int c;\n"
+" c = a;\n"
+" return c += b;\n"
+"}\n"
+"\n"
+"int __operator - (const int a, const int b) {\n"
+" return a + -b;\n"
+"}\n"
+"\n"
+"int __operator * (const int a, const int b) {\n"
+" int c;\n"
+" return (c = a) *= b;\n"
+"}\n"
+"\n"
+"int __operator / (const int a, const int b) {\n"
+" int c;\n"
+" return (c = a) /= b;\n"
+"}\n"
+"\n"
+"vec2 __operator + (const vec2 v, const vec2 u) {\n"
+" return vec2 (v.x + u.x, v.y + u.y);\n"
+"}\n"
+"\n"
+"vec2 __operator - (const vec2 v, const vec2 u) {\n"
+" return vec2 (v.x - u.x, v.y - u.y);\n"
+"}\n"
+"\n"
+"vec3 __operator + (const vec3 v, const vec3 u) {\n"
+" return vec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n"
+"}\n"
+"\n"
+"vec3 __operator - (const vec3 v, const vec3 u) {\n"
+" return vec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n"
+"}\n"
+"\n"
+"vec4 __operator + (const vec4 v, const vec4 u) {\n"
+" return vec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n"
+"}\n"
+"\n"
+"vec4 __operator - (const vec4 v, const vec4 u) {\n"
+" return vec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n"
+"}\n"
+"\n"
+"ivec2 __operator + (const ivec2 v, const ivec2 u) {\n"
+" return ivec2 (v.x + u.x, v.y + u.y);\n"
+"}\n"
+"\n"
+"ivec2 __operator - (const ivec2 v, const ivec2 u) {\n"
+" return ivec2 (v.x - u.x, v.y - u.y);\n"
+"}\n"
+"\n"
+"ivec3 __operator + (const ivec3 v, const ivec3 u) {\n"
+" return ivec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n"
+"}\n"
+"\n"
+"ivec3 __operator - (const ivec3 v, const ivec3 u) {\n"
+" return ivec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n"
+"}\n"
+"\n"
+"ivec4 __operator + (const ivec4 v, const ivec4 u) {\n"
+" return ivec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n"
+"}\n"
+"\n"
+"ivec4 __operator - (const ivec4 v, const ivec4 u) {\n"
+" return ivec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n"
+"}\n"
+"\n"
+"mat2 __operator + (const mat2 m, const mat2 n) {\n"
+" return mat2 (m[0] + n[0], m[1] + n[1]);\n"
+"}\n"
+"\n"
+"mat2 __operator - (const mat2 m, const mat2 n) {\n"
+" return mat2 (m[0] - n[0], m[1] - n[1]);\n"
+"}\n"
+"\n"
+"mat3 __operator + (const mat3 m, const mat3 n) {\n"
+" return mat3 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);\n"
+"}\n"
+"\n"
+"mat3 __operator - (const mat3 m, const mat3 n) {\n"
+" return mat3 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);\n"
+"}\n"
+"\n"
+"mat4 __operator + (const mat4 m, const mat4 n) {\n"
+" return mat4 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);\n"
+"}\n"
+"\n"
+"mat4 __operator - (const mat4 m, const mat4 n) {\n"
+" return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);\n"
+"}\n"
+"\n"
+"vec2 __operator + (const float a, const vec2 u) {\n"
+" return vec2 (a + u.x, a + u.y);\n"
+"}\n"
+"\n"
+"vec2 __operator + (const vec2 v, const float b) {\n"
+" return vec2 (v.x + b, v.y + b);\n"
+"}\n"
+"\n"
+"vec2 __operator - (const float a, const vec2 u) {\n"
+" return vec2 (a - u.x, a - u.y);\n"
+"}\n"
+"\n"
+"vec2 __operator - (const vec2 v, const float b) {\n"
+" return vec2 (v.x - b, v.y - b);\n"
+"}\n"
+"\n"
+"vec2 __operator * (const float a, const vec2 u) {\n"
+" return vec2 (a * u.x, a * u.y);\n"
+"}\n"
+"\n"
+"vec2 __operator * (const vec2 v, const float b) {\n"
+" return vec2 (v.x * b, v.y * b);\n"
+"}\n"
+"\n"
+"vec2 __operator / (const float a, const vec2 u) {\n"
+" return vec2 (a / u.x, a / u.y);\n"
+"}\n"
+"\n"
+"vec2 __operator / (const vec2 v, const float b) {\n"
+" return vec2 (v.x / b, v.y / b);\n"
+"}\n"
+"\n"
+"vec3 __operator + (const float a, const vec3 u) {\n"
+" return vec3 (a + u.x, a + u.y, a + u.z);\n"
+"}\n"
+"\n"
+"vec3 __operator + (const vec3 v, const float b) {\n"
+" return vec3 (v.x + b, v.y + b, v.z + b);\n"
+"}\n"
+"\n"
+"vec3 __operator - (const float a, const vec3 u) {\n"
+" return vec3 (a - u.x, a - u.y, a - u.z);\n"
+"}\n"
+"\n"
+"vec3 __operator - (const vec3 v, const float b) {\n"
+" return vec3 (v.x - b, v.y - b, v.z - b);\n"
+"}\n"
+"\n"
+"vec3 __operator * (const float a, const vec3 u) {\n"
+" return vec3 (a * u.x, a * u.y, a * u.z);\n"
+"}\n"
+"\n"
+"vec3 __operator * (const vec3 v, const float b) {\n"
+" return vec3 (v.x * b, v.y * b, v.z * b);\n"
+"}\n"
+"\n"
+"vec3 __operator / (const float a, const vec3 u) {\n"
+" return vec3 (a / u.x, a / u.y, a / u.z);\n"
+"}\n"
+"\n"
+"vec3 __operator / (const vec3 v, const float b) {\n"
+" return vec3 (v.x / b, v.y / b, v.z / b);\n"
+"}\n"
+"\n"
+"vec4 __operator + (const float a, const vec4 u) {\n"
+" return vec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n"
+"}\n"
+"\n"
+"vec4 __operator + (const vec4 v, const float b) {\n"
+" return vec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n"
+"}\n"
+"\n"
+"vec4 __operator - (const float a, const vec4 u) {\n"
+" return vec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n"
+"}\n"
+"\n"
+"vec4 __operator - (const vec4 v, const float b) {\n"
+" return vec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n"
+"}\n"
+"\n"
+"vec4 __operator * (const float a, const vec4 u) {\n"
+" return vec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n"
+"}\n"
+"\n"
+"vec4 __operator * (const vec4 v, const float b) {\n"
+" return vec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n"
+"}\n"
+"\n"
+"vec4 __operator / (const float a, const vec4 u) {\n"
+" return vec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n"
+"}\n"
+"\n"
+"vec4 __operator / (const vec4 v, const float b) {\n"
+" return vec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n"
+"}\n"
+"\n"
+"mat2 __operator + (const float a, const mat2 n) {\n"
+" return mat2 (a + n[0], a + n[1]);\n"
+"}\n"
+"\n"
+"mat2 __operator + (const mat2 m, const float b) {\n"
+" return mat2 (m[0] + b, m[1] + b);\n"
+"}\n"
+"\n"
+"mat2 __operator - (const float a, const mat2 n) {\n"
+" return mat2 (a - n[0], a - n[1]);\n"
+"}\n"
+"\n"
+"mat2 __operator - (const mat2 m, const float b) {\n"
+" return mat2 (m[0] - b, m[1] - b);\n"
+"}\n"
+"\n"
+"mat2 __operator * (const float a, const mat2 n) {\n"
+" return mat2 (a * n[0], a * n[1]);\n"
+"}\n"
+"\n"
+"mat2 __operator * (const mat2 m, const float b) {\n"
+" return mat2 (m[0] * b, m[1] * b);\n"
+"}\n"
+"\n"
+"mat2 __operator / (const float a, const mat2 n) {\n"
+" return mat2 (a / n[0], a / n[1]);\n"
+"}\n"
+"\n"
+"mat2 __operator / (const mat2 m, const float b) {\n"
+" return mat2 (m[0] / b, m[1] / b);\n"
+"}\n"
+"\n"
+"mat3 __operator + (const float a, const mat3 n) {\n"
+" return mat3 (a + n[0], a + n[1], a + n[2]);\n"
+"}\n"
+"\n"
+"mat3 __operator + (const mat3 m, const float b) {\n"
+" return mat3 (m[0] + b, m[1] + b, m[2] + b);\n"
+"}\n"
+"\n"
+"mat3 __operator - (const float a, const mat3 n) {\n"
+" return mat3 (a - n[0], a - n[1], a - n[2]);\n"
+"}\n"
+"\n"
+"mat3 __operator - (const mat3 m, const float b) {\n"
+" return mat3 (m[0] - b, m[1] - b, m[2] - b);\n"
+"}\n"
+"\n"
+"mat3 __operator * (const float a, const mat3 n) {\n"
+" return mat3 (a * n[0], a * n[1], a * n[2]);\n"
+"}\n"
+"\n"
+"mat3 __operator * (const mat3 m, const float b) {\n"
+" return mat3 (m[0] * b, m[1] * b, m[2] * b);\n"
+"}\n"
+"\n"
+"mat3 __operator / (const float a, const mat3 n) {\n"
+" return mat3 (a / n[0], a / n[1], a / n[2]);\n"
+"}\n"
+"\n"
+"mat3 __operator / (const mat3 m, const float b) {\n"
+" return mat3 (m[0] / b, m[1] / b, m[2] / b);\n"
+"}\n"
+"\n"
+"mat4 __operator + (const float a, const mat4 n) {\n"
+" return mat4 (a + n[0], a + n[1], a + n[2], a + n[3]);\n"
+"}\n"
+"\n"
+"mat4 __operator + (const mat4 m, const float b) {\n"
+" return mat4 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);\n"
+"}\n"
+"\n"
+"mat4 __operator - (const float a, const mat4 n) {\n"
+" return mat4 (a - n[0], a - n[1], a - n[2], a - n[3]);\n"
+"}\n"
+"\n"
+"mat4 __operator - (const mat4 m, const float b) {\n"
+" return mat4 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);\n"
+"}\n"
+"\n"
+"mat4 __operator * (const float a, const mat4 n) {\n"
+" return mat4 (a * n[0], a * n[1], a * n[2], a * n[3]);\n"
+"}\n"
+"\n"
+"mat4 __operator * (const mat4 m, const float b) {\n"
+" return mat4 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);\n"
+"}\n"
+"\n"
+"mat4 __operator / (const float a, const mat4 n) {\n"
+" return mat4 (a / n[0], a / n[1], a / n[2], a / n[3]);\n"
+"}\n"
+"\n"
+"mat4 __operator / (const mat4 m, const float b) {\n"
+" return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);\n"
+"}\n"
+"\n"
+"ivec2 __operator + (const int a, const ivec2 u) {\n"
+" return ivec2 (a + u.x, a + u.y);\n"
+"}\n"
+"\n"
+"ivec2 __operator + (const ivec2 v, const int b) {\n"
+" return ivec2 (v.x + b, v.y + b);\n"
+"}\n"
+"\n"
+"ivec2 __operator - (const int a, const ivec2 u) {\n"
+" return ivec2 (a - u.x, a - u.y);\n"
+"}\n"
+"\n"
+"ivec2 __operator - (const ivec2 v, const int b) {\n"
+" return ivec2 (v.x - b, v.y - b);\n"
+"}\n"
+"\n"
+"ivec2 __operator * (const int a, const ivec2 u) {\n"
+" return ivec2 (a * u.x, a * u.y);\n"
+"}\n"
+"\n"
+"ivec2 __operator * (const ivec2 v, const int b) {\n"
+" return ivec2 (v.x * b, v.y * b);\n"
+"}\n"
+"\n"
+"ivec2 __operator / (const int a, const ivec2 u) {\n"
+" return ivec2 (a / u.x, a / u.y);\n"
+"}\n"
+"\n"
+"ivec2 __operator / (const ivec2 v, const int b) {\n"
+" return ivec2 (v.x / b, v.y / b);\n"
+"}\n"
+"\n"
+"ivec3 __operator + (const int a, const ivec3 u) {\n"
+" return ivec3 (a + u.x, a + u.y, a + u.z);\n"
+"}\n"
+"\n"
+"ivec3 __operator + (const ivec3 v, const int b) {\n"
+" return ivec3 (v.x + b, v.y + b, v.z + b);\n"
+"}\n"
+"\n"
+"ivec3 __operator - (const int a, const ivec3 u) {\n"
+" return ivec3 (a - u.x, a - u.y, a - u.z);\n"
+"}\n"
+"\n"
+"ivec3 __operator - (const ivec3 v, const int b) {\n"
+" return ivec3 (v.x - b, v.y - b, v.z - b);\n"
+"}\n"
+"\n"
+"ivec3 __operator * (const int a, const ivec3 u) {\n"
+" return ivec3 (a * u.x, a * u.y, a * u.z);\n"
+"}\n"
+"\n"
+"ivec3 __operator * (const ivec3 v, const int b) {\n"
+" return ivec3 (v.x * b, v.y * b, v.z * b);\n"
+"}\n"
+"\n"
+"ivec3 __operator / (const int a, const ivec3 u) {\n"
+" return ivec3 (a / u.x, a / u.y, a / u.z);\n"
+"}\n"
+"\n"
+"ivec3 __operator / (const ivec3 v, const int b) {\n"
+" return ivec3 (v.x / b, v.y / b, v.z / b);\n"
+"}\n"
+"\n"
+"ivec4 __operator + (const int a, const ivec4 u) {\n"
+" return ivec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n"
+"}\n"
+"\n"
+"ivec4 __operator + (const ivec4 v, const int b) {\n"
+" return ivec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n"
+"}\n"
+"\n"
+"ivec4 __operator - (const int a, const ivec4 u) {\n"
+" return ivec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n"
+"}\n"
+"\n"
+"ivec4 __operator - (const ivec4 v, const int b) {\n"
+" return ivec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n"
+"}\n"
+"\n"
+"ivec4 __operator * (const int a, const ivec4 u) {\n"
+" return ivec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n"
+"}\n"
+"\n"
+"ivec4 __operator * (const ivec4 v, const int b) {\n"
+" return ivec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n"
+"}\n"
+"\n"
+"ivec4 __operator / (const int a, const ivec4 u) {\n"
+" return ivec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n"
+"}\n"
+"\n"
+"ivec4 __operator / (const ivec4 v, const int b) {\n"
+" return ivec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n"
+"}\n"
+"\n"
+"vec2 __operator * (const vec2 v, const vec2 u) {\n"
+" return vec2 (v.x * u.x, v.y * u.y);\n"
+"}\n"
+"\n"
+"vec3 __operator * (const vec3 v, const vec3 u) {\n"
+" return vec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n"
+"}\n"
+"\n"
+"vec4 __operator * (const vec4 v, const vec4 u) {\n"
+" return vec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n"
+"}\n"
+"\n"
+"ivec2 __operator * (const ivec2 v, const ivec2 u) {\n"
+" return ivec2 (v.x * u.x, v.y * u.y);\n"
+"}\n"
+"\n"
+"ivec3 __operator * (const ivec3 v, const ivec3 u) {\n"
+" return ivec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n"
+"}\n"
+"\n"
+"ivec4 __operator * (const ivec4 v, const ivec4 u) {\n"
+" return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n"
+"}\n"
+"\n"
+"vec2 __operator / (const vec2 v, const vec2 u) {\n"
+" return vec2 (v.x / u.x, v.y / u.y);\n"
+"}\n"
+"\n"
+"vec3 __operator / (const vec3 v, const vec3 u) {\n"
+" return vec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n"
+"}\n"
+"\n"
+"vec4 __operator / (const vec4 v, const vec4 u) {\n"
+" return vec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n"
+"}\n"
+"\n"
+"ivec2 __operator / (const ivec2 v, const ivec2 u) {\n"
+" return ivec2 (v.x / u.x, v.y / u.y);\n"
+"}\n"
+"\n"
+"ivec3 __operator / (const ivec3 v, const ivec3 u) {\n"
+" return ivec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n"
+"}\n"
+"\n"
+"ivec4 __operator / (const ivec4 v, const ivec4 u) {\n"
+" return ivec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n"
+"}\n"
+"\n"
+"mat2 __operator / (const mat2 m, const mat2 n) {\n"
+" return mat2 (m[0] / n[0], m[1] / n[1]);\n"
+"}\n"
+"\n"
+"mat3 __operator / (const mat3 m, const mat3 n) {\n"
+" return mat3 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);\n"
+"}\n"
+"\n"
+"mat4 __operator / (const mat4 m, const mat4 n) {\n"
+" return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);\n"
+"}\n"
+"\n"
+"vec2 __operator - (const vec2 v) {\n"
+" return vec2 (-v.x, -v.y);\n"
+"}\n"
+"\n"
+"vec3 __operator - (const vec3 v) {\n"
+" return vec3 (-v.x, -v.y, -v.z);\n"
+"}\n"
+"\n"
+"vec4 __operator - (const vec4 v) {\n"
+" return vec4 (-v.x, -v.y, -v.z, -v.w);\n"
+"}\n"
+"\n"
+"ivec2 __operator - (const ivec2 v) {\n"
+" return ivec2 (-v.x, -v.y);\n"
+"}\n"
+"\n"
+"ivec3 __operator - (const ivec3 v) {\n"
+" return ivec3 (-v.x, -v.y, -v.z);\n"
+"}\n"
+"\n"
+"ivec4 __operator - (const ivec4 v) {\n"
+" return ivec4 (-v.x, -v.y, -v.z, -v.w);\n"
+"}\n"
+"\n"
+"mat2 __operator - (const mat2 m) {\n"
+" return mat2 (-m[0], -m[1]);\n"
+"}\n"
+"\n"
+"mat3 __operator - (const mat3 m) {\n"
+" return mat3 (-m[0], -m[1], -m[2]);\n"
+"}\n"
+"\n"
+"mat4 __operator - (const mat4 m) {\n"
+" return mat4 (-m[0], -m[1], -m[2], -m[3]);\n"
+"}\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"void __operator -- (inout float a) {\n"
+" a -= 1.0;\n"
+"}\n"
+"\n"
+"void __operator -- (inout int a) {\n"
+" a -= 1;\n"
+"}\n"
+"\n"
+"void __operator -- (inout vec2 v) {\n"
+" --v.x, --v.y;\n"
+"}\n"
+"\n"
+"void __operator -- (inout vec3 v) {\n"
+" --v.x, --v.y, --v.z;\n"
+"}\n"
+"\n"
+"void __operator -- (inout vec4 v) {\n"
+" --v.x, --v.y, --v.z, --v.w;\n"
+"}\n"
+"\n"
+"void __operator -- (inout ivec2 v) {\n"
+" --v.x, --v.y;\n"
+"}\n"
+"\n"
+"void __operator -- (inout ivec3 v) {\n"
+" --v.x, --v.y, --v.z;\n"
+"}\n"
+"\n"
+"void __operator -- (inout ivec4 v) {\n"
+" --v.x, --v.y, --v.z, --v.w;\n"
+"}\n"
+"\n"
+"void __operator -- (inout mat2 m) {\n"
+" --m[0], --m[1];\n"
+"}\n"
+"\n"
+"void __operator -- (inout mat3 m) {\n"
+" --m[0], --m[1], --m[2];\n"
+"}\n"
+"\n"
+"void __operator -- (inout mat4 m) {\n"
+" --m[0], --m[1], --m[2], --m[3];\n"
+"}\n"
+"\n"
+"void __operator ++ (inout float a) {\n"
+" a += 1.0;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout int a) {\n"
+" a += 1;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout vec2 v) {\n"
+" ++v.x, ++v.y;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout vec3 v) {\n"
+" ++v.x, ++v.y, ++v.z;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout vec4 v) {\n"
+" ++v.x, ++v.y, ++v.z, ++v.w;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout ivec2 v) {\n"
+" ++v.x, ++v.y;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout ivec3 v) {\n"
+" ++v.x, ++v.y, ++v.z;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout ivec4 v) {\n"
+" ++v.x, ++v.y, ++v.z, ++v.w;\n"
+"}\n"
+"\n"
+"void __operator ++ (inout mat2 m) {\n"
+" ++m[0], ++m[1];\n"
+"}\n"
+"\n"
+"void __operator ++ (inout mat3 m) {\n"
+" ++m[0], ++m[1], ++m[2];\n"
+"}\n"
+"\n"
+"void __operator ++ (inout mat4 m) {\n"
+" ++m[0], ++m[1], ++m[2], ++m[3];\n"
+"}\n"
+"\n"
+"float __operator -- (inout float a, const int) {\n"
+" float c;\n"
+" c = a;\n"
+" --a;\n"
+" return c;\n"
+"}\n"
+"\n"
+"int __operator -- (inout int a, const int) {\n"
+" int c;\n"
+" c = a;\n"
+" --a;\n"
+" return c;\n"
+"}\n"
+"\n"
+"vec2 __operator -- (inout vec2 v, const int) {\n"
+" return vec2 (v.x--, v.y--);\n"
+"}\n"
+"\n"
+"vec3 __operator -- (inout vec3 v, const int) {\n"
+" return vec3 (v.x--, v.y--, v.z--);\n"
+"}\n"
+"\n"
+"vec4 __operator -- (inout vec4 v, const int) {\n"
+" return vec4 (v.x--, v.y--, v.z--, v.w--);\n"
+"}\n"
+"\n"
+"ivec2 __operator -- (inout ivec2 v, const int) {\n"
+" return ivec2 (v.x--, v.y--);\n"
+"}\n"
+"\n"
+"ivec3 __operator -- (inout ivec3 v, const int) {\n"
+" return ivec3 (v.x--, v.y--, v.z--);\n"
+"}\n"
+"\n"
+"ivec4 __operator -- (inout ivec4 v, const int) {\n"
+" return ivec4 (v.x--, v.y--, v.z--, v.w--);\n"
+"}\n"
+"\n"
+"mat2 __operator -- (inout mat2 m, const int) {\n"
+" return mat2 (m[0]--, m[1]--);\n"
+"}\n"
+"\n"
+"mat3 __operator -- (inout mat3 m, const int) {\n"
+" return mat3 (m[0]--, m[1]--, m[2]--);\n"
+"}\n"
+"\n"
+"mat4 __operator -- (inout mat4 m, const int) {\n"
+" return mat4 (m[0]--, m[1]--, m[2]--, m[3]--);\n"
+"}\n"
+"\n"
+"float __operator ++ (inout float a, const int) {\n"
+" float c;\n"
+" c = a;\n"
+" ++a;\n"
+" return c;\n"
+"}\n"
+"\n"
+"int __operator ++ (inout int a, const int) {\n"
+" int c;\n"
+" c = a;\n"
+" ++a;\n"
+" return c;\n"
+"}\n"
+"\n"
+"vec2 __operator ++ (inout vec2 v, const int) {\n"
+" return vec2 (v.x++, v.y++);\n"
+"}\n"
+"\n"
+"vec3 __operator ++ (inout vec3 v, const int) {\n"
+" return vec3 (v.x++, v.y++, v.z++);\n"
+"}\n"
+"\n"
+"vec4 __operator ++ (inout vec4 v, const int) {\n"
+" return vec4 (v.x++, v.y++, v.z++, v.w++);\n"
+"}\n"
+"\n"
+"ivec2 __operator ++ (inout ivec2 v, const int) {\n"
+" return ivec2 (v.x++, v.y++);\n"
+"}\n"
+"\n"
+"ivec3 __operator ++ (inout ivec3 v, const int) {\n"
+" return ivec3 (v.x++, v.y++, v.z++);\n"
+"}\n"
+"\n"
+"ivec4 __operator ++ (inout ivec4 v, const int) {\n"
+" return ivec4 (v.x++, v.y++, v.z++, v.w++);\n"
+"}\n"
+"\n"
+"mat2 __operator ++ (inout mat2 m, const int) {\n"
+" return mat2 (m[0]++, m[1]++);\n"
+"}\n"
+"\n"
+"mat3 __operator ++ (inout mat3 m, const int) {\n"
+" return mat3 (m[0]++, m[1]++, m[2]++);\n"
+"}\n"
+"\n"
+"mat4 __operator ++ (inout mat4 m, const int) {\n"
+" return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);\n"
+"}\n"
+"\n"
+"bool __operator < (const float a, const float b) {\n"
+" bool c;\n"
+" __asm float_less c, a, b;\n"
+" return c;\n"
+"}\n"
+"\n"
+"bool __operator < (const int a, const int b) {\n"
+" return float (a) < float (b);\n"
+"}\n"
+"\n"
+"bool __operator > (const float a, const float b) {\n"
+" return b < a;\n"
+"}\n"
+"\n"
+"bool __operator > (const int a, const int b) {\n"
+" return b < a;\n"
+"}\n"
+"\n"
+"bool __operator >= (const float a, const float b) {\n"
+" return a > b || a == b;\n"
+"}\n"
+"\n"
+"bool __operator >= (const int a, const int b) {\n"
+" return a > b || a == b;\n"
+"}\n"
+"\n"
+"bool __operator <= (const float a, const float b) {\n"
+" return a < b || a == b;\n"
+"}\n"
+"\n"
+"bool __operator <= (const int a, const int b) {\n"
+" return a < b || a == b;\n"
+"}\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"bool __operator ^^ (const bool a, const bool b) {\n"
+" return a != b;\n"
+"}\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"bool __operator ! (const bool a) {\n"
+" return a == false;\n"
+"}\n"
+"\n"
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h
index 4645e1419..12e2a2137 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h
@@ -1,758 +1,758 @@
-".syntax translation_unit;\n"
-".emtcode REVISION 2\n"
-".emtcode EXTERNAL_NULL 0\n"
-".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
-".emtcode EXTERNAL_DECLARATION 2\n"
-".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"
-".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"
-".emtcode FUNCTION_ORDINARY 0\n"
-".emtcode FUNCTION_CONSTRUCTOR 1\n"
-".emtcode FUNCTION_OPERATOR 2\n"
-".emtcode OPERATOR_ASSIGN 1\n"
-".emtcode OPERATOR_ADDASSIGN 2\n"
-".emtcode OPERATOR_SUBASSIGN 3\n"
-".emtcode OPERATOR_MULASSIGN 4\n"
-".emtcode OPERATOR_DIVASSIGN 5\n"
-".emtcode OPERATOR_LOGICALXOR 12\n"
-".emtcode OPERATOR_EQUAL 16\n"
-".emtcode OPERATOR_NOTEQUAL 17\n"
-".emtcode OPERATOR_LESS 18\n"
-".emtcode OPERATOR_GREATER 19\n"
-".emtcode OPERATOR_LESSEQUAL 20\n"
-".emtcode OPERATOR_GREATEREQUAL 21\n"
-".emtcode OPERATOR_MULTIPLY 24\n"
-".emtcode OPERATOR_DIVIDE 25\n"
-".emtcode OPERATOR_INCREMENT 27\n"
-".emtcode OPERATOR_DECREMENT 28\n"
-".emtcode OPERATOR_PLUS 29\n"
-".emtcode OPERATOR_MINUS 30\n"
-".emtcode OPERATOR_NOT 32\n"
-".emtcode DECLARATOR_NONE 0\n"
-".emtcode DECLARATOR_NEXT 1\n"
-".emtcode VARIABLE_NONE 0\n"
-".emtcode VARIABLE_IDENTIFIER 1\n"
-".emtcode VARIABLE_INITIALIZER 2\n"
-".emtcode VARIABLE_ARRAY_EXPLICIT 3\n"
-".emtcode VARIABLE_ARRAY_UNKNOWN 4\n"
-".emtcode TYPE_QUALIFIER_NONE 0\n"
-".emtcode TYPE_QUALIFIER_CONST 1\n"
-".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n"
-".emtcode TYPE_QUALIFIER_VARYING 3\n"
-".emtcode TYPE_QUALIFIER_UNIFORM 4\n"
-".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n"
-".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n"
-".emtcode TYPE_SPECIFIER_VOID 0\n"
-".emtcode TYPE_SPECIFIER_BOOL 1\n"
-".emtcode TYPE_SPECIFIER_BVEC2 2\n"
-".emtcode TYPE_SPECIFIER_BVEC3 3\n"
-".emtcode TYPE_SPECIFIER_BVEC4 4\n"
-".emtcode TYPE_SPECIFIER_INT 5\n"
-".emtcode TYPE_SPECIFIER_IVEC2 6\n"
-".emtcode TYPE_SPECIFIER_IVEC3 7\n"
-".emtcode TYPE_SPECIFIER_IVEC4 8\n"
-".emtcode TYPE_SPECIFIER_FLOAT 9\n"
-".emtcode TYPE_SPECIFIER_VEC2 10\n"
-".emtcode TYPE_SPECIFIER_VEC3 11\n"
-".emtcode TYPE_SPECIFIER_VEC4 12\n"
-".emtcode TYPE_SPECIFIER_MAT2 13\n"
-".emtcode TYPE_SPECIFIER_MAT3 14\n"
-".emtcode TYPE_SPECIFIER_MAT4 15\n"
-".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n"
-".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n"
-".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n"
-".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n"
-".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n"
-".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n"
-".emtcode TYPE_SPECIFIER_STRUCT 22\n"
-".emtcode TYPE_SPECIFIER_TYPENAME 23\n"
-".emtcode FIELD_NONE 0\n"
-".emtcode FIELD_NEXT 1\n"
-".emtcode FIELD_ARRAY 2\n"
-".emtcode OP_END 0\n"
-".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n"
-".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n"
-".emtcode OP_DECLARE 3\n"
-".emtcode OP_ASM 4\n"
-".emtcode OP_BREAK 5\n"
-".emtcode OP_CONTINUE 6\n"
-".emtcode OP_DISCARD 7\n"
-".emtcode OP_RETURN 8\n"
-".emtcode OP_EXPRESSION 9\n"
-".emtcode OP_IF 10\n"
-".emtcode OP_WHILE 11\n"
-".emtcode OP_DO 12\n"
-".emtcode OP_FOR 13\n"
-".emtcode OP_PUSH_VOID 14\n"
-".emtcode OP_PUSH_BOOL 15\n"
-".emtcode OP_PUSH_INT 16\n"
-".emtcode OP_PUSH_FLOAT 17\n"
-".emtcode OP_PUSH_IDENTIFIER 18\n"
-".emtcode OP_SEQUENCE 19\n"
-".emtcode OP_ASSIGN 20\n"
-".emtcode OP_ADDASSIGN 21\n"
-".emtcode OP_SUBASSIGN 22\n"
-".emtcode OP_MULASSIGN 23\n"
-".emtcode OP_DIVASSIGN 24\n"
-".emtcode OP_SELECT 31\n"
-".emtcode OP_LOGICALOR 32\n"
-".emtcode OP_LOGICALXOR 33\n"
-".emtcode OP_LOGICALAND 34\n"
-".emtcode OP_EQUAL 38\n"
-".emtcode OP_NOTEQUAL 39\n"
-".emtcode OP_LESS 40\n"
-".emtcode OP_GREATER 41\n"
-".emtcode OP_LESSEQUAL 42\n"
-".emtcode OP_GREATEREQUAL 43\n"
-".emtcode OP_ADD 46\n"
-".emtcode OP_SUBTRACT 47\n"
-".emtcode OP_MULTIPLY 48\n"
-".emtcode OP_DIVIDE 49\n"
-".emtcode OP_PREINCREMENT 51\n"
-".emtcode OP_PREDECREMENT 52\n"
-".emtcode OP_PLUS 53\n"
-".emtcode OP_MINUS 54\n"
-".emtcode OP_NOT 56\n"
-".emtcode OP_SUBSCRIPT 57\n"
-".emtcode OP_CALL 58\n"
-".emtcode OP_FIELD 59\n"
-".emtcode OP_POSTINCREMENT 60\n"
-".emtcode OP_POSTDECREMENT 61\n"
-".emtcode PARAM_QUALIFIER_IN 0\n"
-".emtcode PARAM_QUALIFIER_OUT 1\n"
-".emtcode PARAM_QUALIFIER_INOUT 2\n"
-".emtcode PARAMETER_NONE 0\n"
-".emtcode PARAMETER_NEXT 1\n"
-".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n"
-".emtcode PARAMETER_ARRAY_PRESENT 1\n"
-".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n"
-".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n"
-".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n"
-".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n"
-".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n"
-".regbyte parsing_builtin 0\n"
-".regbyte shader_type 0\n"
-"variable_identifier\n"
-" identifier .emit OP_PUSH_IDENTIFIER;\n"
-"primary_expression\n"
-" floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n"
-"primary_expression_1\n"
-" lparen .and expression .and rparen;\n"
-"postfix_expression\n"
-" postfix_expression_1 .and .loop postfix_expression_2;\n"
-"postfix_expression_1\n"
-" function_call .or primary_expression;\n"
-"postfix_expression_2\n"
-" postfix_expression_3 .or postfix_expression_4 .or\n"
-" plusplus .emit OP_POSTINCREMENT .or\n"
-" minusminus .emit OP_POSTDECREMENT;\n"
-"postfix_expression_3\n"
-" lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n"
-"postfix_expression_4\n"
-" dot .and field_selection .emit OP_FIELD;\n"
-"integer_expression\n"
-" expression;\n"
-"function_call\n"
-" function_call_generic .emit OP_CALL .and .true .emit OP_END;\n"
-"function_call_generic\n"
-" function_call_generic_1 .or function_call_generic_2;\n"
-"function_call_generic_1\n"
-" function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n"
-"function_call_generic_2\n"
-" function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n"
-"function_call_header_no_parameters\n"
-" function_call_header .and function_call_header_no_parameters_1;\n"
-"function_call_header_no_parameters_1\n"
-" \"void\" .or .true;\n"
-"function_call_header_with_parameters\n"
-" function_call_header .and assignment_expression .and .true .emit OP_END .and\n"
-" .loop function_call_header_with_parameters_1;\n"
-"function_call_header_with_parameters_1\n"
-" comma .and assignment_expression .and .true .emit OP_END;\n"
-"function_call_header\n"
-" function_identifier .and lparen;\n"
-"function_identifier\n"
-" identifier;\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"
-"unary_expression_1\n"
-" plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n"
-"unary_expression_2\n"
-" minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n"
-"unary_expression_3\n"
-" plus .and unary_expression .and .true .emit OP_PLUS;\n"
-"unary_expression_4\n"
-" minus .and unary_expression .and .true .emit OP_MINUS;\n"
-"unary_expression_5\n"
-" bang .and unary_expression .and .true .emit OP_NOT;\n"
-"multiplicative_expression\n"
-" unary_expression .and .loop multiplicative_expression_1;\n"
-"multiplicative_expression_1\n"
-" multiplicative_expression_2 .or multiplicative_expression_3;\n"
-"multiplicative_expression_2\n"
-" star .and unary_expression .and .true .emit OP_MULTIPLY;\n"
-"multiplicative_expression_3\n"
-" slash .and unary_expression .and .true .emit OP_DIVIDE;\n"
-"additive_expression\n"
-" multiplicative_expression .and .loop additive_expression_1;\n"
-"additive_expression_1\n"
-" additive_expression_2 .or additive_expression_3;\n"
-"additive_expression_2\n"
-" plus .and multiplicative_expression .and .true .emit OP_ADD;\n"
-"additive_expression_3\n"
-" minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n"
-"shift_expression\n"
-" additive_expression;\n"
-"relational_expression\n"
-" shift_expression .and .loop relational_expression_1;\n"
-"relational_expression_1\n"
-" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n"
-" relational_expression_5;\n"
-"relational_expression_2\n"
-" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n"
-"relational_expression_3\n"
-" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n"
-"relational_expression_4\n"
-" less .and shift_expression .and .true .emit OP_LESS;\n"
-"relational_expression_5\n"
-" greater .and shift_expression .and .true .emit OP_GREATER;\n"
-"equality_expression\n"
-" relational_expression .and .loop equality_expression_1;\n"
-"equality_expression_1\n"
-" equality_expression_2 .or equality_expression_3;\n"
-"equality_expression_2\n"
-" equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n"
-"equality_expression_3\n"
-" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n"
-"and_expression\n"
-" equality_expression;\n"
-"exclusive_or_expression\n"
-" and_expression;\n"
-"inclusive_or_expression\n"
-" exclusive_or_expression;\n"
-"logical_and_expression\n"
-" inclusive_or_expression .and .loop logical_and_expression_1;\n"
-"logical_and_expression_1\n"
-" ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n"
-"logical_xor_expression\n"
-" logical_and_expression .and .loop logical_xor_expression_1;\n"
-"logical_xor_expression_1\n"
-" caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n"
-"logical_or_expression\n"
-" logical_xor_expression .and .loop logical_or_expression_1;\n"
-"logical_or_expression_1\n"
-" barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n"
-"conditional_expression\n"
-" logical_or_expression .and .loop conditional_expression_1;\n"
-"conditional_expression_1\n"
-" question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n"
-"assignment_expression\n"
-" assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n"
-" assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n"
-"assignment_expression_1\n"
-" unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n"
-"assignment_expression_2\n"
-" unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n"
-"assignment_expression_3\n"
-" unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n"
-"assignment_expression_4\n"
-" unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n"
-"assignment_expression_5\n"
-" unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n"
-"expression\n"
-" assignment_expression .and .loop expression_1;\n"
-"expression_1\n"
-" comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n"
-"constant_expression\n"
-" conditional_expression .and .true .emit OP_END;\n"
-"declaration\n"
-" declaration_1 .or declaration_2;\n"
-"declaration_1\n"
-" function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n"
-"declaration_2\n"
-" init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n"
-"function_prototype\n"
-" function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n"
-"function_declarator\n"
-" function_header_with_parameters .or function_header;\n"
-"function_header_with_parameters\n"
-" function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n"
-"function_header_with_parameters_1\n"
-" comma .and parameter_declaration;\n"
-"function_header\n"
-" function_header_nospace .or function_header_space;\n"
-"function_header_space\n"
-" fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n"
-"function_header_nospace\n"
-" fully_specified_type_nospace .and function_decl_identifier .and lparen;\n"
-"function_decl_identifier\n"
-" .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n"
-" .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n"
-" identifier .emit FUNCTION_ORDINARY;\n"
-"__operator\n"
-" \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n"
-"overriden_operator\n"
-" plusplus .emit OPERATOR_INCREMENT .or\n"
-" plusequals .emit OPERATOR_ADDASSIGN .or\n"
-" plus .emit OPERATOR_PLUS .or\n"
-" minusminus .emit OPERATOR_DECREMENT .or\n"
-" minusequals .emit OPERATOR_SUBASSIGN .or\n"
-" minus .emit OPERATOR_MINUS .or\n"
-" bangequals .emit OPERATOR_NOTEQUAL .or\n"
-" bang .emit OPERATOR_NOT .or\n"
-" starequals .emit OPERATOR_MULASSIGN .or\n"
-" star .emit OPERATOR_MULTIPLY .or\n"
-" slashequals .emit OPERATOR_DIVASSIGN .or\n"
-" slash .emit OPERATOR_DIVIDE .or\n"
-" lessequals .emit OPERATOR_LESSEQUAL .or\n"
-" \n"
-" \n"
-" less .emit OPERATOR_LESS .or\n"
-" greaterequals .emit OPERATOR_GREATEREQUAL .or\n"
-" \n"
-" \n"
-" greater .emit OPERATOR_GREATER .or\n"
-" equalsequals .emit OPERATOR_EQUAL .or\n"
-" equals .emit OPERATOR_ASSIGN .or\n"
-" \n"
-" \n"
-" \n"
-" \n"
-" \n"
-" \n"
-" \n"
-" \n"
-" caretcaret .emit OPERATOR_LOGICALXOR ;\n"
-"parameter_declarator\n"
-" parameter_declarator_nospace .or parameter_declarator_space;\n"
-"parameter_declarator_nospace\n"
-" type_specifier_nospace .and identifier .and parameter_declarator_1;\n"
-"parameter_declarator_space\n"
-" type_specifier_space .and space .and identifier .and parameter_declarator_1;\n"
-"parameter_declarator_1\n"
-" parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n"
-" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
-"parameter_declarator_2\n"
-" lbracket .and constant_expression .and rbracket;\n"
-"parameter_declaration\n"
-" parameter_declaration_1 .emit PARAMETER_NEXT;\n"
-"parameter_declaration_1\n"
-" parameter_declaration_2 .or parameter_declaration_3;\n"
-"parameter_declaration_2\n"
-" type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n"
-"parameter_declaration_3\n"
-" parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n"
-"parameter_declaration_4\n"
-" parameter_declarator .or parameter_type_specifier;\n"
-"parameter_qualifier\n"
-" parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n"
-"parameter_qualifier_1\n"
-" parameter_qualifier_2 .and space;\n"
-"parameter_qualifier_2\n"
-" \"in\" .emit PARAM_QUALIFIER_IN .or\n"
-" \"out\" .emit PARAM_QUALIFIER_OUT .or\n"
-" \"inout\" .emit PARAM_QUALIFIER_INOUT;\n"
-"parameter_type_specifier\n"
-" parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n"
-"parameter_type_specifier_1\n"
-" type_specifier_nospace .or type_specifier_space;\n"
-"parameter_type_specifier_2\n"
-" parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n"
-" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
-"parameter_type_specifier_3\n"
-" lbracket .and constant_expression .and rbracket;\n"
-"init_declarator_list\n"
-" single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n"
-" .true .emit DECLARATOR_NONE;\n"
-"init_declarator_list_1\n"
-" comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n"
-"init_declarator_list_2\n"
-" init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n"
-"init_declarator_list_3\n"
-" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
-"init_declarator_list_4\n"
-" lbracket .and init_declarator_list_5 .and rbracket;\n"
-"init_declarator_list_5\n"
-" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
-"single_declaration\n"
-" single_declaration_nospace .or single_declaration_space;\n"
-"single_declaration_space\n"
-" fully_specified_type_space .and single_declaration_space_1;\n"
-"single_declaration_nospace\n"
-" fully_specified_type_nospace .and single_declaration_nospace_1;\n"
-"single_declaration_space_1\n"
-" single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
-"single_declaration_nospace_1\n"
-" single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
-"single_declaration_space_2\n"
-" space .and identifier .and single_declaration_3;\n"
-"single_declaration_nospace_2\n"
-" identifier .and single_declaration_3;\n"
-"single_declaration_3\n"
-" single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n"
-"single_declaration_4\n"
-" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
-"single_declaration_5\n"
-" lbracket .and single_declaration_6 .and rbracket;\n"
-"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_1 .and type_specifier_space;\n"
-"fully_specified_type_nospace\n"
-" fully_specified_type_1 .and type_specifier_nospace;\n"
-"fully_specified_type_1\n"
-" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n"
-"fully_specified_type_2\n"
-" type_qualifier .and space;\n"
-"type_qualifier\n"
-" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"
-" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"
-" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n"
-" \"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"
-" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"
-" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"
-" \"int\" .emit TYPE_SPECIFIER_INT .or\n"
-" \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n"
-" \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n"
-" \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n"
-" \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n"
-" \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n"
-" \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n"
-" \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n"
-" \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n"
-" \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n"
-" \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n"
-" \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n"
-" \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n"
-" \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n"
-" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n"
-" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n"
-" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n"
-" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n"
-" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n"
-" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n"
-" type_name .emit TYPE_SPECIFIER_TYPENAME;\n"
-"type_specifier_nospace\n"
-" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\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"
-"struct_specifier_1\n"
-" struct_specifier_2 .or .true .emit '\\0';\n"
-"struct_specifier_2\n"
-" space .and identifier;\n"
-"struct_declaration_list\n"
-" struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n"
-"struct_declaration\n"
-" struct_declaration_nospace .or struct_declaration_space;\n"
-"struct_declaration_space\n"
-" type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
-"struct_declaration_nospace\n"
-" type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
-"struct_declarator_list\n"
-" struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n"
-"struct_declarator_list_1\n"
-" comma .and struct_declarator;\n"
-"struct_declarator\n"
-" identifier .and struct_declarator_1;\n"
-"struct_declarator_1\n"
-" struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n"
-"struct_declarator_2\n"
-" lbracket .and constant_expression .and rbracket;\n"
-"initializer\n"
-" assignment_expression .and .true .emit OP_END;\n"
-"declaration_statement\n"
-" declaration;\n"
-"statement\n"
-" compound_statement .or simple_statement;\n"
-"statement_space\n"
-" compound_statement .or statement_space_1;\n"
-"statement_space_1\n"
-" space .and simple_statement;\n"
-"simple_statement\n"
-" .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n"
-" selection_statement .or\n"
-" iteration_statement .or\n"
-" jump_statement .or\n"
-" expression_statement .emit OP_EXPRESSION .or\n"
-" declaration_statement .emit OP_DECLARE;\n"
-"compound_statement\n"
-" compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n"
-"compound_statement_1\n"
-" compound_statement_2 .or compound_statement_3;\n"
-"compound_statement_2\n"
-" lbrace .and rbrace;\n"
-"compound_statement_3\n"
-" lbrace .and statement_list .and rbrace;\n"
-"statement_no_new_scope\n"
-" compound_statement_no_new_scope .or simple_statement;\n"
-"compound_statement_no_new_scope\n"
-" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"
-"compound_statement_no_new_scope_1\n"
-" compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n"
-"compound_statement_no_new_scope_2\n"
-" lbrace .and rbrace;\n"
-"compound_statement_no_new_scope_3\n"
-" lbrace .and statement_list .and rbrace;\n"
-"statement_list\n"
-" statement .and .loop statement;\n"
-"expression_statement\n"
-" expression_statement_1 .or expression_statement_2;\n"
-"expression_statement_1\n"
-" semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
-"expression_statement_2\n"
-" expression .and semicolon .emit OP_END;\n"
-"selection_statement\n"
-" \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n"
-" rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n"
-"selection_rest_statement\n"
-" statement .and selection_rest_statement_1;\n"
-"selection_rest_statement_1\n"
-" selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n"
-"selection_rest_statement_2\n"
-" \"else\" .and optional_space .and statement;\n"
-"condition\n"
-" condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n"
-" condition_3 .emit OP_EXPRESSION;\n"
-"condition_1\n"
-" condition_1_nospace .or condition_1_space;\n"
-"condition_1_nospace\n"
-" fully_specified_type_nospace .and condition_2;\n"
-"condition_1_space\n"
-" fully_specified_type_space .and space .and condition_2;\n"
-"condition_2\n"
-" identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n"
-" initializer .and .true .emit DECLARATOR_NONE;\n"
-"condition_3\n"
-" expression .and .true .emit OP_END;\n"
-"iteration_statement\n"
-" iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n"
-"iteration_statement_1\n"
-" \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n"
-" rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
-"iteration_statement_2\n"
-" \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n"
-" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"
-"iteration_statement_3\n"
-" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"
-" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
-"for_init_statement\n"
-" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"
-"conditionopt\n"
-" condition .or\n"
-" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n"
-"for_rest_statement\n"
-" conditionopt .and semicolon .and for_rest_statement_1;\n"
-"for_rest_statement_1\n"
-" for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n"
-"for_rest_statement_2\n"
-" expression .and .true .emit OP_END;\n"
-"jump_statement\n"
-" jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n"
-" .if (shader_type == 1) jump_statement_5;\n"
-"jump_statement_1\n"
-" \"continue\" .and semicolon .emit OP_CONTINUE;\n"
-"jump_statement_2\n"
-" \"break\" .and semicolon .emit OP_BREAK;\n"
-"jump_statement_3\n"
-" \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n"
-"jump_statement_4\n"
-" \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
-"jump_statement_5\n"
-" \"discard\" .and semicolon .emit OP_DISCARD;\n"
-"__asm_statement\n"
-" \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n"
-"asm_arguments\n"
-" variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n"
-"asm_arguments_1\n"
-" comma .and variable_identifier .and .true .emit OP_END;\n"
-"translation_unit\n"
-" optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n"
-" .loop external_declaration .and optional_space .and\n"
-" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n"
-"external_declaration\n"
-" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n"
-" declaration .emit EXTERNAL_DECLARATION;\n"
-"function_definition\n"
-" function_prototype .and compound_statement_no_new_scope;\n"
-"digit_oct\n"
-" '0'-'7';\n"
-"digit_dec\n"
-" '0'-'9';\n"
-"digit_hex\n"
-" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n"
-"id_character_first\n"
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"
-"id_character_next\n"
-" id_character_first .or digit_dec;\n"
-"identifier\n"
-" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n"
-"float\n"
-" float_1 .or float_2;\n"
-"float_1\n"
-" float_fractional_constant .and float_optional_exponent_part;\n"
-"float_2\n"
-" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n"
-"float_fractional_constant\n"
-" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n"
-"float_fractional_constant_1\n"
-" float_digit_sequence .and '.' .and float_digit_sequence;\n"
-"float_fractional_constant_2\n"
-" float_digit_sequence .and '.' .and .true .emit '\\0';\n"
-"float_fractional_constant_3\n"
-" '.' .emit '\\0' .and float_digit_sequence;\n"
-"float_optional_exponent_part\n"
-" float_exponent_part .or .true .emit '\\0';\n"
-"float_digit_sequence\n"
-" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
-"float_exponent_part\n"
-" float_exponent_part_1 .or float_exponent_part_2;\n"
-"float_exponent_part_1\n"
-" 'e' .and float_optional_sign .and float_digit_sequence;\n"
-"float_exponent_part_2\n"
-" 'E' .and float_optional_sign .and float_digit_sequence;\n"
-"float_optional_sign\n"
-" float_sign .or .true;\n"
-"float_sign\n"
-" '+' .or '-' .emit '-';\n"
-"integer\n"
-" integer_hex .or integer_oct .or integer_dec;\n"
-"integer_hex\n"
-" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n"
-" .true .emit '\\0';\n"
-"integer_hex_1\n"
-" 'x' .or 'X';\n"
-"integer_oct\n"
-" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n"
-"integer_dec\n"
-" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
-"boolean\n"
-" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n"
-" \"false\" .emit 2 .emit '0' .emit '\\0';\n"
-"type_name\n"
-" identifier;\n"
-"field_selection\n"
-" identifier;\n"
-"floatconstant\n"
-" float .emit OP_PUSH_FLOAT;\n"
-"intconstant\n"
-" integer .emit OP_PUSH_INT;\n"
-"boolconstant\n"
-" boolean .emit OP_PUSH_BOOL;\n"
-"optional_space\n"
-" .loop single_space;\n"
-"space\n"
-" single_space .and .loop single_space;\n"
-"single_space\n"
-" white_char .or c_style_comment_block .or cpp_style_comment_block;\n"
-"white_char\n"
-" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n"
-"new_line\n"
-" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
-"cr_lf\n"
-" '\\r' .and '\\n';\n"
-"lf_cr\n"
-" '\\n' .and '\\r';\n"
-"c_style_comment_block\n"
-" '/' .and '*' .and c_style_comment_rest;\n"
-"c_style_comment_rest\n"
-" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
-"c_style_comment_rest_1\n"
-" c_style_comment_end .or c_style_comment_rest_2;\n"
-"c_style_comment_rest_2\n"
-" '*' .and c_style_comment_rest;\n"
-"c_style_comment_char_no_star\n"
-" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
-"c_style_comment_end\n"
-" '*' .and '/';\n"
-"cpp_style_comment_block\n"
-" '/' .and '/' .and cpp_style_comment_block_1;\n"
-"cpp_style_comment_block_1\n"
-" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
-"cpp_style_comment_block_2\n"
-" .loop cpp_style_comment_char .and new_line;\n"
-"cpp_style_comment_block_3\n"
-" .loop cpp_style_comment_char;\n"
-"cpp_style_comment_char\n"
-" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
-"ampersandampersand\n"
-" optional_space .and '&' .and '&' .and optional_space;\n"
-"barbar\n"
-" optional_space .and '|' .and '|' .and optional_space;\n"
-"bang\n"
-" optional_space .and '!' .and optional_space;\n"
-"bangequals\n"
-" optional_space .and '!' .and '=' .and optional_space;\n"
-"caretcaret\n"
-" optional_space .and '^' .and '^' .and optional_space;\n"
-"colon\n"
-" optional_space .and ':' .and optional_space;\n"
-"comma\n"
-" optional_space .and ',' .and optional_space;\n"
-"dot\n"
-" optional_space .and '.' .and optional_space;\n"
-"equals\n"
-" optional_space .and '=' .and optional_space;\n"
-"equalsequals\n"
-" optional_space .and '=' .and '=' .and optional_space;\n"
-"greater\n"
-" optional_space .and '>' .and optional_space;\n"
-"greaterequals\n"
-" optional_space .and '>' .and '=' .and optional_space;\n"
-"lbrace\n"
-" optional_space .and '{' .and optional_space;\n"
-"lbracket\n"
-" optional_space .and '[' .and optional_space;\n"
-"less\n"
-" optional_space .and '<' .and optional_space;\n"
-"lessequals\n"
-" optional_space .and '<' .and '=' .and optional_space;\n"
-"lparen\n"
-" optional_space .and '(' .and optional_space;\n"
-"minus\n"
-" optional_space .and '-' .and optional_space;\n"
-"minusequals\n"
-" optional_space .and '-' .and '=' .and optional_space;\n"
-"minusminus\n"
-" optional_space .and '-' .and '-' .and optional_space;\n"
-"plus\n"
-" optional_space .and '+' .and optional_space;\n"
-"plusequals\n"
-" optional_space .and '+' .and '=' .and optional_space;\n"
-"plusplus\n"
-" optional_space .and '+' .and '+' .and optional_space;\n"
-"question\n"
-" optional_space .and '?' .and optional_space;\n"
-"rbrace\n"
-" optional_space .and '}' .and optional_space;\n"
-"rbracket\n"
-" optional_space .and ']' .and optional_space;\n"
-"rparen\n"
-" optional_space .and ')' .and optional_space;\n"
-"semicolon\n"
-" optional_space .and ';' .and optional_space;\n"
-"slash\n"
-" optional_space .and '/' .and optional_space;\n"
-"slashequals\n"
-" optional_space .and '/' .and '=' .and optional_space;\n"
-"star\n"
-" optional_space .and '*' .and optional_space;\n"
-"starequals\n"
-" optional_space .and '*' .and '=' .and optional_space;\n"
-".string string_lexer;\n"
-"string_lexer\n"
-" lex_first_identifier_character .and .loop lex_next_identifier_character;\n"
-"lex_first_identifier_character\n"
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"
-"lex_next_identifier_character\n"
-" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n"
-"err_token\n"
-" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n"
-" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n"
-" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"
-"err_identifier\n"
-" id_character_first .and .loop id_character_next;\n"
-""
+".syntax translation_unit;\n"
+".emtcode REVISION 2\n"
+".emtcode EXTERNAL_NULL 0\n"
+".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
+".emtcode EXTERNAL_DECLARATION 2\n"
+".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"
+".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"
+".emtcode FUNCTION_ORDINARY 0\n"
+".emtcode FUNCTION_CONSTRUCTOR 1\n"
+".emtcode FUNCTION_OPERATOR 2\n"
+".emtcode OPERATOR_ASSIGN 1\n"
+".emtcode OPERATOR_ADDASSIGN 2\n"
+".emtcode OPERATOR_SUBASSIGN 3\n"
+".emtcode OPERATOR_MULASSIGN 4\n"
+".emtcode OPERATOR_DIVASSIGN 5\n"
+".emtcode OPERATOR_LOGICALXOR 12\n"
+".emtcode OPERATOR_EQUAL 16\n"
+".emtcode OPERATOR_NOTEQUAL 17\n"
+".emtcode OPERATOR_LESS 18\n"
+".emtcode OPERATOR_GREATER 19\n"
+".emtcode OPERATOR_LESSEQUAL 20\n"
+".emtcode OPERATOR_GREATEREQUAL 21\n"
+".emtcode OPERATOR_MULTIPLY 24\n"
+".emtcode OPERATOR_DIVIDE 25\n"
+".emtcode OPERATOR_INCREMENT 27\n"
+".emtcode OPERATOR_DECREMENT 28\n"
+".emtcode OPERATOR_PLUS 29\n"
+".emtcode OPERATOR_MINUS 30\n"
+".emtcode OPERATOR_NOT 32\n"
+".emtcode DECLARATOR_NONE 0\n"
+".emtcode DECLARATOR_NEXT 1\n"
+".emtcode VARIABLE_NONE 0\n"
+".emtcode VARIABLE_IDENTIFIER 1\n"
+".emtcode VARIABLE_INITIALIZER 2\n"
+".emtcode VARIABLE_ARRAY_EXPLICIT 3\n"
+".emtcode VARIABLE_ARRAY_UNKNOWN 4\n"
+".emtcode TYPE_QUALIFIER_NONE 0\n"
+".emtcode TYPE_QUALIFIER_CONST 1\n"
+".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n"
+".emtcode TYPE_QUALIFIER_VARYING 3\n"
+".emtcode TYPE_QUALIFIER_UNIFORM 4\n"
+".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n"
+".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n"
+".emtcode TYPE_SPECIFIER_VOID 0\n"
+".emtcode TYPE_SPECIFIER_BOOL 1\n"
+".emtcode TYPE_SPECIFIER_BVEC2 2\n"
+".emtcode TYPE_SPECIFIER_BVEC3 3\n"
+".emtcode TYPE_SPECIFIER_BVEC4 4\n"
+".emtcode TYPE_SPECIFIER_INT 5\n"
+".emtcode TYPE_SPECIFIER_IVEC2 6\n"
+".emtcode TYPE_SPECIFIER_IVEC3 7\n"
+".emtcode TYPE_SPECIFIER_IVEC4 8\n"
+".emtcode TYPE_SPECIFIER_FLOAT 9\n"
+".emtcode TYPE_SPECIFIER_VEC2 10\n"
+".emtcode TYPE_SPECIFIER_VEC3 11\n"
+".emtcode TYPE_SPECIFIER_VEC4 12\n"
+".emtcode TYPE_SPECIFIER_MAT2 13\n"
+".emtcode TYPE_SPECIFIER_MAT3 14\n"
+".emtcode TYPE_SPECIFIER_MAT4 15\n"
+".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n"
+".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n"
+".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n"
+".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n"
+".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n"
+".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n"
+".emtcode TYPE_SPECIFIER_STRUCT 22\n"
+".emtcode TYPE_SPECIFIER_TYPENAME 23\n"
+".emtcode FIELD_NONE 0\n"
+".emtcode FIELD_NEXT 1\n"
+".emtcode FIELD_ARRAY 2\n"
+".emtcode OP_END 0\n"
+".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n"
+".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n"
+".emtcode OP_DECLARE 3\n"
+".emtcode OP_ASM 4\n"
+".emtcode OP_BREAK 5\n"
+".emtcode OP_CONTINUE 6\n"
+".emtcode OP_DISCARD 7\n"
+".emtcode OP_RETURN 8\n"
+".emtcode OP_EXPRESSION 9\n"
+".emtcode OP_IF 10\n"
+".emtcode OP_WHILE 11\n"
+".emtcode OP_DO 12\n"
+".emtcode OP_FOR 13\n"
+".emtcode OP_PUSH_VOID 14\n"
+".emtcode OP_PUSH_BOOL 15\n"
+".emtcode OP_PUSH_INT 16\n"
+".emtcode OP_PUSH_FLOAT 17\n"
+".emtcode OP_PUSH_IDENTIFIER 18\n"
+".emtcode OP_SEQUENCE 19\n"
+".emtcode OP_ASSIGN 20\n"
+".emtcode OP_ADDASSIGN 21\n"
+".emtcode OP_SUBASSIGN 22\n"
+".emtcode OP_MULASSIGN 23\n"
+".emtcode OP_DIVASSIGN 24\n"
+".emtcode OP_SELECT 31\n"
+".emtcode OP_LOGICALOR 32\n"
+".emtcode OP_LOGICALXOR 33\n"
+".emtcode OP_LOGICALAND 34\n"
+".emtcode OP_EQUAL 38\n"
+".emtcode OP_NOTEQUAL 39\n"
+".emtcode OP_LESS 40\n"
+".emtcode OP_GREATER 41\n"
+".emtcode OP_LESSEQUAL 42\n"
+".emtcode OP_GREATEREQUAL 43\n"
+".emtcode OP_ADD 46\n"
+".emtcode OP_SUBTRACT 47\n"
+".emtcode OP_MULTIPLY 48\n"
+".emtcode OP_DIVIDE 49\n"
+".emtcode OP_PREINCREMENT 51\n"
+".emtcode OP_PREDECREMENT 52\n"
+".emtcode OP_PLUS 53\n"
+".emtcode OP_MINUS 54\n"
+".emtcode OP_NOT 56\n"
+".emtcode OP_SUBSCRIPT 57\n"
+".emtcode OP_CALL 58\n"
+".emtcode OP_FIELD 59\n"
+".emtcode OP_POSTINCREMENT 60\n"
+".emtcode OP_POSTDECREMENT 61\n"
+".emtcode PARAM_QUALIFIER_IN 0\n"
+".emtcode PARAM_QUALIFIER_OUT 1\n"
+".emtcode PARAM_QUALIFIER_INOUT 2\n"
+".emtcode PARAMETER_NONE 0\n"
+".emtcode PARAMETER_NEXT 1\n"
+".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n"
+".emtcode PARAMETER_ARRAY_PRESENT 1\n"
+".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n"
+".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n"
+".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n"
+".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n"
+".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n"
+".regbyte parsing_builtin 0\n"
+".regbyte shader_type 0\n"
+"variable_identifier\n"
+" identifier .emit OP_PUSH_IDENTIFIER;\n"
+"primary_expression\n"
+" floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n"
+"primary_expression_1\n"
+" lparen .and expression .and rparen;\n"
+"postfix_expression\n"
+" postfix_expression_1 .and .loop postfix_expression_2;\n"
+"postfix_expression_1\n"
+" function_call .or primary_expression;\n"
+"postfix_expression_2\n"
+" postfix_expression_3 .or postfix_expression_4 .or\n"
+" plusplus .emit OP_POSTINCREMENT .or\n"
+" minusminus .emit OP_POSTDECREMENT;\n"
+"postfix_expression_3\n"
+" lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n"
+"postfix_expression_4\n"
+" dot .and field_selection .emit OP_FIELD;\n"
+"integer_expression\n"
+" expression;\n"
+"function_call\n"
+" function_call_generic .emit OP_CALL .and .true .emit OP_END;\n"
+"function_call_generic\n"
+" function_call_generic_1 .or function_call_generic_2;\n"
+"function_call_generic_1\n"
+" function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n"
+"function_call_generic_2\n"
+" function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n"
+"function_call_header_no_parameters\n"
+" function_call_header .and function_call_header_no_parameters_1;\n"
+"function_call_header_no_parameters_1\n"
+" \"void\" .or .true;\n"
+"function_call_header_with_parameters\n"
+" function_call_header .and assignment_expression .and .true .emit OP_END .and\n"
+" .loop function_call_header_with_parameters_1;\n"
+"function_call_header_with_parameters_1\n"
+" comma .and assignment_expression .and .true .emit OP_END;\n"
+"function_call_header\n"
+" function_identifier .and lparen;\n"
+"function_identifier\n"
+" identifier;\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"
+"unary_expression_1\n"
+" plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n"
+"unary_expression_2\n"
+" minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n"
+"unary_expression_3\n"
+" plus .and unary_expression .and .true .emit OP_PLUS;\n"
+"unary_expression_4\n"
+" minus .and unary_expression .and .true .emit OP_MINUS;\n"
+"unary_expression_5\n"
+" bang .and unary_expression .and .true .emit OP_NOT;\n"
+"multiplicative_expression\n"
+" unary_expression .and .loop multiplicative_expression_1;\n"
+"multiplicative_expression_1\n"
+" multiplicative_expression_2 .or multiplicative_expression_3;\n"
+"multiplicative_expression_2\n"
+" star .and unary_expression .and .true .emit OP_MULTIPLY;\n"
+"multiplicative_expression_3\n"
+" slash .and unary_expression .and .true .emit OP_DIVIDE;\n"
+"additive_expression\n"
+" multiplicative_expression .and .loop additive_expression_1;\n"
+"additive_expression_1\n"
+" additive_expression_2 .or additive_expression_3;\n"
+"additive_expression_2\n"
+" plus .and multiplicative_expression .and .true .emit OP_ADD;\n"
+"additive_expression_3\n"
+" minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n"
+"shift_expression\n"
+" additive_expression;\n"
+"relational_expression\n"
+" shift_expression .and .loop relational_expression_1;\n"
+"relational_expression_1\n"
+" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n"
+" relational_expression_5;\n"
+"relational_expression_2\n"
+" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n"
+"relational_expression_3\n"
+" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n"
+"relational_expression_4\n"
+" less .and shift_expression .and .true .emit OP_LESS;\n"
+"relational_expression_5\n"
+" greater .and shift_expression .and .true .emit OP_GREATER;\n"
+"equality_expression\n"
+" relational_expression .and .loop equality_expression_1;\n"
+"equality_expression_1\n"
+" equality_expression_2 .or equality_expression_3;\n"
+"equality_expression_2\n"
+" equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n"
+"equality_expression_3\n"
+" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n"
+"and_expression\n"
+" equality_expression;\n"
+"exclusive_or_expression\n"
+" and_expression;\n"
+"inclusive_or_expression\n"
+" exclusive_or_expression;\n"
+"logical_and_expression\n"
+" inclusive_or_expression .and .loop logical_and_expression_1;\n"
+"logical_and_expression_1\n"
+" ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n"
+"logical_xor_expression\n"
+" logical_and_expression .and .loop logical_xor_expression_1;\n"
+"logical_xor_expression_1\n"
+" caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n"
+"logical_or_expression\n"
+" logical_xor_expression .and .loop logical_or_expression_1;\n"
+"logical_or_expression_1\n"
+" barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n"
+"conditional_expression\n"
+" logical_or_expression .and .loop conditional_expression_1;\n"
+"conditional_expression_1\n"
+" question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n"
+"assignment_expression\n"
+" assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n"
+" assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n"
+"assignment_expression_1\n"
+" unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n"
+"assignment_expression_2\n"
+" unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n"
+"assignment_expression_3\n"
+" unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n"
+"assignment_expression_4\n"
+" unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n"
+"assignment_expression_5\n"
+" unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n"
+"expression\n"
+" assignment_expression .and .loop expression_1;\n"
+"expression_1\n"
+" comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n"
+"constant_expression\n"
+" conditional_expression .and .true .emit OP_END;\n"
+"declaration\n"
+" declaration_1 .or declaration_2;\n"
+"declaration_1\n"
+" function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n"
+"declaration_2\n"
+" init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n"
+"function_prototype\n"
+" function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n"
+"function_declarator\n"
+" function_header_with_parameters .or function_header;\n"
+"function_header_with_parameters\n"
+" function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n"
+"function_header_with_parameters_1\n"
+" comma .and parameter_declaration;\n"
+"function_header\n"
+" function_header_nospace .or function_header_space;\n"
+"function_header_space\n"
+" fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n"
+"function_header_nospace\n"
+" fully_specified_type_nospace .and function_decl_identifier .and lparen;\n"
+"function_decl_identifier\n"
+" .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n"
+" .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n"
+" identifier .emit FUNCTION_ORDINARY;\n"
+"__operator\n"
+" \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n"
+"overriden_operator\n"
+" plusplus .emit OPERATOR_INCREMENT .or\n"
+" plusequals .emit OPERATOR_ADDASSIGN .or\n"
+" plus .emit OPERATOR_PLUS .or\n"
+" minusminus .emit OPERATOR_DECREMENT .or\n"
+" minusequals .emit OPERATOR_SUBASSIGN .or\n"
+" minus .emit OPERATOR_MINUS .or\n"
+" bangequals .emit OPERATOR_NOTEQUAL .or\n"
+" bang .emit OPERATOR_NOT .or\n"
+" starequals .emit OPERATOR_MULASSIGN .or\n"
+" star .emit OPERATOR_MULTIPLY .or\n"
+" slashequals .emit OPERATOR_DIVASSIGN .or\n"
+" slash .emit OPERATOR_DIVIDE .or\n"
+" lessequals .emit OPERATOR_LESSEQUAL .or\n"
+" \n"
+" \n"
+" less .emit OPERATOR_LESS .or\n"
+" greaterequals .emit OPERATOR_GREATEREQUAL .or\n"
+" \n"
+" \n"
+" greater .emit OPERATOR_GREATER .or\n"
+" equalsequals .emit OPERATOR_EQUAL .or\n"
+" equals .emit OPERATOR_ASSIGN .or\n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" caretcaret .emit OPERATOR_LOGICALXOR ;\n"
+"parameter_declarator\n"
+" parameter_declarator_nospace .or parameter_declarator_space;\n"
+"parameter_declarator_nospace\n"
+" type_specifier_nospace .and identifier .and parameter_declarator_1;\n"
+"parameter_declarator_space\n"
+" type_specifier_space .and space .and identifier .and parameter_declarator_1;\n"
+"parameter_declarator_1\n"
+" parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n"
+" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
+"parameter_declarator_2\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"parameter_declaration\n"
+" parameter_declaration_1 .emit PARAMETER_NEXT;\n"
+"parameter_declaration_1\n"
+" parameter_declaration_2 .or parameter_declaration_3;\n"
+"parameter_declaration_2\n"
+" type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n"
+"parameter_declaration_3\n"
+" parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n"
+"parameter_declaration_4\n"
+" parameter_declarator .or parameter_type_specifier;\n"
+"parameter_qualifier\n"
+" parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n"
+"parameter_qualifier_1\n"
+" parameter_qualifier_2 .and space;\n"
+"parameter_qualifier_2\n"
+" \"in\" .emit PARAM_QUALIFIER_IN .or\n"
+" \"out\" .emit PARAM_QUALIFIER_OUT .or\n"
+" \"inout\" .emit PARAM_QUALIFIER_INOUT;\n"
+"parameter_type_specifier\n"
+" parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n"
+"parameter_type_specifier_1\n"
+" type_specifier_nospace .or type_specifier_space;\n"
+"parameter_type_specifier_2\n"
+" parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n"
+" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
+"parameter_type_specifier_3\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"init_declarator_list\n"
+" single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n"
+" .true .emit DECLARATOR_NONE;\n"
+"init_declarator_list_1\n"
+" comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n"
+"init_declarator_list_2\n"
+" init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n"
+"init_declarator_list_3\n"
+" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
+"init_declarator_list_4\n"
+" lbracket .and init_declarator_list_5 .and rbracket;\n"
+"init_declarator_list_5\n"
+" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
+"single_declaration\n"
+" single_declaration_nospace .or single_declaration_space;\n"
+"single_declaration_space\n"
+" fully_specified_type_space .and single_declaration_space_1;\n"
+"single_declaration_nospace\n"
+" fully_specified_type_nospace .and single_declaration_nospace_1;\n"
+"single_declaration_space_1\n"
+" single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_nospace_1\n"
+" single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_space_2\n"
+" space .and identifier .and single_declaration_3;\n"
+"single_declaration_nospace_2\n"
+" identifier .and single_declaration_3;\n"
+"single_declaration_3\n"
+" single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_4\n"
+" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
+"single_declaration_5\n"
+" lbracket .and single_declaration_6 .and rbracket;\n"
+"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_1 .and type_specifier_space;\n"
+"fully_specified_type_nospace\n"
+" fully_specified_type_1 .and type_specifier_nospace;\n"
+"fully_specified_type_1\n"
+" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n"
+"fully_specified_type_2\n"
+" type_qualifier .and space;\n"
+"type_qualifier\n"
+" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"
+" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"
+" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n"
+" \"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"
+" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"
+" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"
+" \"int\" .emit TYPE_SPECIFIER_INT .or\n"
+" \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n"
+" \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n"
+" \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n"
+" \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n"
+" \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n"
+" \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n"
+" \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n"
+" \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n"
+" \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n"
+" \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n"
+" \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n"
+" \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n"
+" \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n"
+" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n"
+" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n"
+" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n"
+" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n"
+" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n"
+" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n"
+" type_name .emit TYPE_SPECIFIER_TYPENAME;\n"
+"type_specifier_nospace\n"
+" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\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"
+"struct_specifier_1\n"
+" struct_specifier_2 .or .true .emit '\\0';\n"
+"struct_specifier_2\n"
+" space .and identifier;\n"
+"struct_declaration_list\n"
+" struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n"
+"struct_declaration\n"
+" struct_declaration_nospace .or struct_declaration_space;\n"
+"struct_declaration_space\n"
+" type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
+"struct_declaration_nospace\n"
+" type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
+"struct_declarator_list\n"
+" struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n"
+"struct_declarator_list_1\n"
+" comma .and struct_declarator;\n"
+"struct_declarator\n"
+" identifier .and struct_declarator_1;\n"
+"struct_declarator_1\n"
+" struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n"
+"struct_declarator_2\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"initializer\n"
+" assignment_expression .and .true .emit OP_END;\n"
+"declaration_statement\n"
+" declaration;\n"
+"statement\n"
+" compound_statement .or simple_statement;\n"
+"statement_space\n"
+" compound_statement .or statement_space_1;\n"
+"statement_space_1\n"
+" space .and simple_statement;\n"
+"simple_statement\n"
+" .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n"
+" selection_statement .or\n"
+" iteration_statement .or\n"
+" jump_statement .or\n"
+" expression_statement .emit OP_EXPRESSION .or\n"
+" declaration_statement .emit OP_DECLARE;\n"
+"compound_statement\n"
+" compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n"
+"compound_statement_1\n"
+" compound_statement_2 .or compound_statement_3;\n"
+"compound_statement_2\n"
+" lbrace .and rbrace;\n"
+"compound_statement_3\n"
+" lbrace .and statement_list .and rbrace;\n"
+"statement_no_new_scope\n"
+" compound_statement_no_new_scope .or simple_statement;\n"
+"compound_statement_no_new_scope\n"
+" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"
+"compound_statement_no_new_scope_1\n"
+" compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n"
+"compound_statement_no_new_scope_2\n"
+" lbrace .and rbrace;\n"
+"compound_statement_no_new_scope_3\n"
+" lbrace .and statement_list .and rbrace;\n"
+"statement_list\n"
+" statement .and .loop statement;\n"
+"expression_statement\n"
+" expression_statement_1 .or expression_statement_2;\n"
+"expression_statement_1\n"
+" semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
+"expression_statement_2\n"
+" expression .and semicolon .emit OP_END;\n"
+"selection_statement\n"
+" \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n"
+" rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n"
+"selection_rest_statement\n"
+" statement .and selection_rest_statement_1;\n"
+"selection_rest_statement_1\n"
+" selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n"
+"selection_rest_statement_2\n"
+" \"else\" .and optional_space .and statement;\n"
+"condition\n"
+" condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n"
+" condition_3 .emit OP_EXPRESSION;\n"
+"condition_1\n"
+" condition_1_nospace .or condition_1_space;\n"
+"condition_1_nospace\n"
+" fully_specified_type_nospace .and condition_2;\n"
+"condition_1_space\n"
+" fully_specified_type_space .and space .and condition_2;\n"
+"condition_2\n"
+" identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n"
+" initializer .and .true .emit DECLARATOR_NONE;\n"
+"condition_3\n"
+" expression .and .true .emit OP_END;\n"
+"iteration_statement\n"
+" iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n"
+"iteration_statement_1\n"
+" \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n"
+" rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
+"iteration_statement_2\n"
+" \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n"
+" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"
+"iteration_statement_3\n"
+" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"
+" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
+"for_init_statement\n"
+" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"
+"conditionopt\n"
+" condition .or\n"
+" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n"
+"for_rest_statement\n"
+" conditionopt .and semicolon .and for_rest_statement_1;\n"
+"for_rest_statement_1\n"
+" for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n"
+"for_rest_statement_2\n"
+" expression .and .true .emit OP_END;\n"
+"jump_statement\n"
+" jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n"
+" .if (shader_type == 1) jump_statement_5;\n"
+"jump_statement_1\n"
+" \"continue\" .and semicolon .emit OP_CONTINUE;\n"
+"jump_statement_2\n"
+" \"break\" .and semicolon .emit OP_BREAK;\n"
+"jump_statement_3\n"
+" \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n"
+"jump_statement_4\n"
+" \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
+"jump_statement_5\n"
+" \"discard\" .and semicolon .emit OP_DISCARD;\n"
+"__asm_statement\n"
+" \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n"
+"asm_arguments\n"
+" variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n"
+"asm_arguments_1\n"
+" comma .and variable_identifier .and .true .emit OP_END;\n"
+"translation_unit\n"
+" optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n"
+" .loop external_declaration .and optional_space .and\n"
+" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n"
+"external_declaration\n"
+" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n"
+" declaration .emit EXTERNAL_DECLARATION;\n"
+"function_definition\n"
+" function_prototype .and compound_statement_no_new_scope;\n"
+"digit_oct\n"
+" '0'-'7';\n"
+"digit_dec\n"
+" '0'-'9';\n"
+"digit_hex\n"
+" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n"
+"id_character_first\n"
+" 'a'-'z' .or 'A'-'Z' .or '_';\n"
+"id_character_next\n"
+" id_character_first .or digit_dec;\n"
+"identifier\n"
+" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n"
+"float\n"
+" float_1 .or float_2;\n"
+"float_1\n"
+" float_fractional_constant .and float_optional_exponent_part;\n"
+"float_2\n"
+" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n"
+"float_fractional_constant\n"
+" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n"
+"float_fractional_constant_1\n"
+" float_digit_sequence .and '.' .and float_digit_sequence;\n"
+"float_fractional_constant_2\n"
+" float_digit_sequence .and '.' .and .true .emit '\\0';\n"
+"float_fractional_constant_3\n"
+" '.' .emit '\\0' .and float_digit_sequence;\n"
+"float_optional_exponent_part\n"
+" float_exponent_part .or .true .emit '\\0';\n"
+"float_digit_sequence\n"
+" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
+"float_exponent_part\n"
+" float_exponent_part_1 .or float_exponent_part_2;\n"
+"float_exponent_part_1\n"
+" 'e' .and float_optional_sign .and float_digit_sequence;\n"
+"float_exponent_part_2\n"
+" 'E' .and float_optional_sign .and float_digit_sequence;\n"
+"float_optional_sign\n"
+" float_sign .or .true;\n"
+"float_sign\n"
+" '+' .or '-' .emit '-';\n"
+"integer\n"
+" integer_hex .or integer_oct .or integer_dec;\n"
+"integer_hex\n"
+" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n"
+" .true .emit '\\0';\n"
+"integer_hex_1\n"
+" 'x' .or 'X';\n"
+"integer_oct\n"
+" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n"
+"integer_dec\n"
+" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
+"boolean\n"
+" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n"
+" \"false\" .emit 2 .emit '0' .emit '\\0';\n"
+"type_name\n"
+" identifier;\n"
+"field_selection\n"
+" identifier;\n"
+"floatconstant\n"
+" float .emit OP_PUSH_FLOAT;\n"
+"intconstant\n"
+" integer .emit OP_PUSH_INT;\n"
+"boolconstant\n"
+" boolean .emit OP_PUSH_BOOL;\n"
+"optional_space\n"
+" .loop single_space;\n"
+"space\n"
+" single_space .and .loop single_space;\n"
+"single_space\n"
+" white_char .or c_style_comment_block .or cpp_style_comment_block;\n"
+"white_char\n"
+" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n"
+"new_line\n"
+" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
+"cr_lf\n"
+" '\\r' .and '\\n';\n"
+"lf_cr\n"
+" '\\n' .and '\\r';\n"
+"c_style_comment_block\n"
+" '/' .and '*' .and c_style_comment_rest;\n"
+"c_style_comment_rest\n"
+" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
+"c_style_comment_rest_1\n"
+" c_style_comment_end .or c_style_comment_rest_2;\n"
+"c_style_comment_rest_2\n"
+" '*' .and c_style_comment_rest;\n"
+"c_style_comment_char_no_star\n"
+" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
+"c_style_comment_end\n"
+" '*' .and '/';\n"
+"cpp_style_comment_block\n"
+" '/' .and '/' .and cpp_style_comment_block_1;\n"
+"cpp_style_comment_block_1\n"
+" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
+"cpp_style_comment_block_2\n"
+" .loop cpp_style_comment_char .and new_line;\n"
+"cpp_style_comment_block_3\n"
+" .loop cpp_style_comment_char;\n"
+"cpp_style_comment_char\n"
+" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
+"ampersandampersand\n"
+" optional_space .and '&' .and '&' .and optional_space;\n"
+"barbar\n"
+" optional_space .and '|' .and '|' .and optional_space;\n"
+"bang\n"
+" optional_space .and '!' .and optional_space;\n"
+"bangequals\n"
+" optional_space .and '!' .and '=' .and optional_space;\n"
+"caretcaret\n"
+" optional_space .and '^' .and '^' .and optional_space;\n"
+"colon\n"
+" optional_space .and ':' .and optional_space;\n"
+"comma\n"
+" optional_space .and ',' .and optional_space;\n"
+"dot\n"
+" optional_space .and '.' .and optional_space;\n"
+"equals\n"
+" optional_space .and '=' .and optional_space;\n"
+"equalsequals\n"
+" optional_space .and '=' .and '=' .and optional_space;\n"
+"greater\n"
+" optional_space .and '>' .and optional_space;\n"
+"greaterequals\n"
+" optional_space .and '>' .and '=' .and optional_space;\n"
+"lbrace\n"
+" optional_space .and '{' .and optional_space;\n"
+"lbracket\n"
+" optional_space .and '[' .and optional_space;\n"
+"less\n"
+" optional_space .and '<' .and optional_space;\n"
+"lessequals\n"
+" optional_space .and '<' .and '=' .and optional_space;\n"
+"lparen\n"
+" optional_space .and '(' .and optional_space;\n"
+"minus\n"
+" optional_space .and '-' .and optional_space;\n"
+"minusequals\n"
+" optional_space .and '-' .and '=' .and optional_space;\n"
+"minusminus\n"
+" optional_space .and '-' .and '-' .and optional_space;\n"
+"plus\n"
+" optional_space .and '+' .and optional_space;\n"
+"plusequals\n"
+" optional_space .and '+' .and '=' .and optional_space;\n"
+"plusplus\n"
+" optional_space .and '+' .and '+' .and optional_space;\n"
+"question\n"
+" optional_space .and '?' .and optional_space;\n"
+"rbrace\n"
+" optional_space .and '}' .and optional_space;\n"
+"rbracket\n"
+" optional_space .and ']' .and optional_space;\n"
+"rparen\n"
+" optional_space .and ')' .and optional_space;\n"
+"semicolon\n"
+" optional_space .and ';' .and optional_space;\n"
+"slash\n"
+" optional_space .and '/' .and optional_space;\n"
+"slashequals\n"
+" optional_space .and '/' .and '=' .and optional_space;\n"
+"star\n"
+" optional_space .and '*' .and optional_space;\n"
+"starequals\n"
+" optional_space .and '*' .and '=' .and optional_space;\n"
+".string string_lexer;\n"
+"string_lexer\n"
+" lex_first_identifier_character .and .loop lex_next_identifier_character;\n"
+"lex_first_identifier_character\n"
+" 'a'-'z' .or 'A'-'Z' .or '_';\n"
+"lex_next_identifier_character\n"
+" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n"
+"err_token\n"
+" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n"
+" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n"
+" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"
+"err_identifier\n"
+" id_character_first .and .loop id_character_next;\n"
+""
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h
index 1c27546d7..3b94d8592 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h
@@ -1,64 +1,64 @@
-".syntax version_directive;\n"
-"version_directive\n"
-" version_directive_1 .and .loop version_directive_2;\n"
-"version_directive_1\n"
-" prior_optional_spaces .and optional_version_directive .and .true .emit $;\n"
-"version_directive_2\n"
-" prior_optional_spaces .and version_directive_body .and .true .emit $;\n"
-"optional_version_directive\n"
-" version_directive_body .or .true .emit 10 .emit 1;\n"
-"version_directive_body\n"
-" '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n"
-" new_line;\n"
-"version_number\n"
-" version_number_110;\n"
-"version_number_110\n"
-" leading_zeroes .and \"110\" .emit 10 .emit 1;\n"
-"leading_zeroes\n"
-" .loop zero;\n"
-"zero\n"
-" '0';\n"
-"space\n"
-" single_space .and .loop single_space;\n"
-"optional_space\n"
-" .loop single_space;\n"
-"single_space\n"
-" ' ' .or '\\t';\n"
-"prior_optional_spaces\n"
-" .loop prior_space;\n"
-"prior_space\n"
-" c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n"
-"c_style_comment_block\n"
-" '/' .and '*' .and c_style_comment_rest;\n"
-"c_style_comment_rest\n"
-" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
-"c_style_comment_rest_1\n"
-" c_style_comment_end .or c_style_comment_rest_2;\n"
-"c_style_comment_rest_2\n"
-" '*' .and c_style_comment_rest;\n"
-"c_style_comment_char_no_star\n"
-" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
-"c_style_comment_end\n"
-" '*' .and '/';\n"
-"cpp_style_comment_block\n"
-" '/' .and '/' .and cpp_style_comment_block_1;\n"
-"cpp_style_comment_block_1\n"
-" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
-"cpp_style_comment_block_2\n"
-" .loop cpp_style_comment_char .and new_line;\n"
-"cpp_style_comment_block_3\n"
-" .loop cpp_style_comment_char;\n"
-"cpp_style_comment_char\n"
-" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
-"new_line\n"
-" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
-"cr_lf\n"
-" '\\r' .and '\\n';\n"
-"lf_cr\n"
-" '\\n' .and '\\r';\n"
-".string __string_filter;\n"
-"__string_filter\n"
-" .loop __identifier_char;\n"
-"__identifier_char\n"
-" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"
-""
+".syntax version_directive;\n"
+"version_directive\n"
+" version_directive_1 .and .loop version_directive_2;\n"
+"version_directive_1\n"
+" prior_optional_spaces .and optional_version_directive .and .true .emit $;\n"
+"version_directive_2\n"
+" prior_optional_spaces .and version_directive_body .and .true .emit $;\n"
+"optional_version_directive\n"
+" version_directive_body .or .true .emit 10 .emit 1;\n"
+"version_directive_body\n"
+" '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n"
+" new_line;\n"
+"version_number\n"
+" version_number_110;\n"
+"version_number_110\n"
+" leading_zeroes .and \"110\" .emit 10 .emit 1;\n"
+"leading_zeroes\n"
+" .loop zero;\n"
+"zero\n"
+" '0';\n"
+"space\n"
+" single_space .and .loop single_space;\n"
+"optional_space\n"
+" .loop single_space;\n"
+"single_space\n"
+" ' ' .or '\\t';\n"
+"prior_optional_spaces\n"
+" .loop prior_space;\n"
+"prior_space\n"
+" c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n"
+"c_style_comment_block\n"
+" '/' .and '*' .and c_style_comment_rest;\n"
+"c_style_comment_rest\n"
+" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
+"c_style_comment_rest_1\n"
+" c_style_comment_end .or c_style_comment_rest_2;\n"
+"c_style_comment_rest_2\n"
+" '*' .and c_style_comment_rest;\n"
+"c_style_comment_char_no_star\n"
+" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
+"c_style_comment_end\n"
+" '*' .and '/';\n"
+"cpp_style_comment_block\n"
+" '/' .and '/' .and cpp_style_comment_block_1;\n"
+"cpp_style_comment_block_1\n"
+" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
+"cpp_style_comment_block_2\n"
+" .loop cpp_style_comment_char .and new_line;\n"
+"cpp_style_comment_block_3\n"
+" .loop cpp_style_comment_char;\n"
+"cpp_style_comment_char\n"
+" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
+"new_line\n"
+" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
+"cr_lf\n"
+" '\\r' .and '\\n';\n"
+"lf_cr\n"
+" '\\n' .and '\\r';\n"
+".string __string_filter;\n"
+"__string_filter\n"
+" .loop __identifier_char;\n"
+"__identifier_char\n"
+" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"
+""
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c
index a9e2b07a5..ef22a0172 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c
@@ -1,1208 +1,1208 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble.c
- * slang intermediate code assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-#include "slang_assemble.h"
-#include "slang_compile.h"
-#include "slang_storage.h"
-#include "slang_assemble_constructor.h"
-#include "slang_assemble_typeinfo.h"
-#include "slang_assemble_conditional.h"
-#include "slang_assemble_assignment.h"
-
-/* slang_assembly */
-
-static void slang_assembly_construct (slang_assembly *assem)
-{
- assem->type = slang_asm_none;
-}
-
-static void slang_assembly_destruct (slang_assembly *assem)
-{
-}
-
-/* slang_assembly_file */
-
-void slang_assembly_file_construct (slang_assembly_file *file)
-{
- file->code = NULL;
- file->count = 0;
-}
-
-void slang_assembly_file_destruct (slang_assembly_file *file)
-{
- unsigned int i;
-
- for (i = 0; i < file->count; i++)
- slang_assembly_destruct (file->code + i);
- slang_alloc_free (file->code);
-}
-
-static int slang_assembly_file_push_new (slang_assembly_file *file)
-{
- file->code = (slang_assembly *) slang_alloc_realloc (file->code, file->count * sizeof (
- slang_assembly), (file->count + 1) * sizeof (slang_assembly));
- if (file->code != NULL)
- {
- slang_assembly_construct (file->code + file->count);
- file->count++;
- return 1;
- }
- return 0;
-}
-
-static int slang_assembly_file_push_general (slang_assembly_file *file, slang_assembly_type type,
- GLfloat literal, GLuint label, GLuint size)
-{
- slang_assembly *assem;
- if (!slang_assembly_file_push_new (file))
- return 0;
- assem = file->code + file->count - 1;
- assem->type = type;
- assem->literal = literal;
- assem->param[0] = label;
- assem->param[1] = size;
- return 1;
-}
-
-int slang_assembly_file_push (slang_assembly_file *file, slang_assembly_type type)
-{
- return slang_assembly_file_push_general (file, type, (GLfloat) 0, 0, 0);
-}
-
-int slang_assembly_file_push_label (slang_assembly_file *file, slang_assembly_type type,
- GLuint label)
-{
- return slang_assembly_file_push_general (file, type, (GLfloat) 0, label, 0);
-}
-
-int slang_assembly_file_push_label2 (slang_assembly_file *file, slang_assembly_type type,
- GLuint label1, GLuint label2)
-{
- return slang_assembly_file_push_general (file, type, (GLfloat) 0, label1, label2);
-}
-
-int slang_assembly_file_push_literal (slang_assembly_file *file, slang_assembly_type type,
- GLfloat literal)
-{
- return slang_assembly_file_push_general (file, type, literal, 0, 0);
-}
-
-/* utility functions */
-
-static int sizeof_variable (slang_type_specifier *spec, slang_type_qualifier qual,
- slang_operation *array_size, slang_assembly_name_space *space, unsigned int *size)
-{
- slang_storage_aggregate agg;
-
- slang_storage_aggregate_construct (&agg);
- if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs))
- {
- slang_storage_aggregate_destruct (&agg);
- return 0;
- }
- *size += _slang_sizeof_aggregate (&agg);
- if (qual == slang_qual_out || qual == slang_qual_inout)
- *size += 4;
- slang_storage_aggregate_destruct (&agg);
- return 1;
-}
-
-static int sizeof_variable2 (slang_variable *var, slang_assembly_name_space *space,
- unsigned int *size)
-{
- var->address = *size;
- if (var->type.qualifier == slang_qual_out || var->type.qualifier == slang_qual_inout)
- var->address += 4;
- return sizeof_variable (&var->type.specifier, var->type.qualifier, var->array_size, space,
- size);
-}
-
-static int sizeof_variables (slang_variable_scope *vars, unsigned int start, unsigned int stop,
- slang_assembly_name_space *space, unsigned int *size)
-{
- unsigned int i;
-
- for (i = start; i < stop; i++)
- if (!sizeof_variable2 (vars->variables + i, space, size))
- return 0;
- return 1;
-}
-
-static int collect_locals (slang_operation *op, slang_assembly_name_space *space,
- unsigned int *size)
-{
- unsigned int i;
-
- if (!sizeof_variables (op->locals, 0, op->locals->num_variables, space, size))
- return 0;
- for (i = 0; i < op->num_children; i++)
- if (!collect_locals (op->children + i, space, size))
- return 0;
- return 1;
-}
-
-/* _slang_locate_function() */
-
-slang_function *_slang_locate_function (const char *name, slang_operation *params,
- unsigned int num_params, slang_assembly_name_space *space)
-{
- unsigned int i;
-
- for (i = 0; i < space->funcs->num_functions; i++)
- {
- unsigned int j;
- slang_function *f = space->funcs->functions + i;
-
- if (slang_string_compare (name, f->header.name) != 0)
- continue;
- if (f->param_count != num_params)
- continue;
- for (j = 0; j < num_params; j++)
- {
- slang_assembly_typeinfo ti;
- slang_assembly_typeinfo_construct (&ti);
- if (!_slang_typeof_operation (params + j, space, &ti))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
- if (!slang_type_specifier_equal (&ti.spec, &f->parameters->variables[j].type.specifier))
- {
- slang_assembly_typeinfo_destruct (&ti);
- break;
- }
- slang_assembly_typeinfo_destruct (&ti);
- /* "out" and "inout" formal parameter requires the actual parameter to be l-value */
- if (!ti.can_be_referenced &&
- (f->parameters->variables[j].type.qualifier == slang_qual_out ||
- f->parameters->variables[j].type.qualifier == slang_qual_inout))
- break;
- }
- if (j == num_params)
- return f;
- }
- if (space->funcs->outer_scope != NULL)
- {
- slang_assembly_name_space my_space = *space;
- my_space.funcs = space->funcs->outer_scope;
- return _slang_locate_function (name, params, num_params, &my_space);
- }
- return NULL;
-}
-
-/* _slang_assemble_function() */
-
-int _slang_assemble_function (slang_assembly_file *file, slang_function *fun,
- slang_assembly_name_space *space)
-{
- unsigned int param_size, local_size;
- unsigned int skip, cleanup;
- slang_assembly_flow_control flow;
- slang_assembly_local_info info;
- slang_assembly_stack_info stk;
-
- fun->address = file->count;
-
- if (fun->body == NULL)
- {
- /* TODO: jump to the actual function body */
- return 1;
- }
-
- /* calculate return value and parameters size */
- param_size = 0;
- if (fun->header.type.specifier.type != slang_spec_void)
- if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space,
- &param_size))
- return 0;
- info.ret_size = param_size;
- if (!sizeof_variables (fun->parameters, 0, fun->param_count, space, &param_size))
- return 0;
-
- /* calculate local variables size, take into account the four-byte return address and
- temporaries for various tasks */
- info.addr_tmp = param_size + 4;
- info.swizzle_tmp = param_size + 4 + 4;
- local_size = param_size + 4 + 4 + 16;
- if (!sizeof_variables (fun->parameters, fun->param_count, fun->parameters->num_variables, space,
- &local_size))
- return 0;
- if (!collect_locals (fun->body, space, &local_size))
- return 0;
-
- /* allocate local variable storage */
- if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, local_size - param_size - 4))
- return 0;
-
- /* mark a new frame for function variable storage */
- if (!slang_assembly_file_push_label (file, slang_asm_enter, local_size))
- return 0;
-
- /* skip the cleanup jump */
- skip = file->count;
- if (!slang_assembly_file_push_new (file))
- return 0;
- file->code[skip].type = slang_asm_jump;
-
- /* all "return" statements will be directed here */
- flow.function_end = file->count;
- cleanup = file->count;
- if (!slang_assembly_file_push_new (file))
- return 0;
- file->code[cleanup].type = slang_asm_jump;
-
- /* execute the function body */
- file->code[skip].param[0] = file->count;
- if (!_slang_assemble_operation (file, fun->body, 0, &flow, space, &info, &stk))
- return 0;
-
- /* this is the end of the function - restore the old function frame */
- file->code[cleanup].param[0] = file->count;
- if (!slang_assembly_file_push (file, slang_asm_leave))
- return 0;
-
- /* free local variable storage */
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, local_size - param_size - 4))
- return 0;
-
- /* jump out of the function */
- if (!slang_assembly_file_push (file, slang_asm_return))
- return 0;
- return 1;
-}
-
-int _slang_cleanup_stack (slang_assembly_file *file, slang_operation *op, int ref,
- slang_assembly_name_space *space)
-{
- slang_assembly_typeinfo ti;
- unsigned int size;
-
- slang_assembly_typeinfo_construct (&ti);
- if (!_slang_typeof_operation (op, space, &ti))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
- if (ti.spec.type == slang_spec_void)
- size = 0;
- else if (ref)
- size = 4;
- else
- {
- size = 0;
- if (!sizeof_variable (&ti.spec, slang_qual_none, NULL, space, &size))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
- }
- slang_assembly_typeinfo_destruct (&ti);
- if (size != 0)
- {
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, size))
- return 0;
- }
- return 1;
-}
-
-/* _slang_assemble_operation() */
-
-/* XXX: general swizzle! */
-static int dereference_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
- unsigned int index, unsigned int *size, slang_assembly_local_info *info)
-{
- unsigned int i;
-
- for (i = agg->count; i > 0; i--)
- {
- const slang_storage_array *arr = agg->arrays + i - 1;
- unsigned int j;
-
- for (j = arr->length; j > 0; j--)
- {
- if (arr->type == slang_stor_aggregate)
- {
- if (!dereference_aggregate (file, arr->aggregate, index, size, info))
- return 0;
- }
- else
- {
- *size -= 4;
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp,
- 4))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_deref))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_addr_push, *size))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_add))
- return 0;
- switch (arr->type)
- {
- case slang_stor_bool:
- if (!slang_assembly_file_push (file, slang_asm_bool_deref))
- return 0;
- break;
- case slang_stor_int:
- if (!slang_assembly_file_push (file, slang_asm_int_deref))
- return 0;
- break;
- case slang_stor_float:
- if (!slang_assembly_file_push (file, slang_asm_float_deref))
- return 0;
- break;
- }
- index += 4;
- }
- }
- }
- return 1;
-}
-/* XXX: general swizzle! */
-int dereference (slang_assembly_file *file, slang_operation *op,
- slang_assembly_name_space *space, slang_assembly_local_info *info)
-{
- slang_assembly_typeinfo ti;
- int result;
- slang_storage_aggregate agg;
- unsigned int size;
-
- slang_assembly_typeinfo_construct (&ti);
- if (!_slang_typeof_operation (op, space, &ti))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
-
- slang_storage_aggregate_construct (&agg);
- if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
- {
- slang_storage_aggregate_destruct (&agg);
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
-
- size = _slang_sizeof_aggregate (&agg);
- result = dereference_aggregate (file, &agg, 0, &size, info);
-
- slang_storage_aggregate_destruct (&agg);
- slang_assembly_typeinfo_destruct (&ti);
- return result;
-}
-
-static int call_function (slang_assembly_file *file, slang_function *fun, slang_operation *params,
- unsigned int param_count, int assignment, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- unsigned int i;
- slang_assembly_stack_info stk;
-
- /* make room for the return value, if any */
- if (fun->header.type.specifier.type != slang_spec_void)
- {
- unsigned int ret_size = 0;
- if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, &ret_size))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, ret_size))
- return 0;
- }
-
- /* push the actual parameters on the stack */
- for (i = 0; i < param_count; i++)
- {
- slang_assembly_flow_control flow;
-
- if (fun->parameters->variables[i].type.qualifier == slang_qual_inout ||
- fun->parameters->variables[i].type.qualifier == slang_qual_out)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4))
- return 0;
- /* TODO: optimize the "out" parameter case */
- /* TODO: inspect stk */
- if (!_slang_assemble_operation (file, params + i, 1, &flow, space, info, &stk))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_copy))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_deref))
- return 0;
- if (i == 0 && assignment)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp,
- 4))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_deref))
- return 0;
- }
- if (!dereference (file, params, space, info))
- return 0;
- }
- else
- {
- /* TODO: for "out" and "inout" parameters also push the address (first) */
- /* TODO: optimize the "out" parameter case */
- /* TODO: inspect stk */
- if (!_slang_assemble_operation (file, params + i, 0, &flow, space, info, &stk))
- return 0;
- }
- }
-
- /* call the function */
- if (!slang_assembly_file_push_label (file, slang_asm_call, fun->address))
- return 0;
-
- /* pop the parameters from the stack */
- for (i = param_count; i > 0; i--)
- {
- unsigned int j = i - 1;
- if (fun->parameters->variables[j].type.qualifier == slang_qual_inout ||
- fun->parameters->variables[j].type.qualifier == slang_qual_out)
- {
- if (!_slang_assemble_assignment (file, params + j, space, info))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
- }
- else
- {
- if (!_slang_cleanup_stack (file, params + j, 0, space))
- return 0;
- }
- }
-
- return 1;
-}
-
-int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params,
- unsigned int param_count, int assignment, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- slang_function *fun = _slang_locate_function (name, params, param_count, space);
- if (fun == NULL)
- return 0;
- return call_function (file, fun, params, param_count, assignment, space, info);
-}
-
-static int call_function_name_dummyint (slang_assembly_file *file, const char *name,
- slang_operation *params, slang_assembly_name_space *space, slang_assembly_local_info *info)
-{
- slang_operation p2[2];
- int result;
-
- p2[0] = *params;
- if (!slang_operation_construct_a (p2 + 1))
- return 0;
- p2[1].type = slang_oper_literal_int;
- result = call_function_name (file, name, p2, 2, 0, space, info);
- slang_operation_destruct (p2 + 1);
- return result;
-}
-
-static int call_asm_instruction (slang_assembly_file *file, const char *name)
-{
- const struct
- {
- const char *name;
- slang_assembly_type code1, code2;
- } inst[] = {
- { "float_to_int", slang_asm_float_to_int, slang_asm_int_copy },
- { "int_to_float", slang_asm_int_to_float, slang_asm_float_copy },
- { "float_copy", slang_asm_float_copy, slang_asm_none },
- { "int_copy", slang_asm_int_copy, slang_asm_none },
- { "bool_copy", slang_asm_bool_copy, slang_asm_none },
- { "float_add", slang_asm_float_add, slang_asm_float_copy },
- { "float_multiply", slang_asm_float_multiply, slang_asm_float_copy },
- { "float_divide", slang_asm_float_divide, slang_asm_float_copy },
- { "float_negate", slang_asm_float_negate, slang_asm_float_copy },
- { "float_less", slang_asm_float_less, slang_asm_bool_copy },
- { "float_equal", slang_asm_float_equal, slang_asm_bool_copy },
- { NULL, slang_asm_none, slang_asm_none }
- };
- unsigned int i;
-
- for (i = 0; inst[i].name != NULL; i++)
- if (slang_string_compare (name, inst[i].name) == 0)
- break;
- if (inst[i].name == NULL)
- return 0;
-
- if (!slang_assembly_file_push_label2 (file, inst[i].code1, 4, 0))
- return 0;
- if (inst[i].code2 != slang_asm_none)
- if (!slang_assembly_file_push_label2 (file, inst[i].code2, 4, 0))
- return 0;
-
- /* clean-up the stack from the remaining dst address */
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
-
- return 1;
-}
-
-/* XXX: general swizzle! */
-static int equality_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
- unsigned int *index, unsigned int size, slang_assembly_local_info *info, unsigned int z_label)
-{
- unsigned int i;
-
- for (i = 0; i < agg->count; i++)
- {
- const slang_storage_array *arr = agg->arrays + i;
- unsigned int j;
-
- for (j = 0; j < arr->length; j++)
- {
- if (arr->type == slang_stor_aggregate)
- {
- if (!equality_aggregate (file, arr->aggregate, index, size, info, z_label))
- return 0;
- }
- else
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_float_equal, size + *index,
- *index))
- return 0;
- *index += 4;
- if (!slang_assembly_file_push_label (file, slang_asm_jump_if_zero, z_label))
- return 0;
- }
- }
- }
- return 1;
-}
-/* XXX: general swizzle! */
-static int equality (slang_assembly_file *file, slang_operation *op,
- slang_assembly_name_space *space, slang_assembly_local_info *info, int equal)
-{
- slang_assembly_typeinfo ti;
- int result;
- slang_storage_aggregate agg;
- unsigned int index, size;
- unsigned int skip_jump, true_label, true_jump, false_label, false_jump;
-
- /* get type of operation */
- slang_assembly_typeinfo_construct (&ti);
- if (!_slang_typeof_operation (op, space, &ti))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
-
- /* convert it to an aggregate */
- slang_storage_aggregate_construct (&agg);
- if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
- goto end;
-
- /* compute the size of the agregate - there are two such aggregates on the stack */
- size = _slang_sizeof_aggregate (&agg);
-
- /* jump to the actual data-comparison code */
- skip_jump = file->count;
- if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
- goto end;
-
- /* pop off the stack the compared data and push 1 */
- true_label = file->count;
- if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2)))
- goto end;
- if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f)))
- goto end;
- true_jump = file->count;
- if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
- goto end;
-
- false_label = file->count;
- if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2)))
- goto end;
- if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 0.0f)))
- goto end;
- false_jump = file->count;
- if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
- goto end;
-
- file->code[skip_jump].param[0] = file->count;
-
- /* compare the data on stack, it will eventually jump either to true or false label */
- index = 0;
- if (!(result = equality_aggregate (file, &agg, &index, size, info,
- equal ? false_label : true_label)))
- goto end;
- if (!(result = slang_assembly_file_push_label (file, slang_asm_jump,
- equal ? true_label : false_label)))
- goto end;
-
- file->code[true_jump].param[0] = file->count;
- file->code[false_jump].param[0] = file->count;
-
- result = 1;
-end:
- slang_storage_aggregate_destruct (&agg);
- slang_assembly_typeinfo_destruct (&ti);
- return result;
-}
-
-int _slang_assemble_operation (slang_assembly_file *file, slang_operation *op, int reference,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info, slang_assembly_stack_info *stk)
-{
- unsigned int assem;
-
- stk->swizzle_mask = 0;
-
- assem = file->count;
- if (!slang_assembly_file_push_new (file))
- return 0;
-
- switch (op->type)
- {
- case slang_oper_block_no_new_scope:
- case slang_oper_block_new_scope:
- {
- unsigned int i;
- for (i = 0; i < op->num_children; i++)
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children + i, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + i, 0, space))
- return 0;
- }
- }
- break;
- case slang_oper_variable_decl:
- {
- unsigned int i;
-
- for (i = 0; i < op->num_children; i++)
- {
- /* TODO: perform initialization of op->children[i] */
- /* TODO: clean-up stack */
- }
- }
- break;
- case slang_oper_asm:
- {
- unsigned int i;
- for (i = 0; i < op->num_children; i++)
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children + i, i == 0, flow, space, info,
- &stk))
- return 0;
- /* TODO: inspect stk */
- }
- if (!call_asm_instruction (file, op->identifier))
- return 0;
- }
- break;
- case slang_oper_break:
- file->code[assem].type = slang_asm_jump;
- file->code[assem].param[0] = flow->loop_end;
- break;
- case slang_oper_continue:
- file->code[assem].type = slang_asm_jump;
- file->code[assem].param[0] = flow->loop_start;
- break;
- case slang_oper_discard:
- file->code[assem].type = slang_asm_discard;
- if (!slang_assembly_file_push (file, slang_asm_exit))
- return 0;
- break;
- case slang_oper_return:
- if (info->ret_size != 0)
- {
- slang_assembly_stack_info stk;
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, 0, info->ret_size))
- return 0;
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- if (!_slang_assemble_assignment (file, op->children, space, info))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
- }
- if (!slang_assembly_file_push_label (file, slang_asm_jump, flow->function_end))
- return 0;
- break;
- case slang_oper_expression:
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- }
- break;
- case slang_oper_if:
- if (!_slang_assemble_if (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_while:
- if (!_slang_assemble_while (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_do:
- if (!_slang_assemble_do (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_for:
- if (!_slang_assemble_for (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_void:
- break;
- case slang_oper_literal_bool:
- file->code[assem].type = slang_asm_bool_push;
- file->code[assem].literal = op->literal;
- break;
- case slang_oper_literal_int:
- file->code[assem].type = slang_asm_int_push;
- file->code[assem].literal = op->literal;
- break;
- case slang_oper_literal_float:
- file->code[assem].type = slang_asm_float_push;
- file->code[assem].literal = op->literal;
- break;
- case slang_oper_identifier:
- {
- slang_variable *var;
- unsigned int size;
- var = _slang_locate_variable (op->locals, op->identifier, 1);
- if (var == NULL)
- return 0;
- size = 0;
- if (!sizeof_variable (&var->type.specifier, slang_qual_none, var->array_size, space,
- &size))
- return 0;
- if (var->initializer != NULL)
- {
- assert (!"var->initializer, oper_identifier");
- }
- else
- {
- if (!reference)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr,
- info->addr_tmp, 4))
- return 0;
- }
- /* XXX: globals! */
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, var->address,
- size))
- return 0;
- if (!reference)
- {
- if (!slang_assembly_file_push (file, slang_asm_addr_copy))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
- if (!dereference (file, op, space, info))
- return 0;
- }
- }
- }
- break;
- case slang_oper_sequence:
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children, 0, space))
- return 0;
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info,
- &stk))
- return 0;
- /* TODO: inspect stk */
- }
- break;
- case slang_oper_assign:
- if (!_slang_assemble_assign (file, op, "=", reference, space, info))
- return 0;
- break;
- case slang_oper_addassign:
- if (!_slang_assemble_assign (file, op, "+=", reference, space, info))
- return 0;
- break;
- case slang_oper_subassign:
- if (!_slang_assemble_assign (file, op, "-=", reference, space, info))
- return 0;
- break;
- case slang_oper_mulassign:
- if (!_slang_assemble_assign (file, op, "*=", reference, space, info))
- return 0;
- break;
- /*case slang_oper_modassign:*/
- /*case slang_oper_lshassign:*/
- /*case slang_oper_rshassign:*/
- /*case slang_oper_orassign:*/
- /*case slang_oper_xorassign:*/
- /*case slang_oper_andassign:*/
- case slang_oper_divassign:
- if (!_slang_assemble_assign (file, op, "/=", reference, space, info))
- return 0;
- break;
- case slang_oper_select:
- if (!_slang_assemble_select (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_logicalor:
- if (!_slang_assemble_logicalor (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_logicaland:
- if (!_slang_assemble_logicaland (file, op, flow, space, info))
- return 0;
- break;
- case slang_oper_logicalxor:
- if (!call_function_name (file, "^^", op->children, 2, 0, space, info))
- return 0;
- break;
- /*case slang_oper_bitor:*/
- /*case slang_oper_bitxor:*/
- /*case slang_oper_bitand:*/
- case slang_oper_less:
- if (!call_function_name (file, "<", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_greater:
- if (!call_function_name (file, ">", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_lessequal:
- if (!call_function_name (file, "<=", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_greaterequal:
- if (!call_function_name (file, ">=", op->children, 2, 0, space, info))
- return 0;
- break;
- /*case slang_oper_lshift:*/
- /*case slang_oper_rshift:*/
- case slang_oper_add:
- if (!call_function_name (file, "+", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_subtract:
- if (!call_function_name (file, "-", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_multiply:
- if (!call_function_name (file, "*", op->children, 2, 0, space, info))
- return 0;
- break;
- /*case slang_oper_modulus:*/
- case slang_oper_divide:
- if (!call_function_name (file, "/", op->children, 2, 0, space, info))
- return 0;
- break;
- case slang_oper_equal:
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- if (!equality (file, op->children, space, info, 1))
- return 0;
- }
- break;
- case slang_oper_notequal:
- {
- slang_assembly_stack_info stk;
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
- if (!equality (file, op->children, space, info, 0))
- return 0;
- }
- break;
- case slang_oper_preincrement:
- if (!_slang_assemble_assign (file, op, "++", reference, space, info))
- return 0;
- break;
- case slang_oper_predecrement:
- if (!_slang_assemble_assign (file, op, "--", reference, space, info))
- return 0;
- break;
- case slang_oper_plus:
- if (!call_function_name (file, "+", op->children, 1, 0, space, info))
- return 0;
- break;
- case slang_oper_minus:
- if (!call_function_name (file, "-", op->children, 1, 0, space, info))
- return 0;
- break;
- /*case slang_oper_complement:*/
- case slang_oper_not:
- if (!call_function_name (file, "!", op->children, 1, 0, space, info))
- return 0;
- break;
- case slang_oper_subscript:
- {
- slang_assembly_stack_info _stk;
- slang_assembly_typeinfo ti_arr, ti_elem;
- unsigned int arr_size = 0, elem_size = 0;
- if (!_slang_assemble_operation (file, op->children, reference, flow, space, info,
- &_stk))
- return 0;
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &_stk))
- return 0;
- slang_assembly_typeinfo_construct (&ti_arr);
- if (!_slang_typeof_operation (op->children, space, &ti_arr))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- return 0;
- }
- if (!sizeof_variable (&ti_arr.spec, slang_qual_none, NULL, space, &arr_size))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- return 0;
- }
- slang_assembly_typeinfo_construct (&ti_elem);
- if (!_slang_typeof_operation (op, space, &ti_elem))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (!sizeof_variable (&ti_elem.spec, slang_qual_none, NULL, space, &elem_size))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (!slang_assembly_file_push (file, slang_asm_int_to_addr))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (!slang_assembly_file_push_label (file, slang_asm_addr_push, elem_size))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (!slang_assembly_file_push (file, slang_asm_addr_multiply))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (reference)
- {
- if (!slang_assembly_file_push (file, slang_asm_addr_add))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- }
- else
- {
- unsigned int i;
- for (i = 0; i < elem_size; i += 4)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_float_move,
- arr_size - elem_size + i + 4, i + 4))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- }
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- if (!slang_assembly_file_push_label (file, slang_asm_local_free,
- arr_size - elem_size))
- {
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- return 0;
- }
- }
- slang_assembly_typeinfo_destruct (&ti_arr);
- slang_assembly_typeinfo_destruct (&ti_elem);
- }
- break;
- case slang_oper_call:
- {
- slang_function *fun = _slang_locate_function (op->identifier, op->children,
- op->num_children, space);
- if (fun == NULL)
- {
- if (!_slang_assemble_constructor (file, op, flow, space, info))
- return 0;
- }
- else
- {
- if (!call_function (file, fun, op->children, op->num_children, 0, space, info))
- return 0;
- }
- }
- break;
- case slang_oper_field:
- {
- slang_assembly_typeinfo ti_after, ti_before;
- slang_assembly_stack_info _stk;
- slang_assembly_typeinfo_construct (&ti_after);
- if (!_slang_typeof_operation (op, space, &ti_after))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- return 0;
- }
- slang_assembly_typeinfo_construct (&ti_before);
- if (!_slang_typeof_operation (op->children, space, &ti_before))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- if (!reference && ti_after.is_swizzled)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr,
- info->swizzle_tmp, 16))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- }
- if (!_slang_assemble_operation (file, op->children, reference, flow, space, info,
- &_stk))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- /* TODO: inspect stk */
- if (ti_after.is_swizzled)
- {
- if (reference)
- {
- if (ti_after.swz.num_components == 1)
- {
- if (!slang_assembly_file_push_label (file, slang_asm_addr_push,
- ti_after.swz.swizzle[0] * 4))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- if (!slang_assembly_file_push (file, slang_asm_addr_add))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- }
- else
- {
- unsigned int i;
- for (i = 0; i < ti_after.swz.num_components; i++)
- stk->swizzle_mask |= 1 << ti_after.swz.swizzle[i];
- }
- }
- else
- {
- if (!_slang_assemble_constructor_from_swizzle (file, &ti_after.swz,
- &ti_after.spec, &ti_before.spec, info))
- {
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- return 0;
- }
- }
- }
- else
- {
- if (reference)
- {
- /* TODO: struct field address */
- }
- else
- {
- /* TODO: struct field value */
- }
- }
- slang_assembly_typeinfo_destruct (&ti_after);
- slang_assembly_typeinfo_destruct (&ti_before);
- }
- break;
- case slang_oper_postincrement:
- if (!call_function_name_dummyint (file, "++", op->children, space, info))
- return 0;
- if (!dereference (file, op, space, info))
- return 0;
- break;
- case slang_oper_postdecrement:
- if (!call_function_name_dummyint (file, "--", op->children, space, info))
- return 0;
- if (!dereference (file, op, space, info))
- return 0;
- break;
- default:
- return 0;
- }
- return 1;
-}
-
-
-
-
-
-
-
-
-
-void xxx_first (slang_assembly_file *file)
-{
- slang_assembly_file_push (file, slang_asm_jump);
-}
-
-void xxx_prolog (slang_assembly_file *file, unsigned int addr)
-{
- file->code[0].param[0] = file->count;
- slang_assembly_file_push_label (file, slang_asm_call, addr);
- slang_assembly_file_push (file, slang_asm_exit);
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_assemble.c
+ * slang intermediate code assembler
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+#include "slang_assemble.h"
+#include "slang_compile.h"
+#include "slang_storage.h"
+#include "slang_assemble_constructor.h"
+#include "slang_assemble_typeinfo.h"
+#include "slang_assemble_conditional.h"
+#include "slang_assemble_assignment.h"
+
+/* slang_assembly */
+
+static void slang_assembly_construct (slang_assembly *assem)
+{
+ assem->type = slang_asm_none;
+}
+
+static void slang_assembly_destruct (slang_assembly *assem)
+{
+}
+
+/* slang_assembly_file */
+
+void slang_assembly_file_construct (slang_assembly_file *file)
+{
+ file->code = NULL;
+ file->count = 0;
+}
+
+void slang_assembly_file_destruct (slang_assembly_file *file)
+{
+ unsigned int i;
+
+ for (i = 0; i < file->count; i++)
+ slang_assembly_destruct (file->code + i);
+ slang_alloc_free (file->code);
+}
+
+static int slang_assembly_file_push_new (slang_assembly_file *file)
+{
+ file->code = (slang_assembly *) slang_alloc_realloc (file->code, file->count * sizeof (
+ slang_assembly), (file->count + 1) * sizeof (slang_assembly));
+ if (file->code != NULL)
+ {
+ slang_assembly_construct (file->code + file->count);
+ file->count++;
+ return 1;
+ }
+ return 0;
+}
+
+static int slang_assembly_file_push_general (slang_assembly_file *file, slang_assembly_type type,
+ GLfloat literal, GLuint label, GLuint size)
+{
+ slang_assembly *assem;
+ if (!slang_assembly_file_push_new (file))
+ return 0;
+ assem = file->code + file->count - 1;
+ assem->type = type;
+ assem->literal = literal;
+ assem->param[0] = label;
+ assem->param[1] = size;
+ return 1;
+}
+
+int slang_assembly_file_push (slang_assembly_file *file, slang_assembly_type type)
+{
+ return slang_assembly_file_push_general (file, type, (GLfloat) 0, 0, 0);
+}
+
+int slang_assembly_file_push_label (slang_assembly_file *file, slang_assembly_type type,
+ GLuint label)
+{
+ return slang_assembly_file_push_general (file, type, (GLfloat) 0, label, 0);
+}
+
+int slang_assembly_file_push_label2 (slang_assembly_file *file, slang_assembly_type type,
+ GLuint label1, GLuint label2)
+{
+ return slang_assembly_file_push_general (file, type, (GLfloat) 0, label1, label2);
+}
+
+int slang_assembly_file_push_literal (slang_assembly_file *file, slang_assembly_type type,
+ GLfloat literal)
+{
+ return slang_assembly_file_push_general (file, type, literal, 0, 0);
+}
+
+/* utility functions */
+
+static int sizeof_variable (slang_type_specifier *spec, slang_type_qualifier qual,
+ slang_operation *array_size, slang_assembly_name_space *space, unsigned int *size)
+{
+ slang_storage_aggregate agg;
+
+ slang_storage_aggregate_construct (&agg);
+ if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs))
+ {
+ slang_storage_aggregate_destruct (&agg);
+ return 0;
+ }
+ *size += _slang_sizeof_aggregate (&agg);
+ if (qual == slang_qual_out || qual == slang_qual_inout)
+ *size += 4;
+ slang_storage_aggregate_destruct (&agg);
+ return 1;
+}
+
+static int sizeof_variable2 (slang_variable *var, slang_assembly_name_space *space,
+ unsigned int *size)
+{
+ var->address = *size;
+ if (var->type.qualifier == slang_qual_out || var->type.qualifier == slang_qual_inout)
+ var->address += 4;
+ return sizeof_variable (&var->type.specifier, var->type.qualifier, var->array_size, space,
+ size);
+}
+
+static int sizeof_variables (slang_variable_scope *vars, unsigned int start, unsigned int stop,
+ slang_assembly_name_space *space, unsigned int *size)
+{
+ unsigned int i;
+
+ for (i = start; i < stop; i++)
+ if (!sizeof_variable2 (vars->variables + i, space, size))
+ return 0;
+ return 1;
+}
+
+static int collect_locals (slang_operation *op, slang_assembly_name_space *space,
+ unsigned int *size)
+{
+ unsigned int i;
+
+ if (!sizeof_variables (op->locals, 0, op->locals->num_variables, space, size))
+ return 0;
+ for (i = 0; i < op->num_children; i++)
+ if (!collect_locals (op->children + i, space, size))
+ return 0;
+ return 1;
+}
+
+/* _slang_locate_function() */
+
+slang_function *_slang_locate_function (const char *name, slang_operation *params,
+ unsigned int num_params, slang_assembly_name_space *space)
+{
+ unsigned int i;
+
+ for (i = 0; i < space->funcs->num_functions; i++)
+ {
+ unsigned int j;
+ slang_function *f = space->funcs->functions + i;
+
+ if (slang_string_compare (name, f->header.name) != 0)
+ continue;
+ if (f->param_count != num_params)
+ continue;
+ for (j = 0; j < num_params; j++)
+ {
+ slang_assembly_typeinfo ti;
+ slang_assembly_typeinfo_construct (&ti);
+ if (!_slang_typeof_operation (params + j, space, &ti))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+ if (!slang_type_specifier_equal (&ti.spec, &f->parameters->variables[j].type.specifier))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ break;
+ }
+ slang_assembly_typeinfo_destruct (&ti);
+ /* "out" and "inout" formal parameter requires the actual parameter to be l-value */
+ if (!ti.can_be_referenced &&
+ (f->parameters->variables[j].type.qualifier == slang_qual_out ||
+ f->parameters->variables[j].type.qualifier == slang_qual_inout))
+ break;
+ }
+ if (j == num_params)
+ return f;
+ }
+ if (space->funcs->outer_scope != NULL)
+ {
+ slang_assembly_name_space my_space = *space;
+ my_space.funcs = space->funcs->outer_scope;
+ return _slang_locate_function (name, params, num_params, &my_space);
+ }
+ return NULL;
+}
+
+/* _slang_assemble_function() */
+
+int _slang_assemble_function (slang_assembly_file *file, slang_function *fun,
+ slang_assembly_name_space *space)
+{
+ unsigned int param_size, local_size;
+ unsigned int skip, cleanup;
+ slang_assembly_flow_control flow;
+ slang_assembly_local_info info;
+ slang_assembly_stack_info stk;
+
+ fun->address = file->count;
+
+ if (fun->body == NULL)
+ {
+ /* TODO: jump to the actual function body */
+ return 1;
+ }
+
+ /* calculate return value and parameters size */
+ param_size = 0;
+ if (fun->header.type.specifier.type != slang_spec_void)
+ if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space,
+ &param_size))
+ return 0;
+ info.ret_size = param_size;
+ if (!sizeof_variables (fun->parameters, 0, fun->param_count, space, &param_size))
+ return 0;
+
+ /* calculate local variables size, take into account the four-byte return address and
+ temporaries for various tasks */
+ info.addr_tmp = param_size + 4;
+ info.swizzle_tmp = param_size + 4 + 4;
+ local_size = param_size + 4 + 4 + 16;
+ if (!sizeof_variables (fun->parameters, fun->param_count, fun->parameters->num_variables, space,
+ &local_size))
+ return 0;
+ if (!collect_locals (fun->body, space, &local_size))
+ return 0;
+
+ /* allocate local variable storage */
+ if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, local_size - param_size - 4))
+ return 0;
+
+ /* mark a new frame for function variable storage */
+ if (!slang_assembly_file_push_label (file, slang_asm_enter, local_size))
+ return 0;
+
+ /* skip the cleanup jump */
+ skip = file->count;
+ if (!slang_assembly_file_push_new (file))
+ return 0;
+ file->code[skip].type = slang_asm_jump;
+
+ /* all "return" statements will be directed here */
+ flow.function_end = file->count;
+ cleanup = file->count;
+ if (!slang_assembly_file_push_new (file))
+ return 0;
+ file->code[cleanup].type = slang_asm_jump;
+
+ /* execute the function body */
+ file->code[skip].param[0] = file->count;
+ if (!_slang_assemble_operation (file, fun->body, 0, &flow, space, &info, &stk))
+ return 0;
+
+ /* this is the end of the function - restore the old function frame */
+ file->code[cleanup].param[0] = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_leave))
+ return 0;
+
+ /* free local variable storage */
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, local_size - param_size - 4))
+ return 0;
+
+ /* jump out of the function */
+ if (!slang_assembly_file_push (file, slang_asm_return))
+ return 0;
+ return 1;
+}
+
+int _slang_cleanup_stack (slang_assembly_file *file, slang_operation *op, int ref,
+ slang_assembly_name_space *space)
+{
+ slang_assembly_typeinfo ti;
+ unsigned int size;
+
+ slang_assembly_typeinfo_construct (&ti);
+ if (!_slang_typeof_operation (op, space, &ti))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+ if (ti.spec.type == slang_spec_void)
+ size = 0;
+ else if (ref)
+ size = 4;
+ else
+ {
+ size = 0;
+ if (!sizeof_variable (&ti.spec, slang_qual_none, NULL, space, &size))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+ }
+ slang_assembly_typeinfo_destruct (&ti);
+ if (size != 0)
+ {
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, size))
+ return 0;
+ }
+ return 1;
+}
+
+/* _slang_assemble_operation() */
+
+/* XXX: general swizzle! */
+static int dereference_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
+ unsigned int index, unsigned int *size, slang_assembly_local_info *info)
+{
+ unsigned int i;
+
+ for (i = agg->count; i > 0; i--)
+ {
+ const slang_storage_array *arr = agg->arrays + i - 1;
+ unsigned int j;
+
+ for (j = arr->length; j > 0; j--)
+ {
+ if (arr->type == slang_stor_aggregate)
+ {
+ if (!dereference_aggregate (file, arr->aggregate, index, size, info))
+ return 0;
+ }
+ else
+ {
+ *size -= 4;
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp,
+ 4))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_deref))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_addr_push, *size))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_add))
+ return 0;
+ switch (arr->type)
+ {
+ case slang_stor_bool:
+ if (!slang_assembly_file_push (file, slang_asm_bool_deref))
+ return 0;
+ break;
+ case slang_stor_int:
+ if (!slang_assembly_file_push (file, slang_asm_int_deref))
+ return 0;
+ break;
+ case slang_stor_float:
+ if (!slang_assembly_file_push (file, slang_asm_float_deref))
+ return 0;
+ break;
+ }
+ index += 4;
+ }
+ }
+ }
+ return 1;
+}
+/* XXX: general swizzle! */
+int dereference (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_name_space *space, slang_assembly_local_info *info)
+{
+ slang_assembly_typeinfo ti;
+ int result;
+ slang_storage_aggregate agg;
+ unsigned int size;
+
+ slang_assembly_typeinfo_construct (&ti);
+ if (!_slang_typeof_operation (op, space, &ti))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+
+ slang_storage_aggregate_construct (&agg);
+ if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
+ {
+ slang_storage_aggregate_destruct (&agg);
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+
+ size = _slang_sizeof_aggregate (&agg);
+ result = dereference_aggregate (file, &agg, 0, &size, info);
+
+ slang_storage_aggregate_destruct (&agg);
+ slang_assembly_typeinfo_destruct (&ti);
+ return result;
+}
+
+static int call_function (slang_assembly_file *file, slang_function *fun, slang_operation *params,
+ unsigned int param_count, int assignment, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ unsigned int i;
+ slang_assembly_stack_info stk;
+
+ /* make room for the return value, if any */
+ if (fun->header.type.specifier.type != slang_spec_void)
+ {
+ unsigned int ret_size = 0;
+ if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, &ret_size))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, ret_size))
+ return 0;
+ }
+
+ /* push the actual parameters on the stack */
+ for (i = 0; i < param_count; i++)
+ {
+ slang_assembly_flow_control flow;
+
+ if (fun->parameters->variables[i].type.qualifier == slang_qual_inout ||
+ fun->parameters->variables[i].type.qualifier == slang_qual_out)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4))
+ return 0;
+ /* TODO: optimize the "out" parameter case */
+ /* TODO: inspect stk */
+ if (!_slang_assemble_operation (file, params + i, 1, &flow, space, info, &stk))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_copy))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_deref))
+ return 0;
+ if (i == 0 && assignment)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp,
+ 4))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_deref))
+ return 0;
+ }
+ if (!dereference (file, params, space, info))
+ return 0;
+ }
+ else
+ {
+ /* TODO: for "out" and "inout" parameters also push the address (first) */
+ /* TODO: optimize the "out" parameter case */
+ /* TODO: inspect stk */
+ if (!_slang_assemble_operation (file, params + i, 0, &flow, space, info, &stk))
+ return 0;
+ }
+ }
+
+ /* call the function */
+ if (!slang_assembly_file_push_label (file, slang_asm_call, fun->address))
+ return 0;
+
+ /* pop the parameters from the stack */
+ for (i = param_count; i > 0; i--)
+ {
+ unsigned int j = i - 1;
+ if (fun->parameters->variables[j].type.qualifier == slang_qual_inout ||
+ fun->parameters->variables[j].type.qualifier == slang_qual_out)
+ {
+ if (!_slang_assemble_assignment (file, params + j, space, info))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+ }
+ else
+ {
+ if (!_slang_cleanup_stack (file, params + j, 0, space))
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params,
+ unsigned int param_count, int assignment, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ slang_function *fun = _slang_locate_function (name, params, param_count, space);
+ if (fun == NULL)
+ return 0;
+ return call_function (file, fun, params, param_count, assignment, space, info);
+}
+
+static int call_function_name_dummyint (slang_assembly_file *file, const char *name,
+ slang_operation *params, slang_assembly_name_space *space, slang_assembly_local_info *info)
+{
+ slang_operation p2[2];
+ int result;
+
+ p2[0] = *params;
+ if (!slang_operation_construct_a (p2 + 1))
+ return 0;
+ p2[1].type = slang_oper_literal_int;
+ result = call_function_name (file, name, p2, 2, 0, space, info);
+ slang_operation_destruct (p2 + 1);
+ return result;
+}
+
+static int call_asm_instruction (slang_assembly_file *file, const char *name)
+{
+ const struct
+ {
+ const char *name;
+ slang_assembly_type code1, code2;
+ } inst[] = {
+ { "float_to_int", slang_asm_float_to_int, slang_asm_int_copy },
+ { "int_to_float", slang_asm_int_to_float, slang_asm_float_copy },
+ { "float_copy", slang_asm_float_copy, slang_asm_none },
+ { "int_copy", slang_asm_int_copy, slang_asm_none },
+ { "bool_copy", slang_asm_bool_copy, slang_asm_none },
+ { "float_add", slang_asm_float_add, slang_asm_float_copy },
+ { "float_multiply", slang_asm_float_multiply, slang_asm_float_copy },
+ { "float_divide", slang_asm_float_divide, slang_asm_float_copy },
+ { "float_negate", slang_asm_float_negate, slang_asm_float_copy },
+ { "float_less", slang_asm_float_less, slang_asm_bool_copy },
+ { "float_equal", slang_asm_float_equal, slang_asm_bool_copy },
+ { NULL, slang_asm_none, slang_asm_none }
+ };
+ unsigned int i;
+
+ for (i = 0; inst[i].name != NULL; i++)
+ if (slang_string_compare (name, inst[i].name) == 0)
+ break;
+ if (inst[i].name == NULL)
+ return 0;
+
+ if (!slang_assembly_file_push_label2 (file, inst[i].code1, 4, 0))
+ return 0;
+ if (inst[i].code2 != slang_asm_none)
+ if (!slang_assembly_file_push_label2 (file, inst[i].code2, 4, 0))
+ return 0;
+
+ /* clean-up the stack from the remaining dst address */
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+
+ return 1;
+}
+
+/* XXX: general swizzle! */
+static int equality_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
+ unsigned int *index, unsigned int size, slang_assembly_local_info *info, unsigned int z_label)
+{
+ unsigned int i;
+
+ for (i = 0; i < agg->count; i++)
+ {
+ const slang_storage_array *arr = agg->arrays + i;
+ unsigned int j;
+
+ for (j = 0; j < arr->length; j++)
+ {
+ if (arr->type == slang_stor_aggregate)
+ {
+ if (!equality_aggregate (file, arr->aggregate, index, size, info, z_label))
+ return 0;
+ }
+ else
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_float_equal, size + *index,
+ *index))
+ return 0;
+ *index += 4;
+ if (!slang_assembly_file_push_label (file, slang_asm_jump_if_zero, z_label))
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+/* XXX: general swizzle! */
+static int equality (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_name_space *space, slang_assembly_local_info *info, int equal)
+{
+ slang_assembly_typeinfo ti;
+ int result;
+ slang_storage_aggregate agg;
+ unsigned int index, size;
+ unsigned int skip_jump, true_label, true_jump, false_label, false_jump;
+
+ /* get type of operation */
+ slang_assembly_typeinfo_construct (&ti);
+ if (!_slang_typeof_operation (op, space, &ti))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+
+ /* convert it to an aggregate */
+ slang_storage_aggregate_construct (&agg);
+ if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
+ goto end;
+
+ /* compute the size of the agregate - there are two such aggregates on the stack */
+ size = _slang_sizeof_aggregate (&agg);
+
+ /* jump to the actual data-comparison code */
+ skip_jump = file->count;
+ if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
+ goto end;
+
+ /* pop off the stack the compared data and push 1 */
+ true_label = file->count;
+ if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2)))
+ goto end;
+ if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f)))
+ goto end;
+ true_jump = file->count;
+ if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
+ goto end;
+
+ false_label = file->count;
+ if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2)))
+ goto end;
+ if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 0.0f)))
+ goto end;
+ false_jump = file->count;
+ if (!(result = slang_assembly_file_push (file, slang_asm_jump)))
+ goto end;
+
+ file->code[skip_jump].param[0] = file->count;
+
+ /* compare the data on stack, it will eventually jump either to true or false label */
+ index = 0;
+ if (!(result = equality_aggregate (file, &agg, &index, size, info,
+ equal ? false_label : true_label)))
+ goto end;
+ if (!(result = slang_assembly_file_push_label (file, slang_asm_jump,
+ equal ? true_label : false_label)))
+ goto end;
+
+ file->code[true_jump].param[0] = file->count;
+ file->code[false_jump].param[0] = file->count;
+
+ result = 1;
+end:
+ slang_storage_aggregate_destruct (&agg);
+ slang_assembly_typeinfo_destruct (&ti);
+ return result;
+}
+
+int _slang_assemble_operation (slang_assembly_file *file, slang_operation *op, int reference,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info, slang_assembly_stack_info *stk)
+{
+ unsigned int assem;
+
+ stk->swizzle_mask = 0;
+
+ assem = file->count;
+ if (!slang_assembly_file_push_new (file))
+ return 0;
+
+ switch (op->type)
+ {
+ case slang_oper_block_no_new_scope:
+ case slang_oper_block_new_scope:
+ {
+ unsigned int i;
+ for (i = 0; i < op->num_children; i++)
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children + i, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + i, 0, space))
+ return 0;
+ }
+ }
+ break;
+ case slang_oper_variable_decl:
+ {
+ unsigned int i;
+
+ for (i = 0; i < op->num_children; i++)
+ {
+ /* TODO: perform initialization of op->children[i] */
+ /* TODO: clean-up stack */
+ }
+ }
+ break;
+ case slang_oper_asm:
+ {
+ unsigned int i;
+ for (i = 0; i < op->num_children; i++)
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children + i, i == 0, flow, space, info,
+ &stk))
+ return 0;
+ /* TODO: inspect stk */
+ }
+ if (!call_asm_instruction (file, op->identifier))
+ return 0;
+ }
+ break;
+ case slang_oper_break:
+ file->code[assem].type = slang_asm_jump;
+ file->code[assem].param[0] = flow->loop_end;
+ break;
+ case slang_oper_continue:
+ file->code[assem].type = slang_asm_jump;
+ file->code[assem].param[0] = flow->loop_start;
+ break;
+ case slang_oper_discard:
+ file->code[assem].type = slang_asm_discard;
+ if (!slang_assembly_file_push (file, slang_asm_exit))
+ return 0;
+ break;
+ case slang_oper_return:
+ if (info->ret_size != 0)
+ {
+ slang_assembly_stack_info stk;
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, 0, info->ret_size))
+ return 0;
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ if (!_slang_assemble_assignment (file, op->children, space, info))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+ }
+ if (!slang_assembly_file_push_label (file, slang_asm_jump, flow->function_end))
+ return 0;
+ break;
+ case slang_oper_expression:
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ }
+ break;
+ case slang_oper_if:
+ if (!_slang_assemble_if (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_while:
+ if (!_slang_assemble_while (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_do:
+ if (!_slang_assemble_do (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_for:
+ if (!_slang_assemble_for (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_void:
+ break;
+ case slang_oper_literal_bool:
+ file->code[assem].type = slang_asm_bool_push;
+ file->code[assem].literal = op->literal;
+ break;
+ case slang_oper_literal_int:
+ file->code[assem].type = slang_asm_int_push;
+ file->code[assem].literal = op->literal;
+ break;
+ case slang_oper_literal_float:
+ file->code[assem].type = slang_asm_float_push;
+ file->code[assem].literal = op->literal;
+ break;
+ case slang_oper_identifier:
+ {
+ slang_variable *var;
+ unsigned int size;
+ var = _slang_locate_variable (op->locals, op->identifier, 1);
+ if (var == NULL)
+ return 0;
+ size = 0;
+ if (!sizeof_variable (&var->type.specifier, slang_qual_none, var->array_size, space,
+ &size))
+ return 0;
+ if (var->initializer != NULL)
+ {
+ assert (!"var->initializer, oper_identifier");
+ }
+ else
+ {
+ if (!reference)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr,
+ info->addr_tmp, 4))
+ return 0;
+ }
+ /* XXX: globals! */
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, var->address,
+ size))
+ return 0;
+ if (!reference)
+ {
+ if (!slang_assembly_file_push (file, slang_asm_addr_copy))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+ if (!dereference (file, op, space, info))
+ return 0;
+ }
+ }
+ }
+ break;
+ case slang_oper_sequence:
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children, 0, space))
+ return 0;
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info,
+ &stk))
+ return 0;
+ /* TODO: inspect stk */
+ }
+ break;
+ case slang_oper_assign:
+ if (!_slang_assemble_assign (file, op, "=", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_addassign:
+ if (!_slang_assemble_assign (file, op, "+=", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_subassign:
+ if (!_slang_assemble_assign (file, op, "-=", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_mulassign:
+ if (!_slang_assemble_assign (file, op, "*=", reference, space, info))
+ return 0;
+ break;
+ /*case slang_oper_modassign:*/
+ /*case slang_oper_lshassign:*/
+ /*case slang_oper_rshassign:*/
+ /*case slang_oper_orassign:*/
+ /*case slang_oper_xorassign:*/
+ /*case slang_oper_andassign:*/
+ case slang_oper_divassign:
+ if (!_slang_assemble_assign (file, op, "/=", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_select:
+ if (!_slang_assemble_select (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_logicalor:
+ if (!_slang_assemble_logicalor (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_logicaland:
+ if (!_slang_assemble_logicaland (file, op, flow, space, info))
+ return 0;
+ break;
+ case slang_oper_logicalxor:
+ if (!call_function_name (file, "^^", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ /*case slang_oper_bitor:*/
+ /*case slang_oper_bitxor:*/
+ /*case slang_oper_bitand:*/
+ case slang_oper_less:
+ if (!call_function_name (file, "<", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_greater:
+ if (!call_function_name (file, ">", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_lessequal:
+ if (!call_function_name (file, "<=", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_greaterequal:
+ if (!call_function_name (file, ">=", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ /*case slang_oper_lshift:*/
+ /*case slang_oper_rshift:*/
+ case slang_oper_add:
+ if (!call_function_name (file, "+", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_subtract:
+ if (!call_function_name (file, "-", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_multiply:
+ if (!call_function_name (file, "*", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ /*case slang_oper_modulus:*/
+ case slang_oper_divide:
+ if (!call_function_name (file, "/", op->children, 2, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_equal:
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ if (!equality (file, op->children, space, info, 1))
+ return 0;
+ }
+ break;
+ case slang_oper_notequal:
+ {
+ slang_assembly_stack_info stk;
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+ if (!equality (file, op->children, space, info, 0))
+ return 0;
+ }
+ break;
+ case slang_oper_preincrement:
+ if (!_slang_assemble_assign (file, op, "++", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_predecrement:
+ if (!_slang_assemble_assign (file, op, "--", reference, space, info))
+ return 0;
+ break;
+ case slang_oper_plus:
+ if (!call_function_name (file, "+", op->children, 1, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_minus:
+ if (!call_function_name (file, "-", op->children, 1, 0, space, info))
+ return 0;
+ break;
+ /*case slang_oper_complement:*/
+ case slang_oper_not:
+ if (!call_function_name (file, "!", op->children, 1, 0, space, info))
+ return 0;
+ break;
+ case slang_oper_subscript:
+ {
+ slang_assembly_stack_info _stk;
+ slang_assembly_typeinfo ti_arr, ti_elem;
+ unsigned int arr_size = 0, elem_size = 0;
+ if (!_slang_assemble_operation (file, op->children, reference, flow, space, info,
+ &_stk))
+ return 0;
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &_stk))
+ return 0;
+ slang_assembly_typeinfo_construct (&ti_arr);
+ if (!_slang_typeof_operation (op->children, space, &ti_arr))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ return 0;
+ }
+ if (!sizeof_variable (&ti_arr.spec, slang_qual_none, NULL, space, &arr_size))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ return 0;
+ }
+ slang_assembly_typeinfo_construct (&ti_elem);
+ if (!_slang_typeof_operation (op, space, &ti_elem))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (!sizeof_variable (&ti_elem.spec, slang_qual_none, NULL, space, &elem_size))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (!slang_assembly_file_push (file, slang_asm_int_to_addr))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (!slang_assembly_file_push_label (file, slang_asm_addr_push, elem_size))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (!slang_assembly_file_push (file, slang_asm_addr_multiply))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (reference)
+ {
+ if (!slang_assembly_file_push (file, slang_asm_addr_add))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < elem_size; i += 4)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_float_move,
+ arr_size - elem_size + i + 4, i + 4))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ }
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free,
+ arr_size - elem_size))
+ {
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ return 0;
+ }
+ }
+ slang_assembly_typeinfo_destruct (&ti_arr);
+ slang_assembly_typeinfo_destruct (&ti_elem);
+ }
+ break;
+ case slang_oper_call:
+ {
+ slang_function *fun = _slang_locate_function (op->identifier, op->children,
+ op->num_children, space);
+ if (fun == NULL)
+ {
+ if (!_slang_assemble_constructor (file, op, flow, space, info))
+ return 0;
+ }
+ else
+ {
+ if (!call_function (file, fun, op->children, op->num_children, 0, space, info))
+ return 0;
+ }
+ }
+ break;
+ case slang_oper_field:
+ {
+ slang_assembly_typeinfo ti_after, ti_before;
+ slang_assembly_stack_info _stk;
+ slang_assembly_typeinfo_construct (&ti_after);
+ if (!_slang_typeof_operation (op, space, &ti_after))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ return 0;
+ }
+ slang_assembly_typeinfo_construct (&ti_before);
+ if (!_slang_typeof_operation (op->children, space, &ti_before))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ if (!reference && ti_after.is_swizzled)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr,
+ info->swizzle_tmp, 16))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ }
+ if (!_slang_assemble_operation (file, op->children, reference, flow, space, info,
+ &_stk))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ /* TODO: inspect stk */
+ if (ti_after.is_swizzled)
+ {
+ if (reference)
+ {
+ if (ti_after.swz.num_components == 1)
+ {
+ if (!slang_assembly_file_push_label (file, slang_asm_addr_push,
+ ti_after.swz.swizzle[0] * 4))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ if (!slang_assembly_file_push (file, slang_asm_addr_add))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < ti_after.swz.num_components; i++)
+ stk->swizzle_mask |= 1 << ti_after.swz.swizzle[i];
+ }
+ }
+ else
+ {
+ if (!_slang_assemble_constructor_from_swizzle (file, &ti_after.swz,
+ &ti_after.spec, &ti_before.spec, info))
+ {
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ if (reference)
+ {
+ /* TODO: struct field address */
+ }
+ else
+ {
+ /* TODO: struct field value */
+ }
+ }
+ slang_assembly_typeinfo_destruct (&ti_after);
+ slang_assembly_typeinfo_destruct (&ti_before);
+ }
+ break;
+ case slang_oper_postincrement:
+ if (!call_function_name_dummyint (file, "++", op->children, space, info))
+ return 0;
+ if (!dereference (file, op, space, info))
+ return 0;
+ break;
+ case slang_oper_postdecrement:
+ if (!call_function_name_dummyint (file, "--", op->children, space, info))
+ return 0;
+ if (!dereference (file, op, space, info))
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+
+
+
+
+
+
+
+
+void xxx_first (slang_assembly_file *file)
+{
+ slang_assembly_file_push (file, slang_asm_jump);
+}
+
+void xxx_prolog (slang_assembly_file *file, unsigned int addr)
+{
+ file->code[0].param[0] = file->count;
+ slang_assembly_file_push_label (file, slang_asm_call, addr);
+ slang_assembly_file_push (file, slang_asm_exit);
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h
index 69e81d6af..04ba7cf04 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h
@@ -1,145 +1,145 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_H
-#define SLANG_ASSEMBLE_H
-
-#include "slang_compile.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-typedef enum slang_assembly_type_
-{
- /* core */
- slang_asm_none,
- slang_asm_float_copy,
- slang_asm_float_move,
- slang_asm_float_push,
- slang_asm_float_deref,
- slang_asm_float_add,
- slang_asm_float_multiply,
- slang_asm_float_divide,
- slang_asm_float_negate,
- slang_asm_float_less,
- slang_asm_float_equal,
- slang_asm_float_to_int,
- slang_asm_int_copy,
- slang_asm_int_move,
- slang_asm_int_push,
- slang_asm_int_deref,
- slang_asm_int_to_float,
- slang_asm_int_to_addr,
- slang_asm_bool_copy,
- slang_asm_bool_move,
- slang_asm_bool_push,
- slang_asm_bool_deref,
- slang_asm_addr_copy,
- slang_asm_addr_push,
- slang_asm_addr_deref,
- slang_asm_addr_add,
- slang_asm_addr_multiply,
- slang_asm_jump,
- slang_asm_jump_if_zero,
- slang_asm_enter,
- slang_asm_leave,
- slang_asm_local_alloc,
- slang_asm_local_free,
- slang_asm_local_addr,
- slang_asm_call,
- slang_asm_return,
- slang_asm_discard,
- slang_asm_exit,
- slang_asm__last
-} slang_assembly_type;
-
-typedef struct slang_assembly_
-{
- slang_assembly_type type;
- GLfloat literal;
- GLuint param[2];
-} slang_assembly;
-
-typedef struct slang_assembly_file_
-{
- slang_assembly *code;
- unsigned int count;
-} slang_assembly_file;
-
-void slang_assembly_file_construct (slang_assembly_file *);
-void slang_assembly_file_destruct (slang_assembly_file *);
-int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type);
-int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint);
-int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint);
-int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat);
-
-typedef struct slang_assembly_flow_control_
-{
- unsigned int loop_start; /* for "continue" statement */
- unsigned int loop_end; /* for "break" statement */
- unsigned int function_end; /* for "return" statement */
-} slang_assembly_flow_control;
-
-typedef struct slang_assembly_name_space_
-{
- struct slang_function_scope_ *funcs;
- struct slang_struct_scope_ *structs;
- struct slang_variable_scope_ *vars;
-} slang_assembly_name_space;
-
-slang_function *_slang_locate_function (const char *name, slang_operation *params,
- unsigned int num_params, slang_assembly_name_space *space);
-
-int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *,
- slang_assembly_name_space *);
-
-typedef struct slang_assembly_stack_info_
-{
- unsigned int swizzle_mask;
-} slang_assembly_stack_info;
-
-int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref,
- slang_assembly_name_space *);
-
-typedef struct slang_assembly_local_info_
-{
- unsigned int ret_size;
- unsigned int addr_tmp;
- unsigned int swizzle_tmp;
-} slang_assembly_local_info;
-
-int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference,
- slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *,
- slang_assembly_stack_info *);
-
-void xxx_first (slang_assembly_file *);
-void xxx_prolog (slang_assembly_file *, unsigned int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_ASSEMBLE_H
+#define SLANG_ASSEMBLE_H
+
+#include "slang_compile.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+typedef enum slang_assembly_type_
+{
+ /* core */
+ slang_asm_none,
+ slang_asm_float_copy,
+ slang_asm_float_move,
+ slang_asm_float_push,
+ slang_asm_float_deref,
+ slang_asm_float_add,
+ slang_asm_float_multiply,
+ slang_asm_float_divide,
+ slang_asm_float_negate,
+ slang_asm_float_less,
+ slang_asm_float_equal,
+ slang_asm_float_to_int,
+ slang_asm_int_copy,
+ slang_asm_int_move,
+ slang_asm_int_push,
+ slang_asm_int_deref,
+ slang_asm_int_to_float,
+ slang_asm_int_to_addr,
+ slang_asm_bool_copy,
+ slang_asm_bool_move,
+ slang_asm_bool_push,
+ slang_asm_bool_deref,
+ slang_asm_addr_copy,
+ slang_asm_addr_push,
+ slang_asm_addr_deref,
+ slang_asm_addr_add,
+ slang_asm_addr_multiply,
+ slang_asm_jump,
+ slang_asm_jump_if_zero,
+ slang_asm_enter,
+ slang_asm_leave,
+ slang_asm_local_alloc,
+ slang_asm_local_free,
+ slang_asm_local_addr,
+ slang_asm_call,
+ slang_asm_return,
+ slang_asm_discard,
+ slang_asm_exit,
+ slang_asm__last
+} slang_assembly_type;
+
+typedef struct slang_assembly_
+{
+ slang_assembly_type type;
+ GLfloat literal;
+ GLuint param[2];
+} slang_assembly;
+
+typedef struct slang_assembly_file_
+{
+ slang_assembly *code;
+ unsigned int count;
+} slang_assembly_file;
+
+void slang_assembly_file_construct (slang_assembly_file *);
+void slang_assembly_file_destruct (slang_assembly_file *);
+int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type);
+int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint);
+int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint);
+int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat);
+
+typedef struct slang_assembly_flow_control_
+{
+ unsigned int loop_start; /* for "continue" statement */
+ unsigned int loop_end; /* for "break" statement */
+ unsigned int function_end; /* for "return" statement */
+} slang_assembly_flow_control;
+
+typedef struct slang_assembly_name_space_
+{
+ struct slang_function_scope_ *funcs;
+ struct slang_struct_scope_ *structs;
+ struct slang_variable_scope_ *vars;
+} slang_assembly_name_space;
+
+slang_function *_slang_locate_function (const char *name, slang_operation *params,
+ unsigned int num_params, slang_assembly_name_space *space);
+
+int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *,
+ slang_assembly_name_space *);
+
+typedef struct slang_assembly_stack_info_
+{
+ unsigned int swizzle_mask;
+} slang_assembly_stack_info;
+
+int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref,
+ slang_assembly_name_space *);
+
+typedef struct slang_assembly_local_info_
+{
+ unsigned int ret_size;
+ unsigned int addr_tmp;
+ unsigned int swizzle_tmp;
+} slang_assembly_local_info;
+
+int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference,
+ slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *,
+ slang_assembly_stack_info *);
+
+void xxx_first (slang_assembly_file *);
+void xxx_prolog (slang_assembly_file *, unsigned int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c
index 551f5d9b1..488c7a91f 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c
@@ -1,187 +1,187 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_assignment.c
- * slang assignment expressions assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_assemble_assignment.h"
-#include "slang_assemble_typeinfo.h"
-#include "slang_storage.h"
-#include "slang_utility.h"
-
-/*
- _slang_assemble_assignment()
-
- copies values on the stack (<component 0> to <component N-1>) to a memory
- location pointed by <addr of variable>;
-
- in:
- +------------------+
- | addr of variable |
- +------------------+
- | component N-1 |
- | ... |
- | component 0 |
- +------------------+
-
- out:
- +------------------+
- | addr of variable |
- +------------------+
-*/
-/* TODO: add support for swizzle mask */
-static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
- unsigned int *index, unsigned int size, slang_assembly_local_info *info)
-{
- unsigned int i;
-
- for (i = 0; i < agg->count; i++)
- {
- const slang_storage_array *arr = agg->arrays + i;
- unsigned int j;
-
- for (j = 0; j < arr->length; j++)
- {
- if (arr->type == slang_stor_aggregate)
- {
- if (!assign_aggregate (file, arr->aggregate, index, size, info))
- return 0;
- }
- else
- {
- slang_assembly_type ty;
-
- switch (arr->type)
- {
- case slang_stor_bool:
- ty = slang_asm_bool_copy;
- break;
- case slang_stor_int:
- ty = slang_asm_int_copy;
- break;
- case slang_stor_float:
- ty = slang_asm_float_copy;
- break;
- default:
- break;
- }
- if (!slang_assembly_file_push_label2 (file, ty, size - *index, *index))
- return 0;
- *index += 4;
- }
- }
- }
- return 1;
-}
-
-int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op,
- slang_assembly_name_space *space, slang_assembly_local_info *info)
-{
- slang_assembly_typeinfo ti;
- int result;
- slang_storage_aggregate agg;
- unsigned int index, size;
-
- slang_assembly_typeinfo_construct (&ti);
- if (!_slang_typeof_operation (op, space, &ti))
- {
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
-
- slang_storage_aggregate_construct (&agg);
- if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
- {
- slang_storage_aggregate_destruct (&agg);
- slang_assembly_typeinfo_destruct (&ti);
- return 0;
- }
-
- index = 0;
- size = _slang_sizeof_aggregate (&agg);
- result = assign_aggregate (file, &agg, &index, size, info);
-
- slang_storage_aggregate_destruct (&agg);
- slang_assembly_typeinfo_destruct (&ti);
- return result;
-}
-
-/*
- _slang_assemble_assign()
-
- performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's
- children
-*/
-
-int dereference (slang_assembly_file *file, slang_operation *op,
- slang_assembly_name_space *space, slang_assembly_local_info *info);
-
-int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params,
- unsigned int param_count, int assignment, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_assign (slang_assembly_file *file, slang_operation *op, const char *oper,
- int ref, slang_assembly_name_space *space, slang_assembly_local_info *info)
-{
- slang_assembly_stack_info stk;
- slang_assembly_flow_control flow;
-
- if (!ref)
- {
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4))
- return 0;
- }
-
- if (slang_string_compare ("=", oper) == 0)
- {
- if (!_slang_assemble_operation (file, op->children, 1, &flow, space, info, &stk))
- return 0;
- if (!_slang_assemble_operation (file, op->children + 1, 0, &flow, space, info, &stk))
- return 0;
- if (!_slang_assemble_assignment (file, op->children, space, info))
- return 0;
- }
- else
- {
- if (!call_function_name (file, oper, op->children, op->num_children, 1, space, info))
- return 0;
- }
-
- if (!ref)
- {
- if (!slang_assembly_file_push (file, slang_asm_addr_copy))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
- if (!dereference (file, op->children, space, info))
- return 0;
- }
-
- return 1;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_assemble_assignment.c
+ * slang assignment expressions assembler
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_assemble_assignment.h"
+#include "slang_assemble_typeinfo.h"
+#include "slang_storage.h"
+#include "slang_utility.h"
+
+/*
+ _slang_assemble_assignment()
+
+ copies values on the stack (<component 0> to <component N-1>) to a memory
+ location pointed by <addr of variable>;
+
+ in:
+ +------------------+
+ | addr of variable |
+ +------------------+
+ | component N-1 |
+ | ... |
+ | component 0 |
+ +------------------+
+
+ out:
+ +------------------+
+ | addr of variable |
+ +------------------+
+*/
+/* TODO: add support for swizzle mask */
+static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
+ unsigned int *index, unsigned int size, slang_assembly_local_info *info)
+{
+ unsigned int i;
+
+ for (i = 0; i < agg->count; i++)
+ {
+ const slang_storage_array *arr = agg->arrays + i;
+ unsigned int j;
+
+ for (j = 0; j < arr->length; j++)
+ {
+ if (arr->type == slang_stor_aggregate)
+ {
+ if (!assign_aggregate (file, arr->aggregate, index, size, info))
+ return 0;
+ }
+ else
+ {
+ slang_assembly_type ty;
+
+ switch (arr->type)
+ {
+ case slang_stor_bool:
+ ty = slang_asm_bool_copy;
+ break;
+ case slang_stor_int:
+ ty = slang_asm_int_copy;
+ break;
+ case slang_stor_float:
+ ty = slang_asm_float_copy;
+ break;
+ default:
+ break;
+ }
+ if (!slang_assembly_file_push_label2 (file, ty, size - *index, *index))
+ return 0;
+ *index += 4;
+ }
+ }
+ }
+ return 1;
+}
+
+int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_name_space *space, slang_assembly_local_info *info)
+{
+ slang_assembly_typeinfo ti;
+ int result;
+ slang_storage_aggregate agg;
+ unsigned int index, size;
+
+ slang_assembly_typeinfo_construct (&ti);
+ if (!_slang_typeof_operation (op, space, &ti))
+ {
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+
+ slang_storage_aggregate_construct (&agg);
+ if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
+ {
+ slang_storage_aggregate_destruct (&agg);
+ slang_assembly_typeinfo_destruct (&ti);
+ return 0;
+ }
+
+ index = 0;
+ size = _slang_sizeof_aggregate (&agg);
+ result = assign_aggregate (file, &agg, &index, size, info);
+
+ slang_storage_aggregate_destruct (&agg);
+ slang_assembly_typeinfo_destruct (&ti);
+ return result;
+}
+
+/*
+ _slang_assemble_assign()
+
+ performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's
+ children
+*/
+
+int dereference (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_name_space *space, slang_assembly_local_info *info);
+
+int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params,
+ unsigned int param_count, int assignment, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_assign (slang_assembly_file *file, slang_operation *op, const char *oper,
+ int ref, slang_assembly_name_space *space, slang_assembly_local_info *info)
+{
+ slang_assembly_stack_info stk;
+ slang_assembly_flow_control flow;
+
+ if (!ref)
+ {
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4))
+ return 0;
+ }
+
+ if (slang_string_compare ("=", oper) == 0)
+ {
+ if (!_slang_assemble_operation (file, op->children, 1, &flow, space, info, &stk))
+ return 0;
+ if (!_slang_assemble_operation (file, op->children + 1, 0, &flow, space, info, &stk))
+ return 0;
+ if (!_slang_assemble_assignment (file, op->children, space, info))
+ return 0;
+ }
+ else
+ {
+ if (!call_function_name (file, oper, op->children, op->num_children, 1, space, info))
+ return 0;
+ }
+
+ if (!ref)
+ {
+ if (!slang_assembly_file_push (file, slang_asm_addr_copy))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+ if (!dereference (file, op->children, space, info))
+ return 0;
+ }
+
+ return 1;
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h
index 06972ad17..8ffd9e4cd 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h
@@ -1,45 +1,45 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_ASSIGNMENT_H
-#define SLANG_ASSEMBLE_ASSIGNMENT_H
-
-#include "slang_assemble.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-int _slang_assemble_assignment (slang_assembly_file *, slang_operation *,
- slang_assembly_name_space *, slang_assembly_local_info *);
-
-int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref,
- slang_assembly_name_space *, slang_assembly_local_info *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_ASSEMBLE_ASSIGNMENT_H
+#define SLANG_ASSEMBLE_ASSIGNMENT_H
+
+#include "slang_assemble.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+int _slang_assemble_assignment (slang_assembly_file *, slang_operation *,
+ slang_assembly_name_space *, slang_assembly_local_info *);
+
+int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref,
+ slang_assembly_name_space *, slang_assembly_local_info *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c
index 498938bdd..2347475f4 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c
@@ -1,485 +1,485 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_conditional.c
- * slang condtional expressions assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-#include "slang_assemble_conditional.h"
-#include "slang_assemble.h"
-
-/* _slang_assemble_logicaland() */
-
-int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- and:
- <left-expression>
- jumpz zero
- <right-expression>
- jump end
- zero:
- push 0
- end:
- */
-
- unsigned int zero_jump, end_jump;
- slang_assembly_stack_info stk;
-
- /* evaluate left expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to pushing 0 if not true */
- zero_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* evaluate right expression */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to the end of the expression */
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* push 0 on stack */
- file->code[zero_jump].param[0] = file->count;
- if (!slang_assembly_file_push (file, slang_asm_bool_push))
- return 0;
-
- /* the end of the expression */
- file->code[end_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_logicalor() */
-
-int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- or:
- <left-expression>
- jumpz right
- push 1
- jump end
- right:
- <right-expression>
- end:
- */
-
- unsigned int right_jump, end_jump;
- slang_assembly_stack_info stk;
-
- /* evaluate left expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to evaluation of right expression if not true */
- right_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* push 1 on stack */
- if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))
- return 0;
-
- /* jump to the end of the expression */
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* evaluate right expression */
- file->code[right_jump].param[0] = file->count;
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* the end of the expression */
- file->code[end_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_select() */
-
-int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- select:
- <condition-expression>
- jumpz false
- <true-expression>
- jump end
- false:
- <false-expression>
- end:
- */
-
- unsigned int cond_jump, end_jump;
- slang_assembly_stack_info stk;
-
- /* execute condition expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to false expression if not true */
- cond_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* execute true expression */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to the end of the expression */
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* resolve false point */
- file->code[cond_jump].param[0] = file->count;
-
- /* execute false expression */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* resolve the end of the expression */
- file->code[end_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_for() */
-
-int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- for:
- <init-statement>
- jump start
- break:
- jump end
- continue:
- <loop-increment>
- start:
- <condition-statement>
- jumpz end
- <loop-body>
- jump continue
- end:
- */
-
- unsigned int start_jump, end_jump, cond_jump;
- unsigned int break_label, cont_label;
- slang_assembly_flow_control loop_flow = *flow;
- slang_assembly_stack_info stk;
-
- /* execute initialization statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children, 0, space))
- return 0;
-
- /* skip the "go to the end of the loop" and loop-increment statements */
- start_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = file->count;
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* resolve the beginning of the loop - continue statements are directed here */
- cont_label = file->count;
-
- /* execute loop-increment statement */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
- return 0;
-
- /* resolve the condition point */
- file->code[start_jump].param[0] = file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: inspect stk */
-
- /* jump to the end of the loop if not true */
- cond_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* execute loop body */
- loop_flow.loop_start = cont_label;
- loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 3, 0, space))
- return 0;
-
- /* go to the beginning of the loop */
- if (!slang_assembly_file_push_label (file, slang_asm_jump, cont_label))
- return 0;
-
- /* resolve the end of the loop */
- file->code[end_jump].param[0] = file->count;
- file->code[cond_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_do() */
-
-int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- do:
- jump start
- break:
- jump end
- continue:
- jump condition
- start:
- <loop-body>
- condition:
- <condition-statement>
- jumpz end
- jump start
- end:
- */
-
- unsigned int skip_jump, end_jump, cont_jump, cond_jump;
- unsigned int break_label, cont_label;
- slang_assembly_flow_control loop_flow = *flow;
- slang_assembly_stack_info stk;
-
- /* skip the "go to the end of the loop" and "go to condition" statements */
- skip_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = file->count;
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* go to condition - continue statements are directed here */
- cont_label = file->count;
- cont_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* resolve the beginning of the loop */
- file->code[skip_jump].param[0] = file->count;
-
- /* execute loop body */
- loop_flow.loop_start = cont_label;
- loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children, 0, space))
- return 0;
-
- /* resolve condition point */
- file->code[cont_jump].param[0] = file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
-
- /* jump to the end of the loop if not true */
- cond_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* jump to the beginning of the loop */
- if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
- return 0;
-
- /* resolve the end of the loop */
- file->code[end_jump].param[0] = file->count;
- file->code[cond_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_while() */
-
-int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- while:
- jump continue
- break:
- jump end
- continue:
- <condition-statement>
- jumpz end
- <loop-body>
- jump continue
- end:
- */
-
- unsigned int skip_jump, end_jump, cond_jump;
- unsigned int break_label;
- slang_assembly_flow_control loop_flow = *flow;
- slang_assembly_stack_info stk;
-
- /* skip the "go to the end of the loop" statement */
- skip_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = file->count;
- end_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* resolve the beginning of the loop - continue statements are directed here */
- file->code[skip_jump].param[0] = file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
-
- /* jump to the end of the loop if not true */
- cond_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* execute loop body */
- loop_flow.loop_start = file->code[skip_jump].param[0];
- loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
- return 0;
-
- /* jump to the beginning of the loop */
- if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
- return 0;
-
- /* resolve the end of the loop */
- file->code[end_jump].param[0] = file->count;
- file->code[cond_jump].param[0] = file->count;
-
- return 1;
-}
-
-/* _slang_assemble_if() */
-
-int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- /*
- if:
- <condition-statement>
- jumpz else
- <true-statement>
- jump end
- else:
- <false-statement>
- end:
- */
-
- unsigned int cond_jump, else_jump;
- slang_assembly_stack_info stk;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
-
- /* jump to false-statement if not true */
- cond_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
- return 0;
-
- /* execute true-statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
- return 0;
-
- /* skip if-false statement */
- else_jump = file->count;
- if (!slang_assembly_file_push (file, slang_asm_jump))
- return 0;
-
- /* resolve start of false-statement */
- file->code[cond_jump].param[0] = file->count;
-
- /* execute false-statement */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
- return 0;
- /* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
- return 0;
-
- /* resolve end of if-false statement */
- file->code[else_jump].param[0] = file->count;
-
- return 1;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_assemble_conditional.c
+ * slang condtional expressions assembler
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+#include "slang_assemble_conditional.h"
+#include "slang_assemble.h"
+
+/* _slang_assemble_logicaland() */
+
+int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ and:
+ <left-expression>
+ jumpz zero
+ <right-expression>
+ jump end
+ zero:
+ push 0
+ end:
+ */
+
+ unsigned int zero_jump, end_jump;
+ slang_assembly_stack_info stk;
+
+ /* evaluate left expression */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to pushing 0 if not true */
+ zero_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* evaluate right expression */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to the end of the expression */
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* push 0 on stack */
+ file->code[zero_jump].param[0] = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_bool_push))
+ return 0;
+
+ /* the end of the expression */
+ file->code[end_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_logicalor() */
+
+int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ or:
+ <left-expression>
+ jumpz right
+ push 1
+ jump end
+ right:
+ <right-expression>
+ end:
+ */
+
+ unsigned int right_jump, end_jump;
+ slang_assembly_stack_info stk;
+
+ /* evaluate left expression */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to evaluation of right expression if not true */
+ right_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* push 1 on stack */
+ if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))
+ return 0;
+
+ /* jump to the end of the expression */
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* evaluate right expression */
+ file->code[right_jump].param[0] = file->count;
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* the end of the expression */
+ file->code[end_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_select() */
+
+int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ select:
+ <condition-expression>
+ jumpz false
+ <true-expression>
+ jump end
+ false:
+ <false-expression>
+ end:
+ */
+
+ unsigned int cond_jump, end_jump;
+ slang_assembly_stack_info stk;
+
+ /* execute condition expression */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to false expression if not true */
+ cond_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* execute true expression */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to the end of the expression */
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* resolve false point */
+ file->code[cond_jump].param[0] = file->count;
+
+ /* execute false expression */
+ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* resolve the end of the expression */
+ file->code[end_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_for() */
+
+int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ for:
+ <init-statement>
+ jump start
+ break:
+ jump end
+ continue:
+ <loop-increment>
+ start:
+ <condition-statement>
+ jumpz end
+ <loop-body>
+ jump continue
+ end:
+ */
+
+ unsigned int start_jump, end_jump, cond_jump;
+ unsigned int break_label, cont_label;
+ slang_assembly_flow_control loop_flow = *flow;
+ slang_assembly_stack_info stk;
+
+ /* execute initialization statement */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children, 0, space))
+ return 0;
+
+ /* skip the "go to the end of the loop" and loop-increment statements */
+ start_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* go to the end of the loop - break statements are directed here */
+ break_label = file->count;
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* resolve the beginning of the loop - continue statements are directed here */
+ cont_label = file->count;
+
+ /* execute loop-increment statement */
+ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
+ return 0;
+
+ /* resolve the condition point */
+ file->code[start_jump].param[0] = file->count;
+
+ /* execute condition statement */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: inspect stk */
+
+ /* jump to the end of the loop if not true */
+ cond_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* execute loop body */
+ loop_flow.loop_start = cont_label;
+ loop_flow.loop_end = break_label;
+ if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + 3, 0, space))
+ return 0;
+
+ /* go to the beginning of the loop */
+ if (!slang_assembly_file_push_label (file, slang_asm_jump, cont_label))
+ return 0;
+
+ /* resolve the end of the loop */
+ file->code[end_jump].param[0] = file->count;
+ file->code[cond_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_do() */
+
+int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ do:
+ jump start
+ break:
+ jump end
+ continue:
+ jump condition
+ start:
+ <loop-body>
+ condition:
+ <condition-statement>
+ jumpz end
+ jump start
+ end:
+ */
+
+ unsigned int skip_jump, end_jump, cont_jump, cond_jump;
+ unsigned int break_label, cont_label;
+ slang_assembly_flow_control loop_flow = *flow;
+ slang_assembly_stack_info stk;
+
+ /* skip the "go to the end of the loop" and "go to condition" statements */
+ skip_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* go to the end of the loop - break statements are directed here */
+ break_label = file->count;
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* go to condition - continue statements are directed here */
+ cont_label = file->count;
+ cont_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* resolve the beginning of the loop */
+ file->code[skip_jump].param[0] = file->count;
+
+ /* execute loop body */
+ loop_flow.loop_start = cont_label;
+ loop_flow.loop_end = break_label;
+ if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children, 0, space))
+ return 0;
+
+ /* resolve condition point */
+ file->code[cont_jump].param[0] = file->count;
+
+ /* execute condition statement */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+
+ /* jump to the end of the loop if not true */
+ cond_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* jump to the beginning of the loop */
+ if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
+ return 0;
+
+ /* resolve the end of the loop */
+ file->code[end_jump].param[0] = file->count;
+ file->code[cond_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_while() */
+
+int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ while:
+ jump continue
+ break:
+ jump end
+ continue:
+ <condition-statement>
+ jumpz end
+ <loop-body>
+ jump continue
+ end:
+ */
+
+ unsigned int skip_jump, end_jump, cond_jump;
+ unsigned int break_label;
+ slang_assembly_flow_control loop_flow = *flow;
+ slang_assembly_stack_info stk;
+
+ /* skip the "go to the end of the loop" statement */
+ skip_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* go to the end of the loop - break statements are directed here */
+ break_label = file->count;
+ end_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* resolve the beginning of the loop - continue statements are directed here */
+ file->code[skip_jump].param[0] = file->count;
+
+ /* execute condition statement */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+
+ /* jump to the end of the loop if not true */
+ cond_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* execute loop body */
+ loop_flow.loop_start = file->code[skip_jump].param[0];
+ loop_flow.loop_end = break_label;
+ if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
+ return 0;
+
+ /* jump to the beginning of the loop */
+ if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
+ return 0;
+
+ /* resolve the end of the loop */
+ file->code[end_jump].param[0] = file->count;
+ file->code[cond_jump].param[0] = file->count;
+
+ return 1;
+}
+
+/* _slang_assemble_if() */
+
+int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ /*
+ if:
+ <condition-statement>
+ jumpz else
+ <true-statement>
+ jump end
+ else:
+ <false-statement>
+ end:
+ */
+
+ unsigned int cond_jump, else_jump;
+ slang_assembly_stack_info stk;
+
+ /* execute condition statement */
+ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+
+ /* jump to false-statement if not true */
+ cond_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
+ return 0;
+
+ /* execute true-statement */
+ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
+ return 0;
+
+ /* skip if-false statement */
+ else_jump = file->count;
+ if (!slang_assembly_file_push (file, slang_asm_jump))
+ return 0;
+
+ /* resolve start of false-statement */
+ file->code[cond_jump].param[0] = file->count;
+
+ /* execute false-statement */
+ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ return 0;
+ /* TODO: pass-in stk to cleanup */
+ if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
+ return 0;
+
+ /* resolve end of if-false statement */
+ file->code[else_jump].param[0] = file->count;
+
+ return 1;
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h
index f52b4129d..b8defae68 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h
@@ -1,67 +1,67 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_CONDITIONAL_H
-#define SLANG_ASSEMBLE_CONDITIONAL_H
-
-#include "slang_assemble.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_ASSEMBLE_CONDITIONAL_H
+#define SLANG_ASSEMBLE_CONDITIONAL_H
+
+#include "slang_assemble.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c
index 76a30f6b6..85ccea9e2 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c
@@ -1,339 +1,339 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_constructor.c
- * slang constructor and vector swizzle assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-#include "slang_assemble_constructor.h"
-#include "slang_assemble_typeinfo.h"
-#include "slang_storage.h"
-
-/* _slang_is_swizzle() */
-
-int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz)
-{
- unsigned int i;
- int xyzw = 0, rgba = 0, stpq = 0;
-
- /* the swizzle can be at most 4-component long */
- swz->num_components = slang_string_length (field);
- if (swz->num_components > 4)
- return 0;
-
- for (i = 0; i < swz->num_components; i++)
- {
- /* mark which swizzle group is used */
- switch (field[i])
- {
- case 'x':
- case 'y':
- case 'z':
- case 'w':
- xyzw = 1;
- break;
- case 'r':
- case 'g':
- case 'b':
- case 'a':
- rgba = 1;
- break;
- case 's':
- case 't':
- case 'p':
- case 'q':
- stpq = 1;
- break;
- default:
- return 0;
- }
-
- /* collect swizzle component */
- switch (field[i])
- {
- case 'x':
- case 'r':
- case 's':
- swz->swizzle[i] = 0;
- break;
- case 'y':
- case 'g':
- case 't':
- if (rows < 2)
- return 0;
- swz->swizzle[i] = 1;
- break;
- case 'z':
- case 'b':
- case 'p':
- if (rows < 3)
- return 0;
- swz->swizzle[i] = 2;
- break;
- case 'w':
- case 'a':
- case 'q':
- if (rows < 4)
- return 0;
- swz->swizzle[i] = 3;
- break;
- }
- }
-
- /* only one swizzle group can be used */
- if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
- return 0;
-
- return 1;
-}
-
-/* _slang_is_swizzle_mask() */
-
-int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows)
-{
- unsigned int c, i;
-
- if (swz->num_components > rows)
- return 0;
- c = swz->swizzle[0];
- for (i = 1; i < swz->num_components; i++)
- {
- if (swz->swizzle[i] <= c)
- return 0;
- c = swz->swizzle[i];
- }
- return 1;
-}
-
-/* _slang_multiply_swizzles() */
-
-void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left,
- const slang_swizzle *right)
-{
- unsigned int i;
- dst->num_components = right->num_components;
- for (i = 0; i < right->num_components; i++)
- dst->swizzle[i] = left->swizzle[right->swizzle[i]];
-}
-
-/* _slang_assemble_constructor() */
-
-static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat,
- unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow,
- slang_assembly_name_space *space, slang_assembly_local_info *info)
-{
- slang_assembly_typeinfo ti;
- int result;
- slang_storage_aggregate agg, flat_agg;
- slang_assembly_stack_info stk;
- unsigned int i;
-
- slang_assembly_typeinfo_construct (&ti);
- if (!(result = _slang_typeof_operation (op, space, &ti)))
- goto end1;
-
- slang_storage_aggregate_construct (&agg);
- if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
- goto end2;
-
- slang_storage_aggregate_construct (&flat_agg);
- if (!(result = _slang_flatten_aggregate (&flat_agg, &agg)))
- goto end;
-
- if (!(result = _slang_assemble_operation (file, op, 0, flow, space, info, &stk)))
- goto end;
-
- for (i = 0; i < flat_agg.count; i++)
- {
- const slang_storage_array *arr1 = flat_agg.arrays + i;
- const slang_storage_array *arr2 = flat->arrays + *index;
-
- if (arr1->type != arr2->type)
- {
- /* TODO: convert (generic) from arr1 to arr2 */
- }
- (*index)++;
- /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */
- }
-
- result = 1;
-end:
- slang_storage_aggregate_destruct (&flat_agg);
-end2:
- slang_storage_aggregate_destruct (&agg);
-end1:
- slang_assembly_typeinfo_destruct (&ti);
- return result;
-}
-/* XXX: general swizzle! */
-int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
-{
- slang_assembly_typeinfo ti;
- int result;
- slang_storage_aggregate agg, flat;
- unsigned int size, index, i;
-
- slang_assembly_typeinfo_construct (&ti);
- if (!(result = _slang_typeof_operation (op, space, &ti)))
- goto end1;
-
- slang_storage_aggregate_construct (&agg);
- if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
- goto end2;
-
- size = _slang_sizeof_aggregate (&agg);
-
- slang_storage_aggregate_construct (&flat);
- if (!(result = _slang_flatten_aggregate (&flat, &agg)))
- goto end;
-
- index = 0;
- for (i = 0; i < op->num_children; i++)
- {
- if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow,
- space, info)))
- goto end;
- /* TODO: watch the index, if it reaches the size, raise an error */
- }
-
- result = 1;
-end:
- slang_storage_aggregate_destruct (&flat);
-end2:
- slang_storage_aggregate_destruct (&agg);
-end1:
- slang_assembly_typeinfo_destruct (&ti);
- return result;
-}
-
-/* _slang_assemble_constructor_from_swizzle() */
-/* XXX: wrong */
-int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
- slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info)
-{
- unsigned int master_rows, i;
- switch (master_spec->type)
- {
- case slang_spec_bool:
- case slang_spec_int:
- case slang_spec_float:
- master_rows = 1;
- break;
- case slang_spec_bvec2:
- case slang_spec_ivec2:
- case slang_spec_vec2:
- master_rows = 2;
- break;
- case slang_spec_bvec3:
- case slang_spec_ivec3:
- case slang_spec_vec3:
- master_rows = 3;
- break;
- case slang_spec_bvec4:
- case slang_spec_ivec4:
- case slang_spec_vec4:
- master_rows = 4;
- break;
- default:
- break;
- }
- for (i = 0; i < master_rows; i++)
- {
- switch (master_spec->type)
- {
- case slang_spec_bool:
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
- if (!slang_assembly_file_push_label2 (file, slang_asm_bool_copy, (master_rows - i) * 4,
- i * 4))
- return 0;
- break;
- case slang_spec_int:
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- if (!slang_assembly_file_push_label2 (file, slang_asm_int_copy, (master_rows - i) * 4,
- i * 4))
- return 0;
- break;
- case slang_spec_float:
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- if (!slang_assembly_file_push_label2 (file, slang_asm_float_copy,
- (master_rows - i) * 4, i * 4))
- return 0;
- break;
- default:
- break;
- }
- }
- if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
- return 0;
- for (i = swz->num_components; i > 0; i--)
- {
- unsigned int n = i - 1;
- if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16))
- return 0;
- if (!slang_assembly_file_push_label (file, slang_asm_addr_push, swz->swizzle[n] * 4))
- return 0;
- if (!slang_assembly_file_push (file, slang_asm_addr_add))
- return 0;
- switch (master_spec->type)
- {
- case slang_spec_bool:
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
- if (!slang_assembly_file_push (file, slang_asm_bool_deref))
- return 0;
- break;
- case slang_spec_int:
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- if (!slang_assembly_file_push (file, slang_asm_int_deref))
- return 0;
- break;
- case slang_spec_float:
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- if (!slang_assembly_file_push (file, slang_asm_float_deref))
- return 0;
- break;
- default:
- break;
- }
- }
- return 1;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_assemble_constructor.c
+ * slang constructor and vector swizzle assembler
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+#include "slang_assemble_constructor.h"
+#include "slang_assemble_typeinfo.h"
+#include "slang_storage.h"
+
+/* _slang_is_swizzle() */
+
+int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz)
+{
+ unsigned int i;
+ int xyzw = 0, rgba = 0, stpq = 0;
+
+ /* the swizzle can be at most 4-component long */
+ swz->num_components = slang_string_length (field);
+ if (swz->num_components > 4)
+ return 0;
+
+ for (i = 0; i < swz->num_components; i++)
+ {
+ /* mark which swizzle group is used */
+ switch (field[i])
+ {
+ case 'x':
+ case 'y':
+ case 'z':
+ case 'w':
+ xyzw = 1;
+ break;
+ case 'r':
+ case 'g':
+ case 'b':
+ case 'a':
+ rgba = 1;
+ break;
+ case 's':
+ case 't':
+ case 'p':
+ case 'q':
+ stpq = 1;
+ break;
+ default:
+ return 0;
+ }
+
+ /* collect swizzle component */
+ switch (field[i])
+ {
+ case 'x':
+ case 'r':
+ case 's':
+ swz->swizzle[i] = 0;
+ break;
+ case 'y':
+ case 'g':
+ case 't':
+ if (rows < 2)
+ return 0;
+ swz->swizzle[i] = 1;
+ break;
+ case 'z':
+ case 'b':
+ case 'p':
+ if (rows < 3)
+ return 0;
+ swz->swizzle[i] = 2;
+ break;
+ case 'w':
+ case 'a':
+ case 'q':
+ if (rows < 4)
+ return 0;
+ swz->swizzle[i] = 3;
+ break;
+ }
+ }
+
+ /* only one swizzle group can be used */
+ if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
+ return 0;
+
+ return 1;
+}
+
+/* _slang_is_swizzle_mask() */
+
+int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows)
+{
+ unsigned int c, i;
+
+ if (swz->num_components > rows)
+ return 0;
+ c = swz->swizzle[0];
+ for (i = 1; i < swz->num_components; i++)
+ {
+ if (swz->swizzle[i] <= c)
+ return 0;
+ c = swz->swizzle[i];
+ }
+ return 1;
+}
+
+/* _slang_multiply_swizzles() */
+
+void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left,
+ const slang_swizzle *right)
+{
+ unsigned int i;
+ dst->num_components = right->num_components;
+ for (i = 0; i < right->num_components; i++)
+ dst->swizzle[i] = left->swizzle[right->swizzle[i]];
+}
+
+/* _slang_assemble_constructor() */
+
+static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat,
+ unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow,
+ slang_assembly_name_space *space, slang_assembly_local_info *info)
+{
+ slang_assembly_typeinfo ti;
+ int result;
+ slang_storage_aggregate agg, flat_agg;
+ slang_assembly_stack_info stk;
+ unsigned int i;
+
+ slang_assembly_typeinfo_construct (&ti);
+ if (!(result = _slang_typeof_operation (op, space, &ti)))
+ goto end1;
+
+ slang_storage_aggregate_construct (&agg);
+ if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
+ goto end2;
+
+ slang_storage_aggregate_construct (&flat_agg);
+ if (!(result = _slang_flatten_aggregate (&flat_agg, &agg)))
+ goto end;
+
+ if (!(result = _slang_assemble_operation (file, op, 0, flow, space, info, &stk)))
+ goto end;
+
+ for (i = 0; i < flat_agg.count; i++)
+ {
+ const slang_storage_array *arr1 = flat_agg.arrays + i;
+ const slang_storage_array *arr2 = flat->arrays + *index;
+
+ if (arr1->type != arr2->type)
+ {
+ /* TODO: convert (generic) from arr1 to arr2 */
+ }
+ (*index)++;
+ /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */
+ }
+
+ result = 1;
+end:
+ slang_storage_aggregate_destruct (&flat_agg);
+end2:
+ slang_storage_aggregate_destruct (&agg);
+end1:
+ slang_assembly_typeinfo_destruct (&ti);
+ return result;
+}
+/* XXX: general swizzle! */
+int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info)
+{
+ slang_assembly_typeinfo ti;
+ int result;
+ slang_storage_aggregate agg, flat;
+ unsigned int size, index, i;
+
+ slang_assembly_typeinfo_construct (&ti);
+ if (!(result = _slang_typeof_operation (op, space, &ti)))
+ goto end1;
+
+ slang_storage_aggregate_construct (&agg);
+ if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
+ goto end2;
+
+ size = _slang_sizeof_aggregate (&agg);
+
+ slang_storage_aggregate_construct (&flat);
+ if (!(result = _slang_flatten_aggregate (&flat, &agg)))
+ goto end;
+
+ index = 0;
+ for (i = 0; i < op->num_children; i++)
+ {
+ if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow,
+ space, info)))
+ goto end;
+ /* TODO: watch the index, if it reaches the size, raise an error */
+ }
+
+ result = 1;
+end:
+ slang_storage_aggregate_destruct (&flat);
+end2:
+ slang_storage_aggregate_destruct (&agg);
+end1:
+ slang_assembly_typeinfo_destruct (&ti);
+ return result;
+}
+
+/* _slang_assemble_constructor_from_swizzle() */
+/* XXX: wrong */
+int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
+ slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info)
+{
+ unsigned int master_rows, i;
+ switch (master_spec->type)
+ {
+ case slang_spec_bool:
+ case slang_spec_int:
+ case slang_spec_float:
+ master_rows = 1;
+ break;
+ case slang_spec_bvec2:
+ case slang_spec_ivec2:
+ case slang_spec_vec2:
+ master_rows = 2;
+ break;
+ case slang_spec_bvec3:
+ case slang_spec_ivec3:
+ case slang_spec_vec3:
+ master_rows = 3;
+ break;
+ case slang_spec_bvec4:
+ case slang_spec_ivec4:
+ case slang_spec_vec4:
+ master_rows = 4;
+ break;
+ default:
+ break;
+ }
+ for (i = 0; i < master_rows; i++)
+ {
+ switch (master_spec->type)
+ {
+ case slang_spec_bool:
+ case slang_spec_bvec2:
+ case slang_spec_bvec3:
+ case slang_spec_bvec4:
+ if (!slang_assembly_file_push_label2 (file, slang_asm_bool_copy, (master_rows - i) * 4,
+ i * 4))
+ return 0;
+ break;
+ case slang_spec_int:
+ case slang_spec_ivec2:
+ case slang_spec_ivec3:
+ case slang_spec_ivec4:
+ if (!slang_assembly_file_push_label2 (file, slang_asm_int_copy, (master_rows - i) * 4,
+ i * 4))
+ return 0;
+ break;
+ case slang_spec_float:
+ case slang_spec_vec2:
+ case slang_spec_vec3:
+ case slang_spec_vec4:
+ if (!slang_assembly_file_push_label2 (file, slang_asm_float_copy,
+ (master_rows - i) * 4, i * 4))
+ return 0;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
+ return 0;
+ for (i = swz->num_components; i > 0; i--)
+ {
+ unsigned int n = i - 1;
+ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16))
+ return 0;
+ if (!slang_assembly_file_push_label (file, slang_asm_addr_push, swz->swizzle[n] * 4))
+ return 0;
+ if (!slang_assembly_file_push (file, slang_asm_addr_add))
+ return 0;
+ switch (master_spec->type)
+ {
+ case slang_spec_bool:
+ case slang_spec_bvec2:
+ case slang_spec_bvec3:
+ case slang_spec_bvec4:
+ if (!slang_assembly_file_push (file, slang_asm_bool_deref))
+ return 0;
+ break;
+ case slang_spec_int:
+ case slang_spec_ivec2:
+ case slang_spec_ivec3:
+ case slang_spec_ivec4:
+ if (!slang_assembly_file_push (file, slang_asm_int_deref))
+ return 0;
+ break;
+ case slang_spec_float:
+ case slang_spec_vec2:
+ case slang_spec_vec3:
+ case slang_spec_vec4:
+ if (!slang_assembly_file_push (file, slang_asm_float_deref))
+ return 0;
+ break;
+ default:
+ break;
+ }
+ }
+ return 1;
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h
index f8a0fead3..31048bc7b 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h
@@ -1,80 +1,80 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H
-#define SLANG_ASSEMBLE_CONSTRUCTOR_H
-
-#include "slang_assemble.h"
-#include "slang_compile.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-/*
- holds a complete information about vector swizzle - the <swizzle> array contains
- vector component sources indices, where 0 is "x", 1 is "y", ...
- example: "xwz" --> { 3, { 0, 3, 2, n/u } }
-*/
-typedef struct slang_swizzle_
-{
- unsigned int num_components;
- unsigned int swizzle[4];
-} slang_swizzle;
-
-/*
- checks if a field selector is a general swizzle (an r-value swizzle with replicated
- components or an l-value swizzle mask) for a vector
- returns 1 if this is the case, <swz> is filled with swizzle information
- returns 0 otherwise
-*/
-int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz);
-
-/*
- checks if a general swizzle is an l-value swizzle - these swizzles do not have
- duplicated fields and they are specified in order
- returns 1 if this is a swizzle mask
- returns 0 otherwise
-*/
-int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows);
-
-/*
- combines two swizzles to form single swizzle
- example: "wzyx.yx" --> "zw"
-*/
-void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *);
-
-int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
- slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info);
-
-int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
- slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H
+#define SLANG_ASSEMBLE_CONSTRUCTOR_H
+
+#include "slang_assemble.h"
+#include "slang_compile.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/*
+ holds a complete information about vector swizzle - the <swizzle> array contains
+ vector component sources indices, where 0 is "x", 1 is "y", ...
+ example: "xwz" --> { 3, { 0, 3, 2, n/u } }
+*/
+typedef struct slang_swizzle_
+{
+ unsigned int num_components;
+ unsigned int swizzle[4];
+} slang_swizzle;
+
+/*
+ checks if a field selector is a general swizzle (an r-value swizzle with replicated
+ components or an l-value swizzle mask) for a vector
+ returns 1 if this is the case, <swz> is filled with swizzle information
+ returns 0 otherwise
+*/
+int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz);
+
+/*
+ checks if a general swizzle is an l-value swizzle - these swizzles do not have
+ duplicated fields and they are specified in order
+ returns 1 if this is a swizzle mask
+ returns 0 otherwise
+*/
+int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows);
+
+/*
+ combines two swizzles to form single swizzle
+ example: "wzyx.yx" --> "zw"
+*/
+void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *);
+
+int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
+ slang_assembly_flow_control *flow, slang_assembly_name_space *space,
+ slang_assembly_local_info *info);
+
+int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
+ slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c
index ce78f66eb..d2cae447a 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c
@@ -1,430 +1,430 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_typeinfo.c
- * slang type info
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-#include "slang_assemble_typeinfo.h"
-
-/* slang_assembly_typeinfo */
-
-void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *ti)
-{
- slang_type_specifier_construct (&ti->spec);
-}
-
-void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *ti)
-{
- slang_type_specifier_destruct (&ti->spec);
-}
-
-/* _slang_typeof_operation() */
-
-int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *space,
- slang_assembly_typeinfo *ti)
-{
- ti->can_be_referenced = 0;
- ti->is_swizzled = 0;
-
- switch (op->type)
- {
- case slang_oper_block_no_new_scope:
- case slang_oper_block_new_scope:
- case slang_oper_variable_decl:
- case slang_oper_asm:
- case slang_oper_break:
- case slang_oper_continue:
- case slang_oper_discard:
- case slang_oper_return:
- case slang_oper_if:
- case slang_oper_while:
- case slang_oper_do:
- case slang_oper_for:
- case slang_oper_void:
- ti->spec.type = slang_spec_void;
- break;
- case slang_oper_expression:
- case slang_oper_assign:
- case slang_oper_addassign:
- case slang_oper_subassign:
- case slang_oper_mulassign:
- case slang_oper_divassign:
- case slang_oper_preincrement:
- case slang_oper_predecrement:
- if (!_slang_typeof_operation (op->children, space, ti))
- return 0;
- break;
- case slang_oper_literal_bool:
- case slang_oper_logicalor:
- case slang_oper_logicalxor:
- case slang_oper_logicaland:
- case slang_oper_equal:
- case slang_oper_notequal:
- case slang_oper_less:
- case slang_oper_greater:
- case slang_oper_lessequal:
- case slang_oper_greaterequal:
- case slang_oper_not:
- ti->spec.type = slang_spec_bool;
- break;
- case slang_oper_literal_int:
- ti->spec.type = slang_spec_int;
- break;
- case slang_oper_literal_float:
- ti->spec.type = slang_spec_float;
- break;
- case slang_oper_identifier:
- {
- slang_variable *var;
-
- var = _slang_locate_variable (op->locals, op->identifier, 1);
- if (var == NULL)
- return 0;
- if (!slang_type_specifier_copy (&ti->spec, &var->type.specifier))
- return 0;
- ti->can_be_referenced = 1;
- }
- break;
- case slang_oper_sequence:
- /* TODO: check [0] and [1] if they match */
- if (!_slang_typeof_operation (op->children + 1, space, ti))
- return 0;
- ti->can_be_referenced = 0;
- ti->is_swizzled = 0;
- break;
- /*case slang_oper_modassign:*/
- /*case slang_oper_lshassign:*/
- /*case slang_oper_rshassign:*/
- /*case slang_oper_orassign:*/
- /*case slang_oper_xorassign:*/
- /*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))
- return 0;
- ti->can_be_referenced = 0;
- ti->is_swizzled = 0;
- break;
- /*case slang_oper_bitor:*/
- /*case slang_oper_bitxor:*/
- /*case slang_oper_bitand:*/
- /*case slang_oper_lshift:*/
- /*case slang_oper_rshift:*/
- case slang_oper_add:
- {
- int exists;
- if (!_slang_typeof_function ("+", op->children, 2, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- case slang_oper_subtract:
- {
- int exists;
- if (!_slang_typeof_function ("-", op->children, 2, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- case slang_oper_multiply:
- {
- int exists;
- if (!_slang_typeof_function ("*", op->children, 2, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- case slang_oper_divide:
- {
- int exists;
- if (!_slang_typeof_function ("/", op->children, 2, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- /*case slang_oper_modulus:*/
- case slang_oper_plus:
- {
- int exists;
- if (!_slang_typeof_function ("+", op->children, 1, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- case slang_oper_minus:
- {
- int exists;
- if (!_slang_typeof_function ("-", op->children, 1, space, &ti->spec, &exists))
- return 0;
- if (!exists)
- return 0;
- }
- break;
- /*case slang_oper_complement:*/
- case slang_oper_subscript:
- {
- slang_assembly_typeinfo _ti;
- slang_assembly_typeinfo_construct (&_ti);
- if (!_slang_typeof_operation (op->children, space, &_ti))
- {
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- ti->can_be_referenced = _ti.can_be_referenced;
- switch (_ti.spec.type)
- {
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
- ti->spec.type = slang_spec_bool;
- break;
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- ti->spec.type = slang_spec_int;
- break;
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- ti->spec.type = slang_spec_float;
- break;
- case slang_spec_mat2:
- ti->spec.type = slang_spec_vec2;
- break;
- case slang_spec_mat3:
- ti->spec.type = slang_spec_vec3;
- break;
- case slang_spec_mat4:
- ti->spec.type = slang_spec_vec4;
- break;
- case slang_spec_array:
- if (!slang_type_specifier_copy (&ti->spec, _ti.spec._array))
- {
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- break;
- default:
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- slang_assembly_typeinfo_destruct (&_ti);
- }
- break;
- case slang_oper_call:
- {
- int exists;
- if (!_slang_typeof_function (op->identifier, op->children, op->num_children, space,
- &ti->spec, &exists))
- return 0;
- if (!exists)
- {
- slang_struct *s = slang_struct_scope_find (space->structs, op->identifier, 1);
- if (s != NULL)
- {
- ti->spec.type = slang_spec_struct;
- ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
- if (ti->spec._struct == NULL)
- return 0;
- if (!slang_struct_construct_a (ti->spec._struct))
- {
- slang_alloc_free (ti->spec._struct);
- ti->spec._struct = NULL;
- return 0;
- }
- if (!slang_struct_copy (ti->spec._struct, s))
- return 0;
- }
- else
- {
- slang_type_specifier_type type = slang_type_specifier_type_from_string (
- op->identifier);
- if (type == slang_spec_void)
- return 0;
- ti->spec.type = type;
- }
- }
- }
- break;
- case slang_oper_field:
- {
- slang_assembly_typeinfo _ti;
- slang_assembly_typeinfo_construct (&_ti);
- if (!_slang_typeof_operation (op->children, space, &_ti))
- {
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- if (_ti.spec.type == slang_spec_struct)
- {
- slang_variable *field = _slang_locate_variable (_ti.spec._struct->fields,
- op->identifier, 0);
- if (field == NULL)
- {
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- if (!slang_type_specifier_copy (&ti->spec, &field->type.specifier))
- {
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- }
- else
- {
- unsigned int rows;
- switch (_ti.spec.type)
- {
- case slang_spec_vec2:
- case slang_spec_ivec2:
- case slang_spec_bvec2:
- rows = 2;
- break;
- case slang_spec_vec3:
- case slang_spec_ivec3:
- case slang_spec_bvec3:
- rows = 3;
- break;
- case slang_spec_vec4:
- case slang_spec_ivec4:
- case slang_spec_bvec4:
- rows = 4;
- break;
- default:
- slang_assembly_typeinfo_destruct (&_ti);
- return 0;
- }
- if (!_slang_is_swizzle (op->identifier, rows, &ti->swz))
- return 0;
- ti->is_swizzled = 1;
- ti->can_be_referenced = _ti.can_be_referenced && _slang_is_swizzle_mask (&ti->swz,
- rows);
- if (_ti.is_swizzled)
- {
- slang_swizzle swz;
- _slang_multiply_swizzles (&swz, &_ti.swz, &ti->swz);
- ti->swz = swz;
- }
- switch (_ti.spec.type)
- {
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- switch (ti->swz.num_components)
- {
- case 1:
- ti->spec.type = slang_spec_float;
- break;
- case 2:
- ti->spec.type = slang_spec_vec2;
- break;
- case 3:
- ti->spec.type = slang_spec_vec3;
- break;
- case 4:
- ti->spec.type = slang_spec_vec4;
- break;
- }
- break;
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- switch (ti->swz.num_components)
- {
- case 1:
- ti->spec.type = slang_spec_int;
- break;
- case 2:
- ti->spec.type = slang_spec_ivec2;
- break;
- case 3:
- ti->spec.type = slang_spec_ivec3;
- break;
- case 4:
- ti->spec.type = slang_spec_ivec4;
- break;
- }
- break;
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
- switch (ti->swz.num_components)
- {
- case 1:
- ti->spec.type = slang_spec_bool;
- break;
- case 2:
- ti->spec.type = slang_spec_bvec2;
- break;
- case 3:
- ti->spec.type = slang_spec_bvec3;
- break;
- case 4:
- ti->spec.type = slang_spec_bvec4;
- break;
- }
- break;
- default:
- break;
- }
- }
- slang_assembly_typeinfo_destruct (&_ti);
- return 1;
- }
- break;
- case slang_oper_postincrement:
- case slang_oper_postdecrement:
- if (!_slang_typeof_operation (op->children, space, ti))
- return 0;
- ti->can_be_referenced = 0;
- ti->is_swizzled = 0;
- break;
- default:
- return 0;
- }
- return 1;
-}
-
-/* _slang_typeof_function() */
-
-int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
- slang_assembly_name_space *space, slang_type_specifier *spec, int *exists)
-{
- slang_function *fun = _slang_locate_function (name, params, num_params, space);
- *exists = fun != NULL;
- if (fun == NULL)
- return 1;
- return slang_type_specifier_copy (spec, &fun->header.type.specifier);
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_assemble_typeinfo.c
+ * slang type info
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+#include "slang_assemble_typeinfo.h"
+
+/* slang_assembly_typeinfo */
+
+void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *ti)
+{
+ slang_type_specifier_construct (&ti->spec);
+}
+
+void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *ti)
+{
+ slang_type_specifier_destruct (&ti->spec);
+}
+
+/* _slang_typeof_operation() */
+
+int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *space,
+ slang_assembly_typeinfo *ti)
+{
+ ti->can_be_referenced = 0;
+ ti->is_swizzled = 0;
+
+ switch (op->type)
+ {
+ case slang_oper_block_no_new_scope:
+ case slang_oper_block_new_scope:
+ case slang_oper_variable_decl:
+ case slang_oper_asm:
+ case slang_oper_break:
+ case slang_oper_continue:
+ case slang_oper_discard:
+ case slang_oper_return:
+ case slang_oper_if:
+ case slang_oper_while:
+ case slang_oper_do:
+ case slang_oper_for:
+ case slang_oper_void:
+ ti->spec.type = slang_spec_void;
+ break;
+ case slang_oper_expression:
+ case slang_oper_assign:
+ case slang_oper_addassign:
+ case slang_oper_subassign:
+ case slang_oper_mulassign:
+ case slang_oper_divassign:
+ case slang_oper_preincrement:
+ case slang_oper_predecrement:
+ if (!_slang_typeof_operation (op->children, space, ti))
+ return 0;
+ break;
+ case slang_oper_literal_bool:
+ case slang_oper_logicalor:
+ case slang_oper_logicalxor:
+ case slang_oper_logicaland:
+ case slang_oper_equal:
+ case slang_oper_notequal:
+ case slang_oper_less:
+ case slang_oper_greater:
+ case slang_oper_lessequal:
+ case slang_oper_greaterequal:
+ case slang_oper_not:
+ ti->spec.type = slang_spec_bool;
+ break;
+ case slang_oper_literal_int:
+ ti->spec.type = slang_spec_int;
+ break;
+ case slang_oper_literal_float:
+ ti->spec.type = slang_spec_float;
+ break;
+ case slang_oper_identifier:
+ {
+ slang_variable *var;
+
+ var = _slang_locate_variable (op->locals, op->identifier, 1);
+ if (var == NULL)
+ return 0;
+ if (!slang_type_specifier_copy (&ti->spec, &var->type.specifier))
+ return 0;
+ ti->can_be_referenced = 1;
+ }
+ break;
+ case slang_oper_sequence:
+ /* TODO: check [0] and [1] if they match */
+ if (!_slang_typeof_operation (op->children + 1, space, ti))
+ return 0;
+ ti->can_be_referenced = 0;
+ ti->is_swizzled = 0;
+ break;
+ /*case slang_oper_modassign:*/
+ /*case slang_oper_lshassign:*/
+ /*case slang_oper_rshassign:*/
+ /*case slang_oper_orassign:*/
+ /*case slang_oper_xorassign:*/
+ /*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))
+ return 0;
+ ti->can_be_referenced = 0;
+ ti->is_swizzled = 0;
+ break;
+ /*case slang_oper_bitor:*/
+ /*case slang_oper_bitxor:*/
+ /*case slang_oper_bitand:*/
+ /*case slang_oper_lshift:*/
+ /*case slang_oper_rshift:*/
+ case slang_oper_add:
+ {
+ int exists;
+ if (!_slang_typeof_function ("+", op->children, 2, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ case slang_oper_subtract:
+ {
+ int exists;
+ if (!_slang_typeof_function ("-", op->children, 2, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ case slang_oper_multiply:
+ {
+ int exists;
+ if (!_slang_typeof_function ("*", op->children, 2, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ case slang_oper_divide:
+ {
+ int exists;
+ if (!_slang_typeof_function ("/", op->children, 2, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ /*case slang_oper_modulus:*/
+ case slang_oper_plus:
+ {
+ int exists;
+ if (!_slang_typeof_function ("+", op->children, 1, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ case slang_oper_minus:
+ {
+ int exists;
+ if (!_slang_typeof_function ("-", op->children, 1, space, &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ return 0;
+ }
+ break;
+ /*case slang_oper_complement:*/
+ case slang_oper_subscript:
+ {
+ slang_assembly_typeinfo _ti;
+ slang_assembly_typeinfo_construct (&_ti);
+ if (!_slang_typeof_operation (op->children, space, &_ti))
+ {
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ ti->can_be_referenced = _ti.can_be_referenced;
+ switch (_ti.spec.type)
+ {
+ case slang_spec_bvec2:
+ case slang_spec_bvec3:
+ case slang_spec_bvec4:
+ ti->spec.type = slang_spec_bool;
+ break;
+ case slang_spec_ivec2:
+ case slang_spec_ivec3:
+ case slang_spec_ivec4:
+ ti->spec.type = slang_spec_int;
+ break;
+ case slang_spec_vec2:
+ case slang_spec_vec3:
+ case slang_spec_vec4:
+ ti->spec.type = slang_spec_float;
+ break;
+ case slang_spec_mat2:
+ ti->spec.type = slang_spec_vec2;
+ break;
+ case slang_spec_mat3:
+ ti->spec.type = slang_spec_vec3;
+ break;
+ case slang_spec_mat4:
+ ti->spec.type = slang_spec_vec4;
+ break;
+ case slang_spec_array:
+ if (!slang_type_specifier_copy (&ti->spec, _ti.spec._array))
+ {
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ break;
+ default:
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ slang_assembly_typeinfo_destruct (&_ti);
+ }
+ break;
+ case slang_oper_call:
+ {
+ int exists;
+ if (!_slang_typeof_function (op->identifier, op->children, op->num_children, space,
+ &ti->spec, &exists))
+ return 0;
+ if (!exists)
+ {
+ slang_struct *s = slang_struct_scope_find (space->structs, op->identifier, 1);
+ if (s != NULL)
+ {
+ ti->spec.type = slang_spec_struct;
+ ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
+ if (ti->spec._struct == NULL)
+ return 0;
+ if (!slang_struct_construct_a (ti->spec._struct))
+ {
+ slang_alloc_free (ti->spec._struct);
+ ti->spec._struct = NULL;
+ return 0;
+ }
+ if (!slang_struct_copy (ti->spec._struct, s))
+ return 0;
+ }
+ else
+ {
+ slang_type_specifier_type type = slang_type_specifier_type_from_string (
+ op->identifier);
+ if (type == slang_spec_void)
+ return 0;
+ ti->spec.type = type;
+ }
+ }
+ }
+ break;
+ case slang_oper_field:
+ {
+ slang_assembly_typeinfo _ti;
+ slang_assembly_typeinfo_construct (&_ti);
+ if (!_slang_typeof_operation (op->children, space, &_ti))
+ {
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ if (_ti.spec.type == slang_spec_struct)
+ {
+ slang_variable *field = _slang_locate_variable (_ti.spec._struct->fields,
+ op->identifier, 0);
+ if (field == NULL)
+ {
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ if (!slang_type_specifier_copy (&ti->spec, &field->type.specifier))
+ {
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ }
+ else
+ {
+ unsigned int rows;
+ switch (_ti.spec.type)
+ {
+ case slang_spec_vec2:
+ case slang_spec_ivec2:
+ case slang_spec_bvec2:
+ rows = 2;
+ break;
+ case slang_spec_vec3:
+ case slang_spec_ivec3:
+ case slang_spec_bvec3:
+ rows = 3;
+ break;
+ case slang_spec_vec4:
+ case slang_spec_ivec4:
+ case slang_spec_bvec4:
+ rows = 4;
+ break;
+ default:
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 0;
+ }
+ if (!_slang_is_swizzle (op->identifier, rows, &ti->swz))
+ return 0;
+ ti->is_swizzled = 1;
+ ti->can_be_referenced = _ti.can_be_referenced && _slang_is_swizzle_mask (&ti->swz,
+ rows);
+ if (_ti.is_swizzled)
+ {
+ slang_swizzle swz;
+ _slang_multiply_swizzles (&swz, &_ti.swz, &ti->swz);
+ ti->swz = swz;
+ }
+ switch (_ti.spec.type)
+ {
+ case slang_spec_vec2:
+ case slang_spec_vec3:
+ case slang_spec_vec4:
+ switch (ti->swz.num_components)
+ {
+ case 1:
+ ti->spec.type = slang_spec_float;
+ break;
+ case 2:
+ ti->spec.type = slang_spec_vec2;
+ break;
+ case 3:
+ ti->spec.type = slang_spec_vec3;
+ break;
+ case 4:
+ ti->spec.type = slang_spec_vec4;
+ break;
+ }
+ break;
+ case slang_spec_ivec2:
+ case slang_spec_ivec3:
+ case slang_spec_ivec4:
+ switch (ti->swz.num_components)
+ {
+ case 1:
+ ti->spec.type = slang_spec_int;
+ break;
+ case 2:
+ ti->spec.type = slang_spec_ivec2;
+ break;
+ case 3:
+ ti->spec.type = slang_spec_ivec3;
+ break;
+ case 4:
+ ti->spec.type = slang_spec_ivec4;
+ break;
+ }
+ break;
+ case slang_spec_bvec2:
+ case slang_spec_bvec3:
+ case slang_spec_bvec4:
+ switch (ti->swz.num_components)
+ {
+ case 1:
+ ti->spec.type = slang_spec_bool;
+ break;
+ case 2:
+ ti->spec.type = slang_spec_bvec2;
+ break;
+ case 3:
+ ti->spec.type = slang_spec_bvec3;
+ break;
+ case 4:
+ ti->spec.type = slang_spec_bvec4;
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ slang_assembly_typeinfo_destruct (&_ti);
+ return 1;
+ }
+ break;
+ case slang_oper_postincrement:
+ case slang_oper_postdecrement:
+ if (!_slang_typeof_operation (op->children, space, ti))
+ return 0;
+ ti->can_be_referenced = 0;
+ ti->is_swizzled = 0;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+/* _slang_typeof_function() */
+
+int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
+ slang_assembly_name_space *space, slang_type_specifier *spec, int *exists)
+{
+ slang_function *fun = _slang_locate_function (name, params, num_params, space);
+ *exists = fun != NULL;
+ if (fun == NULL)
+ return 1;
+ return slang_type_specifier_copy (spec, &fun->header.type.specifier);
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h
index 1c1839457..fc1f3e3ae 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h
@@ -1,67 +1,67 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_TYPEINFO_H
-#define SLANG_ASSEMBLE_TYPEINFO_H
-
-#include "slang_assemble_constructor.h"
-#include "slang_compile.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-typedef struct slang_assembly_typeinfo_
-{
- int can_be_referenced;
- int is_swizzled;
- slang_swizzle swz;
- slang_type_specifier spec;
-} slang_assembly_typeinfo;
-
-void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *);
-void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *);
-
-/*
- retrieves type information about an operation
- returns 1 on success
- returns 0 otherwise
-*/
-int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *,
- slang_assembly_typeinfo *);
-
-/*
- retrieves type of a function prototype, if one exists
- returns 1 on success, even if the function was not found
- returns 0 otherwise
-*/
-int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
- slang_assembly_name_space *space, slang_type_specifier *spec, int *exists);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_ASSEMBLE_TYPEINFO_H
+#define SLANG_ASSEMBLE_TYPEINFO_H
+
+#include "slang_assemble_constructor.h"
+#include "slang_compile.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+typedef struct slang_assembly_typeinfo_
+{
+ int can_be_referenced;
+ int is_swizzled;
+ slang_swizzle swz;
+ slang_type_specifier spec;
+} slang_assembly_typeinfo;
+
+void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *);
+void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *);
+
+/*
+ retrieves type information about an operation
+ returns 1 on success
+ returns 0 otherwise
+*/
+int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *,
+ slang_assembly_typeinfo *);
+
+/*
+ retrieves type of a function prototype, if one exists
+ returns 1 on success, even if the function was not found
+ returns 0 otherwise
+*/
+int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
+ slang_assembly_name_space *space, slang_type_specifier *spec, int *exists);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h
index a9a075c37..d78c66f00 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h
@@ -68,8 +68,8 @@ typedef enum slang_type_specifier_type_
slang_spec_sampler2DShadow,
slang_spec_struct,
slang_spec_array
-} slang_type_specifier_type;
-
+} slang_type_specifier_type;
+
slang_type_specifier_type slang_type_specifier_type_from_string (const char *);
typedef struct slang_type_specifier_
@@ -77,11 +77,11 @@ typedef struct slang_type_specifier_
slang_type_specifier_type type;
struct slang_struct_ *_struct; /* spec_struct */
struct slang_type_specifier_ *_array; /* spec_array */
-} slang_type_specifier;
-
-void slang_type_specifier_construct (slang_type_specifier *);
-void slang_type_specifier_destruct (slang_type_specifier *);
-int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
+} slang_type_specifier;
+
+void slang_type_specifier_construct (slang_type_specifier *);
+void slang_type_specifier_destruct (slang_type_specifier *);
+int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *);
typedef struct slang_fully_specified_type_
@@ -171,9 +171,9 @@ typedef struct slang_operation_
float literal; /* bool, literal_int, literal_float */
char *identifier; /* asm, identifier, call, field */
slang_variable_scope *locals;
-} slang_operation;
-
-int slang_operation_construct_a (slang_operation *);
+} slang_operation;
+
+int slang_operation_construct_a (slang_operation *);
void slang_operation_destruct (slang_operation *);
typedef struct slang_variable_
@@ -181,10 +181,10 @@ typedef struct slang_variable_
slang_fully_specified_type type;
char *name;
slang_operation *array_size; /* spec_array */
- slang_operation *initializer;
+ slang_operation *initializer;
unsigned int address;
-} slang_variable;
-
+} slang_variable;
+
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all);
typedef struct slang_struct_scope_
@@ -192,8 +192,8 @@ typedef struct slang_struct_scope_
struct slang_struct_ *structs;
unsigned int num_structs;
struct slang_struct_scope_ *outer_scope;
-} slang_struct_scope;
-
+} slang_struct_scope;
+
struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int);
typedef struct slang_struct_
@@ -201,9 +201,9 @@ typedef struct slang_struct_
char *name;
slang_variable_scope *fields;
slang_struct_scope *structs;
-} slang_struct;
-
-int slang_struct_construct_a (slang_struct *);
+} slang_struct;
+
+int slang_struct_construct_a (slang_struct *);
int slang_struct_copy (slang_struct *, const slang_struct *);
typedef enum slang_function_kind_
@@ -219,7 +219,7 @@ typedef struct slang_function_
slang_variable header;
slang_variable_scope *parameters;
unsigned int param_count;
- slang_operation *body;
+ slang_operation *body;
unsigned int address;
} slang_function;
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c
index d47f3eaca..57941469c 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c
@@ -1,352 +1,352 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_execute.c
- * intermediate code interpreter
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-#include "slang_assemble.h"
-#include "slang_storage.h"
-#include "slang_execute.h"
-
-static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)
-{
- fprintf (f, "%.5u:\t", i);
-
- switch (a->type)
- {
- case slang_asm_none:
- fprintf (f, "none");
- break;
- case slang_asm_float_copy:
- fprintf (f, "float_copy\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_float_move:
- fprintf (f, "float_move\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_float_push:
- fprintf (f, "float_push\t%f", a->literal);
- break;
- case slang_asm_float_deref:
- fprintf (f, "float_deref");
- break;
- case slang_asm_float_add:
- fprintf (f, "float_add");
- break;
- case slang_asm_float_multiply:
- fprintf (f, "float_multiply");
- break;
- case slang_asm_float_divide:
- fprintf (f, "float_divide");
- break;
- case slang_asm_float_negate:
- fprintf (f, "float_negate");
- break;
- case slang_asm_float_less:
- fprintf (f, "float_less");
- break;
- case slang_asm_float_equal:
- fprintf (f, "float_equal\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_float_to_int:
- fprintf (f, "float_to_int");
- break;
- case slang_asm_int_copy:
- fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_int_move:
- fprintf (f, "int_move\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_int_push:
- fprintf (f, "int_push\t%d", (GLint) a->literal);
- break;
- case slang_asm_int_deref:
- fprintf (f, "int_deref");
- break;
- case slang_asm_int_to_float:
- fprintf (f, "int_to_float");
- break;
- case slang_asm_int_to_addr:
- fprintf (f, "int_to_addr");
- break;
- case slang_asm_bool_copy:
- fprintf (f, "bool_copy\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_bool_move:
- fprintf (f, "bool_move\t%d, %d", a->param[0], a->param[1]);
- break;
- case slang_asm_bool_push:
- fprintf (f, "bool_push\t%d", a->literal != 0.0f);
- break;
- case slang_asm_bool_deref:
- fprintf (f, "bool_deref");
- break;
- case slang_asm_addr_copy:
- fprintf (f, "addr_copy");
- break;
- case slang_asm_addr_push:
- fprintf (f, "addr_push\t%u", a->param[0]);
- break;
- case slang_asm_addr_deref:
- fprintf (f, "addr_deref");
- break;
- case slang_asm_addr_add:
- fprintf (f, "addr_add");
- break;
- case slang_asm_addr_multiply:
- fprintf (f, "addr_multiply");
- break;
- case slang_asm_jump:
- fprintf (f, "jump\t%u", a->param[0]);
- break;
- case slang_asm_jump_if_zero:
- fprintf (f, "jump_if_zero\t%u", a->param[0]);
- break;
- case slang_asm_enter:
- fprintf (f, "enter\t%u", a->param[0]);
- break;
- case slang_asm_leave:
- fprintf (f, "leave");
- break;
- case slang_asm_local_alloc:
- fprintf (f, "local_alloc\t%u", a->param[0]);
- break;
- case slang_asm_local_free:
- fprintf (f, "local_free\t%u", a->param[0]);
- break;
- case slang_asm_local_addr:
- fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]);
- break;
- case slang_asm_call:
- fprintf (f, "call\t%u", a->param[0]);
- break;
- case slang_asm_return:
- fprintf (f, "return");
- break;
- case slang_asm_discard:
- fprintf (f, "discard");
- break;
- case slang_asm_exit:
- fprintf (f, "exit");
- break;
- default:
- break;
- }
-
- fprintf (f, "\n");
-}
-
-static void dump (const slang_assembly_file *file)
-{
- unsigned int i;
- static unsigned int counter = 0;
- FILE *f;
- char filename[256];
-
- counter++;
- sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);
- f = fopen (filename, "w");
- if (f == NULL)
- return;
-
- for (i = 0; i < file->count; i++)
- dump_instruction (f, file->code + i, i);
-
- fclose (f);
-}
-
-int _slang_execute (const slang_assembly_file *file)
-{
- slang_machine mach;
- FILE *f;
-
- mach.ip = 0;
- mach.sp = SLANG_MACHINE_STACK_SIZE;
- mach.bp = 0;
- mach.kill = 0;
- mach.exit = 0;
-
- /* assume 32-bit machine */
- /* XXX why???, disabling the pointer size assertions here.
- * See bug 4021.
- */
- static_assert(sizeof (GLfloat) == 4);
- /*static_assert(sizeof (GLfloat *) == 4);*/
- static_assert(sizeof (GLuint) == 4);
- /*static_assert(sizeof (GLuint *) == 4);*/
-
- dump (file);
-
- f = fopen ("~mesa-slang-assembly-execution.txt", "w");
-
- while (!mach.exit)
- {
- slang_assembly *a = file->code + mach.ip;
- if (f != NULL)
- {
- unsigned int i;
- dump_instruction (f, a, mach.ip);
- fprintf (f, "\t\tsp=%u bp=%u\n", mach.sp, mach.bp);
- for (i = mach.sp; i < SLANG_MACHINE_STACK_SIZE; i++)
- fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]);
- fflush (f);
- }
- mach.ip++;
-
- switch (a->type)
- {
- case slang_asm_none:
- break;
- case slang_asm_float_copy:
- case slang_asm_int_copy:
- case slang_asm_bool_copy:
- *(mach.stack._floatp[mach.sp + a->param[0] / 4] + a->param[1] / 4) =
- mach.stack._float[mach.sp];
- mach.sp++;
- break;
- case slang_asm_float_move:
- case slang_asm_int_move:
- case slang_asm_bool_move:
- mach.stack._float[mach.sp + a->param[0] / 4] =
- mach.stack._float[mach.sp + (mach.stack._addr[mach.sp] + a->param[1]) / 4];
- break;
- case slang_asm_float_push:
- case slang_asm_int_push:
- case slang_asm_bool_push:
- mach.sp--;
- mach.stack._float[mach.sp] = a->literal;
- break;
- case slang_asm_float_deref:
- case slang_asm_int_deref:
- case slang_asm_bool_deref:
- mach.stack._float[mach.sp] = *mach.stack._floatp[mach.sp];
- break;
- case slang_asm_float_add:
- mach.stack._float[mach.sp + 1] += mach.stack._float[mach.sp];
- mach.sp++;
- break;
- case slang_asm_float_multiply:
- mach.stack._float[mach.sp + 1] *= mach.stack._float[mach.sp];
- mach.sp++;
- break;
- case slang_asm_float_divide:
- mach.stack._float[mach.sp + 1] /= mach.stack._float[mach.sp];
- mach.sp++;
- break;
- case slang_asm_float_negate:
- mach.stack._float[mach.sp] = -mach.stack._float[mach.sp];
- break;
- case slang_asm_float_less:
- mach.stack._float[mach.sp + 1] =
- mach.stack._float[mach.sp + 1] < mach.stack._float[mach.sp] ? 1.0f : 0.0f;
- mach.sp++;
- break;
- case slang_asm_float_equal:
- mach.sp--;
- mach.stack._float[mach.sp] = mach.stack._float[mach.sp + 1 + a->param[0] / 4] ==
- mach.stack._float[mach.sp + 1 + a->param[1] / 4] ? 1.0f : 0.0f;
- break;
- case slang_asm_float_to_int:
- mach.stack._float[mach.sp] = (GLfloat) (GLint) mach.stack._float[mach.sp];
- break;
- case slang_asm_int_to_float:
- break;
- case slang_asm_int_to_addr:
- mach.stack._addr[mach.sp] = (GLuint) (GLint) mach.stack._float[mach.sp];
- break;
- case slang_asm_addr_copy:
- *mach.stack._addrp[mach.sp + 1] = mach.stack._addr[mach.sp];
- mach.sp++;
- break;
- case slang_asm_addr_push:
- mach.sp--;
- mach.stack._addr[mach.sp] = a->param[0];
- break;
- case slang_asm_addr_deref:
- mach.stack._addr[mach.sp] = *mach.stack._addrp[mach.sp];
- break;
- case slang_asm_addr_add:
- mach.stack._addr[mach.sp + 1] += mach.stack._addr[mach.sp];
- mach.sp++;
- break;
- case slang_asm_addr_multiply:
- mach.stack._addr[mach.sp + 1] *= mach.stack._addr[mach.sp];
- mach.sp++;
- break;
- case slang_asm_jump:
- mach.ip = a->param[0];
- break;
- case slang_asm_jump_if_zero:
- if (mach.stack._float[mach.sp] == 0.0f)
- mach.ip = a->param[0];
- mach.sp++;
- break;
- case slang_asm_enter:
- mach.sp--;
- mach.stack._addr[mach.sp] = mach.bp;
- mach.bp = mach.sp + a->param[0] / 4;
- break;
- case slang_asm_leave:
- mach.bp = mach.stack._addr[mach.sp];
- mach.sp++;
- break;
- case slang_asm_local_alloc:
- mach.sp -= a->param[0] / 4;
- break;
- case slang_asm_local_free:
- mach.sp += a->param[0] / 4;
- break;
- case slang_asm_local_addr:
- mach.sp--;
- mach.stack._addr[mach.sp] = (GLuint) mach.stack._addr + mach.bp * 4 -
- (a->param[0] + a->param[1]) + 4;
- break;
- case slang_asm_call:
- mach.sp--;
- mach.stack._addr[mach.sp] = mach.ip;
- mach.ip = a->param[0];
- break;
- case slang_asm_return:
- mach.ip = mach.stack._addr[mach.sp];
- mach.sp++;
- break;
- case slang_asm_discard:
- mach.kill = 1;
- break;
- case slang_asm_exit:
- mach.exit = 1;
- break;
- }
- }
-
- if (f != NULL)
- fclose (f);
-
- return 0;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_execute.c
+ * intermediate code interpreter
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+#include "slang_assemble.h"
+#include "slang_storage.h"
+#include "slang_execute.h"
+
+static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)
+{
+ fprintf (f, "%.5u:\t", i);
+
+ switch (a->type)
+ {
+ case slang_asm_none:
+ fprintf (f, "none");
+ break;
+ case slang_asm_float_copy:
+ fprintf (f, "float_copy\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_float_move:
+ fprintf (f, "float_move\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_float_push:
+ fprintf (f, "float_push\t%f", a->literal);
+ break;
+ case slang_asm_float_deref:
+ fprintf (f, "float_deref");
+ break;
+ case slang_asm_float_add:
+ fprintf (f, "float_add");
+ break;
+ case slang_asm_float_multiply:
+ fprintf (f, "float_multiply");
+ break;
+ case slang_asm_float_divide:
+ fprintf (f, "float_divide");
+ break;
+ case slang_asm_float_negate:
+ fprintf (f, "float_negate");
+ break;
+ case slang_asm_float_less:
+ fprintf (f, "float_less");
+ break;
+ case slang_asm_float_equal:
+ fprintf (f, "float_equal\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_float_to_int:
+ fprintf (f, "float_to_int");
+ break;
+ case slang_asm_int_copy:
+ fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_int_move:
+ fprintf (f, "int_move\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_int_push:
+ fprintf (f, "int_push\t%d", (GLint) a->literal);
+ break;
+ case slang_asm_int_deref:
+ fprintf (f, "int_deref");
+ break;
+ case slang_asm_int_to_float:
+ fprintf (f, "int_to_float");
+ break;
+ case slang_asm_int_to_addr:
+ fprintf (f, "int_to_addr");
+ break;
+ case slang_asm_bool_copy:
+ fprintf (f, "bool_copy\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_bool_move:
+ fprintf (f, "bool_move\t%d, %d", a->param[0], a->param[1]);
+ break;
+ case slang_asm_bool_push:
+ fprintf (f, "bool_push\t%d", a->literal != 0.0f);
+ break;
+ case slang_asm_bool_deref:
+ fprintf (f, "bool_deref");
+ break;
+ case slang_asm_addr_copy:
+ fprintf (f, "addr_copy");
+ break;
+ case slang_asm_addr_push:
+ fprintf (f, "addr_push\t%u", a->param[0]);
+ break;
+ case slang_asm_addr_deref:
+ fprintf (f, "addr_deref");
+ break;
+ case slang_asm_addr_add:
+ fprintf (f, "addr_add");
+ break;
+ case slang_asm_addr_multiply:
+ fprintf (f, "addr_multiply");
+ break;
+ case slang_asm_jump:
+ fprintf (f, "jump\t%u", a->param[0]);
+ break;
+ case slang_asm_jump_if_zero:
+ fprintf (f, "jump_if_zero\t%u", a->param[0]);
+ break;
+ case slang_asm_enter:
+ fprintf (f, "enter\t%u", a->param[0]);
+ break;
+ case slang_asm_leave:
+ fprintf (f, "leave");
+ break;
+ case slang_asm_local_alloc:
+ fprintf (f, "local_alloc\t%u", a->param[0]);
+ break;
+ case slang_asm_local_free:
+ fprintf (f, "local_free\t%u", a->param[0]);
+ break;
+ case slang_asm_local_addr:
+ fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]);
+ break;
+ case slang_asm_call:
+ fprintf (f, "call\t%u", a->param[0]);
+ break;
+ case slang_asm_return:
+ fprintf (f, "return");
+ break;
+ case slang_asm_discard:
+ fprintf (f, "discard");
+ break;
+ case slang_asm_exit:
+ fprintf (f, "exit");
+ break;
+ default:
+ break;
+ }
+
+ fprintf (f, "\n");
+}
+
+static void dump (const slang_assembly_file *file)
+{
+ unsigned int i;
+ static unsigned int counter = 0;
+ FILE *f;
+ char filename[256];
+
+ counter++;
+ sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);
+ f = fopen (filename, "w");
+ if (f == NULL)
+ return;
+
+ for (i = 0; i < file->count; i++)
+ dump_instruction (f, file->code + i, i);
+
+ fclose (f);
+}
+
+int _slang_execute (const slang_assembly_file *file)
+{
+ slang_machine mach;
+ FILE *f;
+
+ mach.ip = 0;
+ mach.sp = SLANG_MACHINE_STACK_SIZE;
+ mach.bp = 0;
+ mach.kill = 0;
+ mach.exit = 0;
+
+ /* assume 32-bit machine */
+ /* XXX why???, disabling the pointer size assertions here.
+ * See bug 4021.
+ */
+ _static_assert(sizeof (GLfloat) == 4);
+ /*_static_assert(sizeof (GLfloat *) == 4);*/
+ _static_assert(sizeof (GLuint) == 4);
+ /*_static_assert(sizeof (GLuint *) == 4);*/
+
+ dump (file);
+
+ f = fopen ("~mesa-slang-assembly-execution.txt", "w");
+
+ while (!mach.exit)
+ {
+ slang_assembly *a = file->code + mach.ip;
+ if (f != NULL)
+ {
+ unsigned int i;
+ dump_instruction (f, a, mach.ip);
+ fprintf (f, "\t\tsp=%u bp=%u\n", mach.sp, mach.bp);
+ for (i = mach.sp; i < SLANG_MACHINE_STACK_SIZE; i++)
+ fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]);
+ fflush (f);
+ }
+ mach.ip++;
+
+ switch (a->type)
+ {
+ case slang_asm_none:
+ break;
+ case slang_asm_float_copy:
+ case slang_asm_int_copy:
+ case slang_asm_bool_copy:
+ *(mach.stack._floatp[mach.sp + a->param[0] / 4] + a->param[1] / 4) =
+ mach.stack._float[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_float_move:
+ case slang_asm_int_move:
+ case slang_asm_bool_move:
+ mach.stack._float[mach.sp + a->param[0] / 4] =
+ mach.stack._float[mach.sp + (mach.stack._addr[mach.sp] + a->param[1]) / 4];
+ break;
+ case slang_asm_float_push:
+ case slang_asm_int_push:
+ case slang_asm_bool_push:
+ mach.sp--;
+ mach.stack._float[mach.sp] = a->literal;
+ break;
+ case slang_asm_float_deref:
+ case slang_asm_int_deref:
+ case slang_asm_bool_deref:
+ mach.stack._float[mach.sp] = *mach.stack._floatp[mach.sp];
+ break;
+ case slang_asm_float_add:
+ mach.stack._float[mach.sp + 1] += mach.stack._float[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_float_multiply:
+ mach.stack._float[mach.sp + 1] *= mach.stack._float[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_float_divide:
+ mach.stack._float[mach.sp + 1] /= mach.stack._float[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_float_negate:
+ mach.stack._float[mach.sp] = -mach.stack._float[mach.sp];
+ break;
+ case slang_asm_float_less:
+ mach.stack._float[mach.sp + 1] =
+ mach.stack._float[mach.sp + 1] < mach.stack._float[mach.sp] ? 1.0f : 0.0f;
+ mach.sp++;
+ break;
+ case slang_asm_float_equal:
+ mach.sp--;
+ mach.stack._float[mach.sp] = mach.stack._float[mach.sp + 1 + a->param[0] / 4] ==
+ mach.stack._float[mach.sp + 1 + a->param[1] / 4] ? 1.0f : 0.0f;
+ break;
+ case slang_asm_float_to_int:
+ mach.stack._float[mach.sp] = (GLfloat) (GLint) mach.stack._float[mach.sp];
+ break;
+ case slang_asm_int_to_float:
+ break;
+ case slang_asm_int_to_addr:
+ mach.stack._addr[mach.sp] = (GLuint) (GLint) mach.stack._float[mach.sp];
+ break;
+ case slang_asm_addr_copy:
+ *mach.stack._addrp[mach.sp + 1] = mach.stack._addr[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_addr_push:
+ mach.sp--;
+ mach.stack._addr[mach.sp] = a->param[0];
+ break;
+ case slang_asm_addr_deref:
+ mach.stack._addr[mach.sp] = *mach.stack._addrp[mach.sp];
+ break;
+ case slang_asm_addr_add:
+ mach.stack._addr[mach.sp + 1] += mach.stack._addr[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_addr_multiply:
+ mach.stack._addr[mach.sp + 1] *= mach.stack._addr[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_jump:
+ mach.ip = a->param[0];
+ break;
+ case slang_asm_jump_if_zero:
+ if (mach.stack._float[mach.sp] == 0.0f)
+ mach.ip = a->param[0];
+ mach.sp++;
+ break;
+ case slang_asm_enter:
+ mach.sp--;
+ mach.stack._addr[mach.sp] = mach.bp;
+ mach.bp = mach.sp + a->param[0] / 4;
+ break;
+ case slang_asm_leave:
+ mach.bp = mach.stack._addr[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_local_alloc:
+ mach.sp -= a->param[0] / 4;
+ break;
+ case slang_asm_local_free:
+ mach.sp += a->param[0] / 4;
+ break;
+ case slang_asm_local_addr:
+ mach.sp--;
+ mach.stack._addr[mach.sp] = (GLuint) mach.stack._addr + mach.bp * 4 -
+ (a->param[0] + a->param[1]) + 4;
+ break;
+ case slang_asm_call:
+ mach.sp--;
+ mach.stack._addr[mach.sp] = mach.ip;
+ mach.ip = a->param[0];
+ break;
+ case slang_asm_return:
+ mach.ip = mach.stack._addr[mach.sp];
+ mach.sp++;
+ break;
+ case slang_asm_discard:
+ mach.kill = 1;
+ break;
+ case slang_asm_exit:
+ mach.exit = 1;
+ break;
+ }
+ }
+
+ if (f != NULL)
+ fclose (f);
+
+ return 0;
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h
index 8ff1eb17c..7a7765441 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h
@@ -1,57 +1,57 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_EXECUTE_H
-#define SLANG_EXECUTE_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-#define SLANG_MACHINE_STACK_SIZE 1024
-
-typedef struct slang_machine_
-{
- GLuint ip; /* instruction pointer, for flow control */
- GLuint sp; /* stack pointer, for stack access */
- GLuint bp; /* base pointer, for local variable access */
- GLuint kill; /* discard the fragment */
- GLuint exit; /* terminate the shader */
- union stack_
- {
- GLfloat _float[SLANG_MACHINE_STACK_SIZE];
- GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE];
- GLuint _addr[SLANG_MACHINE_STACK_SIZE];
- GLuint *_addrp[SLANG_MACHINE_STACK_SIZE];
- } stack;
-} slang_machine;
-
-int _slang_execute (const slang_assembly_file *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_EXECUTE_H
+#define SLANG_EXECUTE_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+#define SLANG_MACHINE_STACK_SIZE 1024
+
+typedef struct slang_machine_
+{
+ GLuint ip; /* instruction pointer, for flow control */
+ GLuint sp; /* stack pointer, for stack access */
+ GLuint bp; /* base pointer, for local variable access */
+ GLuint kill; /* discard the fragment */
+ GLuint exit; /* terminate the shader */
+ union stack_
+ {
+ GLfloat _float[SLANG_MACHINE_STACK_SIZE];
+ GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE];
+ GLuint _addr[SLANG_MACHINE_STACK_SIZE];
+ GLuint *_addrp[SLANG_MACHINE_STACK_SIZE];
+ } stack;
+} slang_machine;
+
+int _slang_execute (const slang_assembly_file *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c
index b1f62ded3..1dc156eed 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c
@@ -1,87 +1,87 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_preprocess.c
- * slang preprocessor
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "grammar_mesa.h"
-#include "slang_compile.h"
-#include "slang_preprocess.h"
-
-static const char *slang_version_syn =
-#include "library/slang_version_syn.h"
-;
-
-int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten,
- slang_info_log *log)
-{
- grammar id;
- byte *prod, *I;
- unsigned int size;
-
- id = grammar_load_from_text ((const byte *) slang_version_syn);
- if (id == 0)
- {
- char buf[1024];
- unsigned int pos;
- grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
- slang_info_log_error (log, buf);
- return 0;
- }
-
- if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8))
- {
- char buf[1024];
- unsigned int pos;
- grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
- slang_info_log_error (log, buf);
- grammar_destroy (id);
- return 0;
- }
-
- grammar_destroy (id);
-
- /* there can be multiple #version directives - grab the last one */
- I = prod;
- while (I < prod + size)
- {
- *version =
- (unsigned int) I[0] +
- (unsigned int) I[1] * 100;
- *eaten =
- ((unsigned int) I[2]) +
- ((unsigned int) I[3] << 8) +
- ((unsigned int) I[4] << 16) +
- ((unsigned int) I[5] << 24);
- I += 6;
- }
-
- grammar_alloc_free (prod);
- return 1;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_preprocess.c
+ * slang preprocessor
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "grammar_mesa.h"
+#include "slang_compile.h"
+#include "slang_preprocess.h"
+
+static const char *slang_version_syn =
+#include "library/slang_version_syn.h"
+;
+
+int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten,
+ slang_info_log *log)
+{
+ grammar id;
+ byte *prod, *I;
+ unsigned int size;
+
+ id = grammar_load_from_text ((const byte *) slang_version_syn);
+ if (id == 0)
+ {
+ char buf[1024];
+ unsigned int pos;
+ grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
+ slang_info_log_error (log, buf);
+ return 0;
+ }
+
+ if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8))
+ {
+ char buf[1024];
+ unsigned int pos;
+ grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
+ slang_info_log_error (log, buf);
+ grammar_destroy (id);
+ return 0;
+ }
+
+ grammar_destroy (id);
+
+ /* there can be multiple #version directives - grab the last one */
+ I = prod;
+ while (I < prod + size)
+ {
+ *version =
+ (unsigned int) I[0] +
+ (unsigned int) I[1] * 100;
+ *eaten =
+ ((unsigned int) I[2]) +
+ ((unsigned int) I[3] << 8) +
+ ((unsigned int) I[4] << 16) +
+ ((unsigned int) I[5] << 24);
+ I += 6;
+ }
+
+ grammar_alloc_free (prod);
+ return 1;
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h
index 7901e7858..637b822c9 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h
@@ -1,39 +1,39 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_PREPROCESS_H
-#define SLANG_PREPROCESS_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_PREPROCESS_H
+#define SLANG_PREPROCESS_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c
index c07e161c8..b1b20d9e3 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c
@@ -1,73 +1,73 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_utility.c
- * slang utilities
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_utility.h"
-
-void slang_alloc_free (void *ptr)
-{
- _mesa_free (ptr);
-}
-
-void *slang_alloc_malloc (unsigned int size)
-{
- return _mesa_malloc (size);
-}
-
-void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
-{
- return _mesa_realloc (ptr, old_size, size);
-}
-
-int slang_string_compare (const char *str1, const char *str2)
-{
- return _mesa_strcmp (str1, str2);
-}
-
-char *slang_string_copy (char *dst, const char *src)
-{
- return _mesa_strcpy (dst, src);
-}
-
-char *slang_string_concat (char *dst, const char *src)
-{
- return _mesa_strcpy (dst + _mesa_strlen (dst), src);
-}
-
-char *slang_string_duplicate (const char *src)
-{
- return _mesa_strdup (src);
-}
-
-unsigned int slang_string_length (const char *str)
-{
- return _mesa_strlen (str);
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_utility.c
+ * slang utilities
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+
+void slang_alloc_free (void *ptr)
+{
+ _mesa_free (ptr);
+}
+
+void *slang_alloc_malloc (unsigned int size)
+{
+ return _mesa_malloc (size);
+}
+
+void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
+{
+ return _mesa_realloc (ptr, old_size, size);
+}
+
+int slang_string_compare (const char *str1, const char *str2)
+{
+ return _mesa_strcmp (str1, str2);
+}
+
+char *slang_string_copy (char *dst, const char *src)
+{
+ return _mesa_strcpy (dst, src);
+}
+
+char *slang_string_concat (char *dst, const char *src)
+{
+ return _mesa_strcpy (dst + _mesa_strlen (dst), src);
+}
+
+char *slang_string_duplicate (const char *src)
+{
+ return _mesa_strdup (src);
+}
+
+unsigned int slang_string_length (const char *str)
+{
+ return _mesa_strlen (str);
+}
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h
index 2b040a444..04afa18d1 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h
@@ -1,51 +1,51 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_UTILITY_H
-#define SLANG_UTILITY_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-/* Compile-time assertions. If the expression is zero, try to declare an
- * array of size [-1] to cause compilation error.
- */
-#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)
-
-void slang_alloc_free (void *);
-void *slang_alloc_malloc (unsigned int);
-void *slang_alloc_realloc (void *, unsigned int, unsigned int);
-int slang_string_compare (const char *, const char *);
-char *slang_string_copy (char *, const char *);
-char *slang_string_concat (char *, const char *);
-char *slang_string_duplicate (const char *);
-unsigned int slang_string_length (const char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_UTILITY_H
+#define SLANG_UTILITY_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/* Compile-time assertions. If the expression is zero, try to declare an
+ * array of size [-1] to cause compilation error.
+ */
+#define _static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)
+
+void slang_alloc_free (void *);
+void *slang_alloc_malloc (unsigned int);
+void *slang_alloc_realloc (void *, unsigned int, unsigned int);
+int slang_string_compare (const char *, const char *);
+char *slang_string_copy (char *, const char *);
+char *slang_string_concat (char *, const char *);
+char *slang_string_duplicate (const char *);
+unsigned int slang_string_length (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h b/nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h
index f0cc76108..b2f244ee0 100644
--- a/nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h
+++ b/nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h
@@ -1,112 +1,112 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file traverse_wrap.h
- * Handy TIntermTraverser class wrapper
- * \author Michal Krol
- */
-
-#ifndef __TRAVERSE_WRAP_H__
-#define __TRAVERSE_WRAP_H__
-
-#include "Include/intermediate.h"
-
-/*
- The original TIntermTraverser class that is used to walk the intermediate tree,
- is not very elegant in its design. One must define static functions with
- appropriate prototypes, construct TIntermTraverser object, and set its member
- function pointers to one's static functions. If traversal-specific data
- is needed, a new class must be derived, and one must up-cast the object
- passed as a parameter to the static function.
-
- The class below eliminates this burden by providing virtual methods that are
- to be overridden in the derived class.
-*/
-
-class traverse_wrap: private TIntermTraverser
-{
-private:
- static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) {
- static_cast<traverse_wrap *> (T)->Symbol (*S);
- }
- static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) {
- static_cast<traverse_wrap *> (T)->ConstantUnion (*U);
- }
- static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Binary (preVisit, *B);
- }
- static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Unary (preVisit, *U);
- }
- static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Selection (preVisit, *S);
- }
- static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Aggregate (preVisit, *A);
- }
- static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Loop (preVisit, *L);
- }
- static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) {
- return static_cast<traverse_wrap *> (T)->Branch (preVisit, *B);
- }
-public:
- traverse_wrap () {
- visitSymbol = _visitSymbol;
- visitConstantUnion = _visitConstantUnion;
- visitBinary = _visitBinary;
- visitUnary = _visitUnary;
- visitSelection = _visitSelection;
- visitAggregate = _visitAggregate;
- visitLoop = _visitLoop;
- visitBranch = _visitBranch;
- }
-protected:
- virtual void Symbol (const TIntermSymbol &) {
- }
- virtual void ConstantUnion (const TIntermConstantUnion &) {
- }
- virtual bool Binary (bool, const TIntermBinary &) {
- return true;
- }
- virtual bool Unary (bool, const TIntermUnary &) {
- return true;
- }
- virtual bool Selection (bool, const TIntermSelection &) {
- return true;
- }
- virtual bool Aggregate (bool, const TIntermAggregate &) {
- return true;
- }
- virtual bool Loop (bool, const TIntermLoop &) {
- return true;
- }
- virtual bool Branch (bool, const TIntermBranch &) {
- return true;
- }
-};
-
-#endif
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file traverse_wrap.h
+ * Handy TIntermTraverser class wrapper
+ * \author Michal Krol
+ */
+
+#ifndef __TRAVERSE_WRAP_H__
+#define __TRAVERSE_WRAP_H__
+
+#include "Include/intermediate.h"
+
+/*
+ The original TIntermTraverser class that is used to walk the intermediate tree,
+ is not very elegant in its design. One must define static functions with
+ appropriate prototypes, construct TIntermTraverser object, and set its member
+ function pointers to one's static functions. If traversal-specific data
+ is needed, a new class must be derived, and one must up-cast the object
+ passed as a parameter to the static function.
+
+ The class below eliminates this burden by providing virtual methods that are
+ to be overridden in the derived class.
+*/
+
+class traverse_wrap: private TIntermTraverser
+{
+private:
+ static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) {
+ static_cast<traverse_wrap *> (T)->Symbol (*S);
+ }
+ static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) {
+ static_cast<traverse_wrap *> (T)->ConstantUnion (*U);
+ }
+ static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Binary (preVisit, *B);
+ }
+ static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Unary (preVisit, *U);
+ }
+ static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Selection (preVisit, *S);
+ }
+ static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Aggregate (preVisit, *A);
+ }
+ static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Loop (preVisit, *L);
+ }
+ static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) {
+ return static_cast<traverse_wrap *> (T)->Branch (preVisit, *B);
+ }
+public:
+ traverse_wrap () {
+ visitSymbol = _visitSymbol;
+ visitConstantUnion = _visitConstantUnion;
+ visitBinary = _visitBinary;
+ visitUnary = _visitUnary;
+ visitSelection = _visitSelection;
+ visitAggregate = _visitAggregate;
+ visitLoop = _visitLoop;
+ visitBranch = _visitBranch;
+ }
+protected:
+ virtual void Symbol (const TIntermSymbol &) {
+ }
+ virtual void ConstantUnion (const TIntermConstantUnion &) {
+ }
+ virtual bool Binary (bool, const TIntermBinary &) {
+ return true;
+ }
+ virtual bool Unary (bool, const TIntermUnary &) {
+ return true;
+ }
+ virtual bool Selection (bool, const TIntermSelection &) {
+ return true;
+ }
+ virtual bool Aggregate (bool, const TIntermAggregate &) {
+ return true;
+ }
+ virtual bool Loop (bool, const TIntermLoop &) {
+ return true;
+ }
+ virtual bool Branch (bool, const TIntermBranch &) {
+ return true;
+ }
+};
+
+#endif
+
diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c
index dd5e40ffe..d082e84bf 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c
@@ -39,6 +39,7 @@
#endif
#include <string.h>
+#include <assert.h>
#include "glxserver.h"
#include <GL/glxtokens.h>
@@ -50,7 +51,6 @@
#include "glximports.h"
#include "glxutil.h"
#include "glxext.h"
-#include "GL/glx_ansic.h"
#include "glcontextmodes.h"
/************************************************************************/
@@ -193,11 +193,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
+ glxc = (__GLXcontext *) malloc(sizeof(__GLXcontext));
if (!glxc) {
return BadAlloc;
}
- __glXMemset(glxc, 0, sizeof(__GLXcontext));
+ memset(glxc, 0, sizeof(__GLXcontext));
/*
** Initially, setup the part of the context that could be used by
@@ -216,7 +216,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
imports.other = (void *)glxc;
glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC);
if (!glxc->gc) {
- __glXFree(glxc);
+ free(glxc);
client->errorValue = gcId;
return BadAlloc;
}
@@ -233,7 +233,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
if (!isDirect) {
(*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc);
}
- __glXFree(glxc);
+ free(glxc);
client->errorValue = gcId;
return BadAlloc;
}
@@ -335,9 +335,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
- table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *));
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
} else {
- table = (__GLXcontext **) __glXRealloc(table,
+ table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
}
table[num] = glxc;
@@ -685,7 +685,7 @@ int DoMakeCurrent( __GLXclientState *cl,
** refcount of the X pixmap and free only if it's zero.
*/
(*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(prevglxc->readPixmap);
+ free(prevglxc->readPixmap);
}
}
@@ -701,7 +701,7 @@ int DoMakeCurrent( __GLXclientState *cl,
** refcount of the X pixmap and free only if it's zero.
*/
(*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(prevglxc->drawPixmap);
+ free(prevglxc->drawPixmap);
}
prevglxc->drawPixmap = NULL;
@@ -1192,7 +1192,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
return BadValue;
}
- pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap));
+ pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
if (!pGlxPixmap) {
return BadAlloc;
}
@@ -1382,7 +1382,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)__glXMalloc((size_t)nReplyBytes);
+ sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
return __glXBadContext; /* XXX: Is this correct? */
}
@@ -1400,7 +1400,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
WriteToClient(client, nReplyBytes, sendBuf);
}
- __glXFree((char *)sendBuf);
+ free((char *)sendBuf);
return Success;
}
@@ -1626,17 +1626,17 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen);
+ cl->largeCmdBuf = (GLbyte *) malloc((size_t)cmdlen);
} else {
- cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf,
- (size_t)cmdlen);
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf,
+ (size_t)cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
- __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
@@ -1679,7 +1679,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
__glXResetLargeCommandStatus(cl);
return __glXBadLargeRequest;
}
- __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
@@ -2074,17 +2074,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
ptr = __glXActiveScreens[screen].GLXextensions;
- n = __glXStrlen(ptr) + 1;
+ n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
- if ((buf = (char *) __glXMalloc(length << 2)) == NULL) {
+ /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
+ buf = (char *) malloc(length << 2);
+ if (buf == NULL)
return BadAlloc;
- }
- __glXStrncpy(buf, ptr, n);
+ memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, buf);
@@ -2093,7 +2094,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), buf);
}
- __glXFree(buf);
+ free(buf);
return Success;
}
@@ -2131,7 +2132,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
return BadValue;
}
- n = __glXStrlen(ptr) + 1;
+ n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
@@ -2141,7 +2142,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
if ((buf = (char *) malloc(length << 2)) == NULL) {
return BadAlloc;
}
- __glXStrncpy(buf, ptr, n);
+ memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, buf);
@@ -2150,7 +2151,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), buf);
}
- __glXFree(buf);
+ free(buf);
return Success;
}
@@ -2161,9 +2162,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions)
+ free(cl->GLClientextensions);
buf = (const char *)(req+1);
- cl->GLClientextensions = __glXStrdup(buf);
+ cl->GLClientextensions = xstrdup(buf);
return Success;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
index 092a14e66..98acfe5af 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
@@ -47,7 +47,6 @@
#include <pixmapstr.h>
#include <windowstr.h>
#include "glxext.h"
-#include "GL/glx_ansic.h"
static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
@@ -683,16 +682,16 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen);
+ cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
} else {
- cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen);
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
- __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
@@ -735,7 +734,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
__glXResetLargeCommandStatus(cl);
return __glXBadLargeRequest;
}
- __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.c b/nx-X11/programs/Xserver/GL/glx/glxext.c
index f908c08cf..f6d572d2a 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxext.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxext.c
@@ -62,17 +62,18 @@ static void ResetClientState(int clientIndex)
{
__GLXclientState *cl = __glXClients[clientIndex];
- if (cl->returnBuf) __glXFree(cl->returnBuf);
- if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
- if (cl->currentContexts) __glXFree(cl->currentContexts);
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ if (cl->returnBuf) free(cl->returnBuf);
+ if (cl->largeCmdBuf) free(cl->largeCmdBuf);
+ if (cl->currentContexts) free(cl->currentContexts);
+ memset(cl, 0, sizeof(__GLXclientState));
/*
** By default, assume that the client supports
** GLX major version 1 minor version 0 protocol.
*/
cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions)
+ free(cl->GLClientextensions);
}
@@ -151,7 +152,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
** only if it's zero.
*/
(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(pGlxPixmap);
+ free(pGlxPixmap);
}
return True;
@@ -169,9 +170,9 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
return GL_FALSE;
}
}
- if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
- if (cx->selectBuf) __glXFree(cx->selectBuf);
- __glXFree(cx);
+ if (cx->feedbackBuf) free(cx->feedbackBuf);
+ if (cx->selectBuf) free(cx->selectBuf);
+ free(cx);
if (cx == __glXLastContext) {
__glXFlushContextCache();
}
@@ -404,12 +405,12 @@ static int __glXDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
@@ -458,12 +459,12 @@ static int __glXSwapDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.c b/nx-X11/programs/Xserver/GL/glx/glxfb.c
index 9573d97b9..955c1dd79 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxfb.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxfb.c
@@ -130,7 +130,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
FreeScratchGC(bufferInfo->pGC);
}
- __glXFree(bufferInfo);
+ free(bufferInfo);
buf->other = NULL;
}
@@ -173,7 +173,7 @@ __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
buf->free = Free;
/* allocate local information */
- bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo));
+ bufferInfo = (__GLFBbufferInfo *) malloc(sizeof(__GLFBbufferInfo));
buf->other = (void *) bufferInfo;
pGC = CreateScratchGC(glxPriv->pDraw->pScreen,
diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.c b/nx-X11/programs/Xserver/GL/glx/glximports.c
index a5a5e37ae..fb4d508a9 100644
--- a/nx-X11/programs/Xserver/GL/glx/glximports.c
+++ b/nx-X11/programs/Xserver/GL/glx/glximports.c
@@ -44,7 +44,6 @@
#include "glxserver.h"
#include "glxcontext.h"
#include "glximports.h"
-#include "GL/glx_ansic.h"
void *__glXImpMalloc(__GLcontext *gc, size_t size)
{
@@ -76,7 +75,7 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize)
return NULL;
}
/* zero out memory */
- __glXMemset(addr, 0, size);
+ memset(addr, 0, size);
return addr;
}
@@ -119,17 +118,17 @@ void __glXImpWarning(__GLcontext *gc, char *msg)
void __glXImpFatal(__GLcontext *gc, char *msg)
{
ErrorF("%s",(char *)msg);
- __glXAbort();
+ abort();
}
char *__glXImpGetenv(__GLcontext *gc, const char *var)
{
- return __glXGetenv(var);
+ return getenv(var);
}
int __glXImpAtoi(__GLcontext *gc, const char *str)
{
- return __glXAtoi(str);
+ return atoi(str);
}
int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
@@ -139,7 +138,7 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
/* have to deal with var args */
va_start(ap, fmt);
- ret = __glXVsprintf(str, fmt, ap);
+ ret = vsprintf(str, fmt, ap);
va_end(ap);
return ret;
@@ -147,12 +146,12 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode)
{
- return (void *) __glXFopen(path, mode);
+ return (void *) fopen(path, mode);
}
int __glXImpFclose(__GLcontext *gc, void *stream)
{
- return __glXFclose((FILE *)stream);
+ return fclose((FILE *)stream);
}
int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
@@ -162,7 +161,7 @@ int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
/* have to deal with var args */
va_start(ap, fmt);
- ret = __glXVfprintf((FILE *)stream, fmt, ap);
+ ret = vfprintf((FILE *)stream, fmt, ap);
va_end(ap);
return ret;
diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.c b/nx-X11/programs/Xserver/GL/glx/glxpix.c
index e1628efc0..81e29a9c5 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxpix.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxpix.c
@@ -95,7 +95,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
FreeScratchGC(bufferInfo->pGC);
}
- __glXFree(bufferInfo);
+ free(bufferInfo);
buf->other = NULL;
}
@@ -123,7 +123,7 @@ __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
buf->free = Free;
/* allocate local information */
- bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo));
+ bufferInfo = (__GLPixBufferInfo *) malloc(sizeof(__GLPixBufferInfo));
buf->other = (void *) bufferInfo;
bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen,
diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.c b/nx-X11/programs/Xserver/GL/glx/glxscreens.c
index 6b274a64b..1bff4bc3a 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxscreens.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.c
@@ -288,7 +288,7 @@ static void wrapPositionWindow(int screen)
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
{
if (__glXNumHyperpipeFuncs < screen + 1) {
- __glXHyperpipeFuncs = __glXRealloc(__glXHyperpipeFuncs,
+ __glXHyperpipeFuncs = realloc(__glXHyperpipeFuncs,
(screen+1) * sizeof(__GLXHyperpipeExtensionFuncs));
__glXNumHyperpipeFuncs = screen + 1;
}
@@ -306,7 +306,7 @@ void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
{
if (__glXNumSwapBarrierFuncs < screen + 1) {
- __glXSwapBarrierFuncs = __glXRealloc(__glXSwapBarrierFuncs,
+ __glXSwapBarrierFuncs = realloc(__glXSwapBarrierFuncs,
(screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs));
__glXNumSwapBarrierFuncs = screen + 1;
}
@@ -327,7 +327,7 @@ void __glXScreenInit(GLint numscreens)
** This alloc has to work or else the server might as well core dump.
*/
__glXActiveScreens =
- (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens);
+ (__GLXscreenInfo *) malloc(sizeof(__GLXscreenInfo) * numscreens);
for (i=0; i < numscreens; i++) {
/*
@@ -338,10 +338,10 @@ void __glXScreenInit(GLint numscreens)
__glXActiveScreens[i] = *__glXScreens[j];
__glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals;
- __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions);
- __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName);
- __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
- __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions);
+ __glXActiveScreens[i].GLextensions = strdup(GLServerExtensions);
+ __glXActiveScreens[i].GLXvendor = strdup(GLXServerVendorName);
+ __glXActiveScreens[i].GLXversion = strdup(GLXServerVersion);
+ __glXActiveScreens[i].GLXextensions = strdup(GLXServerExtensions);
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
wrapPositionWindow(i);
@@ -356,10 +356,10 @@ void __glXScreenReset(void)
int i;
for (i = 0; i < __glXNumActiveScreens; i++) {
- __glXFree(__glXActiveScreens[i].GLXvendor);
- __glXFree(__glXActiveScreens[i].GLXversion);
- __glXFree(__glXActiveScreens[i].GLXextensions);
- __glXFree(__glXActiveScreens[i].GLextensions);
+ free(__glXActiveScreens[i].GLXvendor);
+ free(__glXActiveScreens[i].GLXversion);
+ free(__glXActiveScreens[i].GLXextensions);
+ free(__glXActiveScreens[i].GLextensions);
}
free(__glXActiveScreens);
free(__glXHyperpipeFuncs);
diff --git a/nx-X11/programs/Xserver/GL/glx/glxserver.h b/nx-X11/programs/Xserver/GL/glx/glxserver.h
index a991f907e..2debc8435 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxserver.h
+++ b/nx-X11/programs/Xserver/GL/glx/glxserver.h
@@ -50,7 +50,6 @@
#include <extnsionst.h>
#include <resource.h>
#include <scrnintstr.h>
-#include "GL/glx_ansic.h"
#include "protocol-versions.h"
#include <limits.h>
diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.c b/nx-X11/programs/Xserver/GL/glx/glxutil.c
index 5d40bc832..b4cd10a84 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxutil.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxutil.c
@@ -47,7 +47,6 @@
#include <windowstr.h>
#include "glxutil.h"
#include "glxbuf.h"
-#include "GL/glx_ansic.h"
#include "GL/internal/glcore.h"
#include "GL/glxint.h"
#include "glcontextmodes.h"
@@ -58,81 +57,8 @@ void __glXNop(void) {}
/************************************************************************/
-/* Memory Allocation for GLX */
-
-void *
-__glXMalloc(size_t size)
-{
- void *addr;
-
- if (size == 0) {
- return NULL;
- }
- addr = (void *) malloc(size);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- return addr;
-}
-
-void *
-__glXCalloc(size_t numElements, size_t elementSize)
-{
- void *addr;
- size_t size;
-
- if ((numElements == 0) || (elementSize == 0)) {
- return NULL;
- }
- size = numElements * elementSize;
- addr = (void *) malloc(size);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- __glXMemset(addr, 0, size);
- return addr;
-}
-
-void *
-__glXRealloc(void *addr, size_t newSize)
-{
- void *newAddr;
-
- if (addr) {
- if (newSize == 0) {
- free(addr);
- return NULL;
- } else {
- newAddr = realloc(addr, newSize);
- }
- } else {
- if (newSize == 0) {
- return NULL;
- } else {
- newAddr = malloc(newSize);
- }
- }
- if (newAddr == NULL) {
- return NULL; /* XXX: out of memory */
- }
-
- return newAddr;
-}
-
-void
-__glXFree(void *addr)
-{
- if (addr) {
- free(addr);
- }
-}
-
-/************************************************************************/
/* Context stuff */
-
/*
** associate a context with a drawable
*/
@@ -299,8 +225,8 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
__GLdrawablePrivate *glPriv;
__GLXscreenInfo *pGlxScreen;
- glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv));
- __glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
+ glxPriv = (__GLXdrawablePrivate *) malloc(sizeof(*glxPriv));
+ memset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
glxPriv->type = pDraw->type;
glxPriv->pDraw = pDraw;
@@ -312,18 +238,18 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, glxPriv)) {
/* oops! */
- __glXFree(glxPriv);
+ free(glxPriv);
return NULL;
}
/* fill up glPriv */
glPriv = &glxPriv->glPriv;
- glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
+ glPriv->modes = (__GLcontextModes *) malloc(sizeof(__GLcontextModes));
*glPriv->modes = *modes;
- glPriv->malloc = __glXMalloc;
- glPriv->calloc = __glXCalloc;
- glPriv->realloc = __glXRealloc;
- glPriv->free = __glXFree;
+ glPriv->malloc = malloc;
+ glPriv->calloc = calloc;
+ glPriv->realloc = realloc;
+ glPriv->free = free;
glPriv->addSwapRect = NULL;
glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop;
glPriv->lockDP = LockDP;
@@ -334,7 +260,7 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
/* allocate a one-rect ownership region */
glPriv->ownershipRegion.rects =
- (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect));
+ (__GLregionRect *)calloc(1, sizeof(__GLregionRect));
glPriv->ownershipRegion.numRects = 1;
glxPriv->freeBuffers = __glXFreeBuffers;
@@ -377,9 +303,9 @@ __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv)
}
/* Free the drawable Private */
- __glXFree(glxPriv->glPriv.modes);
- __glXFree(glxPriv->glPriv.ownershipRegion.rects);
- __glXFree(glxPriv);
+ free(glxPriv->glPriv.modes);
+ free(glxPriv->glPriv.ownershipRegion.rects);
+ free(glxPriv);
return GL_TRUE;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.h b/nx-X11/programs/Xserver/GL/glx/glxutil.h
index 7231c949f..a0a2e57b7 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxutil.h
+++ b/nx-X11/programs/Xserver/GL/glx/glxutil.h
@@ -42,12 +42,6 @@
extern void __glXNop(void);
-/* memory management */
-extern void *__glXMalloc(size_t size);
-extern void *__glXCalloc(size_t numElements, size_t elementSize);
-extern void *__glXRealloc(void *addr, size_t newSize);
-extern void __glXFree(void *ptr);
-
/* relate contexts with drawables */
extern void __glXAssociateContext(__GLXcontext *glxc);
extern void __glXDeassociateContext(__GLXcontext *glxc);
diff --git a/nx-X11/programs/Xserver/GL/glx/single2.c b/nx-X11/programs/Xserver/GL/glx/single2.c
index d36e57739..47ba628af 100644
--- a/nx-X11/programs/Xserver/GL/glx/single2.c
+++ b/nx-X11/programs/Xserver/GL/glx/single2.c
@@ -46,7 +46,6 @@
#include "glxext.h"
#include "unpack.h"
#include "g_disptab.h"
-#include "GL/glx_ansic.h"
int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
@@ -67,7 +66,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t)size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@@ -97,7 +96,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
pc += __GLX_SINGLE_HDR_SIZE;
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {
@@ -268,24 +267,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
** pull tokens out of shortest string
** include space in combo_string for final separator and null terminator
*/
- if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) {
- combo_string = (char *) __glXMalloc(slen + 2);
- s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string);
+ clen = strlen(cext_string);
+ slen = strlen(sext_string);
+ if (clen > slen) {
+ combo_string = (char *) malloc(slen + 2);
+ s1 = (char *) malloc(slen + 2);
+ strcpy(s1, sext_string);
s2 = cext_string;
} else {
- combo_string = (char *) __glXMalloc(clen + 2);
- s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string);
+ combo_string = (char *) malloc(clen + 2);
+ s1 = (char *) malloc(clen + 2);
+ strcpy(s1, cext_string);
s2 = sext_string;
}
if (!combo_string || !s1) {
- if (combo_string) __glXFree(combo_string);
- if (s1) __glXFree(s1);
+ if (combo_string)
+ free(combo_string);
+ if (s1)
+ free(s1);
return NULL;
}
combo_string[0] = '\0';
/* Get first extension token */
- token = __glXStrtok( s1, SEPARATOR);
+ token = strtok( s1, SEPARATOR);
while ( token != NULL ) {
/*
@@ -293,20 +298,20 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
** beware of extension names which are prefixes of other extension names
*/
const char *p = s2;
- end = p + __glXStrlen(p);
+ end = p + strlen(p);
while (p < end) {
- size_t n = __glXStrcspn(p, SEPARATOR);
- if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) {
- combo_string = __glXStrcat( combo_string, token);
- combo_string = __glXStrcat( combo_string, SEPARATOR);
+ size_t n = strcspn(p, SEPARATOR);
+ if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) {
+ combo_string = strcat(combo_string, token);
+ combo_string = strcat(combo_string, SEPARATOR);
}
p += (n + 1);
}
/* Get next extension token */
- token = __glXStrtok( NULL, SEPARATOR);
+ token = strtok( NULL, SEPARATOR);
}
- __glXFree(s1);
+ free(s1);
return combo_string;
}
@@ -351,26 +356,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
buf = __glXcombine_strings(buf1,
cx->pGlxScreen->GLextensions);
if (buf1 != NULL) {
- __glXFree(buf1);
+ free(buf1);
}
string = buf;
}
else if ( name == GL_VERSION ) {
if ( atof( string ) > atof( GLServerVersion ) ) {
- buf = __glXMalloc( __glXStrlen( string )
- + __glXStrlen( GLServerVersion )
- + 4 );
+ buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
if ( buf == NULL ) {
string = GLServerVersion;
}
else {
- __glXSprintf( buf, "%s (%s)", GLServerVersion, string );
+ sprintf( buf, "%s (%s)", GLServerVersion, string );
string = buf;
}
}
}
if (string) {
- length = __glXStrlen((const char *) string) + 1;
+ length = strlen((const char *) string) + 1;
}
__GLX_BEGIN_REPLY(length);
@@ -384,7 +387,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
__GLX_SEND_HEADER();
WriteToClient(client, length, string);
if (buf != NULL) {
- __glXFree(buf);
+ free(buf);
}
return Success;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/single2swap.c b/nx-X11/programs/Xserver/GL/glx/single2swap.c
index ca8ac2a85..6fdc7e7f2 100644
--- a/nx-X11/programs/Xserver/GL/glx/single2swap.c
+++ b/nx-X11/programs/Xserver/GL/glx/single2swap.c
@@ -42,7 +42,6 @@
#include "glxext.h"
#include "unpack.h"
#include "g_disptab.h"
-#include "GL/glx_ansic.h"
int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
@@ -66,7 +65,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t) size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@@ -99,7 +98,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(pc+0);
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {
diff --git a/nx-X11/programs/Xserver/GL/glx/xfont.c b/nx-X11/programs/Xserver/GL/glx/xfont.c
index b5869cf44..581a6f22b 100644
--- a/nx-X11/programs/Xserver/GL/glx/xfont.c
+++ b/nx-X11/programs/Xserver/GL/glx/xfont.c
@@ -77,7 +77,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
p = buf;
allocbuf = 0;
} else {
- p = (unsigned char *) __glXMalloc(allocBytes);
+ p = (unsigned char *) malloc(allocBytes);
if (!p)
return BadAlloc;
allocbuf = p;
@@ -99,7 +99,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf);
if (allocbuf) {
- __glXFree(allocbuf);
+ free(allocbuf);
}
return Success;
#undef __GL_CHAR_BUF_SIZE
diff --git a/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h b/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h
deleted file mode 100644
index f48ecb8bb..000000000
--- a/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _glx_ansic_h_
-#define _glx_ansic_h_
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-
-/*
-** this needs to check whether we're using XFree86 at all, and then
-** which version we're using. Use these macros if version is 3.9+, else
-** use normal commands below.
-*/
-
-/*
-** turns out this include file only exists for XFree86 3.9+
-** I notice that not having it is not an error and does not stop the build,
-** but having it will allow opengl and glx to be built for 3.9+. We no longer
-** need an explicit define in the Makefile, just point to the correct X source
-** tree and all should be taken care of.
-*/
-
-#ifdef XFree86Server
-
-#ifndef assert
-#define assert(a)
-#endif
-
-#else
-
-#if defined(Lynx) && defined(__assert_h)
-#undef __assert_h
-#endif
-#ifdef assert
-#undef assert
-#endif
-#include <assert.h>
-
-#endif
-
-
-#define GLX_STDOUT stdout
-#define GLX_STDERR stderr
-#define __glXPrintf printf
-#define __glXFprintf fprintf
-#define __glXSprintf sprintf
-#define __glXVfprintf vfprintf
-#define __glXVsprintf vsprintf
-#define __glXFopen fopen
-#define __glXFclose fclose
-#define __glXCos(x) cos(x)
-#define __glXSin(x) sin(x)
-#define __glXAtan(x) atan(x)
-#define __glXAbs(x) abs(x)
-#define __glXLog(x) log(x)
-#define __glXCeil(x) ceil(x)
-#define __glXFloor(x) floor(x)
-#define __glXSqrt(x) sqrt(x)
-#define __glXPow(x, y) pow(x, y)
-#define __glXMemmove(dest, src, n) memmove(dest, src, n)
-#define __glXMemcpy(dest, src, n) memcpy(dest, src, n)
-#define __glXMemset(s, c, n) memset(s, c, n)
-#define __glXStrdup(str) xstrdup(str)
-#define __glXStrcpy(dest, src) strcpy(dest, src)
-#define __glXStrncpy(dest, src, n) strncpy(dest, src, n)
-#define __glXStrcat(dest, src) strcat(dest, src)
-#define __glXStrncat(dest, src, n) strncat(dest, src, n)
-#define __glXStrcmp(s1, s2) strcmp(s1, s2)
-#define __glXStrncmp(s1, s2, n) strncmp(s1, s2, n)
-#define __glXStrlen(str) strlen(str)
-#define __glXAbort() abort()
-#define __glXStrtok(s, delim) strtok(s, delim)
-#define __glXStrcspn(s, reject) strcspn(s, reject)
-#define __glXGetenv(a) getenv(a)
-#define __glXAtoi(a) atoi(a)
-
-#endif /* _glx_ansic_h_ */
diff --git a/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h b/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h
deleted file mode 100644
index 9e69fac65..000000000
--- a/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "miscstruct.h"
diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c
index 0d7496a0e..da0e77134 100644
--- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c
+++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c
@@ -52,7 +52,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86glxint.h"
#include "context.h"
#include "xmesaP.h"
-#include <GL/xf86glx.h>
#include "context.h"
/*
@@ -319,15 +318,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Alloc space for the list of new GLX visuals */
pNewVisualConfigs = (__GLXvisualConfig *)
- __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
+ malloc(numNewConfigs * sizeof(__GLXvisualConfig));
if (!pNewVisualConfigs) {
return FALSE;
}
/* Alloc space for the list of new GLX visual privates */
- pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *));
+ pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *));
if (!pNewVisualPriv) {
- __glXFree(pNewVisualConfigs);
+ free(pNewVisualConfigs);
return FALSE;
}
@@ -371,40 +370,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numConfigs = 0;
/* Alloc temp space for the list of orig VisualIDs for each new visual */
- orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
+ orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID));
if (!orig_vid) {
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisuals */
modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
if (modes == NULL) {
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisualPrivates */
- glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
+ glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *));
if (!glXVisualPriv) {
_gl_context_modes_destroy( modes );
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the new list of the X server's visuals */
- pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
+ pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec));
if (!pVisualNew) {
- __glXFree(glXVisualPriv);
+ free(glXVisualPriv);
_gl_context_modes_destroy( modes );
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
@@ -487,7 +486,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numVids++;
/* Allocate a new list of VisualIDs for this depth */
- pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
+ pVids = (VisualID *)malloc(numVids * sizeof(VisualID));
/* Initialize the new list of VisualIDs for this depth */
for (j = 0; j < pdepth[i].numVids; j++)
@@ -496,7 +495,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
pVids[n++] = pVisualNew[k].vid;
/* Update this depth's list of VisualIDs */
- __glXFree(pdepth[i].vids);
+ free(pdepth[i].vids);
pdepth[i].vids = pVids;
pdepth[i].numVids = numVids;
}
@@ -506,12 +505,12 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
*visualp = pVisualNew;
/* Free the old list of the X server's visuals */
- __glXFree(pVisual);
+ free(pVisual);
/* Clean up temporary allocations */
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
/* Free the private list created by DDX HW driver */
if (visualPrivates)
@@ -581,19 +580,19 @@ static void init_screen_visuals(int screen)
int i, j;
/* Alloc space for the list of XMesa visuals */
- pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis *
+ pXMesaVisual = (XMesaVisual *)malloc(MESAScreens[screen].num_vis *
sizeof(XMesaVisual));
- __glXMemset(pXMesaVisual, 0,
+ memset(pXMesaVisual, 0,
MESAScreens[screen].num_vis * sizeof(XMesaVisual));
/* FIXME: Change 'used' to be a array of bits (rather than of ints),
* FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
* FIXME: than 64 or 128 the stack array can be used instead of calling
- * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to
+ * FIXME: malloc / free. If nothing else, convert 'used' to
* FIXME: array of bytes instead of ints!
*/
- used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int));
- __glXMemset(used, 0, pScreen->numVisuals * sizeof(int));
+ used = (int *)malloc(pScreen->numVisuals * sizeof(int));
+ memset(used, 0, pScreen->numVisuals * sizeof(int));
i = 0;
for ( modes = MESAScreens[screen].modes
@@ -652,7 +651,7 @@ static void init_screen_visuals(int screen)
i++;
}
- __glXFree(used);
+ free(used);
MESAScreens[screen].xm_vis = pXMesaVisual;
}
@@ -703,9 +702,9 @@ extern void __MESA_resetExtension(void)
}
_gl_context_modes_destroy( MESAScreens[i].modes );
MESAScreens[i].modes = NULL;
- __glXFree(MESAScreens[i].private);
+ free(MESAScreens[i].private);
MESAScreens[i].private = NULL;
- __glXFree(MESAScreens[i].xm_vis);
+ free(MESAScreens[i].xm_vis);
MESAScreens[i].xm_vis = NULL;
MESAScreens[i].num_vis = 0;
}
@@ -725,7 +724,7 @@ void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv)
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
glxPriv->modes->visualID);
}
- buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec));
+ buf = (__MESA_buffer)malloc(sizeof(struct __MESA_bufferRec));
/* Create Mesa's buffers */
if (glxPriv->type == DRAWABLE_WINDOW) {
@@ -793,7 +792,7 @@ void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv)
glxPriv->swapBuffers = buf->fbswap;
glPriv->frontBuffer.resize = buf->fbresize;
- __glXFree(glPriv->private);
+ free(glPriv->private);
glPriv->private = NULL;
}
diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c
index d0d8eb239..fad84ec7e 100644
--- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c
+++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c
@@ -41,7 +41,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pixmapstr.h"
#include "xf86glx_util.h"
#include <nx-X11/Xmd.h>
-#include "GL/xf86glx.h"
#ifdef ROUNDUP
#undef ROUNDUP
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c
index e30f69495..c09379c59 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c
@@ -67,12 +67,12 @@ static int __glXDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
@@ -145,12 +145,12 @@ static int __glXSwapDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {