diff options
author | marha <marha@users.sourceforge.net> | 2011-03-04 13:54:03 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-04 13:54:03 +0000 |
commit | 0a5888393c68f6f7db86206d1f277232db18240b (patch) | |
tree | 9afe740e7b124ea8d2125ef7be0d42760d3b8e6a /mesalib | |
parent | 56950d7bed70ee82186f44f9333537cdbb33c448 (diff) | |
download | vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.gz vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.bz2 vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.zip |
xserver xkeyboard-config mesa git update 4 Marc 2011
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/configure.ac | 3 | ||||
-rw-r--r-- | mesalib/docs/news.html | 2629 | ||||
-rw-r--r-- | mesalib/docs/relnotes-7.10.1.html | 380 | ||||
-rw-r--r-- | mesalib/docs/relnotes-7.9.2.html | 336 | ||||
-rw-r--r-- | mesalib/docs/relnotes.html | 174 | ||||
-rw-r--r-- | mesalib/scons/custom.py | 340 | ||||
-rw-r--r-- | mesalib/scons/gallium.py | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/SConscript | 18 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/Makefile.am | 44 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-lex.l | 49 | ||||
-rw-r--r-- | mesalib/src/mesa/SConscript | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/framebuffer.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_instruction.h | 908 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.c | 2151 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program_parse.y | 5536 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_save_api.c | 2 |
18 files changed, 6644 insertions, 5936 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 9fa5eeea1..d33ca301f 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -1162,6 +1162,9 @@ if test "x$enable_egl" = xyes; then if test "$have_libudev" = yes; then DEFINES="$DEFINES -DHAVE_LIBUDEV" fi + # workaround a bug in xcb-dri2 generated by xcb-proto 1.6 + AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [], + [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"]) fi fi diff --git a/mesalib/docs/news.html b/mesalib/docs/news.html index 1bdef71de..6a706ab3c 100644 --- a/mesalib/docs/news.html +++ b/mesalib/docs/news.html @@ -1,1310 +1,1319 @@ -<HTML>
-
-<TITLE>Mesa News</TITLE>
-
-<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<BODY>
-
-<body bgcolor="#eeeeee">
-
-<H1>News</H1>
-
-
-<h2>October 4, 2010</h2>
-
-<p>
-<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new
-development release.
-</p>
-
-
-<h2>September 27, 2010</h2>
-
-<p>
-<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released. This is a
-release candidate for the 7.9 development release.
-</p>
-
-
-<h2>June 16, 2010</h2>
-
-<p>
-<a href="relnotes-7.8.2.html">Mesa 7.8.2</a> is released. This is a bug-fix
-release collecting fixes since the 7.8.1 release.
-</p>
-
-
-<h2>April 5, 2010</h2>
-
-<p>
-<a href="relnotes-7.8.1.html">Mesa 7.8.1</a> is released. This is a bug-fix
-release for a few critical issues in the 7.8 release.
-</p>
-
-
-<h2>March 28, 2010</h2>
-<p>
-<a href="relnotes-7.7.1.html">Mesa 7.7.1</a> is released. This is a bug-fix
-release fixing issues found in the 7.7 release.
-</p>
-<p>
-Also, <a href="relnotes-7.8.html">Mesa 7.8</a> is released. This is a new
-development release.
-</p>
-
-
-
-<h2>December 21, 2009</h2>
-<p>
-<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
-release fixing issues found in the 7.6 release.
-</p>
-<p>
-Also, <a href="relnotes-7.7.html">Mesa 7.7</a> is released. This is a new
-development release.
-</p>
-
-
-<h2>September 28, 2009</h2>
-<p>
-<a href="relnotes-7.6.html">Mesa 7.6</a> is released. This is a new feature
-release. Those especially concerned about stability may want to wait for the
-follow-on 7.6.1 bug-fix release.
-</p>
-<p>
-<a href="relnotes-7.5.2.html">Mesa 7.5.2</a> is also released.
-This is a stable release fixing bugs since the 7.5.1 release.
-</p>
-
-
-<h2>September 3, 2009</h2>
-<p>
-<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released.
-This is a bug-fix release which fixes bugs found in version 7.5.
-</p>
-
-
-<h2>July 17, 2009</h2>
-<p>
-<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
-This is a new features release. People especially concerned about
-stability may want to wait for the follow-on 7.5.1 bug-fix release.
-</p>
-
-
-<h2>June 23, 2009</h2>
-<p>
-<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
-This is a stable release that fixes a regression in the i915/i965 drivers
-that slipped into the 7.4.3 release.
-</p>
-
-
-<h2>June 19, 2009</h2>
-<p>
-<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
-This is a stable release fixing bugs since the 7.4.2 release.
-</p>
-
-
-<h2>May 15, 2009</h2>
-<p>
-<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
-This is a stable release fixing bugs since the 7.4.1 release.
-</p>
-
-
-<h2>April 18, 2009</h2>
-<p>
-<a href="relnotes-7.4.1.html">Mesa 7.4.1</a> is released.
-This is a stable release fixing bugs since the 7.4 release.
-</p>
-
-
-<h2>March 27, 2009</h2>
-<p>
-<a href="relnotes-7.4.html">Mesa 7.4</a> is released.
-This is a stable release fixing bugs since the 7.3 release.
-</p>
-
-
-<h2>January 22, 2009</h2>
-<p>
-<a href="relnotes-7.3.html">Mesa 7.3</a> is released.
-This is a new development release.
-Mesa 7.4 will follow and will have bug fixes relative to 7.3.
-</p>
-
-
-<h2>September 20, 2008</h2>
-<p>
-<a href="relnotes-7.2.html">Mesa 7.2</a> is released.
-This is a stable, bug-fix release.
-</p>
-
-
-<h2>August 26, 2008</h2>
-<p>
-<a href="relnotes-7.1.html">Mesa 7.1</a> is released.
-This is a new development release.
-It should be relatively stable, but those especially concerned about
-stability should wait for the 7.2 release or use Mesa 7.0.4 (the
-previous stable release).
-</p>
-
-
-<h2>August 16, 2008</h2>
-<p>
-<a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released.
-This is a bug-fix release.
-</p>
-
-
-<h2>April 4, 2008</h2>
-<p>
-<a href="relnotes-7.0.3.html">Mesa 7.0.3</a> is released.
-This is a bug-fix release.
-</p>
-
-
-<h2>January 24, 2008</h2>
-
-<p>
-Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
-</p>
-
-
-
-<h2>November 13, 2007</h2>
-
-<p>
-Gallium3D is the codename for the new Mesa device driver architecture
-which is currently under development.
-</p>
-<p>
-Gallium3D development is taking place on the <em>gallium-0.1</em> branch
-of the git repository.
-Currently, there's only a software-only driver and an Intel i915/945 driver
-but other drivers will be coming...
-</p>
-
-
-<h2>November 10, 2007</h2>
-<p>
-<a href="relnotes-7.0.2.html">Mesa 7.0.2</a> is released.
-This is a bug-fix release.
-</p>
-
-
-<h2>August 3, 2007</h2>
-<p>
-<a href="relnotes-7.0.1.html">Mesa 7.0.1</a> is released.
-This is a bug-fix release.
-</p>
-
-
-<h2>June 22, 2007</h2>
-<p>
-<a href="relnotes-7.0.html">Mesa 7.0</a> is released.
-This is a stable release featuring OpenGL 2.1 support.
-</p>
-
-
-<h2>April 27, 2007</h2>
-<p>
-<a href="relnotes-6.5.3.html">Mesa 6.5.3</a> is released.
-This is a development release which will lead up to the Mesa 7.0 release
-(which will advertise OpenGL 2.1 API support).
-</p>
-
-
-<h2>March 26, 2007</h2>
-<p>
-The new Shading Language compiler branch has been merged into the git
-master branch. This is a step toward hardware support for the OpenGL
-2.0 Shading Language and will be included in the next Mesa release.
-In conjunction, <a href="http://glean.sf.net" target="_parent">Glean
-</a> has been updated with a new test that does over 130 tests of the
-shading language and built-in functions.
-</p>
-
-<h2>April 2007</h2>
-<p>
-Thomas Hellström of Tungsten Graphics has written a whitepaper
-describing the new DRI memory management system</a>.
-</p>
-
-<h2>December 5, 2006</h2>
-<p>
-Mesa is now using git as its source code management system.
-The previous CVS repository should no longer be used.
-See the <a href="repository.html">repository page</a> for more information.
-</p>
-
-<h2>December 2, 2006</h2>
-<p>
-<a href="relnotes-6.5.2.html">Mesa 6.5.2</a> has been released.
-This is a new development release.
-</p>
-
-<h2>September 15, 2006</h2>
-<p>
-<a href="relnotes-6.5.1.html">Mesa 6.5.1</a> has been released.
-This is a new development release.
-</p>
-
-<h2>March 31, 2006</h2>
-<p>
-<a href="relnotes-6.5.html">Mesa 6.5</a> has been released.
-This is a new development release.
-</p>
-
-
-<h2>February 2, 2006</h2>
-<p>
-<a href="relnotes-6.4.2.html">Mesa 6.4.2</a> has been released.
-This is stable, bug-fix release.
-</p>
-
-
-<h2>November 29, 2005</h2>
-<p>
-<a href="relnotes-6.4.1.html">Mesa 6.4.1</a> has been released.
-This is stable, bug-fix release.
-</p>
-
-
-
-<h2>October 24, 2005</h2>
-<p>
-<a href="relnotes-6.4.html">Mesa 6.4</a> has been released.
-This is stable, bug-fix release.
-</p>
-
-
-<h2>August 19, 2005</h2>
-<p>
-Mesa 6.3.2 has been released.
-Note: there was no public release of version 6.3.1.
-</p>
-<a href="versions.html#6.3.2">Changes in version 6.3.1</a>
-<p>
-The MD5 checksums are:
-</p>
-<pre>
-98192e45ed8d69113688f89f90869346 MesaLib-6.3.2.tar.gz
-0df27701df0924d17ddf41185efa8ce1 MesaLib-6.3.2.tar.bz2
-ccb2423aab77fc7e81ce628734586140 MesaLib-6.3.2.zip
-9d0fca0a7d051c34a0b485423fb3e85d MesaDemos-6.3.2.tar.gz
-96708868450c188205e42229b5d813c4 MesaDemos-6.3.2.tar.bz2
-c5102501e609aa8996d832fafacb8ab9 MesaDemos-6.3.2.zip
-</pre>
-
-
-<h2>July 20, 2005</h2>
-<p>
-Mesa 6.3 has been released.
-This is a development release with new features, changes and bug fixes.
-</p>
-<pre>
- New:
- - GL_EXT_framebuffer_object extension
- - GL_ARB_draw_buffers extension
- - GL_ARB_pixel_buffer_object extension
- - GL_OES_read_format extension (Ian Romanick)
- - DirectFB driver (Claudio Ciccani)
- - x86_64 vertex transformation code (Mikko T.)
- Changes:
- - added -stereo option for glxgears demo (Jacek Rosik)
- - updated the PBuffer demo code in xdemos/ directory
- - glDeleteTextures/Programs/Buffers() now makes the object ID
- available for immediate re-use
- - assorted 64-bit clean-ups fixes (x86_64 and Win64)
- - lots of internal changes for GL_EXT_framebuffer_object
- Bug fixes:
- - some functions didn't support PBO functionality
- - glGetTexImage didn't convert color index images to RGBA as required
- - fragment program texcoords were sometimes wrong for points and lines
- - fixed problem with negative dot product in arbfplight, fplight demos
- - fixed bug in perspective correction of antialiased, textured lines
- - querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value
- - fixed a couple per-pixel fog bugs (Soju Matsumoto)
- - glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken
- - fixed float parsing bug in ARB frag/vert programs (bug 2520)
- - XMesaGetDepthBuffer() returned incorrect value for bytesPerValue
- - GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha
- - glXChooseFBConfig() crashed if attribList pointer was NULL
- - program state.light[n].spot.direction.w was wrong value (bug 3083)
- - fragment program fog option required glEnable(GL_FOG) - wrong.
- - glColorTable() could produce a Mesa implementation error (bug 3135)
- - RasterPos could get corrupted by color index rendering path
- - Removed bad XTranslateCoordinates call when rendering to Pixmaps
- - glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state
- - fixed a few Darwin compilation problems
-</pre>
-<p>
-The MD5 checksums are:
-</p>
-<pre>
-0236f552d37514776945d5a013e5bb7b MesaLib-6.3.tar.gz
-60e1a8f78c4a8c7750a1e95753190986 MesaLib-6.3.tar.bz2
-ca7c950fbace68c70caa822322db7223 MesaLib-6.3.zip
-25ea801645b376c014051804fe4974b2 MesaDemos-6.3.tar.gz
-9248e74872ea88c57ec25c900c295057 MesaDemos-6.3.tar.bz2
-8537dfa734ef258dcc7272097558d434 MesaDemos-6.3.zip
-</pre>
-
-
-<h2>December 9, 2004</h2>
-<p>
-Mesa 6.2.1 has been released.
-This is a stable release which just fixes bugs since the 6.2 release.
-</p>
-<pre>
- Bug fixes:
- - don't apply regular fog or color sum when using a fragment program
- - glProgramEnvParameter4fARB always generated an error on
- GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645)
- - glVertexAttrib3svNV and glVertexAttrib3svARB were broken
- - fixed width/height mix-up in glSeparableFilter2D()
- - fixed regression in glCopyPixels + convolution
- - glReadPixels from a clipped front color buffer didn't always work
- - glTexImage didn't accept GL_RED/GREEN/BLUE as the format
- - Attempting queries/accesses of VBO 0 weren't detected as errors
- - paletted textures failed if the palette had fewer than 256 entries
- Changes:
- - fixed a bunch of compiler warnings found with gcc 3.4
- - bug reports should to go bugzilla.freedesktop.org
-</pre>
-<p>
-The MD5 checksums are:
-</p>
-<pre>
-80008a92f6e055d3bfdde2cf331ec3fa MesaLib-6.2.1.tar.gz
-f43228cd2bf70f583ef3275c1c545421 MesaLib-6.2.1.tar.bz2
-dec26cfd40116ad021020fea2d94f652 MesaLib-6.2.1.zip
-2c7af3c986a7571c8713c8bfee7e49e3 MesaDemos-6.2.1.tar.gz
-3cac74667b50bcbd4f67f594fb4224a2 MesaDemos-6.2.1.tar.bz2
-75b3edd12eb2b370caf05f29b99e508a MesaDemos-6.2.1.zip
-</pre>
-
-
-<h2>October 2, 2004</h2>
-<p>
-Mesa 6.2 has been released.
-This is a stable release which just fixes bugs since the 6.1 release.
-</p>
-<pre>
- New:
- - enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle)
- - updated Doxygen support (Jose Fonseca)
- Changes:
- - some GGI driver updates (Christoph Egger, bug 1025977)
- Bug fixes:
- - Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features
- - fixed a few compilation issues on IRIX
- - fixed a matrix classification bug (reported by Wes Bethel)
- - we weren't reseting the vertex/fragment program error state
- before parsing (Dave Reveman)
- - adjust texcoords for sampling texture rectangles (Dave Reveman)
- - glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented
- - repeated calls to glDeleteTexture(t) could lead to a crash
- - fixed potential ref count bugs in VBOs and vertex/fragment programs
- - spriteblast demo didn't handle window size changes correctly
- - glTexSubImage didn't handle pixels=NULL correctly for PBOs
- - fixed color index mode glDrawPixels bug (Karl Schultz)
-</pre>
-<p>
-The MD5 checksums are:
-</p>
-<pre>
-9e8f34b059272dbb8e1f2c968b33bbf0 MesaLib-6.2.tar.gz
-3d6a6362390b6a37d3cb2e615f3ac7db MesaLib-6.2.tar.bz2
-6cfd7895d28e695c0dbbed9469564091 MesaLib-6.2.zip
-3e06e33b0809f09855cb60883b8bdfef MesaDemos-6.2.tar.gz
-9d160009c3dfdb35fe7e4088c9ba8f85 MesaDemos-6.2.tar.bz2
-856f7ec947122eb3c8985ebc2f654dcd MesaDemos-6.2.zip
-</pre>
-
-
-<h2>August 18, 2004</h2>
-<p>
-Mesa 6.1 has been released.
-This is a new development release (version 6.2 will be a stabilization
-release).
-</p>
-<pre>
- New:
- - Revamped Makefile system
- - glXUseRotatedXFont() utility (see xdemos/xuserotfont.c)
- - internal driver interface changes related to texture object
- allocation, vertex/fragment programs, BlendEquationSeparate, etc.
- - option to walk triangle edges with double-precision floats
- (Justin Novosad of Discreet) (see config.h file)
- - support for AUX buffers in software GLX driver
- - updated glext.h to version 24 and glxext.h to version 6
- - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars
- - updated BeOS support (Philippe Houdoin)
- Changes:
- - fragment fog interpolation is perspective corrected now
- - new glTexImage code, much cleaner, may be a bit faster
- Bug fixes:
- - glArrayElement in display lists didn't handle generic vertex attribs
- - glFogCoord didn't always work properly
- - ARB_fragment_program fog options didn't work
- - frag prog TEX instruction no longer incorrectly divides s,t,r by q
- - ARB frag prog TEX and TEXP instructions now use LOD=0
- - glTexEnviv in display lists didn't work
- - glRasterPos didn't do texgen or apply texture matrix
- - GL_DOUBLE-valued vertex arrays were broken in some cases
- - fixed texture rectangle edge/border sampling bugs
- - sampling an incomplete texture in a fragment program would segfault
- - glTexImage was missing a few error checks
- - fixed some minor glGetTexParameter glitches
- - GL_INTENSITY was mistakenly accepted as a <format> to glTexImage
- - fragment program writes to RC/HC register were broken
- - fixed a few glitches in GL_HP_occlusion_test extension
- - glBeginQueryARB and glEndQueryARB didn't work inside display lists
- - vertex program state references were broken
- - fixed triangle color interpolation bug on AIX (Shane Blackett)
- - fixed a number of minor memory leaks (bug #1002030)
-</pre>
-The MD5 checksums are:
-</p>
-<pre>
-c9284d295ebcd2e0486cc3cd54e5863c MesaLib-6.1.tar.gz
-5de1f53ec0709f60fc68fdfed57351f3 MesaLib-6.1.tar.bz2
-483e77cac4789a5d36c42f3c0136d6d8 MesaLib-6.1.zip
-8c46cfa6f9732acc6f6c25724aad0246 MesaDemos-6.1.tar.gz
-89bfe0f6c69b39fd0ebd9fff481a4e9b MesaDemos-6.1.tar.bz2
-161268531fcc6f0c5a056430ee97e0c1 MesaDemos-6.1.zip
-</pre>
-
-
-
-<h2>April 2, 2004</h2>
-
-<p>
-Mesa 6.0.1 has been released.
-This release basically just fixes bugs since the 6.0. release.
-</p>
-<pre>
- New:
- - upgraded glext.h to version 22
- - new build targets (Dan Schikore)
- - new linux-x86-opteron build target (Heath Feather)
- Bug fixes:
- - glBindProgramARB didn't update all necessary state
- - fixed build problems on OpenBSD
- - omit CVS directories from tarballs
- - glGetTexImage(GL_COLOR_INDEX) was broken
- - fixed an infinite loop in t&l module
- - silenced some valgrind warnings about using unitialized memory
- - fixed some compilation/link glitches on IRIX (Mike Stephens)
- - glBindProgram wasn't getting compiled into display lists
- - GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079)
- - two-sided lighting and vertex program didn't work (bug 887330)
- - stores to program parameter registers in vertex state programs
- didn't work.
- - fixed glOrtho bug found with gcc 3.2.2 (RH9)
- - glXCreateWindow() wasn't fully implemented (bug 890894)
- - generic vertex attribute arrays didn't work in display lists
- - vertex buffer objects' default usage and access fields were wrong
- - glDrawArrays with start!=0 was broken
- - fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken
- - linux-osmesa16-static config didn't work
- - fixed a few color index rendering problems (bug 910687)
- - glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE
- - OSMesa RGB and BGR modes were broken
- - glProgramStringARB mistakenly required a null-terminated string
- - fragment program XPD instruction was incorrect
- - glGetMaterial() didn't work reliably
-</pre>
-The MD5 checksums are:
-</p>
-<pre>
-011be0e79666c7a6eb9693fbf9348653 MesaLib-6.0.1.tar.gz
-b7f14088c5c2f14490d2739a91102112 MesaLib-6.0.1.tar.bz2
-bf0510cf0a2b87d64cdd317eca3f1db1 MesaLib-6.0.1.zip
-b7b648599e0aaee1c4ffc554a2a9139e MesaDemos-6.0.1.tar.gz
-dd6aadfd9ca8e1cfa90c6ee492bc6f43 MesaDemos-6.0.1.tar.bz2
-eff71d59c211825e949199852f5a2316 MesaDemos-6.0.1.zip
-</pre>
-
-
-
-<h2>January 16, 2004</h2>
-
-<p>
-Mesa 6.0 has been released. This is a stabilization of the 5.1 release
-and primarily just incorporates bug fixes.
-</p>
-<pre>
- New:
- - full OpenGL 1.5 support
- - updated GL/glext.h file to version 21
- Changes:
- - changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h)
- Bug fixes:
- - fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color
- clamping issue
- - updated suno5-gcc configs
- - glColor3 functions sometimes resulted in undefined alpha values
- - fixed FP divide by zero error seen on VMS with xlockmore, others
- - fixed vertex/fragment program debug problem (bug 873011)
- - building on AIX with gcc works now
- - glDeleteProgramsARB failed for ARB fragment programs (bug 876160)
- - glDrawRangeElements tried to modify potentially read-only storage
- - updated files for building on Windows
-</pre>
-
-
-
-<h2>December 28, 2003</h2>
-
-<p>
-The Mesa CVS server has been moved to <a href="http://www.freedesktop.org"
-target="_parent">
-freedesktop.org</a> because of problems with SourceForge's anonymous
-CVS service.
-</p>
-
-<p>Please see the <a href="cvs_access.html">CVS access page</a> for details.
-</p>
-
-
-<h2>December 17, 2003</h2>
-
-<p>
-Mesa 5.1 has been released. This is a new development release.
-Mesa 6.0 will be the next stable release and will support all
-OpenGL 1.5 features.
-</p>
-<pre>
- New features:
- - reorganized directory tree
- - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche)
- - GL_ATI_texture_env_combine3 extension (Ian Romanick)
- - GL_SGI_texture_color_table extension (Eric Plante)
- - GL_NV_fragment_program extension
- - GL_NV_light_max_exponent extension
- - GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle)
- - GL_ARB_occlusion_query extension
- - GL_ARB_point_sprite extension
- - GL_ARB_texture_non_power_of_two extension
- - GL_IBM_multimode_draw_arrays extension
- - GL_EXT_texture_mirror_clamp extension (Ian Romanick)
- - GL_ARB_vertex_buffer_object extension
- - new X86 feature detection code (Petr Sebor)
- - less memory used for display lists and vertex buffers
- - demo of per-pixel lighting with a fragment program (demos/fplight.c)
- - new version (18) of glext.h header
- - new spriteblast.c demo of GL_ARB_point_sprite
- - faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1)
- - faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1)
- Bug fixes:
- - really enable OpenGL 1.4 features in DOS driver.
- - fixed issues in glDrawPixels and glCopyPixels for very wide images
- - glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint
- - fixed some texgen bugs reported by Daniel Borca
- - fixed wglMakeCurrent(NULL, NULL) bug (#835861)
- - fixed glTexSubImage3D z-offset bug (Cedric Gautier)
- - fixed RGBA blend enable bug (Ville Syrjala)
- - glAccum is supposed to be a no-op in selection/feedback mode
- - fixed texgen bug #597589 (John Popplewell)
- Changes:
- - dropped API trace feature (src/Trace/)
- - documentation overhaul. merged with website content. more html.
- - glxgears.c demo updated to use GLX swap rate extensions
- - glTexImage1/2/3D now allows width/height/depth = 0
- - disable SPARC asm code on Linux (bug 852204)
-</pre>
-
-The MD5 checksums are:
-</p>
-<pre>
-78f452f6c55478471a744f07147612b5 MesaLib-5.1.tar.gz
-67b3b8d3f7f4c8c44904551b851d01af MesaLib-5.1.tar.bz2
-6dd19ffa750ec7f634e370a987505c9d MesaLib-5.1.zip
-e0214d4ebb22409dfa9262f2b52fd828 MesaDemos-5.1.tar.gz
-066c9aff4fd924405de1ae9bad5ec9a7 MesaDemos-5.1.tar.bz2
-d2b5ba32b53e0ad0576c637a4cc1fb41 MesaDemos-5.1.zip
-</pre>
-
-
-<H2>November 12, 2003</H2>
-
-<p>
-New Mesa 5.0.2 tarballs have been uploaded to SourceForge which fix a
-number of automake/libtool problems.
-</p>
-<p>
-The new MD5 checksums are:
-</p>
-<pre>
-a9dcf3ff9ad1b7d6ce73a0df7cff8b5b MesaLib-5.0.2.tar.gz
-7b4bf9261657c2fca03796d4955e6f50 MesaLib-5.0.2.tar.bz2
-79c141bddcbad557647535d02194f346 MesaLib-5.0.2.zip
-952d9dc823dd818981d1a648d7b2668a MesaDemos-5.0.2.tar.gz
-b81fafff90995025d2f25ea02b786642 MesaDemos-5.0.2.tar.bz2
-a21be975589e8a2d1871b6bb7874fffa MesaDemos-5.0.2.zip
-</pre>
-
-
-
-<h2>September 5, 2003</h2>
-
-<p>
-Mesa 5.0.2 has been released. This is a stable, bug-fix release.
-</p>
-<pre>
- Bug fixes:
- - fixed texgen problem causing texcoord's Q to be zero (stex3d)
- - default GL_TEXTURE_COMPARE_MODE_ARB was wrong
- - GL_CURRENT_MATRIX_NV query was wrong
- - GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one
- - GL_LIST_MODE query wasn't correct
- - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported
- - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value
- - blended, wide lines didn't always work correctly (bug 711595)
- - glVertexAttrib4svNV w component was always 1
- - fixed bug in GL_IBM_rasterpos_clip (missing return)
- - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly
- - a few Solaris compilation fixes
- - fixed glClear() problem for DRI drivers (non-existant stencil, etc)
- - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux)
- - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz)
- - glFog() didn't clamp fog colors
- - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the
- gl[Get]TexParameteri[v] functions
- - fixed invalid memory references in glTexGen functions (bug 781602)
- - integer-valued color arrays weren't handled correctly
- - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work
- - GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1
- Changes:
- - build GLUT with -fexceptions so C++ apps propogate exceptions
-</pre>
-
-
-
-<h2>June 2003</h2>
-
-<p>
-Mesa's directory tree has been overhauled.
-Things are better organized now with some thought toward future needs.
-</p>
-<p>
-In CVS, the latest Mesa 5.1 development code is now rooted under the
-<b>Mesa-newtree/</b> directory. The old top-level <b>Mesa/</b> directory
-holds the Mesa 5.0.x code which will be abandoned at some point.
-</p>
-
-
-
-<h2>March 30, 2003</h2>
-
-<p>
-Mesa 5.0.1 has been released. This is a stable, bug-fix release.
-</p>
-<pre>
- New:
- - DOS driver updates from Daniel Borca
- - updated GL/gl_mangle.h file (Bill Hoffman)
- Bug fixes:
- - auto mipmap generation for cube maps was broken (bug 641363)
- - writing/clearing software alpha channels was unreliable
- - minor compilation fixes for OS/2 (Evgeny Kotsuba)
- - fixed some bad assertions found with shadowtex demo
- - fixed error checking bug in glCopyTexSubImage2D (bug 659020)
- - glRotate(angle, -x, 0, 0) was incorrect (bug 659677)
- - fixed potential segfault in texture object validation (bug 659012)
- - fixed some bogus code in _mesa_test_os_sse_exception_support (Linus)
- - fix fog stride bug in tnl code for h/w drivers (Michel Danzer)
- - fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080)
- - glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3
- - fixed compilation problem on Solaris7/x86 (bug 536406)
- - fixed prefetch bug in 3DNow! code (Felix Kuhling)
- - fixed NeXT build problem (FABSF macro)
- - glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811)
- - zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964)
- - AA line and triangle Z values are now rounded, not truncated
- - fixed color interpolation bug when GLchan==GLfloat (bug 694461)
- - glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca)
- - fixed a minor GL_COLOR_MATERIAL bug
- - NV vertex program EXP instruction was broken
- - glColorMask misbehaved with X window / pixmap rendering
- - fix autoconf/libtool GLU C++ linker problem on Linux (a total hack)
- - attempt to fix GGI compilation problem when MesaDemos not present
- - NV vertex program ARL-relative fetches didn't work
- Changes:
- - use glPolygonOffset in gloss demo to avoid z-fighting artifacts
- - updated winpos and pointblast demos to use ARB extensions
- - disable SPARC normal transformation code (bug 673938)
- - GLU fixes for OS/2 (Evgeny Kotsuba)
-</pre>
-<p>
-MD5 checksums follow:
-</p>
-<pre>
-b80f8b5d53a3e9f19b9fde5af0c542f0 MesaLib-5.0.1.tar.gz
-513b4bbd7d38951f05027179063d876b MesaLib-5.0.1.tar.bz2
-eebd395678f4520d33b267e5d5c22651 MesaLib-5.0.1.zip
-49d7feaec6dc1d2091d7c3cc72a9b320 MesaDemos-5.0.1.tar.gz
-37190374a98c3c892f0698be9ca3acf0 MesaDemos-5.0.1.tar.bz2
-becd8bf17f5791361b4a54ba2a78e5c9 MesaDemos-5.0.1.zip
-</pre>
-
-
-
-<h2>March 7, 2003</h2>
-<p>
-Website and documentation overhaul.
-</p>
-<p>
-The website content and Mesa documentation (from the doc/ directory) have
-been merged together.
-All the documentation files have been entered into the CVS repository.
-Many of the old plain-text files have been converted to html and modernized.
-</p>
-
-
-<h2>November 13, 2002</h2>
-<p>Mesa 5.0 has been released. This is a stable release which
-implements the OpenGL 1.4 specification.
-</p><pre>New:
- - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4")
- - removed some overlooked debugging code
- - glxinfo updated to support GLX_ARB_multisample
- - GLUT now support GLX_ARB_multisample
- - updated DOS driver (Daniel Borca)
-Bug fixes:
- - GL_POINT and GL_LINE-mode polygons didn't obey cull state
- - fixed potential bug in _mesa_align_malloc/calloc()
- - fixed missing triangle bug when running vertex programs
- - fixed a few HPUX compilation problems
- - FX (Glide) driver didn't compile
- - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work
- - a few EXT functions, like glGenTexturesEXT, were no-ops
- - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate,
- glMultiDrawArrays and glMultiDrawElements were missing
- - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken
- - Pentium 4 Mobile was mistakenly identified as having 3DNow!
- - fixed one-bit error in point/line fragment Z calculation
- - fixed potential segfault in fakeglx code
- - fixed color overflow problem in DOT3 texture env mode
-</pre>
-
-
-<h2>October 29, 2002</h2>
-<p>Mesa 4.1 has been released. This is a new development release.
-For a stable release, get 4.0.4.
-</p><pre>New:
- - GL_NV_vertex_program extension
- - GL_NV_vertex_program1_1 extension
- - GL_ARB_window_pos extension
- - GL_ARB_depth_texture extension
- - GL_ARB_shadow extension
- - GL_ARB_shadow_ambient extension
- - GL_EXT_shadow_funcs extension
- - GL_ARB_point_parameters extension
- - GL_ARB_texture_env_crossbar
- - GL_NV_point_sprite extension
- - GL_NV_texture_rectangle extension
- - GL_EXT_multi_draw_arrays extension
- - GL_EXT_stencil_two_side extension
- - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions
- - GL_ATI_texture_mirror_once extension (Ian Romanick)
- - massive overhaul/simplification of software rasterizer module,
- many contributions from Klaus Niederkrueger
- - faster software texturing in some cases (i.e. trilinear filtering)
- - new OSMesaGetProcAddress() function
- - more blend modes implemented with MMX code (Jose Fonseca)
- - added glutGetProcAddress() to GLUT
- - added GLUT_FPS env var to compute frames/second in glutSwapBuffers()
- - pbinfo and pbdemo PBuffer programs
- - glxinfo -v prints transprent pixel info (Gerd Sussner)
-Bug fixes:
- - better mipmap LOD computation (prevents excessive blurriness)
- - OSMesaMakeCurrent() didn't recognize buffer size changes
- - assorted conformance fixes for 16-bit/channel rendering
- - texcombine alpha subtraction mode was broken
- - fixed some blend problems when GLchan==GLfloat (Gerk Huisma)
- - clamp colors to [0,1] in OSMesa if GLchan==GLfloat (Gerk Huisma)
- - fixed divide by zero error in NURBS tessellator (Jon Perry)
- - fixed GL_LINEAR fog bug by adding clamping
- - fixed FP exceptions found using Alpha CPU
- - 3dfx/glide driver render-to-window feature was broken
- - added missing GLX_TRANSPARENT_RGB token to glx.h
- - fixed error checking related to paletted textures
- - fixed reference count error in glDeleteTextures (Randy Fayan)
-Changes:
- - New spec file and Python code to generate some GL dispatch files
- - Glide driver defaults to "no" with autoconf/automake
- - floating point color channels now clamped to [0,inf)
- - updated demos/stex3d with new options
-</pre>
-
-
-<h2>October 4, 2002</h2>
-<p>
-The <a href="http://mesa3d.sourceforge.net/docs/MesaFAQ.html">Mesa FAQ</a> has been rewritten.
-</p>
-
-<h2>October 3, 2002</h2>
-<p>Mesa 4.0.4 has been released. This is a stable bug-fix release.
-</p><pre> New:
- - GL_NV_texture_rectangle extension
- - updated glext.h header (version 17)
- - updated DOS driver (Daniel Borca)
- - updated BeOS R5 driver (Philippe Houdoin)
- - added GL_IBM_texture_mirror_repeat
- - glxinfo now takes -l option to print interesting OpenGL limits info
- - GL_MESA_ycbcr_texture extension
- - GL_APPLE_client_storage extension (for some DRI drivers only)
- - GL_MESA_pack_invert extension
- Bug fixes:
- - fixed GL_LINEAR fog bug by adding clamping
- - fixed FP exceptions found using Alpha CPU
- - 3dfx MESA_GLX_FX=window (render to window) didn't work
- - fixed memory leak in wglCreateContest (Karl Schultz)
- - define GLAPIENTRY and GLAPI if undefined in glu.h
- - wglGetProcAddress didn't handle all API functions
- - when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map
- - removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc()
- - error checking in compressed tex image functions had some glitches
- - fixed AIX compile problem in src/config.c
- - glGetTexImage was using pixel unpacking instead of packing params
- - auto-mipmap generation for cube maps was incorrect
- Changes:
- - max texture units reduced to six to accomodate texture rectangles
- - removed unfinished GL_MESA_sprite_point extension code
-</pre>
-
-<h2>June 25, 2002</h2>
-<p>Mesa 4.0.3 has been released. This is a stable bug-fix release.
-</p><pre> New:
- - updated GL/glext.h file (version 15)
- - corrected MMX blend code (Jose Fonseca)
- - support for software-based alpha planes in Windows driver
- - updated GGI driver (Filip Spacek)
- Bug fixes:
- - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens
- - OSMesaMakeCurrent() didn't recognize buffer size changes
- - assorted conformance fixes for 16-bit/channel rendering
- - texcombine alpha subtraction mode was broken
- - fixed lighting bug with non-uniform scaling and display lists
- - fixed bug when deleting shared display lists
- - disabled SPARC cliptest assembly code (Mesa bug 544665)
- - fixed a couple Solaris compilation/link problems
- - blending clipped glDrawPixels didn't always work
- - glGetTexImage() didn't accept packed pixel types
- - glPixelMapu[is]v() could explode given too large of pixelmap
- - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT
- - glXCopyContext() could lead to segfaults
- - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665)
- Changes:
- - lots of C++ (g++) code clean-ups
- - lots of T&L updates for the Radeon DRI driver
- Known bugs:
- - mipmap LOD computation (fixed for Mesa 4.1)
-</pre>
-
-<h2>April 2, 2002</h2>
-<p>Mesa 4.0.2 has been released. This is a stable bug-fix release.
-</p><pre> New:
- - New DOS (DJGPP) driver written by Daniel Borca
- - New driver interface functions for TCL drivers (such as Radeon DRI)
- - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32"
- if using deep color channels
- - latest GL/glext.h and GL/glxext.h headers from SGI
- Bug fixes:
- - GL_BLEND with non-black texture env color wasn't always correct
- - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha)
- - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken
- - glReadPixels was sometimes mistakenly clipped by the scissor box
- - glDraw/ReadPixels didn't catch all the errors that they should have
- - Fixed 24bpp rendering problem in Windows driver (Karl Schultz)
- - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c)
- - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP)
- - glColorMask as sometimes effecting glXSwapBuffers()
- - fixed a potential bug in XMesaGarbageCollect()
- - N threads rendering into one window didn't work reliably
- - glCopyPixels didn't work for deep color channels
- - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma)
- - glPopAttrib() didn't correctly restore user clip planes
- - user clip planes failed for some perspective projections (Chromium)
-</pre>
-
-<h2>December 17, 2001</h2>
-<p>Mesa 4.0.1 has been released. This is a stable bug-fix release.
-</p><pre> New:
- - better sub-pixel sample positions for AA triangles (Ray Tice)
- - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO)
- Bug fixes:
- - added missing break statements in glGet*() for multisample cases
- - fixed uninitialized hash table mutex bug (display lists / texobjs)
- - fixed bad teximage error check conditional (bug 476846)
- - fixed demos readtex.c compilation problem on Windows (Karl Schultz)
- - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT
- - silence some compiler warnings (gcc 2.96)
- - enable the #define GL_VERSION_1_3 in GL/gl.h
- - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h
- - fixed glu.h typedef problem found with MSDev 6.0
- - build libGL.so with -Bsymbolic (fixes bug found with Chromium)
- - added missing 'const' to glXGetContextIDEXT() in glxext.h
- - fixed a few glXGetProcAddress() errors (texture compression, etc)
- - fixed start index bug in compiled vertex arrays (Keith)
- - fixed compilation problems in src/SPARC/glapi_sparc.S
- - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith)
- - use glXGetProcAddressARB in GLUT to avoid extension linking problems
- - provoking vertex of flat-shaded, color-index triangles was wrong
- - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith)
- - glTexParameter didn't flush the vertex buffer (Ray Tice)
- - feedback attributes for glDraw/CopyPixels and glBitmap were wrong
- - fixed bug in normal length caching (ParaView lighting bug)
-</pre>
-
-<h2>October 22, 2001</h2>
-<p>Mesa 4.0 has been released. This is a stable release.
-</p><pre> New:
- - Mesa 4.0 implements the OpenGL 1.3 specification
- - GL_IBM_rasterpos_clip extension
- - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp)
- - GL_ARB_texture_mirrored_repeat extension
- - WindML UGL driver (Stephane Raimbault)
- - added OSMESA_MAX_WIDTH/HEIGHT queries
- - attempted compiliation fixes for Solaris 5, 7 and 8
- - updated glext.h and glxext.h files
- - updated Windows driver (Karl Schultz)
- Bug fixes:
- - added some missing GLX 1.3 tokens to include/GL/glx.h
- - GL_COLOR_MATRIX changes weren't recognized by teximage functions
- - glCopyPixels with scale and bias was broken
- - glRasterPos with lighting could segfault
- - glDeleteTextures could leave a dangling pointer
- - Proxy textures for cube maps didn't work
- - fixed a number of 16-bit color channel bugs
- - fixed a few minor memory leaks
- - GLX context sharing was broken in 3.5
- - fixed state-update bugs in glPopClientAttrib()
- - fixed glDrawRangeElements() bug
- - fixed a glPush/PopAttrib() bug related to texture binding
- - flat-shaded, textured lines were broken
- - fixed a dangling pointer problem in the XMesa code (Chris Burghart)
- - lighting didn't always produce the correct alpha value
- - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky)
-</pre>
-
-
-<h2>June 21, 2001</h2>
-<p>Mesa 3.5 has been released. This is a new development release.
-</p><pre> New:
- - internals of Mesa divided into modular pieces (Keith Whitwell)
- - 100% OpenGL 1.2 conformance (passes all conformance tests)
- - new AA line algorithm
- - GL_EXT_convolution extension
- - GL_ARB_imaging subset
- - OSMesaCreateContextExt() function
- - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
- - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight
- - GL_EXT_fog_coord extension (Keith Whitwell)
- - GL_EXT_secondary_color extension (Keith Whitwell)
- - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
- - GL_SGIX_depth_texture extension
- - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions
- - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow
- - GL_ARB_texture_env_combine extension
- - GL_ARB_texture_env_dot3 extension
- - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp)
- - OSMesaCreateContextExt() function
- - libOSMesa.so library, contains the OSMesa driver interface
- - GL/glxext.h header file for GLX extensions
- - somewhat faster software texturing, fogging, depth testing
- - all color-index conformance tests now pass (only 8bpp tested)
- - SPARC assembly language TCL optimizations (David Miller)
- - GL_SGIS_generate_mipmap extension
- Bug Fixes:
- - fbiRev and tmuRev were unitialized when using Glide3
- - fixed a few color index mode conformance failures; all pass now
- - now appling antialiasing coverage to alpha after texturing
- - colors weren't getting clamped to [0,1] before color table lookup
- - fixed RISC alignment errors caused by COPY_4UBV macro
- - drawing wide, flat-shaded lines could cause a segfault
- - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles
- Changes:
- - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU
- - new libOSMesa.so library, contains the OSMesa driver interface
-</pre>
-
-
-<h2>May 17, 2001</h2>
-<p>Mesa 3.4.2 has been released. This is basically just a bug-fix release.
-Here's what's new:</p>
-<pre> Bug fixes:
- - deleting the currently bound texture could cause bad problems
- - using fog could result in random vertex alpha values
- - AA triangle rendering could touch pixels outside right window bound
- - fixed byteswapping problem in clear_32bit_ximage() function
- - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam
- - fixed memory leak in glXUseXFont()
- - fragment sampling in AA triangle function was off by 1/2 pixel
- - Windows: reading pixels from framebuffer didn't always work
- - glConvolutionFilter2D could segfault or cause FP exception
- - fixed segfaults in FX and X drivers when using tex unit 1 but not 0
- - GL_NAND logicop didn't work right in RGBA mode
- - fixed a memory corruption bug in vertex buffer reset code
- - clearing the softwara alpha buffer with scissoring was broken
- - fixed a few color index mode fog bugs
- - fixed some bad assertions in color index mode
- - fixed FX line 'stipple' bug #420091
- Changes:
- - optimized writing mono-colored pixel spans to X pixmaps
- - increased max viewport size to 2048 x 2048
-</pre>
-
-
-<h2>April 29, 2001</h2>
-<p>New Mesa website</p>
-<p>Mark Manning produced the new website.<br>Thanks, Mark!</p>
-
-
-<h2>February 14, 2001</h2>
-<p>Mesa 3.4.1 has been released. Here's what's new:</p>
-<pre> New:
- - fixed some Linux build problems
- - fixed some Windows build problems
- - GL_EXT_texture_env_dot3 extension (Gareth Hughes)
- Bug fixes:
- - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI
- - various state-update code changes needed for DRI bugs
- - disabled pixel transfer ops in glColorTable commands, not needed
- - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter
- - updated sources and fixed compile problems in widgets-mesa/
- - GLX_PBUFFER enum value was wrong in glx.h
- - fixed a glColorMaterial lighting bug
- - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function
- - glXCopySubBufferMESA() Y position was off by one
- - Error checking of glTexSubImage3D() was broken (bug 128775)
- - glPopAttrib() didn't restore all derived Mesa state correctly
- - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL
- conformance problems at 16bpp.
- - clearing depth buffer with scissoring was broken, would segfault
- - OSMesaGetDepthBuffer() returned bad bytesPerValue value
- - fixed a line clipping bug (reported by Craig McDaniel)
- - fixed RGB color over/underflow bug for very tiny triangles
- Known problems:
- - NURBS or evaluator surfaces inside display lists don't always work
-</pre>
-<p>
-</p><h2>November 3, 2000</h2>
-<p>Mesa 3.4 has been released. Here's what's new since the 3.3 release:</p>
-<pre> New:
- - optimized glDrawPixels for glPixelZoom(1,-1)
- Bug Fixes:
- - widgets-mesa/src/*.c files were missing from 3.3 distro
- - include/GL/mesa_wgl.h file was missing from 3.3 distro
- - fixed some Win32 compile problems
- - texture object priorities weren't getting initialized to 1.0
- - glAreTexturesResident return value was wrong when using hardware
- - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX)
- - glReadPixels with GLushort packed types was broken
- - fixed a few bugs in the GL_EXT_texture_env_combine texture code
- - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables
- - fixed some typos/bugs in the VB code
- - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work
- - optimized glDrawPixels paths weren't being used
- - per-fragment fog calculation didn't work without a Z buffer
- - improved blending accuracy, fixes Glean blendFunc test failures
- - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly
- - glXGetProcAddressARB() didn't always return the right address
- - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format
- - texture matrix changes weren't always detected (GLUT projtex demo)
- - fixed random color problem in vertex fog code
- - fixed Glide-related bug that let Quake get a 24-bit Z buffer
- Changes:
- - finished internal support for compressed textures for DRI
-</pre>
-<p>
-</p><h2>April 24, 2000</h2>
-<p>Mesa 3.2 has been released. Here's what's new since the beta release:</p>
-<pre> Bug fixes:
- - fixed memcpy bugs in span.c
- - fixed missing glEnd problem in demos/tessdemo.c
- - fixed bug when clearing 24bpp Ximages
- - fixed clipping problem found in Unreal Tournament
- - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2
- - fixed Loki's 3dfx RGB vs BGR bug
- - fixed Loki's 3dfx smooth/flat shading bug in SoF
- Changes:
- - updated docs/README file
- - use bcopy() optimizations on FreeBSD
- - re-enabled the optimized persp_textured_triangle() function
-</pre>
-<p>
-</p><h2>March 23, 2000</h2>
-<p>I've just upload the Mesa 3.2 beta 1 files to SourceForge at <a href="http://sourceforge.net/project/showfiles.php?group_id=3" target="_parent">http://sourceforge.net/project/filelist.php?group_id=3</a><a href="http://sourceforge.net/project/showfiles.php?group_id=3"></a></p>
-<p>3.2 (note even number) is a stabilization release of Mesa 3.1 meaning it's mainly
-just bug fixes.</p>
-<p>Here's what's changed:
-
-</p><ul>
- Bug fixes:
- <ul>
- - mixed drawing of lines and bitmaps sometimes had wrong colors<br>
- - added missing glHintPGI() function<br>
- - fixed a polygon culling bug<br>
- - fixed bugs in gluPartialDisk()<br>
- - Z values in selection mode were wrong<br>
- - added missing tokens:
- <ul>
- GL_SMOOTH_POINT_SIZE_RANGE<br>
- GL_SMOOTH_POINT_SIZE_GRANULARITY<br>
- GL_SMOOTH_LINE_WIDTH_RANGE<br>
- GL_SMOOTH_LINE_WIDTH_GRANULARITY<br>
- GL_ALIASED_POINT_SIZE_RANGE<br>
- GL_ALIASED_LINE_WIDTH_RANGE
- </ul>
- - fixed glCopyPixels when copying from back to front buffer<br>
- - GL_EXT_compiled_vertex_array tokens had _SGI suffix instead of _EXT<br>
- - glDrawRangeElements(GL_LINES, 0, 1, 2, type, indices) was broken<br>
- - glDeleteTextures() didn't decrement reference count correctly<br>
- - GL_SRCA_ALPHA_SATURATE blend mode didn't work correctly<br>
- - Actual depth of transformation matrix stacks was off by one<br>
- - 24bpp visuals didn't address pixels correctly<br>
- - mipmap level of detail (lambda) calculation simplified, more accurate<br>
- - 101691 - Polygon clipping and GL_LINE<br>
- - 101928 - Polygon clipping and GL_LINE (same fix as above)<br>
- - 101808 - Non-glVertexArrays tristrip bug<br>
- - 101971 - find_last_3f on Dec OSF (worked around)<br>
- - 102369 - segv on dec osf (possibly a duplicate of the above)<br>
- - 102893 - orientations of modelview cause segfault
- </ul>
- New:
- <ul>
- - updated SVGA Linux driver<br>
- - added the MESA_FX_NO_SIGNALS env var, see docs/README.3DFX<br>
- - build libGLw.a (Xt/OpenGL drawing area widget) library by default<br>
- - changed -O2 to -O3 for a number of gcc configs
- </ul>
- Changes:
- <ul>
- - glXCopyContext's mask parameter is now unsigned long, per GLX spec
- </ul>
-</ul>
-
-<p>Please report any problems with this release ASAP. Bugs should be filed on the
-Mesa3D website at sourceforge.<br>
-After 3.2 is wrapped up I hope to release 3.3 beta 1 soon afterward.</p>
-<p>-- Brian</p>
-<p>
-</p><h2>December 17, 1999</h2>
-<p>A Slashdot interview with Brian about Mesa (questions submitted by Slashdot readers)
-can be found at <a href="http://slashdot.org/interviews/99/12/17/0927212.shtml" target="_parent">http://slashdot.org/interviews/99/12/17/0927212.shtml</a>.</p>
-<p>
-</p><h2>December 14, 1999</h2>
-<p>Mesa 3.1 is released!</p>
-<p>
-</p><h2>September 21, 1999</h2>
-<p>There appear to be two new files on the ftp site, <a href="ftp://ftp.mesa3d.org/mesa/beta/MesaLib-3.1beta3.tar.gz">MesaLib-3.1beta3.tar.gz</a>
-and <a href="ftp://ftp.mesa3d.org/mesa/beta/MesaDemos-3.1beta3.tar.gz">MesaDemos-3.1beta3.tar.gz</a>,
-that seem to be... yes, I've just received confirmation from the beta center, they
-are indeed the <b>THIRD</b> beta release of Mesa 3.1! Happy Days. Happy Days. Thanks
-Keith Whitwell for preparing these for us during Brian's absence.</p>
-<p>
-</p><h2>August 30, 1999</h2>
-<p>I'm pleased to announce that I've accepted a position with Precision Insight,
-Inc. effective October, 1999. I'll be leaving Avid Technology in September.</p>
-<p>I've been working on Mesa in my spare time for over five years. With Precision
-Insight I now have the opportunity to devote my full attention to advancing Mesa
-and OpenGL on Linux.</p>
-<p>While I'll be focused on Linux, the X Window System, and hardware acceleration,
-my work will continue to be open sourced and available to any other programmers who
-may want to contribute to it, or use it for other projects or platforms</p>
-<p>PS: I'm going to be traveling until Sep 6 and won't be reading email until then.</p>
-<p>
-</p><h2>August 23, 1999</h2>
-<p>Anonymous CVS access is back online so suck up all the bandwidth you can afford.
-Note that this is a new archive, so you will need to re-checkout the archive. That
-means don't <i>cvs update</i> from a previous download.</p>
-<p>
-</p><h2>August 17, 1999</h2>
-<p>A report from the SIGGRAPH '99 Linux/OpenGL
-BOF meeting is now available.</p>
-<p>-Brian</p>
-<p>
-</p><h2>August 14, 1999</h2>
-<p>www.mesa3d.org is having technical problems due to hardware failures at VA Linux
-systems. The Mac pages, ftp, and CVS services aren't fully restored yet. Please be
-patient.</p>
-<p>-Brian</p>
-<p>
-</p><h2>June 7, 1999</h2>
-<p>RPMS of the nVidia RIVA server can be found at <a href="ftp://ftp.mesa3d.org/mesa/misc/nVidia/">ftp://ftp.mesa3d.org/mesa/misc/nVidia/</a>.</p>
-<p>
-</p><h2>June 2, 1999</h2>
-<p><a href="http://www.nvidia.com/">nVidia</a> has released some Linux binaries for
-xfree86 3.3.3.1, along with the <b>full source</b>, which includes GLX acceleration
-based on Mesa 3.0. They can be downloaded from <a href="http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html">http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html</a>.</p>
-<p>
-</p><h2>May 24, 1999</h2>
-<p>Beta 2 of Mesa 3.1 has been make available at <a href="ftp://ftp.mesa3d.org/mesa/beta/">ftp://ftp.mesa3d.org/mesa/beta/</a>.
-If you are into the quake scene, you may want to try this out, as it contains some
-optimizations specifically in the Q3A rendering path.
-<p>
-</p><h2>May 13, 1999</h2>
-<p>For those interested in the integration of Mesa into XFree86 4.0, Precision Insight
-has posted their lowlevel design documents at http://www.precisioninsight.com.</p>
-<p>
-</p><h2>May 13, 1999</h2>
-<pre>May 1999 - John Carmack of id Software, Inc. has made a donation of
-US$10,000 to the Mesa project to support its continuing development.
-Mesa is a free implementation of the OpenGL 3D graphics library and id's
-newest game, Quake 3 Arena, will use Mesa as the 3D renderer on Linux.
-
-The donation will go to Keith Whitwell, who has been optimizing Mesa to
-improve performance on 3d hardware. Thanks to Keith's work, many
-applications using Mesa 3.1 will see a dramatic performance increase
-over Mesa 3.0. The donation will allow Keith to continue working on
-Mesa full time for some time to come.
-
-For more information about Mesa see www.mesa3d.org. For more
-information about id Software, Inc. see www.idsoftware.com.
-
---------------------------------
-
-This donation from John/id is very generous. Keith and I are very
-grateful.
-
-</pre>
-<p>
-</p><h2>May 1, 1999</h2>
-<p>John Carmack made an interesting .plan update yesterday:
-
-</p><ul>
- <i>"I put together a document on optimizing OpenGL drivers for Q3 that
- should be helpful to the various Linux 3D teams. <br>
- </i>http://www.quake3arena.com/news/glopt.html</i>"
-</ul>
-
-<p>
-</p><h2>April 7, 1999</h2>
-<p>Updated the Mesa contributors section and added links to RPM Mesa packages.</p>
-<p>
-</p><h2>March 18, 1999</h2>
-<p>The new webpages are now online. Enjoy, and let me know if you find any errors.
-<p>
-</p><h2>February 16, 1999</h2>
-<p><a href="http://www.sgi.com/">SGI</a> releases its <a href="http://www.sgi.com/software/opensource/glx/">GLX
-source code</a>.</p>
-<p>
-</p><h2>January 22, 1999</h2>
-<p>www.mesa3d.org established</p>
-
-
-</p>
-
-
-<hr>
-</body>
-</html>
+<HTML> + +<TITLE>Mesa News</TITLE> + +<head><link rel="stylesheet" type="text/css" href="mesa.css"></head> + +<BODY> + +<body bgcolor="#eeeeee"> + +<H1>News</H1> + + +<h2>March 2, 2011</h2> + +<p> +<a href="relnotes-7.9.2.html">Mesa 7.9.2</a> and +<a href="relnotes-7.10.1.html">Mesa 7.10.1</a> are released. These are +stable releases containing bug fixes since the 7.9.1 and 7.10 releases. +</p> + + +<h2>October 4, 2010</h2> + +<p> +<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new +development release. +</p> + + +<h2>September 27, 2010</h2> + +<p> +<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released. This is a +release candidate for the 7.9 development release. +</p> + + +<h2>June 16, 2010</h2> + +<p> +<a href="relnotes-7.8.2.html">Mesa 7.8.2</a> is released. This is a bug-fix +release collecting fixes since the 7.8.1 release. +</p> + + +<h2>April 5, 2010</h2> + +<p> +<a href="relnotes-7.8.1.html">Mesa 7.8.1</a> is released. This is a bug-fix +release for a few critical issues in the 7.8 release. +</p> + + +<h2>March 28, 2010</h2> +<p> +<a href="relnotes-7.7.1.html">Mesa 7.7.1</a> is released. This is a bug-fix +release fixing issues found in the 7.7 release. +</p> +<p> +Also, <a href="relnotes-7.8.html">Mesa 7.8</a> is released. This is a new +development release. +</p> + + + +<h2>December 21, 2009</h2> +<p> +<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix +release fixing issues found in the 7.6 release. +</p> +<p> +Also, <a href="relnotes-7.7.html">Mesa 7.7</a> is released. This is a new +development release. +</p> + + +<h2>September 28, 2009</h2> +<p> +<a href="relnotes-7.6.html">Mesa 7.6</a> is released. This is a new feature +release. Those especially concerned about stability may want to wait for the +follow-on 7.6.1 bug-fix release. +</p> +<p> +<a href="relnotes-7.5.2.html">Mesa 7.5.2</a> is also released. +This is a stable release fixing bugs since the 7.5.1 release. +</p> + + +<h2>September 3, 2009</h2> +<p> +<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released. +This is a bug-fix release which fixes bugs found in version 7.5. +</p> + + +<h2>July 17, 2009</h2> +<p> +<a href="relnotes-7.5.html">Mesa 7.5</a> is released. +This is a new features release. People especially concerned about +stability may want to wait for the follow-on 7.5.1 bug-fix release. +</p> + + +<h2>June 23, 2009</h2> +<p> +<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released. +This is a stable release that fixes a regression in the i915/i965 drivers +that slipped into the 7.4.3 release. +</p> + + +<h2>June 19, 2009</h2> +<p> +<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released. +This is a stable release fixing bugs since the 7.4.2 release. +</p> + + +<h2>May 15, 2009</h2> +<p> +<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released. +This is a stable release fixing bugs since the 7.4.1 release. +</p> + + +<h2>April 18, 2009</h2> +<p> +<a href="relnotes-7.4.1.html">Mesa 7.4.1</a> is released. +This is a stable release fixing bugs since the 7.4 release. +</p> + + +<h2>March 27, 2009</h2> +<p> +<a href="relnotes-7.4.html">Mesa 7.4</a> is released. +This is a stable release fixing bugs since the 7.3 release. +</p> + + +<h2>January 22, 2009</h2> +<p> +<a href="relnotes-7.3.html">Mesa 7.3</a> is released. +This is a new development release. +Mesa 7.4 will follow and will have bug fixes relative to 7.3. +</p> + + +<h2>September 20, 2008</h2> +<p> +<a href="relnotes-7.2.html">Mesa 7.2</a> is released. +This is a stable, bug-fix release. +</p> + + +<h2>August 26, 2008</h2> +<p> +<a href="relnotes-7.1.html">Mesa 7.1</a> is released. +This is a new development release. +It should be relatively stable, but those especially concerned about +stability should wait for the 7.2 release or use Mesa 7.0.4 (the +previous stable release). +</p> + + +<h2>August 16, 2008</h2> +<p> +<a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released. +This is a bug-fix release. +</p> + + +<h2>April 4, 2008</h2> +<p> +<a href="relnotes-7.0.3.html">Mesa 7.0.3</a> is released. +This is a bug-fix release. +</p> + + +<h2>January 24, 2008</h2> + +<p> +Added a new page describing the <a href="cell.html">Mesa Cell driver</a>. +</p> + + + +<h2>November 13, 2007</h2> + +<p> +Gallium3D is the codename for the new Mesa device driver architecture +which is currently under development. +</p> +<p> +Gallium3D development is taking place on the <em>gallium-0.1</em> branch +of the git repository. +Currently, there's only a software-only driver and an Intel i915/945 driver +but other drivers will be coming... +</p> + + +<h2>November 10, 2007</h2> +<p> +<a href="relnotes-7.0.2.html">Mesa 7.0.2</a> is released. +This is a bug-fix release. +</p> + + +<h2>August 3, 2007</h2> +<p> +<a href="relnotes-7.0.1.html">Mesa 7.0.1</a> is released. +This is a bug-fix release. +</p> + + +<h2>June 22, 2007</h2> +<p> +<a href="relnotes-7.0.html">Mesa 7.0</a> is released. +This is a stable release featuring OpenGL 2.1 support. +</p> + + +<h2>April 27, 2007</h2> +<p> +<a href="relnotes-6.5.3.html">Mesa 6.5.3</a> is released. +This is a development release which will lead up to the Mesa 7.0 release +(which will advertise OpenGL 2.1 API support). +</p> + + +<h2>March 26, 2007</h2> +<p> +The new Shading Language compiler branch has been merged into the git +master branch. This is a step toward hardware support for the OpenGL +2.0 Shading Language and will be included in the next Mesa release. +In conjunction, <a href="http://glean.sf.net" target="_parent">Glean +</a> has been updated with a new test that does over 130 tests of the +shading language and built-in functions. +</p> + +<h2>April 2007</h2> +<p> +Thomas Hellström of Tungsten Graphics has written a whitepaper +describing the new DRI memory management system</a>. +</p> + +<h2>December 5, 2006</h2> +<p> +Mesa is now using git as its source code management system. +The previous CVS repository should no longer be used. +See the <a href="repository.html">repository page</a> for more information. +</p> + +<h2>December 2, 2006</h2> +<p> +<a href="relnotes-6.5.2.html">Mesa 6.5.2</a> has been released. +This is a new development release. +</p> + +<h2>September 15, 2006</h2> +<p> +<a href="relnotes-6.5.1.html">Mesa 6.5.1</a> has been released. +This is a new development release. +</p> + +<h2>March 31, 2006</h2> +<p> +<a href="relnotes-6.5.html">Mesa 6.5</a> has been released. +This is a new development release. +</p> + + +<h2>February 2, 2006</h2> +<p> +<a href="relnotes-6.4.2.html">Mesa 6.4.2</a> has been released. +This is stable, bug-fix release. +</p> + + +<h2>November 29, 2005</h2> +<p> +<a href="relnotes-6.4.1.html">Mesa 6.4.1</a> has been released. +This is stable, bug-fix release. +</p> + + + +<h2>October 24, 2005</h2> +<p> +<a href="relnotes-6.4.html">Mesa 6.4</a> has been released. +This is stable, bug-fix release. +</p> + + +<h2>August 19, 2005</h2> +<p> +Mesa 6.3.2 has been released. +Note: there was no public release of version 6.3.1. +</p> +<a href="versions.html#6.3.2">Changes in version 6.3.1</a> +<p> +The MD5 checksums are: +</p> +<pre> +98192e45ed8d69113688f89f90869346 MesaLib-6.3.2.tar.gz +0df27701df0924d17ddf41185efa8ce1 MesaLib-6.3.2.tar.bz2 +ccb2423aab77fc7e81ce628734586140 MesaLib-6.3.2.zip +9d0fca0a7d051c34a0b485423fb3e85d MesaDemos-6.3.2.tar.gz +96708868450c188205e42229b5d813c4 MesaDemos-6.3.2.tar.bz2 +c5102501e609aa8996d832fafacb8ab9 MesaDemos-6.3.2.zip +</pre> + + +<h2>July 20, 2005</h2> +<p> +Mesa 6.3 has been released. +This is a development release with new features, changes and bug fixes. +</p> +<pre> + New: + - GL_EXT_framebuffer_object extension + - GL_ARB_draw_buffers extension + - GL_ARB_pixel_buffer_object extension + - GL_OES_read_format extension (Ian Romanick) + - DirectFB driver (Claudio Ciccani) + - x86_64 vertex transformation code (Mikko T.) + Changes: + - added -stereo option for glxgears demo (Jacek Rosik) + - updated the PBuffer demo code in xdemos/ directory + - glDeleteTextures/Programs/Buffers() now makes the object ID + available for immediate re-use + - assorted 64-bit clean-ups fixes (x86_64 and Win64) + - lots of internal changes for GL_EXT_framebuffer_object + Bug fixes: + - some functions didn't support PBO functionality + - glGetTexImage didn't convert color index images to RGBA as required + - fragment program texcoords were sometimes wrong for points and lines + - fixed problem with negative dot product in arbfplight, fplight demos + - fixed bug in perspective correction of antialiased, textured lines + - querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value + - fixed a couple per-pixel fog bugs (Soju Matsumoto) + - glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken + - fixed float parsing bug in ARB frag/vert programs (bug 2520) + - XMesaGetDepthBuffer() returned incorrect value for bytesPerValue + - GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha + - glXChooseFBConfig() crashed if attribList pointer was NULL + - program state.light[n].spot.direction.w was wrong value (bug 3083) + - fragment program fog option required glEnable(GL_FOG) - wrong. + - glColorTable() could produce a Mesa implementation error (bug 3135) + - RasterPos could get corrupted by color index rendering path + - Removed bad XTranslateCoordinates call when rendering to Pixmaps + - glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state + - fixed a few Darwin compilation problems +</pre> +<p> +The MD5 checksums are: +</p> +<pre> +0236f552d37514776945d5a013e5bb7b MesaLib-6.3.tar.gz +60e1a8f78c4a8c7750a1e95753190986 MesaLib-6.3.tar.bz2 +ca7c950fbace68c70caa822322db7223 MesaLib-6.3.zip +25ea801645b376c014051804fe4974b2 MesaDemos-6.3.tar.gz +9248e74872ea88c57ec25c900c295057 MesaDemos-6.3.tar.bz2 +8537dfa734ef258dcc7272097558d434 MesaDemos-6.3.zip +</pre> + + +<h2>December 9, 2004</h2> +<p> +Mesa 6.2.1 has been released. +This is a stable release which just fixes bugs since the 6.2 release. +</p> +<pre> + Bug fixes: + - don't apply regular fog or color sum when using a fragment program + - glProgramEnvParameter4fARB always generated an error on + GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645) + - glVertexAttrib3svNV and glVertexAttrib3svARB were broken + - fixed width/height mix-up in glSeparableFilter2D() + - fixed regression in glCopyPixels + convolution + - glReadPixels from a clipped front color buffer didn't always work + - glTexImage didn't accept GL_RED/GREEN/BLUE as the format + - Attempting queries/accesses of VBO 0 weren't detected as errors + - paletted textures failed if the palette had fewer than 256 entries + Changes: + - fixed a bunch of compiler warnings found with gcc 3.4 + - bug reports should to go bugzilla.freedesktop.org +</pre> +<p> +The MD5 checksums are: +</p> +<pre> +80008a92f6e055d3bfdde2cf331ec3fa MesaLib-6.2.1.tar.gz +f43228cd2bf70f583ef3275c1c545421 MesaLib-6.2.1.tar.bz2 +dec26cfd40116ad021020fea2d94f652 MesaLib-6.2.1.zip +2c7af3c986a7571c8713c8bfee7e49e3 MesaDemos-6.2.1.tar.gz +3cac74667b50bcbd4f67f594fb4224a2 MesaDemos-6.2.1.tar.bz2 +75b3edd12eb2b370caf05f29b99e508a MesaDemos-6.2.1.zip +</pre> + + +<h2>October 2, 2004</h2> +<p> +Mesa 6.2 has been released. +This is a stable release which just fixes bugs since the 6.1 release. +</p> +<pre> + New: + - enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle) + - updated Doxygen support (Jose Fonseca) + Changes: + - some GGI driver updates (Christoph Egger, bug 1025977) + Bug fixes: + - Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features + - fixed a few compilation issues on IRIX + - fixed a matrix classification bug (reported by Wes Bethel) + - we weren't reseting the vertex/fragment program error state + before parsing (Dave Reveman) + - adjust texcoords for sampling texture rectangles (Dave Reveman) + - glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented + - repeated calls to glDeleteTexture(t) could lead to a crash + - fixed potential ref count bugs in VBOs and vertex/fragment programs + - spriteblast demo didn't handle window size changes correctly + - glTexSubImage didn't handle pixels=NULL correctly for PBOs + - fixed color index mode glDrawPixels bug (Karl Schultz) +</pre> +<p> +The MD5 checksums are: +</p> +<pre> +9e8f34b059272dbb8e1f2c968b33bbf0 MesaLib-6.2.tar.gz +3d6a6362390b6a37d3cb2e615f3ac7db MesaLib-6.2.tar.bz2 +6cfd7895d28e695c0dbbed9469564091 MesaLib-6.2.zip +3e06e33b0809f09855cb60883b8bdfef MesaDemos-6.2.tar.gz +9d160009c3dfdb35fe7e4088c9ba8f85 MesaDemos-6.2.tar.bz2 +856f7ec947122eb3c8985ebc2f654dcd MesaDemos-6.2.zip +</pre> + + +<h2>August 18, 2004</h2> +<p> +Mesa 6.1 has been released. +This is a new development release (version 6.2 will be a stabilization +release). +</p> +<pre> + New: + - Revamped Makefile system + - glXUseRotatedXFont() utility (see xdemos/xuserotfont.c) + - internal driver interface changes related to texture object + allocation, vertex/fragment programs, BlendEquationSeparate, etc. + - option to walk triangle edges with double-precision floats + (Justin Novosad of Discreet) (see config.h file) + - support for AUX buffers in software GLX driver + - updated glext.h to version 24 and glxext.h to version 6 + - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars + - updated BeOS support (Philippe Houdoin) + Changes: + - fragment fog interpolation is perspective corrected now + - new glTexImage code, much cleaner, may be a bit faster + Bug fixes: + - glArrayElement in display lists didn't handle generic vertex attribs + - glFogCoord didn't always work properly + - ARB_fragment_program fog options didn't work + - frag prog TEX instruction no longer incorrectly divides s,t,r by q + - ARB frag prog TEX and TEXP instructions now use LOD=0 + - glTexEnviv in display lists didn't work + - glRasterPos didn't do texgen or apply texture matrix + - GL_DOUBLE-valued vertex arrays were broken in some cases + - fixed texture rectangle edge/border sampling bugs + - sampling an incomplete texture in a fragment program would segfault + - glTexImage was missing a few error checks + - fixed some minor glGetTexParameter glitches + - GL_INTENSITY was mistakenly accepted as a <format> to glTexImage + - fragment program writes to RC/HC register were broken + - fixed a few glitches in GL_HP_occlusion_test extension + - glBeginQueryARB and glEndQueryARB didn't work inside display lists + - vertex program state references were broken + - fixed triangle color interpolation bug on AIX (Shane Blackett) + - fixed a number of minor memory leaks (bug #1002030) +</pre> +The MD5 checksums are: +</p> +<pre> +c9284d295ebcd2e0486cc3cd54e5863c MesaLib-6.1.tar.gz +5de1f53ec0709f60fc68fdfed57351f3 MesaLib-6.1.tar.bz2 +483e77cac4789a5d36c42f3c0136d6d8 MesaLib-6.1.zip +8c46cfa6f9732acc6f6c25724aad0246 MesaDemos-6.1.tar.gz +89bfe0f6c69b39fd0ebd9fff481a4e9b MesaDemos-6.1.tar.bz2 +161268531fcc6f0c5a056430ee97e0c1 MesaDemos-6.1.zip +</pre> + + + +<h2>April 2, 2004</h2> + +<p> +Mesa 6.0.1 has been released. +This release basically just fixes bugs since the 6.0. release. +</p> +<pre> + New: + - upgraded glext.h to version 22 + - new build targets (Dan Schikore) + - new linux-x86-opteron build target (Heath Feather) + Bug fixes: + - glBindProgramARB didn't update all necessary state + - fixed build problems on OpenBSD + - omit CVS directories from tarballs + - glGetTexImage(GL_COLOR_INDEX) was broken + - fixed an infinite loop in t&l module + - silenced some valgrind warnings about using unitialized memory + - fixed some compilation/link glitches on IRIX (Mike Stephens) + - glBindProgram wasn't getting compiled into display lists + - GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079) + - two-sided lighting and vertex program didn't work (bug 887330) + - stores to program parameter registers in vertex state programs + didn't work. + - fixed glOrtho bug found with gcc 3.2.2 (RH9) + - glXCreateWindow() wasn't fully implemented (bug 890894) + - generic vertex attribute arrays didn't work in display lists + - vertex buffer objects' default usage and access fields were wrong + - glDrawArrays with start!=0 was broken + - fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken + - linux-osmesa16-static config didn't work + - fixed a few color index rendering problems (bug 910687) + - glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE + - OSMesa RGB and BGR modes were broken + - glProgramStringARB mistakenly required a null-terminated string + - fragment program XPD instruction was incorrect + - glGetMaterial() didn't work reliably +</pre> +The MD5 checksums are: +</p> +<pre> +011be0e79666c7a6eb9693fbf9348653 MesaLib-6.0.1.tar.gz +b7f14088c5c2f14490d2739a91102112 MesaLib-6.0.1.tar.bz2 +bf0510cf0a2b87d64cdd317eca3f1db1 MesaLib-6.0.1.zip +b7b648599e0aaee1c4ffc554a2a9139e MesaDemos-6.0.1.tar.gz +dd6aadfd9ca8e1cfa90c6ee492bc6f43 MesaDemos-6.0.1.tar.bz2 +eff71d59c211825e949199852f5a2316 MesaDemos-6.0.1.zip +</pre> + + + +<h2>January 16, 2004</h2> + +<p> +Mesa 6.0 has been released. This is a stabilization of the 5.1 release +and primarily just incorporates bug fixes. +</p> +<pre> + New: + - full OpenGL 1.5 support + - updated GL/glext.h file to version 21 + Changes: + - changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h) + Bug fixes: + - fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color + clamping issue + - updated suno5-gcc configs + - glColor3 functions sometimes resulted in undefined alpha values + - fixed FP divide by zero error seen on VMS with xlockmore, others + - fixed vertex/fragment program debug problem (bug 873011) + - building on AIX with gcc works now + - glDeleteProgramsARB failed for ARB fragment programs (bug 876160) + - glDrawRangeElements tried to modify potentially read-only storage + - updated files for building on Windows +</pre> + + + +<h2>December 28, 2003</h2> + +<p> +The Mesa CVS server has been moved to <a href="http://www.freedesktop.org" +target="_parent"> +freedesktop.org</a> because of problems with SourceForge's anonymous +CVS service. +</p> + +<p>Please see the <a href="cvs_access.html">CVS access page</a> for details. +</p> + + +<h2>December 17, 2003</h2> + +<p> +Mesa 5.1 has been released. This is a new development release. +Mesa 6.0 will be the next stable release and will support all +OpenGL 1.5 features. +</p> +<pre> + New features: + - reorganized directory tree + - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche) + - GL_ATI_texture_env_combine3 extension (Ian Romanick) + - GL_SGI_texture_color_table extension (Eric Plante) + - GL_NV_fragment_program extension + - GL_NV_light_max_exponent extension + - GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle) + - GL_ARB_occlusion_query extension + - GL_ARB_point_sprite extension + - GL_ARB_texture_non_power_of_two extension + - GL_IBM_multimode_draw_arrays extension + - GL_EXT_texture_mirror_clamp extension (Ian Romanick) + - GL_ARB_vertex_buffer_object extension + - new X86 feature detection code (Petr Sebor) + - less memory used for display lists and vertex buffers + - demo of per-pixel lighting with a fragment program (demos/fplight.c) + - new version (18) of glext.h header + - new spriteblast.c demo of GL_ARB_point_sprite + - faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1) + - faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1) + Bug fixes: + - really enable OpenGL 1.4 features in DOS driver. + - fixed issues in glDrawPixels and glCopyPixels for very wide images + - glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint + - fixed some texgen bugs reported by Daniel Borca + - fixed wglMakeCurrent(NULL, NULL) bug (#835861) + - fixed glTexSubImage3D z-offset bug (Cedric Gautier) + - fixed RGBA blend enable bug (Ville Syrjala) + - glAccum is supposed to be a no-op in selection/feedback mode + - fixed texgen bug #597589 (John Popplewell) + Changes: + - dropped API trace feature (src/Trace/) + - documentation overhaul. merged with website content. more html. + - glxgears.c demo updated to use GLX swap rate extensions + - glTexImage1/2/3D now allows width/height/depth = 0 + - disable SPARC asm code on Linux (bug 852204) +</pre> + +The MD5 checksums are: +</p> +<pre> +78f452f6c55478471a744f07147612b5 MesaLib-5.1.tar.gz +67b3b8d3f7f4c8c44904551b851d01af MesaLib-5.1.tar.bz2 +6dd19ffa750ec7f634e370a987505c9d MesaLib-5.1.zip +e0214d4ebb22409dfa9262f2b52fd828 MesaDemos-5.1.tar.gz +066c9aff4fd924405de1ae9bad5ec9a7 MesaDemos-5.1.tar.bz2 +d2b5ba32b53e0ad0576c637a4cc1fb41 MesaDemos-5.1.zip +</pre> + + +<H2>November 12, 2003</H2> + +<p> +New Mesa 5.0.2 tarballs have been uploaded to SourceForge which fix a +number of automake/libtool problems. +</p> +<p> +The new MD5 checksums are: +</p> +<pre> +a9dcf3ff9ad1b7d6ce73a0df7cff8b5b MesaLib-5.0.2.tar.gz +7b4bf9261657c2fca03796d4955e6f50 MesaLib-5.0.2.tar.bz2 +79c141bddcbad557647535d02194f346 MesaLib-5.0.2.zip +952d9dc823dd818981d1a648d7b2668a MesaDemos-5.0.2.tar.gz +b81fafff90995025d2f25ea02b786642 MesaDemos-5.0.2.tar.bz2 +a21be975589e8a2d1871b6bb7874fffa MesaDemos-5.0.2.zip +</pre> + + + +<h2>September 5, 2003</h2> + +<p> +Mesa 5.0.2 has been released. This is a stable, bug-fix release. +</p> +<pre> + Bug fixes: + - fixed texgen problem causing texcoord's Q to be zero (stex3d) + - default GL_TEXTURE_COMPARE_MODE_ARB was wrong + - GL_CURRENT_MATRIX_NV query was wrong + - GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one + - GL_LIST_MODE query wasn't correct + - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported + - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value + - blended, wide lines didn't always work correctly (bug 711595) + - glVertexAttrib4svNV w component was always 1 + - fixed bug in GL_IBM_rasterpos_clip (missing return) + - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly + - a few Solaris compilation fixes + - fixed glClear() problem for DRI drivers (non-existant stencil, etc) + - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux) + - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz) + - glFog() didn't clamp fog colors + - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the + gl[Get]TexParameteri[v] functions + - fixed invalid memory references in glTexGen functions (bug 781602) + - integer-valued color arrays weren't handled correctly + - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work + - GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1 + Changes: + - build GLUT with -fexceptions so C++ apps propogate exceptions +</pre> + + + +<h2>June 2003</h2> + +<p> +Mesa's directory tree has been overhauled. +Things are better organized now with some thought toward future needs. +</p> +<p> +In CVS, the latest Mesa 5.1 development code is now rooted under the +<b>Mesa-newtree/</b> directory. The old top-level <b>Mesa/</b> directory +holds the Mesa 5.0.x code which will be abandoned at some point. +</p> + + + +<h2>March 30, 2003</h2> + +<p> +Mesa 5.0.1 has been released. This is a stable, bug-fix release. +</p> +<pre> + New: + - DOS driver updates from Daniel Borca + - updated GL/gl_mangle.h file (Bill Hoffman) + Bug fixes: + - auto mipmap generation for cube maps was broken (bug 641363) + - writing/clearing software alpha channels was unreliable + - minor compilation fixes for OS/2 (Evgeny Kotsuba) + - fixed some bad assertions found with shadowtex demo + - fixed error checking bug in glCopyTexSubImage2D (bug 659020) + - glRotate(angle, -x, 0, 0) was incorrect (bug 659677) + - fixed potential segfault in texture object validation (bug 659012) + - fixed some bogus code in _mesa_test_os_sse_exception_support (Linus) + - fix fog stride bug in tnl code for h/w drivers (Michel Danzer) + - fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080) + - glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3 + - fixed compilation problem on Solaris7/x86 (bug 536406) + - fixed prefetch bug in 3DNow! code (Felix Kuhling) + - fixed NeXT build problem (FABSF macro) + - glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811) + - zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964) + - AA line and triangle Z values are now rounded, not truncated + - fixed color interpolation bug when GLchan==GLfloat (bug 694461) + - glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca) + - fixed a minor GL_COLOR_MATERIAL bug + - NV vertex program EXP instruction was broken + - glColorMask misbehaved with X window / pixmap rendering + - fix autoconf/libtool GLU C++ linker problem on Linux (a total hack) + - attempt to fix GGI compilation problem when MesaDemos not present + - NV vertex program ARL-relative fetches didn't work + Changes: + - use glPolygonOffset in gloss demo to avoid z-fighting artifacts + - updated winpos and pointblast demos to use ARB extensions + - disable SPARC normal transformation code (bug 673938) + - GLU fixes for OS/2 (Evgeny Kotsuba) +</pre> +<p> +MD5 checksums follow: +</p> +<pre> +b80f8b5d53a3e9f19b9fde5af0c542f0 MesaLib-5.0.1.tar.gz +513b4bbd7d38951f05027179063d876b MesaLib-5.0.1.tar.bz2 +eebd395678f4520d33b267e5d5c22651 MesaLib-5.0.1.zip +49d7feaec6dc1d2091d7c3cc72a9b320 MesaDemos-5.0.1.tar.gz +37190374a98c3c892f0698be9ca3acf0 MesaDemos-5.0.1.tar.bz2 +becd8bf17f5791361b4a54ba2a78e5c9 MesaDemos-5.0.1.zip +</pre> + + + +<h2>March 7, 2003</h2> +<p> +Website and documentation overhaul. +</p> +<p> +The website content and Mesa documentation (from the doc/ directory) have +been merged together. +All the documentation files have been entered into the CVS repository. +Many of the old plain-text files have been converted to html and modernized. +</p> + + +<h2>November 13, 2002</h2> +<p>Mesa 5.0 has been released. This is a stable release which +implements the OpenGL 1.4 specification. +</p><pre>New: + - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4") + - removed some overlooked debugging code + - glxinfo updated to support GLX_ARB_multisample + - GLUT now support GLX_ARB_multisample + - updated DOS driver (Daniel Borca) +Bug fixes: + - GL_POINT and GL_LINE-mode polygons didn't obey cull state + - fixed potential bug in _mesa_align_malloc/calloc() + - fixed missing triangle bug when running vertex programs + - fixed a few HPUX compilation problems + - FX (Glide) driver didn't compile + - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work + - a few EXT functions, like glGenTexturesEXT, were no-ops + - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate, + glMultiDrawArrays and glMultiDrawElements were missing + - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken + - Pentium 4 Mobile was mistakenly identified as having 3DNow! + - fixed one-bit error in point/line fragment Z calculation + - fixed potential segfault in fakeglx code + - fixed color overflow problem in DOT3 texture env mode +</pre> + + +<h2>October 29, 2002</h2> +<p>Mesa 4.1 has been released. This is a new development release. +For a stable release, get 4.0.4. +</p><pre>New: + - GL_NV_vertex_program extension + - GL_NV_vertex_program1_1 extension + - GL_ARB_window_pos extension + - GL_ARB_depth_texture extension + - GL_ARB_shadow extension + - GL_ARB_shadow_ambient extension + - GL_EXT_shadow_funcs extension + - GL_ARB_point_parameters extension + - GL_ARB_texture_env_crossbar + - GL_NV_point_sprite extension + - GL_NV_texture_rectangle extension + - GL_EXT_multi_draw_arrays extension + - GL_EXT_stencil_two_side extension + - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions + - GL_ATI_texture_mirror_once extension (Ian Romanick) + - massive overhaul/simplification of software rasterizer module, + many contributions from Klaus Niederkrueger + - faster software texturing in some cases (i.e. trilinear filtering) + - new OSMesaGetProcAddress() function + - more blend modes implemented with MMX code (Jose Fonseca) + - added glutGetProcAddress() to GLUT + - added GLUT_FPS env var to compute frames/second in glutSwapBuffers() + - pbinfo and pbdemo PBuffer programs + - glxinfo -v prints transprent pixel info (Gerd Sussner) +Bug fixes: + - better mipmap LOD computation (prevents excessive blurriness) + - OSMesaMakeCurrent() didn't recognize buffer size changes + - assorted conformance fixes for 16-bit/channel rendering + - texcombine alpha subtraction mode was broken + - fixed some blend problems when GLchan==GLfloat (Gerk Huisma) + - clamp colors to [0,1] in OSMesa if GLchan==GLfloat (Gerk Huisma) + - fixed divide by zero error in NURBS tessellator (Jon Perry) + - fixed GL_LINEAR fog bug by adding clamping + - fixed FP exceptions found using Alpha CPU + - 3dfx/glide driver render-to-window feature was broken + - added missing GLX_TRANSPARENT_RGB token to glx.h + - fixed error checking related to paletted textures + - fixed reference count error in glDeleteTextures (Randy Fayan) +Changes: + - New spec file and Python code to generate some GL dispatch files + - Glide driver defaults to "no" with autoconf/automake + - floating point color channels now clamped to [0,inf) + - updated demos/stex3d with new options +</pre> + + +<h2>October 4, 2002</h2> +<p> +The <a href="http://mesa3d.sourceforge.net/docs/MesaFAQ.html">Mesa FAQ</a> has been rewritten. +</p> + +<h2>October 3, 2002</h2> +<p>Mesa 4.0.4 has been released. This is a stable bug-fix release. +</p><pre> New: + - GL_NV_texture_rectangle extension + - updated glext.h header (version 17) + - updated DOS driver (Daniel Borca) + - updated BeOS R5 driver (Philippe Houdoin) + - added GL_IBM_texture_mirror_repeat + - glxinfo now takes -l option to print interesting OpenGL limits info + - GL_MESA_ycbcr_texture extension + - GL_APPLE_client_storage extension (for some DRI drivers only) + - GL_MESA_pack_invert extension + Bug fixes: + - fixed GL_LINEAR fog bug by adding clamping + - fixed FP exceptions found using Alpha CPU + - 3dfx MESA_GLX_FX=window (render to window) didn't work + - fixed memory leak in wglCreateContest (Karl Schultz) + - define GLAPIENTRY and GLAPI if undefined in glu.h + - wglGetProcAddress didn't handle all API functions + - when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map + - removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc() + - error checking in compressed tex image functions had some glitches + - fixed AIX compile problem in src/config.c + - glGetTexImage was using pixel unpacking instead of packing params + - auto-mipmap generation for cube maps was incorrect + Changes: + - max texture units reduced to six to accomodate texture rectangles + - removed unfinished GL_MESA_sprite_point extension code +</pre> + +<h2>June 25, 2002</h2> +<p>Mesa 4.0.3 has been released. This is a stable bug-fix release. +</p><pre> New: + - updated GL/glext.h file (version 15) + - corrected MMX blend code (Jose Fonseca) + - support for software-based alpha planes in Windows driver + - updated GGI driver (Filip Spacek) + Bug fixes: + - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens + - OSMesaMakeCurrent() didn't recognize buffer size changes + - assorted conformance fixes for 16-bit/channel rendering + - texcombine alpha subtraction mode was broken + - fixed lighting bug with non-uniform scaling and display lists + - fixed bug when deleting shared display lists + - disabled SPARC cliptest assembly code (Mesa bug 544665) + - fixed a couple Solaris compilation/link problems + - blending clipped glDrawPixels didn't always work + - glGetTexImage() didn't accept packed pixel types + - glPixelMapu[is]v() could explode given too large of pixelmap + - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT + - glXCopyContext() could lead to segfaults + - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665) + Changes: + - lots of C++ (g++) code clean-ups + - lots of T&L updates for the Radeon DRI driver + Known bugs: + - mipmap LOD computation (fixed for Mesa 4.1) +</pre> + +<h2>April 2, 2002</h2> +<p>Mesa 4.0.2 has been released. This is a stable bug-fix release. +</p><pre> New: + - New DOS (DJGPP) driver written by Daniel Borca + - New driver interface functions for TCL drivers (such as Radeon DRI) + - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32" + if using deep color channels + - latest GL/glext.h and GL/glxext.h headers from SGI + Bug fixes: + - GL_BLEND with non-black texture env color wasn't always correct + - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha) + - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken + - glReadPixels was sometimes mistakenly clipped by the scissor box + - glDraw/ReadPixels didn't catch all the errors that they should have + - Fixed 24bpp rendering problem in Windows driver (Karl Schultz) + - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c) + - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP) + - glColorMask as sometimes effecting glXSwapBuffers() + - fixed a potential bug in XMesaGarbageCollect() + - N threads rendering into one window didn't work reliably + - glCopyPixels didn't work for deep color channels + - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma) + - glPopAttrib() didn't correctly restore user clip planes + - user clip planes failed for some perspective projections (Chromium) +</pre> + +<h2>December 17, 2001</h2> +<p>Mesa 4.0.1 has been released. This is a stable bug-fix release. +</p><pre> New: + - better sub-pixel sample positions for AA triangles (Ray Tice) + - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO) + Bug fixes: + - added missing break statements in glGet*() for multisample cases + - fixed uninitialized hash table mutex bug (display lists / texobjs) + - fixed bad teximage error check conditional (bug 476846) + - fixed demos readtex.c compilation problem on Windows (Karl Schultz) + - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT + - silence some compiler warnings (gcc 2.96) + - enable the #define GL_VERSION_1_3 in GL/gl.h + - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h + - fixed glu.h typedef problem found with MSDev 6.0 + - build libGL.so with -Bsymbolic (fixes bug found with Chromium) + - added missing 'const' to glXGetContextIDEXT() in glxext.h + - fixed a few glXGetProcAddress() errors (texture compression, etc) + - fixed start index bug in compiled vertex arrays (Keith) + - fixed compilation problems in src/SPARC/glapi_sparc.S + - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith) + - use glXGetProcAddressARB in GLUT to avoid extension linking problems + - provoking vertex of flat-shaded, color-index triangles was wrong + - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith) + - glTexParameter didn't flush the vertex buffer (Ray Tice) + - feedback attributes for glDraw/CopyPixels and glBitmap were wrong + - fixed bug in normal length caching (ParaView lighting bug) +</pre> + +<h2>October 22, 2001</h2> +<p>Mesa 4.0 has been released. This is a stable release. +</p><pre> New: + - Mesa 4.0 implements the OpenGL 1.3 specification + - GL_IBM_rasterpos_clip extension + - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp) + - GL_ARB_texture_mirrored_repeat extension + - WindML UGL driver (Stephane Raimbault) + - added OSMESA_MAX_WIDTH/HEIGHT queries + - attempted compiliation fixes for Solaris 5, 7 and 8 + - updated glext.h and glxext.h files + - updated Windows driver (Karl Schultz) + Bug fixes: + - added some missing GLX 1.3 tokens to include/GL/glx.h + - GL_COLOR_MATRIX changes weren't recognized by teximage functions + - glCopyPixels with scale and bias was broken + - glRasterPos with lighting could segfault + - glDeleteTextures could leave a dangling pointer + - Proxy textures for cube maps didn't work + - fixed a number of 16-bit color channel bugs + - fixed a few minor memory leaks + - GLX context sharing was broken in 3.5 + - fixed state-update bugs in glPopClientAttrib() + - fixed glDrawRangeElements() bug + - fixed a glPush/PopAttrib() bug related to texture binding + - flat-shaded, textured lines were broken + - fixed a dangling pointer problem in the XMesa code (Chris Burghart) + - lighting didn't always produce the correct alpha value + - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky) +</pre> + + +<h2>June 21, 2001</h2> +<p>Mesa 3.5 has been released. This is a new development release. +</p><pre> New: + - internals of Mesa divided into modular pieces (Keith Whitwell) + - 100% OpenGL 1.2 conformance (passes all conformance tests) + - new AA line algorithm + - GL_EXT_convolution extension + - GL_ARB_imaging subset + - OSMesaCreateContextExt() function + - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) + - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight + - GL_EXT_fog_coord extension (Keith Whitwell) + - GL_EXT_secondary_color extension (Keith Whitwell) + - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) + - GL_SGIX_depth_texture extension + - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions + - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow + - GL_ARB_texture_env_combine extension + - GL_ARB_texture_env_dot3 extension + - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp) + - OSMesaCreateContextExt() function + - libOSMesa.so library, contains the OSMesa driver interface + - GL/glxext.h header file for GLX extensions + - somewhat faster software texturing, fogging, depth testing + - all color-index conformance tests now pass (only 8bpp tested) + - SPARC assembly language TCL optimizations (David Miller) + - GL_SGIS_generate_mipmap extension + Bug Fixes: + - fbiRev and tmuRev were unitialized when using Glide3 + - fixed a few color index mode conformance failures; all pass now + - now appling antialiasing coverage to alpha after texturing + - colors weren't getting clamped to [0,1] before color table lookup + - fixed RISC alignment errors caused by COPY_4UBV macro + - drawing wide, flat-shaded lines could cause a segfault + - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles + Changes: + - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU + - new libOSMesa.so library, contains the OSMesa driver interface +</pre> + + +<h2>May 17, 2001</h2> +<p>Mesa 3.4.2 has been released. This is basically just a bug-fix release. +Here's what's new:</p> +<pre> Bug fixes: + - deleting the currently bound texture could cause bad problems + - using fog could result in random vertex alpha values + - AA triangle rendering could touch pixels outside right window bound + - fixed byteswapping problem in clear_32bit_ximage() function + - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam + - fixed memory leak in glXUseXFont() + - fragment sampling in AA triangle function was off by 1/2 pixel + - Windows: reading pixels from framebuffer didn't always work + - glConvolutionFilter2D could segfault or cause FP exception + - fixed segfaults in FX and X drivers when using tex unit 1 but not 0 + - GL_NAND logicop didn't work right in RGBA mode + - fixed a memory corruption bug in vertex buffer reset code + - clearing the softwara alpha buffer with scissoring was broken + - fixed a few color index mode fog bugs + - fixed some bad assertions in color index mode + - fixed FX line 'stipple' bug #420091 + Changes: + - optimized writing mono-colored pixel spans to X pixmaps + - increased max viewport size to 2048 x 2048 +</pre> + + +<h2>April 29, 2001</h2> +<p>New Mesa website</p> +<p>Mark Manning produced the new website.<br>Thanks, Mark!</p> + + +<h2>February 14, 2001</h2> +<p>Mesa 3.4.1 has been released. Here's what's new:</p> +<pre> New: + - fixed some Linux build problems + - fixed some Windows build problems + - GL_EXT_texture_env_dot3 extension (Gareth Hughes) + Bug fixes: + - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI + - various state-update code changes needed for DRI bugs + - disabled pixel transfer ops in glColorTable commands, not needed + - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter + - updated sources and fixed compile problems in widgets-mesa/ + - GLX_PBUFFER enum value was wrong in glx.h + - fixed a glColorMaterial lighting bug + - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function + - glXCopySubBufferMESA() Y position was off by one + - Error checking of glTexSubImage3D() was broken (bug 128775) + - glPopAttrib() didn't restore all derived Mesa state correctly + - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL + conformance problems at 16bpp. + - clearing depth buffer with scissoring was broken, would segfault + - OSMesaGetDepthBuffer() returned bad bytesPerValue value + - fixed a line clipping bug (reported by Craig McDaniel) + - fixed RGB color over/underflow bug for very tiny triangles + Known problems: + - NURBS or evaluator surfaces inside display lists don't always work +</pre> +<p> +</p><h2>November 3, 2000</h2> +<p>Mesa 3.4 has been released. Here's what's new since the 3.3 release:</p> +<pre> New: + - optimized glDrawPixels for glPixelZoom(1,-1) + Bug Fixes: + - widgets-mesa/src/*.c files were missing from 3.3 distro + - include/GL/mesa_wgl.h file was missing from 3.3 distro + - fixed some Win32 compile problems + - texture object priorities weren't getting initialized to 1.0 + - glAreTexturesResident return value was wrong when using hardware + - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX) + - glReadPixels with GLushort packed types was broken + - fixed a few bugs in the GL_EXT_texture_env_combine texture code + - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables + - fixed some typos/bugs in the VB code + - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work + - optimized glDrawPixels paths weren't being used + - per-fragment fog calculation didn't work without a Z buffer + - improved blending accuracy, fixes Glean blendFunc test failures + - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly + - glXGetProcAddressARB() didn't always return the right address + - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format + - texture matrix changes weren't always detected (GLUT projtex demo) + - fixed random color problem in vertex fog code + - fixed Glide-related bug that let Quake get a 24-bit Z buffer + Changes: + - finished internal support for compressed textures for DRI +</pre> +<p> +</p><h2>April 24, 2000</h2> +<p>Mesa 3.2 has been released. Here's what's new since the beta release:</p> +<pre> Bug fixes: + - fixed memcpy bugs in span.c + - fixed missing glEnd problem in demos/tessdemo.c + - fixed bug when clearing 24bpp Ximages + - fixed clipping problem found in Unreal Tournament + - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2 + - fixed Loki's 3dfx RGB vs BGR bug + - fixed Loki's 3dfx smooth/flat shading bug in SoF + Changes: + - updated docs/README file + - use bcopy() optimizations on FreeBSD + - re-enabled the optimized persp_textured_triangle() function +</pre> +<p> +</p><h2>March 23, 2000</h2> +<p>I've just upload the Mesa 3.2 beta 1 files to SourceForge at <a href="http://sourceforge.net/project/showfiles.php?group_id=3" target="_parent">http://sourceforge.net/project/filelist.php?group_id=3</a><a href="http://sourceforge.net/project/showfiles.php?group_id=3"></a></p> +<p>3.2 (note even number) is a stabilization release of Mesa 3.1 meaning it's mainly +just bug fixes.</p> +<p>Here's what's changed: + +</p><ul> + Bug fixes: + <ul> + - mixed drawing of lines and bitmaps sometimes had wrong colors<br> + - added missing glHintPGI() function<br> + - fixed a polygon culling bug<br> + - fixed bugs in gluPartialDisk()<br> + - Z values in selection mode were wrong<br> + - added missing tokens: + <ul> + GL_SMOOTH_POINT_SIZE_RANGE<br> + GL_SMOOTH_POINT_SIZE_GRANULARITY<br> + GL_SMOOTH_LINE_WIDTH_RANGE<br> + GL_SMOOTH_LINE_WIDTH_GRANULARITY<br> + GL_ALIASED_POINT_SIZE_RANGE<br> + GL_ALIASED_LINE_WIDTH_RANGE + </ul> + - fixed glCopyPixels when copying from back to front buffer<br> + - GL_EXT_compiled_vertex_array tokens had _SGI suffix instead of _EXT<br> + - glDrawRangeElements(GL_LINES, 0, 1, 2, type, indices) was broken<br> + - glDeleteTextures() didn't decrement reference count correctly<br> + - GL_SRCA_ALPHA_SATURATE blend mode didn't work correctly<br> + - Actual depth of transformation matrix stacks was off by one<br> + - 24bpp visuals didn't address pixels correctly<br> + - mipmap level of detail (lambda) calculation simplified, more accurate<br> + - 101691 - Polygon clipping and GL_LINE<br> + - 101928 - Polygon clipping and GL_LINE (same fix as above)<br> + - 101808 - Non-glVertexArrays tristrip bug<br> + - 101971 - find_last_3f on Dec OSF (worked around)<br> + - 102369 - segv on dec osf (possibly a duplicate of the above)<br> + - 102893 - orientations of modelview cause segfault + </ul> + New: + <ul> + - updated SVGA Linux driver<br> + - added the MESA_FX_NO_SIGNALS env var, see docs/README.3DFX<br> + - build libGLw.a (Xt/OpenGL drawing area widget) library by default<br> + - changed -O2 to -O3 for a number of gcc configs + </ul> + Changes: + <ul> + - glXCopyContext's mask parameter is now unsigned long, per GLX spec + </ul> +</ul> + +<p>Please report any problems with this release ASAP. Bugs should be filed on the +Mesa3D website at sourceforge.<br> +After 3.2 is wrapped up I hope to release 3.3 beta 1 soon afterward.</p> +<p>-- Brian</p> +<p> +</p><h2>December 17, 1999</h2> +<p>A Slashdot interview with Brian about Mesa (questions submitted by Slashdot readers) +can be found at <a href="http://slashdot.org/interviews/99/12/17/0927212.shtml" target="_parent">http://slashdot.org/interviews/99/12/17/0927212.shtml</a>.</p> +<p> +</p><h2>December 14, 1999</h2> +<p>Mesa 3.1 is released!</p> +<p> +</p><h2>September 21, 1999</h2> +<p>There appear to be two new files on the ftp site, <a href="ftp://ftp.mesa3d.org/mesa/beta/MesaLib-3.1beta3.tar.gz">MesaLib-3.1beta3.tar.gz</a> +and <a href="ftp://ftp.mesa3d.org/mesa/beta/MesaDemos-3.1beta3.tar.gz">MesaDemos-3.1beta3.tar.gz</a>, +that seem to be... yes, I've just received confirmation from the beta center, they +are indeed the <b>THIRD</b> beta release of Mesa 3.1! Happy Days. Happy Days. Thanks +Keith Whitwell for preparing these for us during Brian's absence.</p> +<p> +</p><h2>August 30, 1999</h2> +<p>I'm pleased to announce that I've accepted a position with Precision Insight, +Inc. effective October, 1999. I'll be leaving Avid Technology in September.</p> +<p>I've been working on Mesa in my spare time for over five years. With Precision +Insight I now have the opportunity to devote my full attention to advancing Mesa +and OpenGL on Linux.</p> +<p>While I'll be focused on Linux, the X Window System, and hardware acceleration, +my work will continue to be open sourced and available to any other programmers who +may want to contribute to it, or use it for other projects or platforms</p> +<p>PS: I'm going to be traveling until Sep 6 and won't be reading email until then.</p> +<p> +</p><h2>August 23, 1999</h2> +<p>Anonymous CVS access is back online so suck up all the bandwidth you can afford. +Note that this is a new archive, so you will need to re-checkout the archive. That +means don't <i>cvs update</i> from a previous download.</p> +<p> +</p><h2>August 17, 1999</h2> +<p>A report from the SIGGRAPH '99 Linux/OpenGL +BOF meeting is now available.</p> +<p>-Brian</p> +<p> +</p><h2>August 14, 1999</h2> +<p>www.mesa3d.org is having technical problems due to hardware failures at VA Linux +systems. The Mac pages, ftp, and CVS services aren't fully restored yet. Please be +patient.</p> +<p>-Brian</p> +<p> +</p><h2>June 7, 1999</h2> +<p>RPMS of the nVidia RIVA server can be found at <a href="ftp://ftp.mesa3d.org/mesa/misc/nVidia/">ftp://ftp.mesa3d.org/mesa/misc/nVidia/</a>.</p> +<p> +</p><h2>June 2, 1999</h2> +<p><a href="http://www.nvidia.com/">nVidia</a> has released some Linux binaries for +xfree86 3.3.3.1, along with the <b>full source</b>, which includes GLX acceleration +based on Mesa 3.0. They can be downloaded from <a href="http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html">http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html</a>.</p> +<p> +</p><h2>May 24, 1999</h2> +<p>Beta 2 of Mesa 3.1 has been make available at <a href="ftp://ftp.mesa3d.org/mesa/beta/">ftp://ftp.mesa3d.org/mesa/beta/</a>. +If you are into the quake scene, you may want to try this out, as it contains some +optimizations specifically in the Q3A rendering path. +<p> +</p><h2>May 13, 1999</h2> +<p>For those interested in the integration of Mesa into XFree86 4.0, Precision Insight +has posted their lowlevel design documents at http://www.precisioninsight.com.</p> +<p> +</p><h2>May 13, 1999</h2> +<pre>May 1999 - John Carmack of id Software, Inc. has made a donation of +US$10,000 to the Mesa project to support its continuing development. +Mesa is a free implementation of the OpenGL 3D graphics library and id's +newest game, Quake 3 Arena, will use Mesa as the 3D renderer on Linux. + +The donation will go to Keith Whitwell, who has been optimizing Mesa to +improve performance on 3d hardware. Thanks to Keith's work, many +applications using Mesa 3.1 will see a dramatic performance increase +over Mesa 3.0. The donation will allow Keith to continue working on +Mesa full time for some time to come. + +For more information about Mesa see www.mesa3d.org. For more +information about id Software, Inc. see www.idsoftware.com. + +-------------------------------- + +This donation from John/id is very generous. Keith and I are very +grateful. + +</pre> +<p> +</p><h2>May 1, 1999</h2> +<p>John Carmack made an interesting .plan update yesterday: + +</p><ul> + <i>"I put together a document on optimizing OpenGL drivers for Q3 that + should be helpful to the various Linux 3D teams. <br> + </i>http://www.quake3arena.com/news/glopt.html</i>" +</ul> + +<p> +</p><h2>April 7, 1999</h2> +<p>Updated the Mesa contributors section and added links to RPM Mesa packages.</p> +<p> +</p><h2>March 18, 1999</h2> +<p>The new webpages are now online. Enjoy, and let me know if you find any errors. +<p> +</p><h2>February 16, 1999</h2> +<p><a href="http://www.sgi.com/">SGI</a> releases its <a href="http://www.sgi.com/software/opensource/glx/">GLX +source code</a>.</p> +<p> +</p><h2>January 22, 1999</h2> +<p>www.mesa3d.org established</p> + + +</p> + + +<hr> +</body> +</html> diff --git a/mesalib/docs/relnotes-7.10.1.html b/mesalib/docs/relnotes-7.10.1.html new file mode 100644 index 000000000..ea605d966 --- /dev/null +++ b/mesalib/docs/relnotes-7.10.1.html @@ -0,0 +1,380 @@ +<HTML> + +<head> +<TITLE>Mesa Release Notes</TITLE> +<link rel="stylesheet" type="text/css" href="mesa.css"> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +</head> + +<BODY> + +<body bgcolor="#eeeeee"> + +<H1>Mesa 7.10.1 Release Notes / TBD</H1> + +<p> +Mesa 7.10.1 is a bug fix release which fixes bugs found since the 7.10 release. +</p> +<p> +Mesa 7.10.1 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +</p> +<p> +See the <a href="install.html">Compiling/Installing page</a> for prerequisites +for DRI hardware acceleration. +</p> + + +<h2>MD5 checksums</h2> +<pre> +4b4cee19f3bf16eb78bd4cc278ccf812 MesaLib-7.10.1.tar.gz +efe8da4d80c2a5d32a800770b8ce5dfa MesaLib-7.10.1.tar.bz2 +0fd2b1a025934de3f8cecf9fb9b57f4c MesaLib-7.10.1.zip +42beb0f5188d544476c19496f725fa67 MesaGLUT-7.10.1.tar.gz +637bb8a20fdad89f7382b4ea83f896e3 MesaGLUT-7.10.1.tar.bz2 +bdbf3ffb2606d6aa8afabb6c6243b91b MesaGLUT-7.10.1.zip +</pre> + + +<h2>New features</h2> +<p>None.</p> + +<h2>Bug fixes</h2> +<p>This list is likely incomplete.</p> +<ul> +<li>Fix an off-by-one bug in a vsplit assertion.</li> +<li>Fix incorrect handling of <tt>layout</tt> qualifier +with <tt>in</tt>, <tt>out</tt>, <tt>attribute</tt>, and <tt>varying</tt>.</li> + +<li>Fix an i965 shader bug where the negative absolute value was generated instead of the absolute value of a negation.</li> + +<li>Fix numerous issues handling precision qualifiers in GLSL ES.</li> + +<li>Fixed a few GLX protocol encoder bugs (Julien Cristau)</li> + +<li>Assorted Gallium llvmpipe driver bug fixes</li> + +<li>Assorted Mesa/Gallium state tracker bug fixes</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26795">Bug 26795</a> - gl_FragCoord off by one in Gallium drivers.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29164">Bug 29164</a> - [GLSL 1.20] invariant variable shouldn't be used before declaration</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29823">Bug 29823</a> - GetUniform[if]v busted</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29927">Bug 29927</a> - [glsl2] fail to compile shader with constructor for array of struct type</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30156">Bug 30156</a> - [i965] After updating to Mesa 7.9, Civilization IV starts to show garbage</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31923">Bug 31923</a> - [GLSL 1.20] allowing inconsistent centroid declaration between two vertex shaders</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31925">Bug 31925</a> - [GLSL 1.20] "#pragma STDGL invariant(all)" fail</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32214">Bug 32214</a> - [gles2]no link error happens when missing vertex shader or frag shader</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32375">Bug 32375</a> - [gl gles2] Not able to get the attribute by function glGetVertexAttribfv</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32541">Bug 32541</a> - Segmentation Fault while running an HDR (high dynamic range) rendering demo</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32569">Bug 32569</a> - [gles2] glGetShaderPrecisionFormat not implemented yet</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32695">Bug 32695</a> - [glsl] SIGSEGV glcpp/glcpp-parse.y:833</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32831">Bug 32831</a> - [glsl] division by zero crashes GLSL compiler</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32910">Bug 32910</a> - Keywords 'in' and 'out' not handled properly for GLSL 1.20 shaders</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33219">Bug 33219</a> -[GLSL bisected] implicit sized array triggers segfault in ir_to_mesa_visitor::copy_propagate</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33306">Bug 33306</a> - GLSL integer division by zero crashes GLSL compiler</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33308">Bug 33308</a> -[glsl] ast_to_hir.cpp:3016: virtual ir_rvalue* ast_jump_statement::hir(exec_list*, _mesa_glsl_parse_state*): Assertion `ret != __null' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33316">Bug 33316</a> - uniform array will be allocate one line more and initialize it when it was freed will abort</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33386">Bug 33386</a> - Dubious assembler in read_rgba_span_x86.S</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33388">Bug 33388</a> - Dubious assembler in xform4.S</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33433">Bug 33433</a> - Error in x86-64 API dispatch code.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33507">Bug 33507</a> - [glsl] GLSL preprocessor modulus by zero crash</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33508">Bug 33508</a> - [glsl] GLSL compiler modulus by zero crash</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33916">Bug 33916</a> - Compiler accepts reserved operators % and %=</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34030">Bug 34030</a> - [bisected] Starcraft 2: some effects are corrupted or too big</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34047">Bug 34047</a> - Assert in _tnl_import_array() when using GLfixed vertex datatypes with GLESv2</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34114">Bug 34114</a> - Sun Studio build fails due to standard library functions not being in global namespace</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34179">Bug 34179</a> - Nouveau 3D driver: nv50_pc_emit.c:863 assertion error kills Compiz</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34198">Bug 34198</a> - [GLSL] implicit sized array with index 0 used gets assertion</li> + +<li><a href="https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/691653">Ubuntu bug 691653</a> - compiz crashes when using alt-tab (the radeon driver kills it) </li> + +<li><a href="https://bugs.meego.com/show_bug.cgi?id=13005">Meego bug 13005</a> - Graphics GLSL issue lead to camera preview fail on Pinetrail</li> + +<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> --> + +</ul> + + +<h2>Changes</h2> +<p>The full set of changes can be viewed by using the following GIT command:</p> + +<pre> + git log mesa-7.10..mesa-7.10.1 +</pre> + +<p>Alberto Milone (1): +<ul> + <li>r600c: add evergreen ARL support.</li> +</ul></p> + +<p>Brian Paul (21): +<ul> + <li>draw: Fix an off-by-one bug in a vsplit assertion.</li> + <li>docs: add links to 7.9.1 and 7.10 release notes</li> + <li>docs: added news item for 7.9.1 and 7.10 release</li> + <li>gallivm: work around LLVM 2.6 bug when calling C functions</li> + <li>gallivm: fix copy&paste error from previous commit</li> + <li>mesa: fix a few format table mistakes, assertions</li> + <li>mesa: fix num_draw_buffers==0 in fixed-function fragment program generation</li> + <li>mesa: don't assert in GetIntegerIndexed, etc</li> + <li>mesa: check for dummy renderbuffer in _mesa_FramebufferRenderbufferEXT()</li> + <li>llvmpipe: make sure binning is active when we begin/end a query</li> + <li>st/mesa: fix incorrect fragcoord.x translation</li> + <li>softpipe: fix off-by-one error in setup_fragcoord_coeff()</li> + <li>cso: fix loop bound in cso_set_vertex_samplers()</li> + <li>st/mesa: fix incorrect glCopyPixels position on fallback path</li> + <li>st/mesa: set renderbuffer _BaseFormat in a few places</li> + <li>st/mesa: fix the default case in st_format_datatype()</li> + <li>st/mesa: need to translate clear color according to surface's base format</li> + <li>docs: update 7.9.2 release notes with Brian's cherry-picks</li> + <li>docs: add link to 7.10.1 release notes</li> + <li>mesa: implement glGetShaderPrecisionFormat()</li> + <li>docs: updated environment variable list</li> +</ul></p> + +<p>Bryce Harrington (1): +<ul> + <li>r300g: Null pointer check for buffer deref in gallium winsys</li> +</ul></p> + +<p>Chad Versace (20): +<ul> + <li>glsl: At link-time, check that globals have matching centroid qualifiers</li> + <li>glcpp: Fix segfault when validating macro redefinitions</li> + <li>glsl: Fix parser rule for type_specifier</li> + <li>glsl: Change default value of ast_type_specifier::precision</li> + <li>glsl: Add semantic checks for precision qualifiers</li> + <li>glsl: Add support for default precision statements</li> + <li>glsl: Remove redundant semantic check in parser</li> + <li>glsl: Fix semantic checks on precision qualifiers</li> + <li>glsl: Fix segfault due to missing printf argument</li> + <li>glsl: Mark 'in' variables at global scope as read-only</li> + <li>mesa: Refactor handling of extension strings</li> + <li>mesa: Add/remove extensions in extension string</li> + <li>mesa: Change dependencies of some OES extension strings</li> + <li>mesa: Change OES_point_sprite to depend on ARB_point_sprite</li> + <li>mesa: Change OES_standard_derivatives to be stand-alone extension</li> + <li>i915: Disable extension OES_standard_derivatives</li> + <li>glcpp: Raise error when modulus is zero</li> + <li>glsl: Set operators '%' and '%=' to be reserved when GLSL < 1.30</li> + <li>glsl: Reinstate constant-folding for division by zero</li> + <li>tnl: Add support for datatype GL_FIXED in vertex arrays</li> +</ul></p> + +<p>Chia-I Wu (1): +<ul> + <li>mesa: Add glDepthRangef and glClearDepthf to APIspec.xml.</li> +</ul></p> + +<p>Christoph Bumiller (1): +<ul> + <li>nv50,nvc0: do not forget to apply sign mode to saved TGSI inputs</li> +</ul></p> + +<p>Cyril Brulebois (1): +<ul> + <li>Point to bugs.freedesktop.org rather than bugzilla.freedesktop.org</li> +</ul></p> + +<p>Dave Airlie (3): +<ul> + <li>radeon/r200: fix fbo-clearmipmap + gen-teximage</li> + <li>radeon: calculate complete texture state inside TFP function</li> + <li>radeon: avoid segfault on 3D textures.</li> +</ul></p> + +<p>Dimitry Andric (4): +<ul> + <li>mesa: s/movzx/movzbl/</li> + <li>mesa: s/movzxw/movzwl/ in read_rgba_span_x86.S</li> + <li>glapi: adding @ char before type specifier in glapi_x86.S</li> + <li>glapi: add @GOTPCREL relocation type</li> +</ul></p> + +<p>Eric Anholt (16): +<ul> + <li>glsl: Fix the lowering of variable array indexing to not lose write_masks.</li> + <li>i965/fs: When producing ir_unop_abs of an operand, strip negate.</li> + <li>i965/vs: When MOVing to produce ABS, strip negate of the operand.</li> + <li>i965/fs: Do flat shading when appropriate.</li> + <li>i965: Avoid double-negation of immediate values in the VS.</li> + <li>intel: Make renderbuffer tiling choice match texture tiling choice.</li> + <li>i965: Fix dead pointers to fp->Parameters->ParameterValues[] after realloc.</li> + <li>docs: Add a relnote for the Civ IV on i965.</li> + <li>glapi: Add entrypoints and enums for GL_ARB_ES2_compatibility.</li> + <li>mesa: Add extension enable bit for GL_ARB_ES2_compatibility.</li> + <li>mesa: Add actual support for glReleaseShaderCompiler from ES2.</li> + <li>mesa: Add support for glDepthRangef and glClearDepthf.</li> + <li>mesa: Add getters for ARB_ES2_compatibility MAX_*_VECTORS.</li> + <li>mesa: Add getter for GL_SHADER_COMPILER with ARB_ES2_compatibility.</li> + <li>i965: Fix a bug in i965 compute-to-MRF.</li> + <li>i965/fs: Add a helper function for detecting math opcodes.</li> +</ul></p> + +<p>Fredrik Höglund (1): +<ul> + <li>st/mesa: fix a regression from cae2bb76</li> +</ul></p> + +<p>Ian Romanick (42): +<ul> + <li>docs: Add 7.10 md5sums</li> + <li>glsl: Support the 'invariant(all)' pragma</li> + <li>glcpp: Generate an error for division by zero</li> + <li>glsl: Add version_string containing properly formatted GLSL version</li> + <li>glsl & glcpp: Refresh autogenerated lexer and parser files.</li> + <li>glsl: Disallow 'in' and 'out' on globals in GLSL 1.20</li> + <li>glsl: Track variable usage, use that to enforce semantics</li> + <li>glsl: Allow 'in' and 'out' when 'layout' is also available</li> + <li>docs: Initial bits of 7.10.1 release notes</li> + <li>mesa: bump version to 7.10.1-devel</li> + <li>doc: Update 7.10.1 release notes</li> + <li>glsl: Emit errors or warnings when 'layout' is used with 'attribute' or 'varying'</li> + <li>docs: Update 7.10.1 release notes</li> + <li>glsl: Refresh autogenerated lexer and parser files.</li> + <li>glsl: Don't assert when the value returned by a function has no rvalue</li> + <li>linker: Set sizes for non-global arrays as well</li> + <li>linker: Propagate max_array_access while linking functions</li> + <li>docs: Update 7.10.1 release notes</li> + <li>mesa: glGetUniform only returns a single element of an array</li> + <li>linker: Generate link errors when ES shaders are missing stages</li> + <li>mesa: Fix error checks in GetVertexAttrib functions</li> + <li>Use C-style system headers in C++ code to avoid issues with std:: namespace</li> + <li>docs: Update 7.10.1 release notes</li> + <li>glapi: Regenerate for GL_ARB_ES2_compatibility.</li> + <li>mesa: Connect glGetShaderPrecisionFormat into the dispatch table</li> + <li>i965: Set correct values for range/precision of fragment shader types</li> + <li>i915: Set correct values for range/precision of fragment shader types</li> + <li>intel: Fix typeos from 3d028024 and 790ff232</li> + <li>glsl: Ensure that all GLSL versions are supported in the stand-alone compiler</li> + <li>glsl: Reject shader versions not supported by the implementation</li> + <li>mesa: Initial size for secondary color array is 3</li> + <li>glsl: Finish out the reduce/reduce error fixes</li> + <li>glsl: Regenerate compiler and glcpp files from cherry picks</li> + <li>linker: Fix off-by-one error implicit array sizing</li> + <li>docs: update 7.10.1 release notes with Ian's recent cherry picks</li> + <li>i915: Only mark a register as available if all components are written</li> + <li>i915: Calculate partial result to temp register first</li> + <li>i915: Force lowering of all types of indirect array accesses in the FS</li> + <li>docs: Update 7.10.1 with (hopefully) the last of the cherry picks</li> + <li>docs: Clean up bug fixes list</li> + <li>intel: Remove driver date and related bits from renderer string</li> + <li>mesa: set version string to 7.10.1 (final)</li> +</ul></p> + +<p>Jian Zhao (1): +<ul> + <li>mesa: fix an error in uniform arrays in row calculating.</li> +</ul></p> + +<p>Julien Cristau (3): +<ul> + <li>glx: fix request lengths</li> + <li>glx: fix GLXChangeDrawableAttributesSGIX request</li> + <li>glx: fix length of GLXGetFBConfigsSGIX</li> +</ul></p> + +<p>Keith Packard (1): +<ul> + <li>glsl: Eliminate reduce/reduce conflicts in glsl grammar</li> +</ul></p> + +<p>Kenneth Graunke (20): +<ul> + <li>glsl: Expose a public glsl_type::void_type const pointer.</li> + <li>glsl: Don't bother unsetting a destructor that was never set.</li> + <li>glsl, i965: Remove unnecessary talloc includes.</li> + <li>glcpp: Remove use of talloc reference counting.</li> + <li>ralloc: Add a fake implementation of ralloc based on talloc.</li> + <li>Convert everything from the talloc API to the ralloc API.</li> + <li>ralloc: a new MIT-licensed recursive memory allocator.</li> + <li>Remove talloc from the make and automake build systems.</li> + <li>Remove talloc from the SCons build system.</li> + <li>Remove the talloc sources from the Mesa repository.</li> + <li>glsl: Fix use of uninitialized values in _mesa_glsl_parse_state ctor.</li> + <li>i965/fs: Apply source modifier workarounds to POW as well.</li> + <li>i965: Fix shaders that write to gl_PointSize on Sandybridge.</li> + <li>i965/fs: Avoid register coalescing away gen6 MATH workarounds.</li> + <li>i965/fs: Correctly set up gl_FragCoord.w on Sandybridge.</li> + <li>i965: Increase Sandybridge point size clamp.</li> + <li>i965/fs: Refactor control flow stack handling.</li> + <li>i965: Increase Sandybridge point size clamp in the clip state.</li> + <li>glsl: Use reralloc instead of plain realloc.</li> + <li>Revert "i965/fs: Correctly set up gl_FragCoord.w on Sandybridge."</li> +</ul></p> + +<p>Marek Olšák (4): +<ul> + <li>docs: fix messed up names with special characters in relnotes-7.10</li> + <li>docs: fix messed up names with special characters in relnotes-7.9.1</li> + <li>mesa: fix texture3D mipmap generation for UNSIGNED_BYTE_3_3_2</li> + <li>st/dri: Track drawable context bindings</li> +</ul></p> + +<p>Paulo Zanoni (1): +<ul> + <li>dri_util: fail driCreateNewScreen if InitScreen is NULL</li> +</ul></p> + +<p>Sam Hocevar (2): +<ul> + <li>docs: add glsl info</li> + <li>docs: fix glsl_compiler name</li> +</ul></p> + +<p>Tom Fogal (1): +<ul> + <li>Regenerate gl_mangle.h.</li> +</ul></p> + +<p>Tom Stellard (2): +<ul> + <li>r300/compiler: Disable register rename pass on r500</li> + <li>r300/compiler: Don't erase sources when converting RGB->Alpha</li> +</ul></p> + +<p>Vinson Lee (3): +<ul> + <li>ralloc: Add missing va_end following va_copy.</li> + <li>mesa: Move declaration before code in extensions.c.</li> + <li>mesa: Move loop variable declarations outside for loop in extensions.c.</li> +</ul></p> + +<p>nobled (1): +<ul> + <li>glx: Put null check before use</li> +</ul></p> + +</p> + +</body> +</html> diff --git a/mesalib/docs/relnotes-7.9.2.html b/mesalib/docs/relnotes-7.9.2.html new file mode 100644 index 000000000..65929cc2a --- /dev/null +++ b/mesalib/docs/relnotes-7.9.2.html @@ -0,0 +1,336 @@ +<HTML> + +<head> +<TITLE>Mesa Release Notes</TITLE> +<link rel="stylesheet" type="text/css" href="mesa.css"> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +</head> + +<BODY> + +<body bgcolor="#eeeeee"> + +<H1>Mesa 7.9.2 Release Notes / TBD</H1> + +<p> +Mesa 7.9.2 is a bug fix release which fixes bugs found since the 7.9.1 release. +</p> +<p> +Mesa 7.9.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +</p> +<p> +See the <a href="install.html">Compiling/Installing page</a> for prerequisites +for DRI hardware acceleration. +</p> + + +<h2>MD5 checksums</h2> +<pre> +eb4ab8c1a03386def3ea34b1358e9cda MesaLib-7.9.2.tar.gz +8f6d1474912787ce13bd35f3bae9938a MesaLib-7.9.2.tar.bz2 +427a81dd43ac97603768dc5c6af3df26 MesaLib-7.9.2.zip +aacb8f4db997e346db40c6066942140a MesaGLUT-7.9.2.tar.gz +18abe6cff4fad8ad4752c7b7ab548e5d MesaGLUT-7.9.2.tar.bz2 +3189e5732d636c71baf3d8bc23ce7b11 MesaGLUT-7.9.2.zip +</pre> + + +<h2>New features</h2> +<p>None.</p> + +<h2>Bug fixes</h2> +<p>This list is likely incomplete.</p> +<ul> +<li>Fix an off-by-one bug in a vsplit assertion.</li> +<li>Fix incorrect handling of <tt>layout</tt> qualifier +with <tt>in</tt>, <tt>out</tt>, <tt>attribute</tt>, and <tt>varying</tt>.</li> + +<li>Fix an i965 GPU hang in GLSL shaders that contain an unconditional <tt>discard</tt> statement.</li> + +<li>Fix an i965 shader bug where the negative absolute value was generated instead of the absolute value of a negation.</li> + +<li>Fix numerous issues handling precision qualifiers in GLSL ES.</li> + +<li>Fixed a few GLX protocol encoder bugs (Julien Cristau)</li> + +<li>Assorted Gallium llvmpipe driver bug fixes</li> + +<li>Assorted Mesa/Gallium state tracker bug fixes</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26795">Bug 26795</a> - gl_FragCoord off by one in Gallium drivers.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29164">Bug 29164</a> - [GLSL 1.20] invariant variable shouldn't be used before declaration</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29823">Bug 29823</a> - GetUniform[if]v busted</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29927">Bug 29927</a> - [glsl2] fail to compile shader with constructor for array of struct type</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30156">Bug 30156</a> - [i965] After updating to Mesa 7.9, Civilization IV starts to show garbage</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31923">Bug 31923</a> - [GLSL 1.20] allowing inconsistent centroid declaration between two vertex shaders</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31925">Bug 31925</a> - [GLSL 1.20] "#pragma STDGL invariant(all)" fail</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32214">Bug 32214</a> - [gles2]no link error happens when missing vertex shader or frag shader</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32375">Bug 32375</a> - [gl gles2] Not able to get the attribute by function glGetVertexAttribfv</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32541">Bug 32541</a> - Segmentation Fault while running an HDR (high dynamic range) rendering demo</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32569">Bug 32569</a> - [gles2] glGetShaderPrecisionFormat not implemented yet</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32695">Bug 32695</a> - [glsl] SIGSEGV glcpp/glcpp-parse.y:833</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32831">Bug 32831</a> - [glsl] division by zero crashes GLSL compiler</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32910">Bug 32910</a> - Keywords 'in' and 'out' not handled properly for GLSL 1.20 shaders</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33219">Bug 33219</a> -[GLSL bisected] implicit sized array triggers segfault in ir_to_mesa_visitor::copy_propagate</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33306">Bug 33306</a> - GLSL integer division by zero crashes GLSL compiler</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33308">Bug 33308</a> -[glsl] ast_to_hir.cpp:3016: virtual ir_rvalue* ast_jump_statement::hir(exec_list*, _mesa_glsl_parse_state*): Assertion `ret != __null' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33316">Bug 33316</a> - uniform array will be allocate one line more and initialize it when it was freed will abort</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33386">Bug 33386</a> - Dubious assembler in read_rgba_span_x86.S</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33388">Bug 33388</a> - Dubious assembler in xform4.S</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33433">Bug 33433</a> - Error in x86-64 API dispatch code.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33507">Bug 33507</a> - [glsl] GLSL preprocessor modulus by zero crash</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33508">Bug 33508</a> - [glsl] GLSL compiler modulus by zero crash</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33916">Bug 33916</a> - Compiler accepts reserved operators % and %=</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34047">Bug 34047</a> - Assert in _tnl_import_array() when using GLfixed vertex datatypes with GLESv2</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34114">Bug 34114</a> - Sun Studio build fails due to standard library functions not being in global namespace</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34198">Bug 34198</a> - [GLSL] implicit sized array with index 0 used gets assertion</li> + +<li><a href="https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/691653">Ubuntu bug 691653</a> - compiz crashes when using alt-tab (the radeon driver kills it) </li> + +<li><a href="https://bugs.meego.com/show_bug.cgi?id=13005">Meego bug 13005</a> - Graphics GLSL issue lead to camera preview fail on Pinetrail</li> + +<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> --> + +</ul> + + +<h2>Changes</h2> +<p>The full set of changes can be viewed by using the following GIT command:</p> + +<pre> + git log mesa-7.9.1..mesa-7.9.2 +</pre> + +<p>Alberto Milone (1): +<ul> + <li>r600c: add evergreen ARL support.</li> +</ul></p> + +<p>Brian Paul (19): +<ul> + <li>draw: Fix an off-by-one bug in a vsplit assertion.</li> + <li>mesa: fix a few format table mistakes, assertions</li> + <li>mesa: fix num_draw_buffers==0 in fixed-function fragment program generation</li> + <li>mesa: don't assert in GetIntegerIndexed, etc</li> + <li>mesa: check for dummy renderbuffer in _mesa_FramebufferRenderbufferEXT()</li> + <li>llvmpipe: make sure binning is active when we begin/end a query</li> + <li>st/mesa: fix incorrect fragcoord.x translation</li> + <li>softpipe: fix off-by-one error in setup_fragcoord_coeff()</li> + <li>cso: fix loop bound in cso_set_vertex_samplers()</li> + <li>st/mesa: set renderbuffer _BaseFormat in a few places</li> + <li>st/mesa: fix the default case in st_format_datatype()</li> + <li>st/mesa: need to translate clear color according to surface's base format</li> + <li>docs: update 7.9.2 release notes with Brian's cherry-picks</li> + <li>docs: add links to 7.9.1 and 7.9.2 release notes</li> + <li>mesa: include compiler.h for ASSERT macro</li> + <li>glsl: add ir_shader case in switch stmt to silence warning</li> + <li>glsl2: fix signed/unsigned comparison warning</li> + <li>mesa: implement glGetShaderPrecisionFormat()</li> + <li>docs: updated environment variable list</li> +</ul></p> + +<p>Bryce Harrington (1): +<ul> + <li>r300g: Null pointer check for buffer deref in gallium winsys</li> +</ul></p> + +<p>Chad Versace (14): +<ul> + <li>glsl: At link-time, check that globals have matching centroid qualifiers</li> + <li>glcpp: Fix segfault when validating macro redefinitions</li> + <li>glsl: Fix parser rule for type_specifier</li> + <li>glsl: Change default value of ast_type_specifier::precision</li> + <li>glsl: Add semantic checks for precision qualifiers</li> + <li>glsl: Add support for default precision statements</li> + <li>glsl: Remove redundant semantic check in parser</li> + <li>glsl: Fix semantic checks on precision qualifiers</li> + <li>glsl: Fix segfault due to missing printf argument</li> + <li>glsl: Mark 'in' variables at global scope as read-only</li> + <li>glcpp: Raise error when modulus is zero</li> + <li>glsl: Set operators '%' and '%=' to be reserved when GLSL < 1.30</li> + <li>glsl: Reinstate constant-folding for division by zero</li> + <li>tnl: Add support for datatype GL_FIXED in vertex arrays</li> +</ul></p> + +<p>Chia-I Wu (1): +<ul> + <li>mesa: Add glDepthRangef and glClearDepthf to APIspec.xml.</li> +</ul></p> + +<p>Chris Wilson (1): +<ul> + <li>intel: Check for unsupported texture when finishing using as a render target</li> +</ul></p> + +<p>Cyril Brulebois (1): +<ul> + <li>Point to bugs.freedesktop.org rather than bugzilla.freedesktop.org</li> +</ul></p> + +<p>Dave Airlie (2): +<ul> + <li>radeon/r200: fix fbo-clearmipmap + gen-teximage</li> + <li>radeon: avoid segfault on 3D textures.</li> +</ul></p> + +<p>Dimitry Andric (4): +<ul> + <li>mesa: s/movzx/movzbl/</li> + <li>mesa: s/movzxw/movzwl/ in read_rgba_span_x86.S</li> + <li>glapi: adding @ char before type specifier in glapi_x86.S</li> + <li>glapi: add @GOTPCREL relocation type</li> +</ul></p> + +<p>Eric Anholt (11): +<ul> + <li>i965: Avoid double-negation of immediate values in the VS.</li> + <li>docs: Add a relnote for the Civ IV on i965.</li> + <li>i965/vs: When MOVing to produce ABS, strip negate of the operand.</li> + <li>glsl: Fix the lowering of variable array indexing to not lose write_masks.</li> + <li>intel: Make renderbuffer tiling choice match texture tiling choice.</li> + <li>glapi: Add entrypoints and enums for GL_ARB_ES2_compatibility.</li> + <li>mesa: Add extension enable bit for GL_ARB_ES2_compatibility.</li> + <li>mesa: Add actual support for glReleaseShaderCompiler from ES2.</li> + <li>mesa: Add support for glDepthRangef and glClearDepthf.</li> + <li>mesa: Add getters for ARB_ES2_compatibility MAX_*_VECTORS.</li> + <li>mesa: Add getter for GL_SHADER_COMPILER with ARB_ES2_compatibility.</li> +</ul></p> + +<p>Ian Romanick (42): +<ul> + <li>docs: Add 7.9.1 md5sums</li> + <li>glsl: Support the 'invariant(all)' pragma</li> + <li>glcpp: Generate an error for division by zero</li> + <li>glsl: Add version_string containing properly formatted GLSL version</li> + <li>glsl & glcpp: Refresh autogenerated lexer and parser files.</li> + <li>glsl: Disallow 'in' and 'out' on globals in GLSL 1.20</li> + <li>glsl: Track variable usage, use that to enforce semantics</li> + <li>glsl: Allow 'in' and 'out' when 'layout' is also available</li> + <li>docs: Initial set of release notes for 7.9.2</li> + <li>mesa: bump version to 7.9.2-devel</li> + <li>docs: Update 7.9.2 release notes</li> + <li>i965: Make OPCODE_KIL_NV do its work in a temp, not the null reg!</li> + <li>glsl: Refresh autogenerated lexer and parser files.</li> + <li>glsl: Don't assert when the value returned by a function has no rvalue</li> + <li>linker: Set sizes for non-global arrays as well</li> + <li>linker: Propagate max_array_access while linking functions</li> + <li>docs: Update 7.9.2 release notes</li> + <li>Use C-style system headers in C++ code to avoid issues with std:: namespace</li> + <li>mesa: glGetUniform only returns a single element of an array</li> + <li>linker: Generate link errors when ES shaders are missing stages</li> + <li>mesa: Fix error checks in GetVertexAttrib functions</li> + <li>docs: Update 7.9.2 release notes</li> + <li>mesa: Remove unsupported OES extensions</li> + <li>glapi: Regenerate for GL_ARB_ES2_compatibility.</li> + <li>mesa: Connect glGetShaderPrecisionFormat into the dispatch table</li> + <li>i965: Set correct values for range/precision of fragment shader types</li> + <li>i915: Set correct values for range/precision of fragment shader types</li> + <li>intel: Fix typeos from 3d028024 and 790ff232</li> + <li>glsl: Ensure that all GLSL versions are supported in the stand-alone compiler</li> + <li>glsl: Reject shader versions not supported by the implementation</li> + <li>mesa: Initial size for secondary color array is 3</li> + <li>glcpp: Regenerate files from recent cherry picks</li> + <li>glsl: Finish out the reduce/reduce error fixes</li> + <li>glsl: Regenerate compiler files from cherry picks</li> + <li>linker: Fix off-by-one error implicit array sizing</li> + <li>i915: Only mark a register as available if all components are written</li> + <li>i915: Calculate partial result to temp register first</li> + <li>i915: Force lowering of all types of indirect array accesses in the FS</li> + <li>docs: Update 7.9.2 release notes for recent cherry picks</li> + <li>docs: Clean up bug fixes list</li> + <li>intel: Remove driver date and related bits from renderer string</li> + <li>mesa: set version string to 7.9.2 (final)</li> +</ul></p> + +<p>Jian Zhao (1): +<ul> + <li>mesa: fix an error in uniform arrays in row calculating.</li> +</ul></p> + +<p>Julien Cristau (3): +<ul> + <li>glx: fix request lengths</li> + <li>glx: fix GLXChangeDrawableAttributesSGIX request</li> + <li>glx: fix length of GLXGetFBConfigsSGIX</li> +</ul></p> + +<p>Keith Packard (1): +<ul> + <li>glsl: Eliminate reduce/reduce conflicts in glsl grammar</li> +</ul></p> + +<p>Kenneth Graunke (12): +<ul> + <li>glsl: Expose a public glsl_type::void_type const pointer.</li> + <li>glsl: Don't bother unsetting a destructor that was never set.</li> + <li>glsl, i965: Remove unnecessary talloc includes.</li> + <li>glcpp: Remove use of talloc reference counting.</li> + <li>ralloc: Add a fake implementation of ralloc based on talloc.</li> + <li>Convert everything from the talloc API to the ralloc API.</li> + <li>ralloc: a new MIT-licensed recursive memory allocator.</li> + <li>Remove talloc from the make and automake build systems.</li> + <li>Remove talloc from the SCons build system.</li> + <li>Remove the talloc sources from the Mesa repository.</li> + <li>glsl: Fix use of uninitialized values in _mesa_glsl_parse_state ctor.</li> + <li>glsl: Use reralloc instead of plain realloc.</li> +</ul></p> + +<p>Marek Olšák (3): +<ul> + <li>docs: fix messed up names with special characters in relnotes-7.9.1</li> + <li>mesa: fix texture3D mipmap generation for UNSIGNED_BYTE_3_3_2</li> + <li>st/dri: Track drawable context bindings</li> +</ul></p> + +<p>Paulo Zanoni (1): +<ul> + <li>dri_util: fail driCreateNewScreen if InitScreen is NULL</li> +</ul></p> + +<p>Sam Hocevar (2): +<ul> + <li>docs: add glsl info</li> + <li>docs: fix glsl_compiler name</li> +</ul></p> + +<p>Vinson Lee (1): +<ul> + <li>ralloc: Add missing va_end following va_copy.</li> +</ul></p> + +<p>nobled (1): +<ul> + <li>glx: Put null check before use</li> +</ul></p> +</p> + +</body> +</html> diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html index 07aa6ffba..b0ca3ef43 100644 --- a/mesalib/docs/relnotes.html +++ b/mesalib/docs/relnotes.html @@ -1,86 +1,88 @@ -<HTML>
-
-<TITLE>Mesa Release Notes</TITLE>
-
-<link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<BODY>
-
-<H1>Release Notes</H1>
-
-<p>
-The release notes summarize what's new or changed in each Mesa release.
-</p>
-
-<UL>
-<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
-<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
-<LI><A HREF="relnotes-7.9.1.html">7.9.1 release notes</A>
-<LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
-<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
-<LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
-<LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
-<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
-<LI><A HREF="relnotes-7.7.1.html">7.7.1 release notes</A>
-<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
-<LI><A HREF="relnotes-7.6.1.html">7.6.1 release notes</A>
-<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
-<LI><A HREF="relnotes-7.5.2.html">7.5.2 release notes</A>
-<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
-<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
-<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
-<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
-<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A>
-<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
-<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
-<LI><A HREF="relnotes-7.3.html">7.3 release notes</A>
-<LI><A HREF="relnotes-7.2.html">7.2 release notes</A>
-<LI><A HREF="relnotes-7.1.html">7.1 release notes</A>
-<LI><A HREF="relnotes-7.0.4.html">7.0.4 release notes</A>
-<LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A>
-<LI><A HREF="relnotes-7.0.2.html">7.0.2 release notes</A>
-<LI><A HREF="relnotes-7.0.1.html">7.0.1 release notes</A>
-<LI><A HREF="relnotes-7.0.html">7.0 release notes</A>
-<LI><A HREF="relnotes-6.5.3.html">6.5.3 release notes</A>
-<LI><A HREF="relnotes-6.5.2.html">6.5.2 release notes</A>
-<LI><A HREF="relnotes-6.5.1.html">6.5.1 release notes</A>
-<LI><A HREF="relnotes-6.5.html">6.5 release notes</A>
-<LI><A HREF="relnotes-6.4.2.html">6.4.2 release notes</A>
-<LI><A HREF="relnotes-6.4.1.html">6.4.1 release notes</A>
-<LI><A HREF="relnotes-6.4.html">6.4 release notes</A>
-</UL
-
-<p>
-Versions of Mesa prior to 6.4 are summarized in the
-<a href="versions.html">versions file</a> and the following release notes.
-</p>
-
-<UL>
-<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A>
-<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A>
-<LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A>
-<LI><A HREF="RELNOTES-6.2">RELNOTES-6.2</A>
-<LI><A HREF="RELNOTES-6.1">RELNOTES-6.1</A>
-<LI><A HREF="RELNOTES-6.0">RELNOTES-6.0</A>
-<LI><A HREF="RELNOTES-5.1">RELNOTES-5.1</A>
-<LI><A HREF="RELNOTES-5.0.2">RELNOTES-5.0.2</A>
-<LI><A HREF="RELNOTES-5.0.1">RELNOTES-5.0.1</A>
-<LI><A HREF="RELNOTES-5.0">RELNOTES-5.0</A>
-<LI><A HREF="RELNOTES-4.1">RELNOTES-4.1</A>
-<LI><A HREF="RELNOTES-4.0.3">RELNOTES-4.0.3</A>
-<LI><A HREF="RELNOTES-4.0.2">RELNOTES-4.0.2</A>
-<LI><A HREF="RELNOTES-4.0.1">RELNOTES-4.0.1</A>
-<LI><A HREF="RELNOTES-4.0">RELNOTES-4.0</A>
-<LI><A HREF="RELNOTES-3.5">RELNOTES-3.5</A>
-<LI><A HREF="RELNOTES-3.4.2">RELNOTES-3.4.2</A>
-<LI><A HREF="RELNOTES-3.4.1">RELNOTES-3.4.1</A>
-<LI><A HREF="RELNOTES-3.4">RELNOTES-3.4</A>
-<LI><A HREF="RELNOTES-3.3">RELNOTES-3.3</A>
-<LI><A HREF="RELNOTES-3.2.1">RELNOTES-3.2.1</A>
-<LI><A HREF="RELNOTES-3.2">RELNOTES-3.2</A>
-<LI><A HREF="RELNOTES-3.1">RELNOTES-3.1</A>
-</UL>
-
-
-</BODY>
-</HTML>
+<HTML> + +<TITLE>Mesa Release Notes</TITLE> + +<link rel="stylesheet" type="text/css" href="mesa.css"></head> + +<BODY> + +<H1>Release Notes</H1> + +<p> +The release notes summarize what's new or changed in each Mesa release. +</p> + +<UL> +<LI><A HREF="relnotes-7.11.html">7.11 release notes</A> +<LI><A HREF="relnotes-7.10.1.html">7.10.1 release notes</A> +<LI><A HREF="relnotes-7.10.html">7.10 release notes</A> +<LI><A HREF="relnotes-7.9.2.html">7.9.2 release notes</A> +<LI><A HREF="relnotes-7.9.1.html">7.9.1 release notes</A> +<LI><A HREF="relnotes-7.9.html">7.9 release notes</A> +<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A> +<LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A> +<LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A> +<LI><A HREF="relnotes-7.8.html">7.8 release notes</A> +<LI><A HREF="relnotes-7.7.1.html">7.7.1 release notes</A> +<LI><A HREF="relnotes-7.7.html">7.7 release notes</A> +<LI><A HREF="relnotes-7.6.1.html">7.6.1 release notes</A> +<LI><A HREF="relnotes-7.6.html">7.6 release notes</A> +<LI><A HREF="relnotes-7.5.2.html">7.5.2 release notes</A> +<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A> +<LI><A HREF="relnotes-7.5.html">7.5 release notes</A> +<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A> +<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A> +<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A> +<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A> +<LI><A HREF="relnotes-7.4.html">7.4 release notes</A> +<LI><A HREF="relnotes-7.3.html">7.3 release notes</A> +<LI><A HREF="relnotes-7.2.html">7.2 release notes</A> +<LI><A HREF="relnotes-7.1.html">7.1 release notes</A> +<LI><A HREF="relnotes-7.0.4.html">7.0.4 release notes</A> +<LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A> +<LI><A HREF="relnotes-7.0.2.html">7.0.2 release notes</A> +<LI><A HREF="relnotes-7.0.1.html">7.0.1 release notes</A> +<LI><A HREF="relnotes-7.0.html">7.0 release notes</A> +<LI><A HREF="relnotes-6.5.3.html">6.5.3 release notes</A> +<LI><A HREF="relnotes-6.5.2.html">6.5.2 release notes</A> +<LI><A HREF="relnotes-6.5.1.html">6.5.1 release notes</A> +<LI><A HREF="relnotes-6.5.html">6.5 release notes</A> +<LI><A HREF="relnotes-6.4.2.html">6.4.2 release notes</A> +<LI><A HREF="relnotes-6.4.1.html">6.4.1 release notes</A> +<LI><A HREF="relnotes-6.4.html">6.4 release notes</A> +</UL + +<p> +Versions of Mesa prior to 6.4 are summarized in the +<a href="versions.html">versions file</a> and the following release notes. +</p> + +<UL> +<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A> +<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A> +<LI><A HREF="RELNOTES-6.2.1">RELNOTES-6.2.1</A> +<LI><A HREF="RELNOTES-6.2">RELNOTES-6.2</A> +<LI><A HREF="RELNOTES-6.1">RELNOTES-6.1</A> +<LI><A HREF="RELNOTES-6.0">RELNOTES-6.0</A> +<LI><A HREF="RELNOTES-5.1">RELNOTES-5.1</A> +<LI><A HREF="RELNOTES-5.0.2">RELNOTES-5.0.2</A> +<LI><A HREF="RELNOTES-5.0.1">RELNOTES-5.0.1</A> +<LI><A HREF="RELNOTES-5.0">RELNOTES-5.0</A> +<LI><A HREF="RELNOTES-4.1">RELNOTES-4.1</A> +<LI><A HREF="RELNOTES-4.0.3">RELNOTES-4.0.3</A> +<LI><A HREF="RELNOTES-4.0.2">RELNOTES-4.0.2</A> +<LI><A HREF="RELNOTES-4.0.1">RELNOTES-4.0.1</A> +<LI><A HREF="RELNOTES-4.0">RELNOTES-4.0</A> +<LI><A HREF="RELNOTES-3.5">RELNOTES-3.5</A> +<LI><A HREF="RELNOTES-3.4.2">RELNOTES-3.4.2</A> +<LI><A HREF="RELNOTES-3.4.1">RELNOTES-3.4.1</A> +<LI><A HREF="RELNOTES-3.4">RELNOTES-3.4</A> +<LI><A HREF="RELNOTES-3.3">RELNOTES-3.3</A> +<LI><A HREF="RELNOTES-3.2.1">RELNOTES-3.2.1</A> +<LI><A HREF="RELNOTES-3.2">RELNOTES-3.2</A> +<LI><A HREF="RELNOTES-3.1">RELNOTES-3.1</A> +</UL> + + +</BODY> +</HTML> diff --git a/mesalib/scons/custom.py b/mesalib/scons/custom.py index 457a02011..7c59fe985 100644 --- a/mesalib/scons/custom.py +++ b/mesalib/scons/custom.py @@ -1,169 +1,171 @@ -"""custom
-
-Custom builders and methods.
-
-"""
-
-#
-# Copyright 2008 Tungsten Graphics, 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 TUNGSTEN GRAPHICS 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.
-#
-
-
-import os
-import os.path
-import re
-
-import SCons.Action
-import SCons.Builder
-import SCons.Scanner
-
-import fixes
-
-
-def quietCommandLines(env):
- # Quiet command lines
- # See also http://www.scons.org/wiki/HidingCommandLinesInOutput
- env['ASCOMSTR'] = " Assembling $SOURCE ..."
- env['ASPPCOMSTR'] = " Assembling $SOURCE ..."
- env['CCCOMSTR'] = " Compiling $SOURCE ..."
- env['SHCCCOMSTR'] = " Compiling $SOURCE ..."
- env['CXXCOMSTR'] = " Compiling $SOURCE ..."
- env['SHCXXCOMSTR'] = " Compiling $SOURCE ..."
- env['ARCOMSTR'] = " Archiving $TARGET ..."
- env['RANLIBCOMSTR'] = " Indexing $TARGET ..."
- env['LINKCOMSTR'] = " Linking $TARGET ..."
- env['SHLINKCOMSTR'] = " Linking $TARGET ..."
- env['LDMODULECOMSTR'] = " Linking $TARGET ..."
- env['SWIGCOMSTR'] = " Generating $TARGET ..."
- env['CODEGENCOMSTR'] = " Generating $TARGET ..."
-
-
-def createConvenienceLibBuilder(env):
- """This is a utility function that creates the ConvenienceLibrary
- Builder in an Environment if it is not there already.
-
- If it is already there, we return the existing one.
-
- Based on the stock StaticLibrary and SharedLibrary builders.
- """
-
- try:
- convenience_lib = env['BUILDERS']['ConvenienceLibrary']
- except KeyError:
- action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
- if env.Detect('ranlib'):
- ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
- action_list.append(ranlib_action)
-
- convenience_lib = SCons.Builder.Builder(action = action_list,
- emitter = '$LIBEMITTER',
- prefix = '$LIBPREFIX',
- suffix = '$LIBSUFFIX',
- src_suffix = '$SHOBJSUFFIX',
- src_builder = 'SharedObject')
- env['BUILDERS']['ConvenienceLibrary'] = convenience_lib
-
- return convenience_lib
-
-
-# TODO: handle import statements with multiple modules
-# TODO: handle from import statements
-import_re = re.compile(r'^import\s+(\S+)$', re.M)
-
-def python_scan(node, env, path):
- # http://www.scons.org/doc/0.98.5/HTML/scons-user/c2781.html#AEN2789
- contents = node.get_contents()
- source_dir = node.get_dir()
- imports = import_re.findall(contents)
- results = []
- for imp in imports:
- for dir in path:
- file = os.path.join(str(dir), imp.replace('.', os.sep) + '.py')
- if os.path.exists(file):
- results.append(env.File(file))
- break
- file = os.path.join(str(dir), imp.replace('.', os.sep), '__init__.py')
- if os.path.exists(file):
- results.append(env.File(file))
- break
- return results
-
-python_scanner = SCons.Scanner.Scanner(function = python_scan, skeys = ['.py'])
-
-
-def code_generate(env, script, target, source, command):
- """Method to simplify code generation via python scripts.
-
- http://www.scons.org/wiki/UsingCodeGenerators
- http://www.scons.org/doc/0.98.5/HTML/scons-user/c2768.html
- """
-
- # We're generating code using Python scripts, so we have to be
- # careful with our scons elements. This entry represents
- # the generator file *in the source directory*.
- script_src = env.File(script).srcnode()
-
- # This command creates generated code *in the build directory*.
- command = command.replace('$SCRIPT', script_src.path)
- action = SCons.Action.Action(command, "$CODEGENCOMSTR")
- code = env.Command(target, source, action)
-
- # Explicitly mark that the generated code depends on the generator,
- # and on implicitly imported python modules
- path = (script_src.get_dir(),)
- deps = [script_src]
- deps += script_src.get_implicit_deps(env, python_scanner, path)
- env.Depends(code, deps)
-
- # Running the Python script causes .pyc files to be generated in the
- # source directory. When we clean up, they should go too. So add side
- # effects for .pyc files
- for dep in deps:
- pyc = env.File(str(dep) + 'c')
- env.SideEffect(pyc, code)
-
- return code
-
-
-def createCodeGenerateMethod(env):
- env.Append(SCANNERS = python_scanner)
- env.AddMethod(code_generate, 'CodeGenerate')
-
-
-def generate(env):
- """Common environment generation code"""
-
- if env.get('quiet', True):
- quietCommandLines(env)
-
- # Custom builders and methods
- createConvenienceLibBuilder(env)
- createCodeGenerateMethod(env)
-
- # for debugging
- #print env.Dump()
-
-
-def exists(env):
- return 1
+"""custom + +Custom builders and methods. + +""" + +# +# Copyright 2008 Tungsten Graphics, 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 TUNGSTEN GRAPHICS 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. +# + + +import os +import os.path +import re + +import SCons.Action +import SCons.Builder +import SCons.Scanner + +import fixes + + +def quietCommandLines(env): + # Quiet command lines + # See also http://www.scons.org/wiki/HidingCommandLinesInOutput + env['ASCOMSTR'] = " Assembling $SOURCE ..." + env['ASPPCOMSTR'] = " Assembling $SOURCE ..." + env['CCCOMSTR'] = " Compiling $SOURCE ..." + env['SHCCCOMSTR'] = " Compiling $SOURCE ..." + env['CXXCOMSTR'] = " Compiling $SOURCE ..." + env['SHCXXCOMSTR'] = " Compiling $SOURCE ..." + env['ARCOMSTR'] = " Archiving $TARGET ..." + env['RANLIBCOMSTR'] = " Indexing $TARGET ..." + env['LINKCOMSTR'] = " Linking $TARGET ..." + env['SHLINKCOMSTR'] = " Linking $TARGET ..." + env['LDMODULECOMSTR'] = " Linking $TARGET ..." + env['SWIGCOMSTR'] = " Generating $TARGET ..." + env['LEXCOMSTR'] = " Generating $TARGET ..." + env['YACCCOMSTR'] = " Generating $TARGET ..." + env['CODEGENCOMSTR'] = " Generating $TARGET ..." + + +def createConvenienceLibBuilder(env): + """This is a utility function that creates the ConvenienceLibrary + Builder in an Environment if it is not there already. + + If it is already there, we return the existing one. + + Based on the stock StaticLibrary and SharedLibrary builders. + """ + + try: + convenience_lib = env['BUILDERS']['ConvenienceLibrary'] + except KeyError: + action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ] + if env.Detect('ranlib'): + ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR") + action_list.append(ranlib_action) + + convenience_lib = SCons.Builder.Builder(action = action_list, + emitter = '$LIBEMITTER', + prefix = '$LIBPREFIX', + suffix = '$LIBSUFFIX', + src_suffix = '$SHOBJSUFFIX', + src_builder = 'SharedObject') + env['BUILDERS']['ConvenienceLibrary'] = convenience_lib + + return convenience_lib + + +# TODO: handle import statements with multiple modules +# TODO: handle from import statements +import_re = re.compile(r'^import\s+(\S+)$', re.M) + +def python_scan(node, env, path): + # http://www.scons.org/doc/0.98.5/HTML/scons-user/c2781.html#AEN2789 + contents = node.get_contents() + source_dir = node.get_dir() + imports = import_re.findall(contents) + results = [] + for imp in imports: + for dir in path: + file = os.path.join(str(dir), imp.replace('.', os.sep) + '.py') + if os.path.exists(file): + results.append(env.File(file)) + break + file = os.path.join(str(dir), imp.replace('.', os.sep), '__init__.py') + if os.path.exists(file): + results.append(env.File(file)) + break + return results + +python_scanner = SCons.Scanner.Scanner(function = python_scan, skeys = ['.py']) + + +def code_generate(env, script, target, source, command): + """Method to simplify code generation via python scripts. + + http://www.scons.org/wiki/UsingCodeGenerators + http://www.scons.org/doc/0.98.5/HTML/scons-user/c2768.html + """ + + # We're generating code using Python scripts, so we have to be + # careful with our scons elements. This entry represents + # the generator file *in the source directory*. + script_src = env.File(script).srcnode() + + # This command creates generated code *in the build directory*. + command = command.replace('$SCRIPT', script_src.path) + action = SCons.Action.Action(command, "$CODEGENCOMSTR") + code = env.Command(target, source, action) + + # Explicitly mark that the generated code depends on the generator, + # and on implicitly imported python modules + path = (script_src.get_dir(),) + deps = [script_src] + deps += script_src.get_implicit_deps(env, python_scanner, path) + env.Depends(code, deps) + + # Running the Python script causes .pyc files to be generated in the + # source directory. When we clean up, they should go too. So add side + # effects for .pyc files + for dep in deps: + pyc = env.File(str(dep) + 'c') + env.SideEffect(pyc, code) + + return code + + +def createCodeGenerateMethod(env): + env.Append(SCANNERS = python_scanner) + env.AddMethod(code_generate, 'CodeGenerate') + + +def generate(env): + """Common environment generation code""" + + if env.get('quiet', True): + quietCommandLines(env) + + # Custom builders and methods + createConvenienceLibBuilder(env) + createCodeGenerateMethod(env) + + # for debugging + #print env.Dump() + + +def exists(env): + return 1 diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py index 112f6c89d..34523d589 100644 --- a/mesalib/scons/gallium.py +++ b/mesalib/scons/gallium.py @@ -598,6 +598,8 @@ def generate(env): env.Append(LIBS = []) # Load tools + env.Tool('lex') + env.Tool('yacc') if env['llvm']: env.Tool('llvm') env.Tool('udis86') diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript index 10abab6f9..bb02a87c7 100644 --- a/mesalib/src/glsl/SConscript +++ b/mesalib/src/glsl/SConscript @@ -14,10 +14,16 @@ env.Prepend(CPPPATH = [ '#src/glsl/glcpp', ]) +# Make glcpp/glcpp-parse.h and glsl_parser.h reacheable from the include path +env.Append(CPPPATH = [Dir('.').abspath]) + env.Append(YACCFLAGS = '-d') -parser_env = env.Clone(); -parser_env.Append(YACCFLAGS = ['--defines=src/glsl/glsl_parser.h', '-p', '_mesa_glsl_']) +parser_env = env.Clone() +parser_env.Append(YACCFLAGS = [ + '--defines=%s' % File('glsl_parser.h').abspath, + '-p', '_mesa_glsl_', +]) glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l') glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y') @@ -107,6 +113,10 @@ else: '#src/mesa/program/symbol_table.c'], ) + # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll + # depends on glsl_parser.h + env.Depends(builtin_compiler, glsl_parser) + builtin_glsl_function = env.CodeGenerate( target = 'builtin_function.cpp', script = 'builtins/tools/generate_builtins.py', @@ -129,6 +139,10 @@ glsl = env.ConvenienceLibrary( source = sources, ) +# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on +# glsl_parser.h +env.Depends(glsl, glsl_parser) + Export('glsl') # FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am deleted file mode 100644 index 8a3e9b007..000000000 --- a/mesalib/src/glsl/glcpp/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright © 2010 Intel Corporation
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# on the rights to use, copy, modify, merge, publish, distribute, sub
-# license, and/or sell copies of the Software, and to permit persons to whom
-# the Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-# USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-noinst_LTLIBRARIES = libglcpp.la
-libglcpp_la_SOURCES = \
- glcpp-lex.l \
- glcpp-parse.y \
- glcpp.h \
- pp.c
-
-BUILT_SOURCES = glcpp-parse.h glcpp-parse.c glcpp-lex.c
-CLEANFILES = $(BUILT_SOURCES)
-
-glcpp-parse.h: glcpp-parse.c
-
-bin_PROGRAMS = glcpp
-glcpp_LDADD = libglcpp.la
-glcpp_LDFLAGS = @LDFLAGS@ $(talloc_LIBS)
-glcpp_SOURCES = glcpp.c
-
-.l.c:
- $(LEXCOMPILE) --outfile="$@" $<
-
-test: glcpp
- @(cd tests; ./glcpp-test)
diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l index 11b73aea8..68e44eb79 100644 --- a/mesalib/src/glsl/glcpp/glcpp-lex.l +++ b/mesalib/src/glsl/glcpp/glcpp-lex.l @@ -57,7 +57,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); %option stack %option never-interactive -%x DONE COMMENT UNREACHABLE +%x DONE COMMENT UNREACHABLE SKIP SPACE [[:space:]] NONSPACE [^[:space:]] @@ -74,6 +74,17 @@ OCTAL_INTEGER 0[0-7]*[uU]? HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? %% + /* Implicitly switch between SKIP and INITIAL (non-skipping); + * don't switch if some other state was explicitly set. + */ + glcpp_parser_t *parser = yyextra; + if (YY_START == 0 || YY_START == SKIP) { + if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { + BEGIN 0; + } else { + BEGIN SKIP; + } + } /* Single-line comments */ "//"[^\n]* { @@ -137,60 +148,44 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? yylineno = strtol(ptr, &ptr, 0) - 1; } -{HASH}ifdef/.*\n { +<SKIP,INITIAL>{ +{HASH}ifdef { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFDEF; } -{HASH}ifndef/.*\n { +{HASH}ifndef { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFNDEF; } -{HASH}if/[^_a-zA-Z0-9].*\n { +{HASH}if/[^_a-zA-Z0-9] { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IF; } -{HASH}elif/.*\n { +{HASH}elif { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_ELIF; } -{HASH}else/.*\n { +{HASH}else { yyextra->space_tokens = 0; return HASH_ELSE; } -{HASH}endif/.*\n { +{HASH}endif { yyextra->space_tokens = 0; return HASH_ENDIF; } - - /* When skipping (due to an #if 0 or similar) consume anything - * up to a newline. We do this with less priority than any - * #if-related directive (#if, #elif, #else, #endif), but with - * more priority than any other directive or token to avoid - * any side-effects from skipped content. - * - * We use the lexing_if flag to avoid skipping any part of an - * if conditional expression. */ -[^\n]+/\n { - /* Since this rule always matches, YY_USER_ACTION gets called for it, - * wrongly incrementing yycolumn. We undo that effect here. */ - yycolumn -= yyleng; - if (yyextra->lexing_if || - yyextra->skip_stack == NULL || - yyextra->skip_stack->type == SKIP_NO_SKIP) - { - REJECT; - } } +<SKIP>[^\n] ; + {HASH}error.* { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -293,7 +288,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } } -\n { +<SKIP,INITIAL>\n { yyextra->lexing_if = 0; yylineno++; yycolumn = 0; diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index acbf86ebd..7e8bb2486 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -218,6 +218,10 @@ env.Append(YACCFLAGS = '-d') program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l') program_parse = env.CFile('program/program_parse.tab.c', 'program/program_parse.y') + +# Make program/program_parse.tab.h reacheable from the include path +env.Append(CPPPATH = [Dir('.').abspath]) + program_sources = [ 'program/arbprogparse.c', 'program/hash_table.c', diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index a94231455..5d581c840 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -487,6 +487,7 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; prog->MaxUniformComponents = 4 * MAX_UNIFORMS; + prog->MaxAddressOffset = MAX_PROGRAM_LOCAL_PARAMS; switch (type) { case GL_VERTEX_PROGRAM_ARB: diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 227b214a5..8916441f4 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -799,7 +799,7 @@ update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) /* This is a user-created framebuffer. * Completeness only matters for user-created framebuffers. */ - if (fb->_Status == 0) { + if (fb->_Status != GL_FRAMEBUFFER_COMPLETE) { _mesa_test_framebuffer_completeness(ctx, fb); } } diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index fcb06d49e..db3eba20c 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2573,6 +2573,7 @@ struct gl_program_constants GLuint MaxAttribs; GLuint MaxTemps; GLuint MaxAddressRegs; + GLuint MaxAddressOffset; /**< [-MaxAddressOffset, MaxAddressOffset-1] */ GLuint MaxParameters; GLuint MaxLocalParams; GLuint MaxEnvParams; diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index 0a88e0d70..669d71029 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -1,454 +1,454 @@ -/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file prog_instruction.h
- *
- * Vertex/fragment program instruction datatypes and constants.
- *
- * \author Brian Paul
- * \author Keith Whitwell
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-
-#ifndef PROG_INSTRUCTION_H
-#define PROG_INSTRUCTION_H
-
-
-#include "main/glheader.h"
-
-
-/**
- * Swizzle indexes.
- * Do not change!
- */
-/*@{*/
-#define SWIZZLE_X 0
-#define SWIZZLE_Y 1
-#define SWIZZLE_Z 2
-#define SWIZZLE_W 3
-#define SWIZZLE_ZERO 4 /**< For SWZ instruction only */
-#define SWIZZLE_ONE 5 /**< For SWZ instruction only */
-#define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */
-/*@}*/
-
-#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9))
-#define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3)
-#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7)
-#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1)
-
-#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W)
-#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)
-#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)
-#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z)
-#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)
-
-
-/**
- * Writemask values, 1 bit per component.
- */
-/*@{*/
-#define WRITEMASK_X 0x1
-#define WRITEMASK_Y 0x2
-#define WRITEMASK_XY 0x3
-#define WRITEMASK_Z 0x4
-#define WRITEMASK_XZ 0x5
-#define WRITEMASK_YZ 0x6
-#define WRITEMASK_XYZ 0x7
-#define WRITEMASK_W 0x8
-#define WRITEMASK_XW 0x9
-#define WRITEMASK_YW 0xa
-#define WRITEMASK_XYW 0xb
-#define WRITEMASK_ZW 0xc
-#define WRITEMASK_XZW 0xd
-#define WRITEMASK_YZW 0xe
-#define WRITEMASK_XYZW 0xf
-/*@}*/
-
-
-/**
- * Condition codes
- */
-/*@{*/
-#define COND_GT 1 /**< greater than zero */
-#define COND_EQ 2 /**< equal to zero */
-#define COND_LT 3 /**< less than zero */
-#define COND_UN 4 /**< unordered (NaN) */
-#define COND_GE 5 /**< greater than or equal to zero */
-#define COND_LE 6 /**< less than or equal to zero */
-#define COND_NE 7 /**< not equal to zero */
-#define COND_TR 8 /**< always true */
-#define COND_FL 9 /**< always false */
-/*@}*/
-
-
-/**
- * Instruction precision for GL_NV_fragment_program
- */
-/*@{*/
-#define FLOAT32 0x1
-#define FLOAT16 0x2
-#define FIXED12 0x4
-/*@}*/
-
-
-/**
- * Saturation modes when storing values.
- */
-/*@{*/
-#define SATURATE_OFF 0
-#define SATURATE_ZERO_ONE 1
-/*@}*/
-
-
-/**
- * Per-component negation masks
- */
-/*@{*/
-#define NEGATE_X 0x1
-#define NEGATE_Y 0x2
-#define NEGATE_Z 0x4
-#define NEGATE_W 0x8
-#define NEGATE_XYZ 0x7
-#define NEGATE_XYZW 0xf
-#define NEGATE_NONE 0x0
-/*@}*/
-
-
-/**
- * Program instruction opcodes for vertex, fragment and geometry programs.
- */
-typedef enum prog_opcode {
- /* ARB_vp ARB_fp NV_vp NV_fp GLSL */
- /*------------------------------------------*/
- OPCODE_NOP = 0, /* X */
- OPCODE_ABS, /* X X 1.1 X */
- OPCODE_ADD, /* X X X X X */
- OPCODE_AND, /* */
- OPCODE_ARA, /* 2 */
- OPCODE_ARL, /* X X X */
- OPCODE_ARL_NV, /* 2 */
- OPCODE_ARR, /* 2 */
- OPCODE_BGNLOOP, /* opt */
- OPCODE_BGNSUB, /* opt */
- OPCODE_BRA, /* 2 X */
- OPCODE_BRK, /* 2 opt */
- OPCODE_CAL, /* 2 2 X */
- OPCODE_CMP, /* X X */
- OPCODE_CONT, /* opt */
- OPCODE_COS, /* X 2 X X */
- OPCODE_DDX, /* X X */
- OPCODE_DDY, /* X X */
- OPCODE_DP2, /* 2 X */
- OPCODE_DP2A, /* 2 */
- OPCODE_DP3, /* X X X X X */
- OPCODE_DP4, /* X X X X X */
- OPCODE_DPH, /* X X 1.1 */
- OPCODE_DST, /* X X X X */
- OPCODE_ELSE, /* X */
- OPCODE_EMIT_VERTEX,/* X */
- OPCODE_END, /* X X X X opt */
- OPCODE_END_PRIMITIVE,/* X */
- OPCODE_ENDIF, /* opt */
- OPCODE_ENDLOOP, /* opt */
- OPCODE_ENDSUB, /* opt */
- OPCODE_EX2, /* X X 2 X X */
- OPCODE_EXP, /* X X X */
- OPCODE_FLR, /* X X 2 X X */
- OPCODE_FRC, /* X X 2 X X */
- OPCODE_IF, /* opt */
- OPCODE_KIL, /* X */
- OPCODE_KIL_NV, /* X X */
- OPCODE_LG2, /* X X 2 X X */
- OPCODE_LIT, /* X X X X */
- OPCODE_LOG, /* X X X */
- OPCODE_LRP, /* X X X */
- OPCODE_MAD, /* X X X X X */
- OPCODE_MAX, /* X X X X X */
- OPCODE_MIN, /* X X X X X */
- OPCODE_MOV, /* X X X X X */
- OPCODE_MUL, /* X X X X X */
- OPCODE_NOISE1, /* X */
- OPCODE_NOISE2, /* X */
- OPCODE_NOISE3, /* X */
- OPCODE_NOISE4, /* X */
- OPCODE_NOT, /* */
- OPCODE_NRM3, /* X */
- OPCODE_NRM4, /* X */
- OPCODE_OR, /* */
- OPCODE_PK2H, /* X */
- OPCODE_PK2US, /* X */
- OPCODE_PK4B, /* X */
- OPCODE_PK4UB, /* X */
- OPCODE_POW, /* X X X X */
- OPCODE_POPA, /* 3 */
- OPCODE_PRINT, /* X X */
- OPCODE_PUSHA, /* 3 */
- OPCODE_RCC, /* 1.1 */
- OPCODE_RCP, /* X X X X X */
- OPCODE_RET, /* 2 2 X */
- OPCODE_RFL, /* X X */
- OPCODE_RSQ, /* X X X X X */
- OPCODE_SCS, /* X */
- OPCODE_SEQ, /* 2 X X */
- OPCODE_SFL, /* 2 X */
- OPCODE_SGE, /* X X X X X */
- OPCODE_SGT, /* 2 X X */
- OPCODE_SIN, /* X 2 X X */
- OPCODE_SLE, /* 2 X X */
- OPCODE_SLT, /* X X X X X */
- OPCODE_SNE, /* 2 X X */
- OPCODE_SSG, /* 2 */
- OPCODE_STR, /* 2 X */
- OPCODE_SUB, /* X X 1.1 X X */
- OPCODE_SWZ, /* X X */
- OPCODE_TEX, /* X 3 X X */
- OPCODE_TXB, /* X 3 X */
- OPCODE_TXD, /* X X */
- OPCODE_TXL, /* 3 2 X */
- OPCODE_TXP, /* X X */
- OPCODE_TXP_NV, /* 3 X */
- OPCODE_TRUNC, /* X */
- OPCODE_UP2H, /* X */
- OPCODE_UP2US, /* X */
- OPCODE_UP4B, /* X */
- OPCODE_UP4UB, /* X */
- OPCODE_X2D, /* X */
- OPCODE_XOR, /* */
- OPCODE_XPD, /* X X X */
- MAX_OPCODE
-} gl_inst_opcode;
-
-
-/**
- * Number of bits for the src/dst register Index field.
- * This limits the size of temp/uniform register files.
- */
-#define INST_INDEX_BITS 11
-
-
-/**
- * Instruction source register.
- */
-struct prog_src_register
-{
- GLuint File:4; /**< One of the PROGRAM_* register file values. */
- GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit.
- * May be negative for relative addressing.
- */
- GLuint Swizzle:12;
- GLuint RelAddr:1;
-
- /** Take the component-wise absolute value */
- GLuint Abs:1;
-
- /**
- * Post-Abs negation.
- * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ
- * instruction which allows per-component negation.
- */
- GLuint Negate:4;
-
- /**
- * Is the register two-dimensional.
- * Two dimensional registers are of the
- * REGISTER[index][index2] format.
- * They are used by the geometry shaders where
- * the first index is the index within an array
- * and the second index is the semantic of the
- * array, e.g. gl_PositionIn[index] would become
- * INPUT[index][gl_PositionIn]
- */
- GLuint HasIndex2:1;
- GLuint RelAddr2:1;
- GLint Index2:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit.
- * May be negative for relative
- * addressing. */
-};
-
-
-/**
- * Instruction destination register.
- */
-struct prog_dst_register
-{
- GLuint File:4; /**< One of the PROGRAM_* register file values */
- GLuint Index:INST_INDEX_BITS; /**< Unsigned, never negative */
- GLuint WriteMask:4;
- GLuint RelAddr:1;
-
- /**
- * \name Conditional destination update control.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- /*@{*/
- /**
- * Takes one of the 9 possible condition values (EQ, FL, GT, GE, LE, LT,
- * NE, TR, or UN). Dest reg is only written to if the matching
- * (swizzled) condition code value passes. When a conditional update mask
- * is not specified, this will be \c COND_TR.
- */
- GLuint CondMask:4;
-
- /**
- * Condition code swizzle value.
- */
- GLuint CondSwizzle:12;
-
- /**
- * Selects the condition code register to use for conditional destination
- * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only
- * condition code register 0 is available. In NV_vertex_program3 mode,
- * condition code registers 0 and 1 are available.
- */
- GLuint CondSrc:1;
- /*@}*/
-};
-
-
-/**
- * Vertex/fragment program instruction.
- */
-struct prog_instruction
-{
- gl_inst_opcode Opcode;
- struct prog_src_register SrcReg[3];
- struct prog_dst_register DstReg;
-
- /**
- * Indicates that the instruction should update the condition code
- * register.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- GLuint CondUpdate:1;
-
- /**
- * If prog_instruction::CondUpdate is \c GL_TRUE, this value selects the
- * condition code register that is to be updated.
- *
- * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition
- * code register 0 is available. In GL_NV_vertex_program3 mode, condition
- * code registers 0 and 1 are available.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- GLuint CondDst:1;
-
- /**
- * Saturate each value of the vectored result to the range [0,1] or the
- * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is
- * only available in NV_fragment_program2 mode.
- * Value is one of the SATURATE_* tokens.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3.
- */
- GLuint SaturateMode:2;
-
- /**
- * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option.
- */
- GLuint Precision:3;
-
- /**
- * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions.
- */
- /*@{*/
- /** Source texture unit. */
- GLuint TexSrcUnit:5;
-
- /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
- GLuint TexSrcTarget:3;
-
- /** True if tex instruction should do shadow comparison */
- GLuint TexShadow:1;
- /*@}*/
-
- /**
- * For BRA and CAL instructions, the location to jump to.
- * For BGNLOOP, points to ENDLOOP (and vice-versa).
- * For BRK, points to ENDLOOP
- * For IF, points to ELSE or ENDIF.
- * For ELSE, points to ENDIF.
- */
- GLint BranchTarget;
-
- /** for debugging purposes */
- const char *Comment;
-
- /** Arbitrary data. Used for OPCODE_PRINT and some drivers */
- void *Data;
-
- /** for driver use (try to remove someday) */
- GLint Aux;
-};
-
-
-extern void
-_mesa_init_instructions(struct prog_instruction *inst, GLuint count);
-
-extern struct prog_instruction *
-_mesa_alloc_instructions(GLuint numInst);
-
-extern struct prog_instruction *
-_mesa_realloc_instructions(struct prog_instruction *oldInst,
- GLuint numOldInst, GLuint numNewInst);
-
-extern struct prog_instruction *
-_mesa_copy_instructions(struct prog_instruction *dest,
- const struct prog_instruction *src, GLuint n);
-
-extern void
-_mesa_free_instructions(struct prog_instruction *inst, GLuint count);
-
-extern GLuint
-_mesa_num_inst_src_regs(gl_inst_opcode opcode);
-
-extern GLuint
-_mesa_num_inst_dst_regs(gl_inst_opcode opcode);
-
-extern GLboolean
-_mesa_is_tex_instruction(gl_inst_opcode opcode);
-
-extern GLboolean
-_mesa_check_soa_dependencies(const struct prog_instruction *inst);
-
-extern const char *
-_mesa_opcode_string(gl_inst_opcode opcode);
-
-
-#endif /* PROG_INSTRUCTION_H */
+/* + * Mesa 3-D graphics library + * Version: 7.3 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file prog_instruction.h + * + * Vertex/fragment program instruction datatypes and constants. + * + * \author Brian Paul + * \author Keith Whitwell + * \author Ian Romanick <idr@us.ibm.com> + */ + + +#ifndef PROG_INSTRUCTION_H +#define PROG_INSTRUCTION_H + + +#include "main/glheader.h" + + +/** + * Swizzle indexes. + * Do not change! + */ +/*@{*/ +#define SWIZZLE_X 0 +#define SWIZZLE_Y 1 +#define SWIZZLE_Z 2 +#define SWIZZLE_W 3 +#define SWIZZLE_ZERO 4 /**< For SWZ instruction only */ +#define SWIZZLE_ONE 5 /**< For SWZ instruction only */ +#define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */ +/*@}*/ + +#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) +#define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3) +#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) +#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) + +#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W) +#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X) +#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y) +#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z) +#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) + + +/** + * Writemask values, 1 bit per component. + */ +/*@{*/ +#define WRITEMASK_X 0x1 +#define WRITEMASK_Y 0x2 +#define WRITEMASK_XY 0x3 +#define WRITEMASK_Z 0x4 +#define WRITEMASK_XZ 0x5 +#define WRITEMASK_YZ 0x6 +#define WRITEMASK_XYZ 0x7 +#define WRITEMASK_W 0x8 +#define WRITEMASK_XW 0x9 +#define WRITEMASK_YW 0xa +#define WRITEMASK_XYW 0xb +#define WRITEMASK_ZW 0xc +#define WRITEMASK_XZW 0xd +#define WRITEMASK_YZW 0xe +#define WRITEMASK_XYZW 0xf +/*@}*/ + + +/** + * Condition codes + */ +/*@{*/ +#define COND_GT 1 /**< greater than zero */ +#define COND_EQ 2 /**< equal to zero */ +#define COND_LT 3 /**< less than zero */ +#define COND_UN 4 /**< unordered (NaN) */ +#define COND_GE 5 /**< greater than or equal to zero */ +#define COND_LE 6 /**< less than or equal to zero */ +#define COND_NE 7 /**< not equal to zero */ +#define COND_TR 8 /**< always true */ +#define COND_FL 9 /**< always false */ +/*@}*/ + + +/** + * Instruction precision for GL_NV_fragment_program + */ +/*@{*/ +#define FLOAT32 0x1 +#define FLOAT16 0x2 +#define FIXED12 0x4 +/*@}*/ + + +/** + * Saturation modes when storing values. + */ +/*@{*/ +#define SATURATE_OFF 0 +#define SATURATE_ZERO_ONE 1 +/*@}*/ + + +/** + * Per-component negation masks + */ +/*@{*/ +#define NEGATE_X 0x1 +#define NEGATE_Y 0x2 +#define NEGATE_Z 0x4 +#define NEGATE_W 0x8 +#define NEGATE_XYZ 0x7 +#define NEGATE_XYZW 0xf +#define NEGATE_NONE 0x0 +/*@}*/ + + +/** + * Program instruction opcodes for vertex, fragment and geometry programs. + */ +typedef enum prog_opcode { + /* ARB_vp ARB_fp NV_vp NV_fp GLSL */ + /*------------------------------------------*/ + OPCODE_NOP = 0, /* X */ + OPCODE_ABS, /* X X 1.1 X */ + OPCODE_ADD, /* X X X X X */ + OPCODE_AND, /* */ + OPCODE_ARA, /* 2 */ + OPCODE_ARL, /* X X X */ + OPCODE_ARL_NV, /* 2 */ + OPCODE_ARR, /* 2 */ + OPCODE_BGNLOOP, /* opt */ + OPCODE_BGNSUB, /* opt */ + OPCODE_BRA, /* 2 X */ + OPCODE_BRK, /* 2 opt */ + OPCODE_CAL, /* 2 2 X */ + OPCODE_CMP, /* X X */ + OPCODE_CONT, /* opt */ + OPCODE_COS, /* X 2 X X */ + OPCODE_DDX, /* X X */ + OPCODE_DDY, /* X X */ + OPCODE_DP2, /* 2 X */ + OPCODE_DP2A, /* 2 */ + OPCODE_DP3, /* X X X X X */ + OPCODE_DP4, /* X X X X X */ + OPCODE_DPH, /* X X 1.1 */ + OPCODE_DST, /* X X X X */ + OPCODE_ELSE, /* X */ + OPCODE_EMIT_VERTEX,/* X */ + OPCODE_END, /* X X X X opt */ + OPCODE_END_PRIMITIVE,/* X */ + OPCODE_ENDIF, /* opt */ + OPCODE_ENDLOOP, /* opt */ + OPCODE_ENDSUB, /* opt */ + OPCODE_EX2, /* X X 2 X X */ + OPCODE_EXP, /* X X X */ + OPCODE_FLR, /* X X 2 X X */ + OPCODE_FRC, /* X X 2 X X */ + OPCODE_IF, /* opt */ + OPCODE_KIL, /* X */ + OPCODE_KIL_NV, /* X X */ + OPCODE_LG2, /* X X 2 X X */ + OPCODE_LIT, /* X X X X */ + OPCODE_LOG, /* X X X */ + OPCODE_LRP, /* X X X */ + OPCODE_MAD, /* X X X X X */ + OPCODE_MAX, /* X X X X X */ + OPCODE_MIN, /* X X X X X */ + OPCODE_MOV, /* X X X X X */ + OPCODE_MUL, /* X X X X X */ + OPCODE_NOISE1, /* X */ + OPCODE_NOISE2, /* X */ + OPCODE_NOISE3, /* X */ + OPCODE_NOISE4, /* X */ + OPCODE_NOT, /* */ + OPCODE_NRM3, /* X */ + OPCODE_NRM4, /* X */ + OPCODE_OR, /* */ + OPCODE_PK2H, /* X */ + OPCODE_PK2US, /* X */ + OPCODE_PK4B, /* X */ + OPCODE_PK4UB, /* X */ + OPCODE_POW, /* X X X X */ + OPCODE_POPA, /* 3 */ + OPCODE_PRINT, /* X X */ + OPCODE_PUSHA, /* 3 */ + OPCODE_RCC, /* 1.1 */ + OPCODE_RCP, /* X X X X X */ + OPCODE_RET, /* 2 2 X */ + OPCODE_RFL, /* X X */ + OPCODE_RSQ, /* X X X X X */ + OPCODE_SCS, /* X */ + OPCODE_SEQ, /* 2 X X */ + OPCODE_SFL, /* 2 X */ + OPCODE_SGE, /* X X X X X */ + OPCODE_SGT, /* 2 X X */ + OPCODE_SIN, /* X 2 X X */ + OPCODE_SLE, /* 2 X X */ + OPCODE_SLT, /* X X X X X */ + OPCODE_SNE, /* 2 X X */ + OPCODE_SSG, /* 2 */ + OPCODE_STR, /* 2 X */ + OPCODE_SUB, /* X X 1.1 X X */ + OPCODE_SWZ, /* X X */ + OPCODE_TEX, /* X 3 X X */ + OPCODE_TXB, /* X 3 X */ + OPCODE_TXD, /* X X */ + OPCODE_TXL, /* 3 2 X */ + OPCODE_TXP, /* X X */ + OPCODE_TXP_NV, /* 3 X */ + OPCODE_TRUNC, /* X */ + OPCODE_UP2H, /* X */ + OPCODE_UP2US, /* X */ + OPCODE_UP4B, /* X */ + OPCODE_UP4UB, /* X */ + OPCODE_X2D, /* X */ + OPCODE_XOR, /* */ + OPCODE_XPD, /* X X X */ + MAX_OPCODE +} gl_inst_opcode; + + +/** + * Number of bits for the src/dst register Index field. + * This limits the size of temp/uniform register files. + */ +#define INST_INDEX_BITS 12 + + +/** + * Instruction source register. + */ +struct prog_src_register +{ + GLuint File:4; /**< One of the PROGRAM_* register file values. */ + GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + * May be negative for relative addressing. + */ + GLuint Swizzle:12; + GLuint RelAddr:1; + + /** Take the component-wise absolute value */ + GLuint Abs:1; + + /** + * Post-Abs negation. + * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ + * instruction which allows per-component negation. + */ + GLuint Negate:4; + + /** + * Is the register two-dimensional. + * Two dimensional registers are of the + * REGISTER[index][index2] format. + * They are used by the geometry shaders where + * the first index is the index within an array + * and the second index is the semantic of the + * array, e.g. gl_PositionIn[index] would become + * INPUT[index][gl_PositionIn] + */ + GLuint HasIndex2:1; + GLuint RelAddr2:1; + GLint Index2:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + * May be negative for relative + * addressing. */ +}; + + +/** + * Instruction destination register. + */ +struct prog_dst_register +{ + GLuint File:4; /**< One of the PROGRAM_* register file values */ + GLuint Index:INST_INDEX_BITS; /**< Unsigned, never negative */ + GLuint WriteMask:4; + GLuint RelAddr:1; + + /** + * \name Conditional destination update control. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + /*@{*/ + /** + * Takes one of the 9 possible condition values (EQ, FL, GT, GE, LE, LT, + * NE, TR, or UN). Dest reg is only written to if the matching + * (swizzled) condition code value passes. When a conditional update mask + * is not specified, this will be \c COND_TR. + */ + GLuint CondMask:4; + + /** + * Condition code swizzle value. + */ + GLuint CondSwizzle:12; + + /** + * Selects the condition code register to use for conditional destination + * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only + * condition code register 0 is available. In NV_vertex_program3 mode, + * condition code registers 0 and 1 are available. + */ + GLuint CondSrc:1; + /*@}*/ +}; + + +/** + * Vertex/fragment program instruction. + */ +struct prog_instruction +{ + gl_inst_opcode Opcode; + struct prog_src_register SrcReg[3]; + struct prog_dst_register DstReg; + + /** + * Indicates that the instruction should update the condition code + * register. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + GLuint CondUpdate:1; + + /** + * If prog_instruction::CondUpdate is \c GL_TRUE, this value selects the + * condition code register that is to be updated. + * + * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition + * code register 0 is available. In GL_NV_vertex_program3 mode, condition + * code registers 0 and 1 are available. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + GLuint CondDst:1; + + /** + * Saturate each value of the vectored result to the range [0,1] or the + * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is + * only available in NV_fragment_program2 mode. + * Value is one of the SATURATE_* tokens. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3. + */ + GLuint SaturateMode:2; + + /** + * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12. + * + * \since + * NV_fragment_program, NV_fragment_program_option. + */ + GLuint Precision:3; + + /** + * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. + */ + /*@{*/ + /** Source texture unit. */ + GLuint TexSrcUnit:5; + + /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */ + GLuint TexSrcTarget:3; + + /** True if tex instruction should do shadow comparison */ + GLuint TexShadow:1; + /*@}*/ + + /** + * For BRA and CAL instructions, the location to jump to. + * For BGNLOOP, points to ENDLOOP (and vice-versa). + * For BRK, points to ENDLOOP + * For IF, points to ELSE or ENDIF. + * For ELSE, points to ENDIF. + */ + GLint BranchTarget; + + /** for debugging purposes */ + const char *Comment; + + /** Arbitrary data. Used for OPCODE_PRINT and some drivers */ + void *Data; + + /** for driver use (try to remove someday) */ + GLint Aux; +}; + + +extern void +_mesa_init_instructions(struct prog_instruction *inst, GLuint count); + +extern struct prog_instruction * +_mesa_alloc_instructions(GLuint numInst); + +extern struct prog_instruction * +_mesa_realloc_instructions(struct prog_instruction *oldInst, + GLuint numOldInst, GLuint numNewInst); + +extern struct prog_instruction * +_mesa_copy_instructions(struct prog_instruction *dest, + const struct prog_instruction *src, GLuint n); + +extern void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count); + +extern GLuint +_mesa_num_inst_src_regs(gl_inst_opcode opcode); + +extern GLuint +_mesa_num_inst_dst_regs(gl_inst_opcode opcode); + +extern GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode); + +extern GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst); + +extern const char * +_mesa_opcode_string(gl_inst_opcode opcode); + + +#endif /* PROG_INSTRUCTION_H */ diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 8bd26d0d7..cfdd0da86 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -1,1074 +1,1077 @@ -/*
- * Mesa 3-D graphics library
- * Version: 6.5.3
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file program.c
- * Vertex and fragment program support functions.
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/hash.h"
-#include "main/mfeatures.h"
-#include "program.h"
-#include "prog_cache.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-
-
-/**
- * A pointer to this dummy program is put into the hash table when
- * glGenPrograms is called.
- */
-struct gl_program _mesa_DummyProgram;
-
-
-/**
- * Init context's vertex/fragment program state
- */
-void
-_mesa_init_program(struct gl_context *ctx)
-{
- GLuint i;
-
- /*
- * If this assertion fails, we need to increase the field
- * size for register indexes (see INST_INDEX_BITS).
- */
- ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4
- <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4
- <= (1 << INST_INDEX_BITS));
-
- ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
-
- ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
- ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
-
- /* If this fails, increase prog_instruction::TexSrcUnit size */
- ASSERT(MAX_TEXTURE_UNITS < (1 << 5));
-
- /* If this fails, increase prog_instruction::TexSrcTarget size */
- ASSERT(NUM_TEXTURE_TARGETS < (1 << 3));
-
- ctx->Program.ErrorPos = -1;
- ctx->Program.ErrorString = _mesa_strdup("");
-
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- ctx->VertexProgram.Enabled = GL_FALSE;
-#if FEATURE_es2_glsl
- ctx->VertexProgram.PointSizeEnabled =
- (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
-#else
- ctx->VertexProgram.PointSizeEnabled = GL_FALSE;
-#endif
- ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- ctx->Shared->DefaultVertexProgram);
- assert(ctx->VertexProgram.Current);
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
- ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
- }
- ctx->VertexProgram.Cache = _mesa_new_program_cache();
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- ctx->FragmentProgram.Enabled = GL_FALSE;
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- ctx->Shared->DefaultFragmentProgram);
- assert(ctx->FragmentProgram.Current);
- ctx->FragmentProgram.Cache = _mesa_new_program_cache();
-#endif
-
-#if FEATURE_ARB_geometry_shader4
- ctx->GeometryProgram.Enabled = GL_FALSE;
- /* right now by default we don't have a geometry program */
- _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
- NULL);
- ctx->GeometryProgram.Cache = _mesa_new_program_cache();
-#endif
-
- /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
- ctx->ATIFragmentShader.Enabled = GL_FALSE;
- ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader;
- assert(ctx->ATIFragmentShader.Current);
- ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Free a context's vertex/fragment program state
- */
-void
-_mesa_free_program_data(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
- _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
-#endif
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
- _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache);
-#endif
-#if FEATURE_ARB_geometry_shader4
- _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL);
- _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache);
-#endif
- /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
- if (ctx->ATIFragmentShader.Current) {
- ctx->ATIFragmentShader.Current->RefCount--;
- if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
- free(ctx->ATIFragmentShader.Current);
- }
- }
-#endif
- free((void *) ctx->Program.ErrorString);
-}
-
-
-/**
- * Update the default program objects in the given context to reference those
- * specified in the shared state and release those referencing the old
- * shared state.
- */
-void
-_mesa_update_default_objects_program(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- (struct gl_vertex_program *)
- ctx->Shared->DefaultVertexProgram);
- assert(ctx->VertexProgram.Current);
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- (struct gl_fragment_program *)
- ctx->Shared->DefaultFragmentProgram);
- assert(ctx->FragmentProgram.Current);
-#endif
-
-#if FEATURE_ARB_geometry_shader4
- _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
- (struct gl_geometry_program *)
- ctx->Shared->DefaultGeometryProgram);
-#endif
-
- /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
- if (ctx->ATIFragmentShader.Current) {
- ctx->ATIFragmentShader.Current->RefCount--;
- if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
- free(ctx->ATIFragmentShader.Current);
- }
- }
- ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
- assert(ctx->ATIFragmentShader.Current);
- ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Set the vertex/fragment program error state (position and error string).
- * This is generally called from within the parsers.
- */
-void
-_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
-{
- ctx->Program.ErrorPos = pos;
- free((void *) ctx->Program.ErrorString);
- if (!string)
- string = "";
- ctx->Program.ErrorString = _mesa_strdup(string);
-}
-
-
-/**
- * Find the line number and column for 'pos' within 'string'.
- * Return a copy of the line which contains 'pos'. Free the line with
- * free().
- * \param string the program string
- * \param pos the position within the string
- * \param line returns the line number corresponding to 'pos'.
- * \param col returns the column number corresponding to 'pos'.
- * \return copy of the line containing 'pos'.
- */
-const GLubyte *
-_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
- GLint *line, GLint *col)
-{
- const GLubyte *lineStart = string;
- const GLubyte *p = string;
- GLubyte *s;
- int len;
-
- *line = 1;
-
- while (p != pos) {
- if (*p == (GLubyte) '\n') {
- (*line)++;
- lineStart = p + 1;
- }
- p++;
- }
-
- *col = (pos - lineStart) + 1;
-
- /* return copy of this line */
- while (*p != 0 && *p != '\n')
- p++;
- len = p - lineStart;
- s = (GLubyte *) malloc(len + 1);
- memcpy(s, lineStart, len);
- s[len] = 0;
-
- return s;
-}
-
-
-/**
- * Initialize a new vertex/fragment program object.
- */
-static struct gl_program *
-_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
- GLenum target, GLuint id)
-{
- (void) ctx;
- if (prog) {
- GLuint i;
- memset(prog, 0, sizeof(*prog));
- prog->Id = id;
- prog->Target = target;
- prog->Resident = GL_TRUE;
- prog->RefCount = 1;
- prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
-
- /* default mapping from samplers to texture units */
- for (i = 0; i < MAX_SAMPLERS; i++)
- prog->SamplerUnits[i] = i;
- }
-
- return prog;
-}
-
-
-/**
- * Initialize a new fragment program object.
- */
-struct gl_program *
-_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
- GLenum target, GLuint id)
-{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
-}
-
-
-/**
- * Initialize a new vertex program object.
- */
-struct gl_program *
-_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
- GLenum target, GLuint id)
-{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
-}
-
-
-/**
- * Initialize a new geometry program object.
- */
-struct gl_program *
-_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
- GLenum target, GLuint id)
-{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
-}
-
-
-/**
- * Allocate and initialize a new fragment/vertex program object but
- * don't put it into the program hash table. Called via
- * ctx->Driver.NewProgram. May be overridden (ie. replaced) by a
- * device driver function to implement OO deriviation with additional
- * types not understood by this function.
- *
- * \param ctx context
- * \param id program id/number
- * \param target program target/type
- * \return pointer to new program object
- */
-struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
-{
- struct gl_program *prog;
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
- case GL_VERTEX_STATE_PROGRAM_NV:
- prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
- target, id );
- break;
- case GL_FRAGMENT_PROGRAM_NV:
- case GL_FRAGMENT_PROGRAM_ARB:
- prog =_mesa_init_fragment_program(ctx,
- CALLOC_STRUCT(gl_fragment_program),
- target, id );
- break;
- case MESA_GEOMETRY_PROGRAM:
- prog = _mesa_init_geometry_program(ctx,
- CALLOC_STRUCT(gl_geometry_program),
- target, id);
- break;
- default:
- _mesa_problem(ctx, "bad target in _mesa_new_program");
- prog = NULL;
- }
- return prog;
-}
-
-
-/**
- * Delete a program and remove it from the hash table, ignoring the
- * reference count.
- * Called via ctx->Driver.DeleteProgram. May be wrapped (OO deriviation)
- * by a device driver function.
- */
-void
-_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
-{
- (void) ctx;
- ASSERT(prog);
- ASSERT(prog->RefCount==0);
-
- if (prog == &_mesa_DummyProgram)
- return;
-
- if (prog->String)
- free(prog->String);
-
- _mesa_free_instructions(prog->Instructions, prog->NumInstructions);
-
- if (prog->Parameters) {
- _mesa_free_parameter_list(prog->Parameters);
- }
- if (prog->Varying) {
- _mesa_free_parameter_list(prog->Varying);
- }
- if (prog->Attributes) {
- _mesa_free_parameter_list(prog->Attributes);
- }
-
- free(prog);
-}
-
-
-/**
- * Return the gl_program object for a given ID.
- * Basically just a wrapper for _mesa_HashLookup() to avoid a lot of
- * casts elsewhere.
- */
-struct gl_program *
-_mesa_lookup_program(struct gl_context *ctx, GLuint id)
-{
- if (id)
- return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
- else
- return NULL;
-}
-
-
-/**
- * Reference counting for vertex/fragment programs
- */
-void
-_mesa_reference_program(struct gl_context *ctx,
- struct gl_program **ptr,
- struct gl_program *prog)
-{
- assert(ptr);
- if (*ptr && prog) {
- /* sanity check */
- if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB)
- ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB);
- else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB)
- ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
- prog->Target == GL_FRAGMENT_PROGRAM_NV);
- else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
- ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
- }
- if (*ptr == prog) {
- return; /* no change */
- }
- if (*ptr) {
- GLboolean deleteFlag;
-
- /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/
-#if 0
- printf("Program %p ID=%u Target=%s Refcount-- to %d\n",
- *ptr, (*ptr)->Id,
- ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
- ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
- (*ptr)->RefCount - 1);
-#endif
- ASSERT((*ptr)->RefCount > 0);
- (*ptr)->RefCount--;
-
- deleteFlag = ((*ptr)->RefCount == 0);
- /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/
-
- if (deleteFlag) {
- ASSERT(ctx);
- ctx->Driver.DeleteProgram(ctx, *ptr);
- }
-
- *ptr = NULL;
- }
-
- assert(!*ptr);
- if (prog) {
- /*_glthread_LOCK_MUTEX(prog->Mutex);*/
- prog->RefCount++;
-#if 0
- printf("Program %p ID=%u Target=%s Refcount++ to %d\n",
- prog, prog->Id,
- (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
- (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
- prog->RefCount);
-#endif
- /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
- }
-
- *ptr = prog;
-}
-
-
-/**
- * Return a copy of a program.
- * XXX Problem here if the program object is actually OO-derivation
- * made by a device driver.
- */
-struct gl_program *
-_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
-{
- struct gl_program *clone;
-
- clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id);
- if (!clone)
- return NULL;
-
- assert(clone->Target == prog->Target);
- assert(clone->RefCount == 1);
-
- clone->String = (GLubyte *) _mesa_strdup((char *) prog->String);
- clone->Format = prog->Format;
- clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
- if (!clone->Instructions) {
- _mesa_reference_program(ctx, &clone, NULL);
- return NULL;
- }
- _mesa_copy_instructions(clone->Instructions, prog->Instructions,
- prog->NumInstructions);
- clone->InputsRead = prog->InputsRead;
- clone->OutputsWritten = prog->OutputsWritten;
- clone->SamplersUsed = prog->SamplersUsed;
- clone->ShadowSamplers = prog->ShadowSamplers;
- memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
-
- if (prog->Parameters)
- clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
- memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
- if (prog->Varying)
- clone->Varying = _mesa_clone_parameter_list(prog->Varying);
- if (prog->Attributes)
- clone->Attributes = _mesa_clone_parameter_list(prog->Attributes);
- memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
- clone->IndirectRegisterFiles = prog->IndirectRegisterFiles;
- clone->NumInstructions = prog->NumInstructions;
- clone->NumTemporaries = prog->NumTemporaries;
- clone->NumParameters = prog->NumParameters;
- clone->NumAttributes = prog->NumAttributes;
- clone->NumAddressRegs = prog->NumAddressRegs;
- clone->NumNativeInstructions = prog->NumNativeInstructions;
- clone->NumNativeTemporaries = prog->NumNativeTemporaries;
- clone->NumNativeParameters = prog->NumNativeParameters;
- clone->NumNativeAttributes = prog->NumNativeAttributes;
- clone->NumNativeAddressRegs = prog->NumNativeAddressRegs;
- clone->NumAluInstructions = prog->NumAluInstructions;
- clone->NumTexInstructions = prog->NumTexInstructions;
- clone->NumTexIndirections = prog->NumTexIndirections;
- clone->NumNativeAluInstructions = prog->NumNativeAluInstructions;
- clone->NumNativeTexInstructions = prog->NumNativeTexInstructions;
- clone->NumNativeTexIndirections = prog->NumNativeTexIndirections;
-
- switch (prog->Target) {
- case GL_VERTEX_PROGRAM_ARB:
- {
- const struct gl_vertex_program *vp
- = (const struct gl_vertex_program *) prog;
- struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone;
- vpc->IsPositionInvariant = vp->IsPositionInvariant;
- vpc->IsNVProgram = vp->IsNVProgram;
- }
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
- {
- const struct gl_fragment_program *fp
- = (const struct gl_fragment_program *) prog;
- struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
- fpc->FogOption = fp->FogOption;
- fpc->UsesKill = fp->UsesKill;
- fpc->OriginUpperLeft = fp->OriginUpperLeft;
- fpc->PixelCenterInteger = fp->PixelCenterInteger;
- }
- break;
- case MESA_GEOMETRY_PROGRAM:
- {
- const struct gl_geometry_program *gp
- = (const struct gl_geometry_program *) prog;
- struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone;
- gpc->VerticesOut = gp->VerticesOut;
- gpc->InputType = gp->InputType;
- gpc->OutputType = gp->OutputType;
- }
- break;
- default:
- _mesa_problem(NULL, "Unexpected target in _mesa_clone_program");
- }
-
- return clone;
-}
-
-
-/**
- * Insert 'count' NOP instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
- const GLuint origLen = prog->NumInstructions;
- const GLuint newLen = origLen + count;
- struct prog_instruction *newInst;
- GLuint i;
-
- /* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->BranchTarget > 0) {
- if ((GLuint)inst->BranchTarget >= start) {
- inst->BranchTarget += count;
- }
- }
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- return GL_FALSE;
- }
-
- /* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
-
- /* init the new instructions */
- _mesa_init_instructions(newInst + start, count);
-
- /* Copy the remaining/tail instructions to new inst buffer */
- _mesa_copy_instructions(newInst + start + count,
- prog->Instructions + start,
- origLen - start);
-
- /* free old instructions */
- _mesa_free_instructions(prog->Instructions, origLen);
-
- /* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
-
- return GL_TRUE;
-}
-
-/**
- * Delete 'count' instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
- const GLuint origLen = prog->NumInstructions;
- const GLuint newLen = origLen - count;
- struct prog_instruction *newInst;
- GLuint i;
-
- /* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->BranchTarget > 0) {
- if (inst->BranchTarget > (GLint) start) {
- inst->BranchTarget -= count;
- }
- }
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- return GL_FALSE;
- }
-
- /* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
-
- /* Copy the remaining/tail instructions to new inst buffer */
- _mesa_copy_instructions(newInst + start,
- prog->Instructions + start + count,
- newLen - start);
-
- /* free old instructions */
- _mesa_free_instructions(prog->Instructions, origLen);
-
- /* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
-
- return GL_TRUE;
-}
-
-
-/**
- * Search instructions for registers that match (oldFile, oldIndex),
- * replacing them with (newFile, newIndex).
- */
-static void
-replace_registers(struct prog_instruction *inst, GLuint numInst,
- GLuint oldFile, GLuint oldIndex,
- GLuint newFile, GLuint newIndex)
-{
- GLuint i, j;
- for (i = 0; i < numInst; i++) {
- /* src regs */
- for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
- if (inst[i].SrcReg[j].File == oldFile &&
- inst[i].SrcReg[j].Index == oldIndex) {
- inst[i].SrcReg[j].File = newFile;
- inst[i].SrcReg[j].Index = newIndex;
- }
- }
- /* dst reg */
- if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) {
- inst[i].DstReg.File = newFile;
- inst[i].DstReg.Index = newIndex;
- }
- }
-}
-
-
-/**
- * Search instructions for references to program parameters. When found,
- * increment the parameter index by 'offset'.
- * Used when combining programs.
- */
-static void
-adjust_param_indexes(struct prog_instruction *inst, GLuint numInst,
- GLuint offset)
-{
- GLuint i, j;
- for (i = 0; i < numInst; i++) {
- for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
- GLuint f = inst[i].SrcReg[j].File;
- if (f == PROGRAM_CONSTANT ||
- f == PROGRAM_UNIFORM ||
- f == PROGRAM_STATE_VAR) {
- inst[i].SrcReg[j].Index += offset;
- }
- }
- }
-}
-
-
-/**
- * Combine two programs into one. Fix instructions so the outputs of
- * the first program go to the inputs of the second program.
- */
-struct gl_program *
-_mesa_combine_programs(struct gl_context *ctx,
- const struct gl_program *progA,
- const struct gl_program *progB)
-{
- struct prog_instruction *newInst;
- struct gl_program *newProg;
- const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */
- const GLuint lenB = progB->NumInstructions;
- const GLuint numParamsA = _mesa_num_parameters(progA->Parameters);
- const GLuint newLength = lenA + lenB;
- GLboolean usedTemps[MAX_PROGRAM_TEMPS];
- GLuint firstTemp = 0;
- GLbitfield inputsB;
- GLuint i;
-
- ASSERT(progA->Target == progB->Target);
-
- newInst = _mesa_alloc_instructions(newLength);
- if (!newInst)
- return GL_FALSE;
-
- _mesa_copy_instructions(newInst, progA->Instructions, lenA);
- _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB);
-
- /* adjust branch / instruction addresses for B's instructions */
- for (i = 0; i < lenB; i++) {
- newInst[lenA + i].BranchTarget += lenA;
- }
-
- newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0);
- newProg->Instructions = newInst;
- newProg->NumInstructions = newLength;
-
- /* find used temp regs (we may need new temps below) */
- _mesa_find_used_registers(newProg, PROGRAM_TEMPORARY,
- usedTemps, MAX_PROGRAM_TEMPS);
-
- if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fprogA, *fprogB, *newFprog;
- GLbitfield progB_inputsRead = progB->InputsRead;
- GLint progB_colorFile, progB_colorIndex;
-
- fprogA = (struct gl_fragment_program *) progA;
- fprogB = (struct gl_fragment_program *) progB;
- newFprog = (struct gl_fragment_program *) newProg;
-
- newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
-
- /* We'll do a search and replace for instances
- * of progB_colorFile/progB_colorIndex below...
- */
- progB_colorFile = PROGRAM_INPUT;
- progB_colorIndex = FRAG_ATTRIB_COL0;
-
- /*
- * The fragment program may get color from a state var rather than
- * a fragment input (vertex output) if it's constant.
- * See the texenvprogram.c code.
- * So, search the program's parameter list now to see if the program
- * gets color from a state var instead of a conventional fragment
- * input register.
- */
- for (i = 0; i < progB->Parameters->NumParameters; i++) {
- struct gl_program_parameter *p = &progB->Parameters->Parameters[i];
- if (p->Type == PROGRAM_STATE_VAR &&
- p->StateIndexes[0] == STATE_INTERNAL &&
- p->StateIndexes[1] == STATE_CURRENT_ATTRIB &&
- (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) {
- progB_inputsRead |= FRAG_BIT_COL0;
- progB_colorFile = PROGRAM_STATE_VAR;
- progB_colorIndex = i;
- break;
- }
- }
-
- /* Connect color outputs of fprogA to color inputs of fprogB, via a
- * new temporary register.
- */
- if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
- (progB_inputsRead & FRAG_BIT_COL0)) {
- GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS,
- firstTemp);
- if (tempReg < 0) {
- _mesa_problem(ctx, "No free temp regs found in "
- "_mesa_combine_programs(), using 31");
- tempReg = 31;
- }
- firstTemp = tempReg + 1;
-
- /* replace writes to result.color[0] with tempReg */
- replace_registers(newInst, lenA,
- PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
- PROGRAM_TEMPORARY, tempReg);
- /* replace reads from the input color with tempReg */
- replace_registers(newInst + lenA, lenB,
- progB_colorFile, progB_colorIndex, /* search for */
- PROGRAM_TEMPORARY, tempReg /* replace with */ );
- }
-
- /* compute combined program's InputsRead */
- inputsB = progB_inputsRead;
- if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
- inputsB &= ~(1 << FRAG_ATTRIB_COL0);
- }
- newProg->InputsRead = progA->InputsRead | inputsB;
- newProg->OutputsWritten = progB->OutputsWritten;
- newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed;
- }
- else {
- /* vertex program */
- assert(0); /* XXX todo */
- }
-
- /*
- * Merge parameters (uniforms, constants, etc)
- */
- newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters,
- progB->Parameters);
-
- adjust_param_indexes(newInst + lenA, lenB, numParamsA);
-
-
- return newProg;
-}
-
-
-/**
- * Populate the 'used' array with flags indicating which registers (TEMPs,
- * INPUTs, OUTPUTs, etc, are used by the given program.
- * \param file type of register to scan for
- * \param used returns true/false flags for in use / free
- * \param usedSize size of the 'used' array
- */
-void
-_mesa_find_used_registers(const struct gl_program *prog,
- gl_register_file file,
- GLboolean used[], GLuint usedSize)
-{
- GLuint i, j;
-
- memset(used, 0, usedSize);
-
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
- const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
- if (inst->DstReg.File == file) {
- ASSERT(inst->DstReg.Index < usedSize);
- if(inst->DstReg.Index < usedSize)
- used[inst->DstReg.Index] = GL_TRUE;
- }
-
- for (j = 0; j < n; j++) {
- if (inst->SrcReg[j].File == file) {
- ASSERT(inst->SrcReg[j].Index < usedSize);
- if(inst->SrcReg[j].Index < usedSize)
- used[inst->SrcReg[j].Index] = GL_TRUE;
- }
- }
- }
-}
-
-
-/**
- * Scan the given 'used' register flag array for the first entry
- * that's >= firstReg.
- * \param used vector of flags indicating registers in use (as returned
- * by _mesa_find_used_registers())
- * \param usedSize size of the 'used' array
- * \param firstReg first register to start searching at
- * \return index of unused register, or -1 if none.
- */
-GLint
-_mesa_find_free_register(const GLboolean used[],
- GLuint usedSize, GLuint firstReg)
-{
- GLuint i;
-
- assert(firstReg < usedSize);
-
- for (i = firstReg; i < usedSize; i++)
- if (!used[i])
- return i;
-
- return -1;
-}
-
-
-
-/**
- * Check if the given register index is valid (doesn't exceed implementation-
- * dependent limits).
- * \return GL_TRUE if OK, GL_FALSE if bad index
- */
-GLboolean
-_mesa_valid_register_index(const struct gl_context *ctx,
- gl_shader_type shaderType,
- gl_register_file file, GLint index)
-{
- const struct gl_program_constants *c;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- c = &ctx->Const.VertexProgram;
- break;
- case MESA_SHADER_FRAGMENT:
- c = &ctx->Const.FragmentProgram;
- break;
- case MESA_SHADER_GEOMETRY:
- c = &ctx->Const.GeometryProgram;
- break;
- default:
- _mesa_problem(ctx,
- "unexpected shader type in _mesa_valid_register_index()");
- return GL_FALSE;
- }
-
- switch (file) {
- case PROGRAM_UNDEFINED:
- return GL_TRUE; /* XXX or maybe false? */
-
- case PROGRAM_TEMPORARY:
- return index >= 0 && index < c->MaxTemps;
-
- case PROGRAM_ENV_PARAM:
- return index >= 0 && index < c->MaxEnvParams;
-
- case PROGRAM_LOCAL_PARAM:
- return index >= 0 && index < c->MaxLocalParams;
-
- case PROGRAM_NAMED_PARAM:
- return index >= 0 && index < c->MaxParameters;
-
- case PROGRAM_UNIFORM:
- case PROGRAM_STATE_VAR:
- /* aka constant buffer */
- return index >= 0 && index < c->MaxUniformComponents / 4;
-
- case PROGRAM_CONSTANT:
- /* constant buffer w/ possible relative negative addressing */
- return (index > (int) c->MaxUniformComponents / -4 &&
- index < c->MaxUniformComponents / 4);
-
- case PROGRAM_INPUT:
- if (index < 0)
- return GL_FALSE;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs;
- case MESA_SHADER_FRAGMENT:
- return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying;
- case MESA_SHADER_GEOMETRY:
- return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying;
- default:
- return GL_FALSE;
- }
-
- case PROGRAM_OUTPUT:
- if (index < 0)
- return GL_FALSE;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
- case MESA_SHADER_FRAGMENT:
- return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
- case MESA_SHADER_GEOMETRY:
- return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying;
- default:
- return GL_FALSE;
- }
-
- case PROGRAM_ADDRESS:
- return index >= 0 && index < c->MaxAddressRegs;
-
- default:
- _mesa_problem(ctx,
- "unexpected register file in _mesa_valid_register_index()");
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * "Post-process" a GPU program. This is intended to be used for debugging.
- * Example actions include no-op'ing instructions or changing instruction
- * behaviour.
- */
-void
-_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
-{
- static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 };
- GLuint i;
- GLuint whiteSwizzle;
- GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters,
- white, 4, &whiteSwizzle);
-
- (void) whiteIndex;
-
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
- (void) n;
-
- if (_mesa_is_tex_instruction(inst->Opcode)) {
-#if 0
- /* replace TEX/TXP/TXB with MOV */
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-
-#if 0
- /* disable shadow texture mode */
- inst->TexShadow = 0;
-#endif
- }
-
- if (inst->Opcode == OPCODE_TXP) {
-#if 0
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_CONSTANT;
- inst->SrcReg[0].Index = whiteIndex;
- inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-#if 0
- inst->TexShadow = 0;
-#endif
-#if 0
- inst->Opcode = OPCODE_TEX;
- inst->TexShadow = 0;
-#endif
- }
-
- }
-}
+/* + * Mesa 3-D graphics library + * Version: 6.5.3 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file program.c + * Vertex and fragment program support functions. + * \author Brian Paul + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/hash.h" +#include "main/mfeatures.h" +#include "program.h" +#include "prog_cache.h" +#include "prog_parameter.h" +#include "prog_instruction.h" + + +/** + * A pointer to this dummy program is put into the hash table when + * glGenPrograms is called. + */ +struct gl_program _mesa_DummyProgram; + + +/** + * Init context's vertex/fragment program state + */ +void +_mesa_init_program(struct gl_context *ctx) +{ + GLuint i; + + /* + * If this assertion fails, we need to increase the field + * size for register indexes (see INST_INDEX_BITS). + */ + ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4 + <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4 + <= (1 << INST_INDEX_BITS)); + + ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); + + ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + + ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); + + /* If this fails, increase prog_instruction::TexSrcUnit size */ + ASSERT(MAX_TEXTURE_UNITS < (1 << 5)); + + /* If this fails, increase prog_instruction::TexSrcTarget size */ + ASSERT(NUM_TEXTURE_TARGETS < (1 << 3)); + + ctx->Program.ErrorPos = -1; + ctx->Program.ErrorString = _mesa_strdup(""); + +#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + ctx->VertexProgram.Enabled = GL_FALSE; +#if FEATURE_es2_glsl + ctx->VertexProgram.PointSizeEnabled = + (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE; +#else + ctx->VertexProgram.PointSizeEnabled = GL_FALSE; +#endif + ctx->VertexProgram.TwoSideEnabled = GL_FALSE; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + ctx->Shared->DefaultVertexProgram); + assert(ctx->VertexProgram.Current); + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { + ctx->VertexProgram.TrackMatrix[i] = GL_NONE; + ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; + } + ctx->VertexProgram.Cache = _mesa_new_program_cache(); +#endif + +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program + ctx->FragmentProgram.Enabled = GL_FALSE; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + ctx->Shared->DefaultFragmentProgram); + assert(ctx->FragmentProgram.Current); + ctx->FragmentProgram.Cache = _mesa_new_program_cache(); +#endif + +#if FEATURE_ARB_geometry_shader4 + ctx->GeometryProgram.Enabled = GL_FALSE; + /* right now by default we don't have a geometry program */ + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, + NULL); + ctx->GeometryProgram.Cache = _mesa_new_program_cache(); +#endif + + /* XXX probably move this stuff */ +#if FEATURE_ATI_fragment_shader + ctx->ATIFragmentShader.Enabled = GL_FALSE; + ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader; + assert(ctx->ATIFragmentShader.Current); + ctx->ATIFragmentShader.Current->RefCount++; +#endif +} + + +/** + * Free a context's vertex/fragment program state + */ +void +_mesa_free_program_data(struct gl_context *ctx) +{ +#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); + _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache); +#endif +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); + _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache); +#endif +#if FEATURE_ARB_geometry_shader4 + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL); + _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache); +#endif + /* XXX probably move this stuff */ +#if FEATURE_ATI_fragment_shader + if (ctx->ATIFragmentShader.Current) { + ctx->ATIFragmentShader.Current->RefCount--; + if (ctx->ATIFragmentShader.Current->RefCount <= 0) { + free(ctx->ATIFragmentShader.Current); + } + } +#endif + free((void *) ctx->Program.ErrorString); +} + + +/** + * Update the default program objects in the given context to reference those + * specified in the shared state and release those referencing the old + * shared state. + */ +void +_mesa_update_default_objects_program(struct gl_context *ctx) +{ +#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + (struct gl_vertex_program *) + ctx->Shared->DefaultVertexProgram); + assert(ctx->VertexProgram.Current); +#endif + +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + (struct gl_fragment_program *) + ctx->Shared->DefaultFragmentProgram); + assert(ctx->FragmentProgram.Current); +#endif + +#if FEATURE_ARB_geometry_shader4 + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, + (struct gl_geometry_program *) + ctx->Shared->DefaultGeometryProgram); +#endif + + /* XXX probably move this stuff */ +#if FEATURE_ATI_fragment_shader + if (ctx->ATIFragmentShader.Current) { + ctx->ATIFragmentShader.Current->RefCount--; + if (ctx->ATIFragmentShader.Current->RefCount <= 0) { + free(ctx->ATIFragmentShader.Current); + } + } + ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader; + assert(ctx->ATIFragmentShader.Current); + ctx->ATIFragmentShader.Current->RefCount++; +#endif +} + + +/** + * Set the vertex/fragment program error state (position and error string). + * This is generally called from within the parsers. + */ +void +_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string) +{ + ctx->Program.ErrorPos = pos; + free((void *) ctx->Program.ErrorString); + if (!string) + string = ""; + ctx->Program.ErrorString = _mesa_strdup(string); +} + + +/** + * Find the line number and column for 'pos' within 'string'. + * Return a copy of the line which contains 'pos'. Free the line with + * free(). + * \param string the program string + * \param pos the position within the string + * \param line returns the line number corresponding to 'pos'. + * \param col returns the column number corresponding to 'pos'. + * \return copy of the line containing 'pos'. + */ +const GLubyte * +_mesa_find_line_column(const GLubyte *string, const GLubyte *pos, + GLint *line, GLint *col) +{ + const GLubyte *lineStart = string; + const GLubyte *p = string; + GLubyte *s; + int len; + + *line = 1; + + while (p != pos) { + if (*p == (GLubyte) '\n') { + (*line)++; + lineStart = p + 1; + } + p++; + } + + *col = (pos - lineStart) + 1; + + /* return copy of this line */ + while (*p != 0 && *p != '\n') + p++; + len = p - lineStart; + s = (GLubyte *) malloc(len + 1); + memcpy(s, lineStart, len); + s[len] = 0; + + return s; +} + + +/** + * Initialize a new vertex/fragment program object. + */ +static struct gl_program * +_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog, + GLenum target, GLuint id) +{ + (void) ctx; + if (prog) { + GLuint i; + memset(prog, 0, sizeof(*prog)); + prog->Id = id; + prog->Target = target; + prog->Resident = GL_TRUE; + prog->RefCount = 1; + prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; + + /* default mapping from samplers to texture units */ + for (i = 0; i < MAX_SAMPLERS; i++) + prog->SamplerUnits[i] = i; + } + + return prog; +} + + +/** + * Initialize a new fragment program object. + */ +struct gl_program * +_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog, + GLenum target, GLuint id) +{ + if (prog) + return _mesa_init_program_struct( ctx, &prog->Base, target, id ); + else + return NULL; +} + + +/** + * Initialize a new vertex program object. + */ +struct gl_program * +_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog, + GLenum target, GLuint id) +{ + if (prog) + return _mesa_init_program_struct( ctx, &prog->Base, target, id ); + else + return NULL; +} + + +/** + * Initialize a new geometry program object. + */ +struct gl_program * +_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog, + GLenum target, GLuint id) +{ + if (prog) + return _mesa_init_program_struct( ctx, &prog->Base, target, id ); + else + return NULL; +} + + +/** + * Allocate and initialize a new fragment/vertex program object but + * don't put it into the program hash table. Called via + * ctx->Driver.NewProgram. May be overridden (ie. replaced) by a + * device driver function to implement OO deriviation with additional + * types not understood by this function. + * + * \param ctx context + * \param id program id/number + * \param target program target/type + * \return pointer to new program object + */ +struct gl_program * +_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id) +{ + struct gl_program *prog; + switch (target) { + case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ + case GL_VERTEX_STATE_PROGRAM_NV: + prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), + target, id ); + break; + case GL_FRAGMENT_PROGRAM_NV: + case GL_FRAGMENT_PROGRAM_ARB: + prog =_mesa_init_fragment_program(ctx, + CALLOC_STRUCT(gl_fragment_program), + target, id ); + break; + case MESA_GEOMETRY_PROGRAM: + prog = _mesa_init_geometry_program(ctx, + CALLOC_STRUCT(gl_geometry_program), + target, id); + break; + default: + _mesa_problem(ctx, "bad target in _mesa_new_program"); + prog = NULL; + } + return prog; +} + + +/** + * Delete a program and remove it from the hash table, ignoring the + * reference count. + * Called via ctx->Driver.DeleteProgram. May be wrapped (OO deriviation) + * by a device driver function. + */ +void +_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog) +{ + (void) ctx; + ASSERT(prog); + ASSERT(prog->RefCount==0); + + if (prog == &_mesa_DummyProgram) + return; + + if (prog->String) + free(prog->String); + + _mesa_free_instructions(prog->Instructions, prog->NumInstructions); + + if (prog->Parameters) { + _mesa_free_parameter_list(prog->Parameters); + } + if (prog->Varying) { + _mesa_free_parameter_list(prog->Varying); + } + if (prog->Attributes) { + _mesa_free_parameter_list(prog->Attributes); + } + + free(prog); +} + + +/** + * Return the gl_program object for a given ID. + * Basically just a wrapper for _mesa_HashLookup() to avoid a lot of + * casts elsewhere. + */ +struct gl_program * +_mesa_lookup_program(struct gl_context *ctx, GLuint id) +{ + if (id) + return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); + else + return NULL; +} + + +/** + * Reference counting for vertex/fragment programs + */ +void +_mesa_reference_program(struct gl_context *ctx, + struct gl_program **ptr, + struct gl_program *prog) +{ + assert(ptr); + if (*ptr && prog) { + /* sanity check */ + if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB) + ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB); + else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB) + ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB || + prog->Target == GL_FRAGMENT_PROGRAM_NV); + else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM) + ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM); + } + if (*ptr == prog) { + return; /* no change */ + } + if (*ptr) { + GLboolean deleteFlag; + + /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/ +#if 0 + printf("Program %p ID=%u Target=%s Refcount-- to %d\n", + *ptr, (*ptr)->Id, + ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : + ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")), + (*ptr)->RefCount - 1); +#endif + ASSERT((*ptr)->RefCount > 0); + (*ptr)->RefCount--; + + deleteFlag = ((*ptr)->RefCount == 0); + /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/ + + if (deleteFlag) { + ASSERT(ctx); + ctx->Driver.DeleteProgram(ctx, *ptr); + } + + *ptr = NULL; + } + + assert(!*ptr); + if (prog) { + /*_glthread_LOCK_MUTEX(prog->Mutex);*/ + prog->RefCount++; +#if 0 + printf("Program %p ID=%u Target=%s Refcount++ to %d\n", + prog, prog->Id, + (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : + (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")), + prog->RefCount); +#endif + /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/ + } + + *ptr = prog; +} + + +/** + * Return a copy of a program. + * XXX Problem here if the program object is actually OO-derivation + * made by a device driver. + */ +struct gl_program * +_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog) +{ + struct gl_program *clone; + + clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id); + if (!clone) + return NULL; + + assert(clone->Target == prog->Target); + assert(clone->RefCount == 1); + + clone->String = (GLubyte *) _mesa_strdup((char *) prog->String); + clone->Format = prog->Format; + clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); + if (!clone->Instructions) { + _mesa_reference_program(ctx, &clone, NULL); + return NULL; + } + _mesa_copy_instructions(clone->Instructions, prog->Instructions, + prog->NumInstructions); + clone->InputsRead = prog->InputsRead; + clone->OutputsWritten = prog->OutputsWritten; + clone->SamplersUsed = prog->SamplersUsed; + clone->ShadowSamplers = prog->ShadowSamplers; + memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed)); + + if (prog->Parameters) + clone->Parameters = _mesa_clone_parameter_list(prog->Parameters); + memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + if (prog->Varying) + clone->Varying = _mesa_clone_parameter_list(prog->Varying); + if (prog->Attributes) + clone->Attributes = _mesa_clone_parameter_list(prog->Attributes); + memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + clone->IndirectRegisterFiles = prog->IndirectRegisterFiles; + clone->NumInstructions = prog->NumInstructions; + clone->NumTemporaries = prog->NumTemporaries; + clone->NumParameters = prog->NumParameters; + clone->NumAttributes = prog->NumAttributes; + clone->NumAddressRegs = prog->NumAddressRegs; + clone->NumNativeInstructions = prog->NumNativeInstructions; + clone->NumNativeTemporaries = prog->NumNativeTemporaries; + clone->NumNativeParameters = prog->NumNativeParameters; + clone->NumNativeAttributes = prog->NumNativeAttributes; + clone->NumNativeAddressRegs = prog->NumNativeAddressRegs; + clone->NumAluInstructions = prog->NumAluInstructions; + clone->NumTexInstructions = prog->NumTexInstructions; + clone->NumTexIndirections = prog->NumTexIndirections; + clone->NumNativeAluInstructions = prog->NumNativeAluInstructions; + clone->NumNativeTexInstructions = prog->NumNativeTexInstructions; + clone->NumNativeTexIndirections = prog->NumNativeTexIndirections; + + switch (prog->Target) { + case GL_VERTEX_PROGRAM_ARB: + { + const struct gl_vertex_program *vp + = (const struct gl_vertex_program *) prog; + struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone; + vpc->IsPositionInvariant = vp->IsPositionInvariant; + vpc->IsNVProgram = vp->IsNVProgram; + } + break; + case GL_FRAGMENT_PROGRAM_ARB: + { + const struct gl_fragment_program *fp + = (const struct gl_fragment_program *) prog; + struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone; + fpc->FogOption = fp->FogOption; + fpc->UsesKill = fp->UsesKill; + fpc->OriginUpperLeft = fp->OriginUpperLeft; + fpc->PixelCenterInteger = fp->PixelCenterInteger; + } + break; + case MESA_GEOMETRY_PROGRAM: + { + const struct gl_geometry_program *gp + = (const struct gl_geometry_program *) prog; + struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone; + gpc->VerticesOut = gp->VerticesOut; + gpc->InputType = gp->InputType; + gpc->OutputType = gp->OutputType; + } + break; + default: + _mesa_problem(NULL, "Unexpected target in _mesa_clone_program"); + } + + return clone; +} + + +/** + * Insert 'count' NOP instructions at 'start' in the given program. + * Adjust branch targets accordingly. + */ +GLboolean +_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count) +{ + const GLuint origLen = prog->NumInstructions; + const GLuint newLen = origLen + count; + struct prog_instruction *newInst; + GLuint i; + + /* adjust branches */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->BranchTarget > 0) { + if ((GLuint)inst->BranchTarget >= start) { + inst->BranchTarget += count; + } + } + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + return GL_FALSE; + } + + /* Copy 'start' instructions into new instruction buffer */ + _mesa_copy_instructions(newInst, prog->Instructions, start); + + /* init the new instructions */ + _mesa_init_instructions(newInst + start, count); + + /* Copy the remaining/tail instructions to new inst buffer */ + _mesa_copy_instructions(newInst + start + count, + prog->Instructions + start, + origLen - start); + + /* free old instructions */ + _mesa_free_instructions(prog->Instructions, origLen); + + /* install new instructions */ + prog->Instructions = newInst; + prog->NumInstructions = newLen; + + return GL_TRUE; +} + +/** + * Delete 'count' instructions at 'start' in the given program. + * Adjust branch targets accordingly. + */ +GLboolean +_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count) +{ + const GLuint origLen = prog->NumInstructions; + const GLuint newLen = origLen - count; + struct prog_instruction *newInst; + GLuint i; + + /* adjust branches */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->BranchTarget > 0) { + if (inst->BranchTarget > (GLint) start) { + inst->BranchTarget -= count; + } + } + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + return GL_FALSE; + } + + /* Copy 'start' instructions into new instruction buffer */ + _mesa_copy_instructions(newInst, prog->Instructions, start); + + /* Copy the remaining/tail instructions to new inst buffer */ + _mesa_copy_instructions(newInst + start, + prog->Instructions + start + count, + newLen - start); + + /* free old instructions */ + _mesa_free_instructions(prog->Instructions, origLen); + + /* install new instructions */ + prog->Instructions = newInst; + prog->NumInstructions = newLen; + + return GL_TRUE; +} + + +/** + * Search instructions for registers that match (oldFile, oldIndex), + * replacing them with (newFile, newIndex). + */ +static void +replace_registers(struct prog_instruction *inst, GLuint numInst, + GLuint oldFile, GLuint oldIndex, + GLuint newFile, GLuint newIndex) +{ + GLuint i, j; + for (i = 0; i < numInst; i++) { + /* src regs */ + for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) { + if (inst[i].SrcReg[j].File == oldFile && + inst[i].SrcReg[j].Index == oldIndex) { + inst[i].SrcReg[j].File = newFile; + inst[i].SrcReg[j].Index = newIndex; + } + } + /* dst reg */ + if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) { + inst[i].DstReg.File = newFile; + inst[i].DstReg.Index = newIndex; + } + } +} + + +/** + * Search instructions for references to program parameters. When found, + * increment the parameter index by 'offset'. + * Used when combining programs. + */ +static void +adjust_param_indexes(struct prog_instruction *inst, GLuint numInst, + GLuint offset) +{ + GLuint i, j; + for (i = 0; i < numInst; i++) { + for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) { + GLuint f = inst[i].SrcReg[j].File; + if (f == PROGRAM_CONSTANT || + f == PROGRAM_UNIFORM || + f == PROGRAM_STATE_VAR) { + inst[i].SrcReg[j].Index += offset; + } + } + } +} + + +/** + * Combine two programs into one. Fix instructions so the outputs of + * the first program go to the inputs of the second program. + */ +struct gl_program * +_mesa_combine_programs(struct gl_context *ctx, + const struct gl_program *progA, + const struct gl_program *progB) +{ + struct prog_instruction *newInst; + struct gl_program *newProg; + const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */ + const GLuint lenB = progB->NumInstructions; + const GLuint numParamsA = _mesa_num_parameters(progA->Parameters); + const GLuint newLength = lenA + lenB; + GLboolean usedTemps[MAX_PROGRAM_TEMPS]; + GLuint firstTemp = 0; + GLbitfield inputsB; + GLuint i; + + ASSERT(progA->Target == progB->Target); + + newInst = _mesa_alloc_instructions(newLength); + if (!newInst) + return GL_FALSE; + + _mesa_copy_instructions(newInst, progA->Instructions, lenA); + _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB); + + /* adjust branch / instruction addresses for B's instructions */ + for (i = 0; i < lenB; i++) { + newInst[lenA + i].BranchTarget += lenA; + } + + newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0); + newProg->Instructions = newInst; + newProg->NumInstructions = newLength; + + /* find used temp regs (we may need new temps below) */ + _mesa_find_used_registers(newProg, PROGRAM_TEMPORARY, + usedTemps, MAX_PROGRAM_TEMPS); + + if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) { + struct gl_fragment_program *fprogA, *fprogB, *newFprog; + GLbitfield progB_inputsRead = progB->InputsRead; + GLint progB_colorFile, progB_colorIndex; + + fprogA = (struct gl_fragment_program *) progA; + fprogB = (struct gl_fragment_program *) progB; + newFprog = (struct gl_fragment_program *) newProg; + + newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill; + + /* We'll do a search and replace for instances + * of progB_colorFile/progB_colorIndex below... + */ + progB_colorFile = PROGRAM_INPUT; + progB_colorIndex = FRAG_ATTRIB_COL0; + + /* + * The fragment program may get color from a state var rather than + * a fragment input (vertex output) if it's constant. + * See the texenvprogram.c code. + * So, search the program's parameter list now to see if the program + * gets color from a state var instead of a conventional fragment + * input register. + */ + for (i = 0; i < progB->Parameters->NumParameters; i++) { + struct gl_program_parameter *p = &progB->Parameters->Parameters[i]; + if (p->Type == PROGRAM_STATE_VAR && + p->StateIndexes[0] == STATE_INTERNAL && + p->StateIndexes[1] == STATE_CURRENT_ATTRIB && + (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) { + progB_inputsRead |= FRAG_BIT_COL0; + progB_colorFile = PROGRAM_STATE_VAR; + progB_colorIndex = i; + break; + } + } + + /* Connect color outputs of fprogA to color inputs of fprogB, via a + * new temporary register. + */ + if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) && + (progB_inputsRead & FRAG_BIT_COL0)) { + GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS, + firstTemp); + if (tempReg < 0) { + _mesa_problem(ctx, "No free temp regs found in " + "_mesa_combine_programs(), using 31"); + tempReg = 31; + } + firstTemp = tempReg + 1; + + /* replace writes to result.color[0] with tempReg */ + replace_registers(newInst, lenA, + PROGRAM_OUTPUT, FRAG_RESULT_COLOR, + PROGRAM_TEMPORARY, tempReg); + /* replace reads from the input color with tempReg */ + replace_registers(newInst + lenA, lenB, + progB_colorFile, progB_colorIndex, /* search for */ + PROGRAM_TEMPORARY, tempReg /* replace with */ ); + } + + /* compute combined program's InputsRead */ + inputsB = progB_inputsRead; + if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) { + inputsB &= ~(1 << FRAG_ATTRIB_COL0); + } + newProg->InputsRead = progA->InputsRead | inputsB; + newProg->OutputsWritten = progB->OutputsWritten; + newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed; + } + else { + /* vertex program */ + assert(0); /* XXX todo */ + } + + /* + * Merge parameters (uniforms, constants, etc) + */ + newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters, + progB->Parameters); + + adjust_param_indexes(newInst + lenA, lenB, numParamsA); + + + return newProg; +} + + +/** + * Populate the 'used' array with flags indicating which registers (TEMPs, + * INPUTs, OUTPUTs, etc, are used by the given program. + * \param file type of register to scan for + * \param used returns true/false flags for in use / free + * \param usedSize size of the 'used' array + */ +void +_mesa_find_used_registers(const struct gl_program *prog, + gl_register_file file, + GLboolean used[], GLuint usedSize) +{ + GLuint i, j; + + memset(used, 0, usedSize); + + for (i = 0; i < prog->NumInstructions; i++) { + const struct prog_instruction *inst = prog->Instructions + i; + const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); + + if (inst->DstReg.File == file) { + ASSERT(inst->DstReg.Index < usedSize); + if(inst->DstReg.Index < usedSize) + used[inst->DstReg.Index] = GL_TRUE; + } + + for (j = 0; j < n; j++) { + if (inst->SrcReg[j].File == file) { + ASSERT(inst->SrcReg[j].Index < usedSize); + if(inst->SrcReg[j].Index < usedSize) + used[inst->SrcReg[j].Index] = GL_TRUE; + } + } + } +} + + +/** + * Scan the given 'used' register flag array for the first entry + * that's >= firstReg. + * \param used vector of flags indicating registers in use (as returned + * by _mesa_find_used_registers()) + * \param usedSize size of the 'used' array + * \param firstReg first register to start searching at + * \return index of unused register, or -1 if none. + */ +GLint +_mesa_find_free_register(const GLboolean used[], + GLuint usedSize, GLuint firstReg) +{ + GLuint i; + + assert(firstReg < usedSize); + + for (i = firstReg; i < usedSize; i++) + if (!used[i]) + return i; + + return -1; +} + + + +/** + * Check if the given register index is valid (doesn't exceed implementation- + * dependent limits). + * \return GL_TRUE if OK, GL_FALSE if bad index + */ +GLboolean +_mesa_valid_register_index(const struct gl_context *ctx, + gl_shader_type shaderType, + gl_register_file file, GLint index) +{ + const struct gl_program_constants *c; + + switch (shaderType) { + case MESA_SHADER_VERTEX: + c = &ctx->Const.VertexProgram; + break; + case MESA_SHADER_FRAGMENT: + c = &ctx->Const.FragmentProgram; + break; + case MESA_SHADER_GEOMETRY: + c = &ctx->Const.GeometryProgram; + break; + default: + _mesa_problem(ctx, + "unexpected shader type in _mesa_valid_register_index()"); + return GL_FALSE; + } + + switch (file) { + case PROGRAM_UNDEFINED: + return GL_TRUE; /* XXX or maybe false? */ + + case PROGRAM_TEMPORARY: + return index >= 0 && index < c->MaxTemps; + + case PROGRAM_ENV_PARAM: + return index >= 0 && index < c->MaxEnvParams; + + case PROGRAM_LOCAL_PARAM: + return index >= 0 && index < c->MaxLocalParams; + + case PROGRAM_NAMED_PARAM: + return index >= 0 && index < c->MaxParameters; + + case PROGRAM_UNIFORM: + case PROGRAM_STATE_VAR: + /* aka constant buffer */ + return index >= 0 && index < c->MaxUniformComponents / 4; + + case PROGRAM_CONSTANT: + /* constant buffer w/ possible relative negative addressing */ + return (index > (int) c->MaxUniformComponents / -4 && + index < c->MaxUniformComponents / 4); + + case PROGRAM_INPUT: + if (index < 0) + return GL_FALSE; + + switch (shaderType) { + case MESA_SHADER_VERTEX: + return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs; + case MESA_SHADER_FRAGMENT: + return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying; + case MESA_SHADER_GEOMETRY: + return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying; + default: + return GL_FALSE; + } + + case PROGRAM_OUTPUT: + if (index < 0) + return GL_FALSE; + + switch (shaderType) { + case MESA_SHADER_VERTEX: + return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying; + case MESA_SHADER_FRAGMENT: + return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers; + case MESA_SHADER_GEOMETRY: + return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying; + default: + return GL_FALSE; + } + + case PROGRAM_ADDRESS: + return index >= 0 && index < c->MaxAddressRegs; + + default: + _mesa_problem(ctx, + "unexpected register file in _mesa_valid_register_index()"); + return GL_FALSE; + } +} + + + +/** + * "Post-process" a GPU program. This is intended to be used for debugging. + * Example actions include no-op'ing instructions or changing instruction + * behaviour. + */ +void +_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog) +{ + static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 }; + GLuint i; + GLuint whiteSwizzle; + GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters, + white, 4, &whiteSwizzle); + + (void) whiteIndex; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); + + (void) n; + + if (_mesa_is_tex_instruction(inst->Opcode)) { +#if 0 + /* replace TEX/TXP/TXB with MOV */ + inst->Opcode = OPCODE_MOV; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->SrcReg[0].Negate = NEGATE_NONE; +#endif + +#if 0 + /* disable shadow texture mode */ + inst->TexShadow = 0; +#endif + } + + if (inst->Opcode == OPCODE_TXP) { +#if 0 + inst->Opcode = OPCODE_MOV; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_CONSTANT; + inst->SrcReg[0].Index = whiteIndex; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->SrcReg[0].Negate = NEGATE_NONE; +#endif +#if 0 + inst->TexShadow = 0; +#endif +#if 0 + inst->Opcode = OPCODE_TEX; + inst->TexShadow = 0; +#endif + } + + } +} diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index a85977e2e..19aa8ccdb 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -1,2768 +1,2768 @@ -%{
-/*
- * Copyright © 2009 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "main/mtypes.h"
-#include "main/imports.h"
-#include "program/program.h"
-#include "program/prog_parameter.h"
-#include "program/prog_parameter_layout.h"
-#include "program/prog_statevars.h"
-#include "program/prog_instruction.h"
-
-#include "program/symbol_table.h"
-#include "program/program_parser.h"
-
-extern void *yy_scan_string(char *);
-extern void yy_delete_buffer(void *);
-
-static struct asm_symbol *declare_variable(struct asm_parser_state *state,
- char *name, enum asm_type t, struct YYLTYPE *locp);
-
-static int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var, const struct asm_vector *vec,
- GLboolean allowSwizzle);
-
-static int yyparse(struct asm_parser_state *state);
-
-static char *make_error_string(const char *fmt, ...);
-
-static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
- const char *s);
-
-static int validate_inputs(struct YYLTYPE *locp,
- struct asm_parser_state *state);
-
-static void init_dst_reg(struct prog_dst_register *r);
-
-static void set_dst_reg(struct prog_dst_register *r,
- gl_register_file file, GLint index);
-
-static void init_src_reg(struct asm_src_register *r);
-
-static void set_src_reg(struct asm_src_register *r,
- gl_register_file file, GLint index);
-
-static void set_src_reg_swz(struct asm_src_register *r,
- gl_register_file file, GLint index, GLuint swizzle);
-
-static void asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_copy_ctor(
- const struct prog_instruction *base, const struct prog_dst_register *dst,
- const struct asm_src_register *src0, const struct asm_src_register *src1,
- const struct asm_src_register *src2);
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- do { \
- if (YYID(N)) { \
- (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
- (Current).position = YYRHSLOC(Rhs, 1).position; \
- (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
- } else { \
- (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
- (Current).last_line = (Current).first_line; \
- (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
- (Current).last_column = (Current).first_column; \
- (Current).position = YYRHSLOC(Rhs, 0).position \
- + (Current).first_column; \
- } \
- } while(YYID(0))
-
-#define YYLEX_PARAM state->scanner
-%}
-
-%pure-parser
-%locations
-%parse-param { struct asm_parser_state *state }
-%error-verbose
-%lex-param { void *scanner }
-
-%union {
- struct asm_instruction *inst;
- struct asm_symbol *sym;
- struct asm_symbol temp_sym;
- struct asm_swizzle_mask swiz_mask;
- struct asm_src_register src_reg;
- struct prog_dst_register dst_reg;
- struct prog_instruction temp_inst;
- char *string;
- unsigned result;
- unsigned attrib;
- int integer;
- float real;
- gl_state_index state[STATE_LENGTH];
- int negate;
- struct asm_vector vector;
- gl_inst_opcode opcode;
-
- struct {
- unsigned swz;
- unsigned rgba_valid:1;
- unsigned xyzw_valid:1;
- unsigned negate:1;
- } ext_swizzle;
-}
-
-%token ARBvp_10 ARBfp_10
-
-/* Tokens for assembler pseudo-ops */
-%token <integer> ADDRESS
-%token ALIAS ATTRIB
-%token OPTION OUTPUT
-%token PARAM
-%token <integer> TEMP
-%token END
-
- /* Tokens for instructions */
-%token <temp_inst> BIN_OP BINSC_OP SAMPLE_OP SCALAR_OP TRI_OP VECTOR_OP
-%token <temp_inst> ARL KIL SWZ TXD_OP
-
-%token <integer> INTEGER
-%token <real> REAL
-
-%token AMBIENT ATTENUATION
-%token BACK
-%token CLIP COLOR
-%token DEPTH DIFFUSE DIRECTION
-%token EMISSION ENV EYE
-%token FOG FOGCOORD FRAGMENT FRONT
-%token HALF
-%token INVERSE INVTRANS
-%token LIGHT LIGHTMODEL LIGHTPROD LOCAL
-%token MATERIAL MAT_PROGRAM MATRIX MATRIXINDEX MODELVIEW MVP
-%token NORMAL
-%token OBJECT
-%token PALETTE PARAMS PLANE POINT_TOK POINTSIZE POSITION PRIMARY PROGRAM PROJECTION
-%token RANGE RESULT ROW
-%token SCENECOLOR SECONDARY SHININESS SIZE_TOK SPECULAR SPOT STATE
-%token TEXCOORD TEXENV TEXGEN TEXGEN_Q TEXGEN_R TEXGEN_S TEXGEN_T TEXTURE TRANSPOSE
-%token TEXTURE_UNIT TEX_1D TEX_2D TEX_3D TEX_CUBE TEX_RECT
-%token TEX_SHADOW1D TEX_SHADOW2D TEX_SHADOWRECT
-%token TEX_ARRAY1D TEX_ARRAY2D TEX_ARRAYSHADOW1D TEX_ARRAYSHADOW2D
-%token VERTEX VTXATTRIB
-%token WEIGHT
-
-%token <string> IDENTIFIER USED_IDENTIFIER
-%type <string> string
-%token <swiz_mask> MASK4 MASK3 MASK2 MASK1 SWIZZLE
-%token DOT_DOT
-%token DOT
-
-%type <inst> instruction ALU_instruction TexInstruction
-%type <inst> ARL_instruction VECTORop_instruction
-%type <inst> SCALARop_instruction BINSCop_instruction BINop_instruction
-%type <inst> TRIop_instruction TXD_instruction SWZ_instruction SAMPLE_instruction
-%type <inst> KIL_instruction
-
-%type <dst_reg> dstReg maskedDstReg maskedAddrReg
-%type <src_reg> srcReg scalarUse scalarSrcReg swizzleSrcReg
-%type <swiz_mask> scalarSuffix swizzleSuffix extendedSwizzle
-%type <ext_swizzle> extSwizComp extSwizSel
-%type <swiz_mask> optionalMask
-
-%type <sym> progParamArray
-%type <integer> addrRegRelOffset addrRegPosOffset addrRegNegOffset
-%type <src_reg> progParamArrayMem progParamArrayAbs progParamArrayRel
-%type <sym> addrReg
-%type <swiz_mask> addrComponent addrWriteMask
-
-%type <dst_reg> ccMaskRule ccTest ccMaskRule2 ccTest2 optionalCcMask
-
-%type <result> resultBinding resultColBinding
-%type <integer> optFaceType optColorType
-%type <integer> optResultFaceType optResultColorType
-
-%type <integer> optTexImageUnitNum texImageUnitNum
-%type <integer> optTexCoordUnitNum texCoordUnitNum
-%type <integer> optLegacyTexUnitNum legacyTexUnitNum
-%type <integer> texImageUnit texTarget
-%type <integer> vtxAttribNum
-
-%type <attrib> attribBinding vtxAttribItem fragAttribItem
-
-%type <temp_sym> paramSingleInit paramSingleItemDecl
-%type <integer> optArraySize
-
-%type <state> stateSingleItem stateMultipleItem
-%type <state> stateMaterialItem
-%type <state> stateLightItem stateLightModelItem stateLightProdItem
-%type <state> stateTexGenItem stateFogItem stateClipPlaneItem statePointItem
-%type <state> stateMatrixItem stateMatrixRow stateMatrixRows
-%type <state> stateTexEnvItem stateDepthItem
-
-%type <state> stateLModProperty
-%type <state> stateMatrixName optMatrixRows
-
-%type <integer> stateMatProperty
-%type <integer> stateLightProperty stateSpotProperty
-%type <integer> stateLightNumber stateLProdProperty
-%type <integer> stateTexGenType stateTexGenCoord
-%type <integer> stateTexEnvProperty
-%type <integer> stateFogProperty
-%type <integer> stateClipPlaneNum
-%type <integer> statePointProperty
-
-%type <integer> stateOptMatModifier stateMatModifier stateMatrixRowNum
-%type <integer> stateOptModMatNum stateModMatNum statePaletteMatNum
-%type <integer> stateProgramMatNum
-
-%type <integer> ambDiffSpecProperty
-
-%type <state> programSingleItem progEnvParam progLocalParam
-%type <state> programMultipleItem progEnvParams progLocalParams
-
-%type <temp_sym> paramMultipleInit paramMultInitList paramMultipleItem
-%type <temp_sym> paramSingleItemUse
-
-%type <integer> progEnvParamNum progLocalParamNum
-%type <state> progEnvParamNums progLocalParamNums
-
-%type <vector> paramConstDecl paramConstUse
-%type <vector> paramConstScalarDecl paramConstScalarUse paramConstVector
-%type <real> signedFloatConstant
-%type <negate> optionalSign
-
-%{
-extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
- void *yyscanner);
-%}
-
-%%
-
-program: language optionSequence statementSequence END
- ;
-
-language: ARBvp_10
- {
- if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
- yyerror(& @1, state, "invalid fragment program header");
-
- }
- state->mode = ARB_vertex;
- }
- | ARBfp_10
- {
- if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
- yyerror(& @1, state, "invalid vertex program header");
- }
- state->mode = ARB_fragment;
-
- state->option.TexRect =
- (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
- }
- ;
-
-optionSequence: optionSequence option
- |
- ;
-
-option: OPTION string ';'
- {
- int valid = 0;
-
- if (state->mode == ARB_vertex) {
- valid = _mesa_ARBvp_parse_option(state, $2);
- } else if (state->mode == ARB_fragment) {
- valid = _mesa_ARBfp_parse_option(state, $2);
- }
-
-
- free($2);
-
- if (!valid) {
- const char *const err_str = (state->mode == ARB_vertex)
- ? "invalid ARB vertex program option"
- : "invalid ARB fragment program option";
-
- yyerror(& @2, state, err_str);
- YYERROR;
- }
- }
- ;
-
-statementSequence: statementSequence statement
- |
- ;
-
-statement: instruction ';'
- {
- if ($1 != NULL) {
- if (state->inst_tail == NULL) {
- state->inst_head = $1;
- } else {
- state->inst_tail->next = $1;
- }
-
- state->inst_tail = $1;
- $1->next = NULL;
-
- state->prog->NumInstructions++;
- }
- }
- | namingStatement ';'
- ;
-
-instruction: ALU_instruction
- {
- $$ = $1;
- state->prog->NumAluInstructions++;
- }
- | TexInstruction
- {
- $$ = $1;
- state->prog->NumTexInstructions++;
- }
- ;
-
-ALU_instruction: ARL_instruction
- | VECTORop_instruction
- | SCALARop_instruction
- | BINSCop_instruction
- | BINop_instruction
- | TRIop_instruction
- | SWZ_instruction
- ;
-
-TexInstruction: SAMPLE_instruction
- | KIL_instruction
- | TXD_instruction
- ;
-
-ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg
- {
- $$ = asm_instruction_ctor(OPCODE_ARL, & $2, & $4, NULL, NULL);
- }
- ;
-
-VECTORop_instruction: VECTOR_OP maskedDstReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-SCALARop_instruction: SCALAR_OP maskedDstReg ',' scalarSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-BINSCop_instruction: BINSC_OP maskedDstReg ',' scalarSrcReg ',' scalarSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL);
- }
- ;
-
-
-BINop_instruction: BIN_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL);
- }
- ;
-
-TRIop_instruction: TRI_OP maskedDstReg ','
- swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8);
- }
- ;
-
-SAMPLE_instruction: SAMPLE_OP maskedDstReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- if ($$ != NULL) {
- const GLbitfield tex_mask = (1U << $6);
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- $$->Base.TexSrcUnit = $6;
-
- if ($8 < 0) {
- shadow_tex = tex_mask;
-
- $$->Base.TexSrcTarget = -$8;
- $$->Base.TexShadow = 1;
- } else {
- $$->Base.TexSrcTarget = $8;
- }
-
- target_mask = (1U << $$->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[$6] != 0)
- && ((state->prog->TexturesUsed[$6] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& @8, state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[$6] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- }
- ;
-
-KIL_instruction: KIL swizzleSrcReg
- {
- $$ = asm_instruction_ctor(OPCODE_KIL, NULL, & $2, NULL, NULL);
- state->fragment.UsesKill = 1;
- }
- | KIL ccTest
- {
- $$ = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
- $$->Base.DstReg.CondMask = $2.CondMask;
- $$->Base.DstReg.CondSwizzle = $2.CondSwizzle;
- $$->Base.DstReg.CondSrc = $2.CondSrc;
- state->fragment.UsesKill = 1;
- }
- ;
-
-TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8);
- if ($$ != NULL) {
- const GLbitfield tex_mask = (1U << $10);
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- $$->Base.TexSrcUnit = $10;
-
- if ($12 < 0) {
- shadow_tex = tex_mask;
-
- $$->Base.TexSrcTarget = -$12;
- $$->Base.TexShadow = 1;
- } else {
- $$->Base.TexSrcTarget = $12;
- }
-
- target_mask = (1U << $$->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[$10] != 0)
- && ((state->prog->TexturesUsed[$10] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& @12, state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[$10] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- }
- ;
-
-texImageUnit: TEXTURE_UNIT optTexImageUnitNum
- {
- $$ = $2;
- }
- ;
-
-texTarget: TEX_1D { $$ = TEXTURE_1D_INDEX; }
- | TEX_2D { $$ = TEXTURE_2D_INDEX; }
- | TEX_3D { $$ = TEXTURE_3D_INDEX; }
- | TEX_CUBE { $$ = TEXTURE_CUBE_INDEX; }
- | TEX_RECT { $$ = TEXTURE_RECT_INDEX; }
- | TEX_SHADOW1D { $$ = -TEXTURE_1D_INDEX; }
- | TEX_SHADOW2D { $$ = -TEXTURE_2D_INDEX; }
- | TEX_SHADOWRECT { $$ = -TEXTURE_RECT_INDEX; }
- | TEX_ARRAY1D { $$ = TEXTURE_1D_ARRAY_INDEX; }
- | TEX_ARRAY2D { $$ = TEXTURE_2D_ARRAY_INDEX; }
- | TEX_ARRAYSHADOW1D { $$ = -TEXTURE_1D_ARRAY_INDEX; }
- | TEX_ARRAYSHADOW2D { $$ = -TEXTURE_2D_ARRAY_INDEX; }
- ;
-
-SWZ_instruction: SWZ maskedDstReg ',' srcReg ',' extendedSwizzle
- {
- /* FIXME: Is this correct? Should the extenedSwizzle be applied
- * FIXME: to the existing swizzle?
- */
- $4.Base.Swizzle = $6.swizzle;
- $4.Base.Negate = $6.mask;
-
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-scalarSrcReg: optionalSign scalarUse
- {
- $$ = $2;
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
- }
- | optionalSign '|' scalarUse '|'
- {
- $$ = $3;
-
- if (!state->option.NV_fragment) {
- yyerror(& @2, state, "unexpected character '|'");
- YYERROR;
- }
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Abs = 1;
- }
- ;
-
-scalarUse: srcReg scalarSuffix
- {
- $$ = $1;
-
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $2.swizzle);
- }
- | paramConstScalarUse
- {
- struct asm_symbol temp_sym;
-
- if (!state->option.NV_fragment) {
- yyerror(& @1, state, "expected scalar suffix");
- YYERROR;
- }
-
- memset(& temp_sym, 0, sizeof(temp_sym));
- temp_sym.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE);
-
- set_src_reg_swz(& $$, PROGRAM_CONSTANT,
- temp_sym.param_binding_begin,
- temp_sym.param_binding_swizzle);
- }
- ;
-
-swizzleSrcReg: optionalSign srcReg swizzleSuffix
- {
- $$ = $2;
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $3.swizzle);
- }
- | optionalSign '|' srcReg swizzleSuffix '|'
- {
- $$ = $3;
-
- if (!state->option.NV_fragment) {
- yyerror(& @2, state, "unexpected character '|'");
- YYERROR;
- }
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Abs = 1;
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $4.swizzle);
- }
-
- ;
-
-maskedDstReg: dstReg optionalMask optionalCcMask
- {
- $$ = $1;
- $$.WriteMask = $2.mask;
- $$.CondMask = $3.CondMask;
- $$.CondSwizzle = $3.CondSwizzle;
- $$.CondSrc = $3.CondSrc;
-
- if ($$.File == PROGRAM_OUTPUT) {
- /* Technically speaking, this should check that it is in
- * vertex program mode. However, PositionInvariant can never be
- * set in fragment program mode, so it is somewhat irrelevant.
- */
- if (state->option.PositionInvariant
- && ($$.Index == VERT_RESULT_HPOS)) {
- yyerror(& @1, state, "position-invariant programs cannot "
- "write position");
- YYERROR;
- }
-
- state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index);
- }
- }
- ;
-
-maskedAddrReg: addrReg addrWriteMask
- {
- set_dst_reg(& $$, PROGRAM_ADDRESS, 0);
- $$.WriteMask = $2.mask;
- }
- ;
-
-extendedSwizzle: extSwizComp ',' extSwizComp ',' extSwizComp ',' extSwizComp
- {
- const unsigned xyzw_valid =
- ($1.xyzw_valid << 0)
- | ($3.xyzw_valid << 1)
- | ($5.xyzw_valid << 2)
- | ($7.xyzw_valid << 3);
- const unsigned rgba_valid =
- ($1.rgba_valid << 0)
- | ($3.rgba_valid << 1)
- | ($5.rgba_valid << 2)
- | ($7.rgba_valid << 3);
-
- /* All of the swizzle components have to be valid in either RGBA
- * or XYZW. Note that 0 and 1 are valid in both, so both masks
- * can have some bits set.
- *
- * We somewhat deviate from the spec here. It would be really hard
- * to figure out which component is the error, and there probably
- * isn't a lot of benefit.
- */
- if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
- yyerror(& @1, state, "cannot combine RGBA and XYZW swizzle "
- "components");
- YYERROR;
- }
-
- $$.swizzle = MAKE_SWIZZLE4($1.swz, $3.swz, $5.swz, $7.swz);
- $$.mask = ($1.negate) | ($3.negate << 1) | ($5.negate << 2)
- | ($7.negate << 3);
- }
- ;
-
-extSwizComp: optionalSign extSwizSel
- {
- $$ = $2;
- $$.negate = ($1) ? 1 : 0;
- }
- ;
-
-extSwizSel: INTEGER
- {
- if (($1 != 0) && ($1 != 1)) {
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- $$.swz = ($1 == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
-
- /* 0 and 1 are valid for both RGBA swizzle names and XYZW
- * swizzle names.
- */
- $$.xyzw_valid = 1;
- $$.rgba_valid = 1;
- }
- | string
- {
- char s;
-
- if (strlen($1) > 1) {
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- s = $1[0];
- free($1);
-
- switch (s) {
- case 'x':
- $$.swz = SWIZZLE_X;
- $$.xyzw_valid = 1;
- break;
- case 'y':
- $$.swz = SWIZZLE_Y;
- $$.xyzw_valid = 1;
- break;
- case 'z':
- $$.swz = SWIZZLE_Z;
- $$.xyzw_valid = 1;
- break;
- case 'w':
- $$.swz = SWIZZLE_W;
- $$.xyzw_valid = 1;
- break;
-
- case 'r':
- $$.swz = SWIZZLE_X;
- $$.rgba_valid = 1;
- break;
- case 'g':
- $$.swz = SWIZZLE_Y;
- $$.rgba_valid = 1;
- break;
- case 'b':
- $$.swz = SWIZZLE_Z;
- $$.rgba_valid = 1;
- break;
- case 'a':
- $$.swz = SWIZZLE_W;
- $$.rgba_valid = 1;
- break;
-
- default:
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- break;
- }
- }
- ;
-
-srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) && (s->type != at_temp)
- && (s->type != at_attrib)) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type == at_param) && s->param_is_array) {
- yyerror(& @1, state, "non-array access to array PARAM");
- YYERROR;
- }
-
- init_src_reg(& $$);
- switch (s->type) {
- case at_temp:
- set_src_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_param:
- set_src_reg_swz(& $$, s->param_binding_type,
- s->param_binding_begin,
- s->param_binding_swizzle);
- break;
- case at_attrib:
- set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding);
- state->prog->InputsRead |= (1U << $$.Base.Index);
-
- if (!validate_inputs(& @1, state)) {
- YYERROR;
- }
- break;
-
- default:
- YYERROR;
- break;
- }
- }
- | attribBinding
- {
- set_src_reg(& $$, PROGRAM_INPUT, $1);
- state->prog->InputsRead |= (1U << $$.Base.Index);
-
- if (!validate_inputs(& @1, state)) {
- YYERROR;
- }
- }
- | progParamArray '[' progParamArrayMem ']'
- {
- if (! $3.Base.RelAddr
- && ((unsigned) $3.Base.Index >= $1->param_binding_length)) {
- yyerror(& @3, state, "out of bounds array access");
- YYERROR;
- }
-
- init_src_reg(& $$);
- $$.Base.File = $1->param_binding_type;
-
- if ($3.Base.RelAddr) {
- state->prog->IndirectRegisterFiles |= (1 << $$.Base.File);
- $1->param_accessed_indirectly = 1;
-
- $$.Base.RelAddr = 1;
- $$.Base.Index = $3.Base.Index;
- $$.Symbol = $1;
- } else {
- $$.Base.Index = $1->param_binding_begin + $3.Base.Index;
- }
- }
- | paramSingleItemUse
- {
- gl_register_file file = ($1.name != NULL)
- ? $1.param_binding_type
- : PROGRAM_CONSTANT;
- set_src_reg_swz(& $$, file, $1.param_binding_begin,
- $1.param_binding_swizzle);
- }
- ;
-
-dstReg: resultBinding
- {
- set_dst_reg(& $$, PROGRAM_OUTPUT, $1);
- }
- | USED_IDENTIFIER /* temporaryReg | vertexResultReg */
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_output) && (s->type != at_temp)) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- }
-
- switch (s->type) {
- case at_temp:
- set_dst_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_output:
- set_dst_reg(& $$, PROGRAM_OUTPUT, s->output_binding);
- break;
- default:
- set_dst_reg(& $$, s->param_binding_type, s->param_binding_begin);
- break;
- }
- }
- ;
-
-progParamArray: USED_IDENTIFIER
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) || !s->param_is_array) {
- yyerror(& @1, state, "array access to non-PARAM variable");
- YYERROR;
- } else {
- $$ = s;
- }
- }
- ;
-
-progParamArrayMem: progParamArrayAbs | progParamArrayRel;
-
-progParamArrayAbs: INTEGER
- {
- init_src_reg(& $$);
- $$.Base.Index = $1;
- }
- ;
-
-progParamArrayRel: addrReg addrComponent addrRegRelOffset
- {
- /* FINISHME: Add support for multiple address registers.
- */
- /* FINISHME: Add support for 4-component address registers.
- */
- init_src_reg(& $$);
- $$.Base.RelAddr = 1;
- $$.Base.Index = $3;
- }
- ;
-
-addrRegRelOffset: { $$ = 0; }
- | '+' addrRegPosOffset { $$ = $2; }
- | '-' addrRegNegOffset { $$ = -$2; }
- ;
-
-addrRegPosOffset: INTEGER
- {
- if (($1 < 0) || ($1 > 4095)) {
- char s[100];
- _mesa_snprintf(s, sizeof(s),
- "relative address offset too large (%d)", $1);
- yyerror(& @1, state, s);
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrRegNegOffset: INTEGER
- {
- if (($1 < 0) || ($1 > 4096)) {
- char s[100];
- _mesa_snprintf(s, sizeof(s),
- "relative address offset too large (%d)", $1);
- yyerror(& @1, state, s);
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrReg: USED_IDENTIFIER
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid array member");
- YYERROR;
- } else if (s->type != at_address) {
- yyerror(& @1, state,
- "invalid variable for indexed array access");
- YYERROR;
- } else {
- $$ = s;
- }
- }
- ;
-
-addrComponent: MASK1
- {
- if ($1.mask != WRITEMASK_X) {
- yyerror(& @1, state, "invalid address component selector");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrWriteMask: MASK1
- {
- if ($1.mask != WRITEMASK_X) {
- yyerror(& @1, state,
- "address register write mask must be \".x\"");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-scalarSuffix: MASK1;
-
-swizzleSuffix: MASK1
- | MASK4
- | SWIZZLE
- | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; }
- ;
-
-optionalMask: MASK4 | MASK3 | MASK2 | MASK1
- | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; }
- ;
-
-optionalCcMask: '(' ccTest ')'
- {
- $$ = $2;
- }
- | '(' ccTest2 ')'
- {
- $$ = $2;
- }
- |
- {
- $$.CondMask = COND_TR;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-ccTest: ccMaskRule swizzleSuffix
- {
- $$ = $1;
- $$.CondSwizzle = $2.swizzle;
- }
- ;
-
-ccTest2: ccMaskRule2 swizzleSuffix
- {
- $$ = $1;
- $$.CondSwizzle = $2.swizzle;
- }
- ;
-
-ccMaskRule: IDENTIFIER
- {
- const int cond = _mesa_parse_cc($1);
- if ((cond == 0) || ($1[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- $$.CondMask = cond;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-ccMaskRule2: USED_IDENTIFIER
- {
- const int cond = _mesa_parse_cc($1);
- if ((cond == 0) || ($1[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- $$.CondMask = cond;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-namingStatement: ATTRIB_statement
- | PARAM_statement
- | TEMP_statement
- | ADDRESS_statement
- | OUTPUT_statement
- | ALIAS_statement
- ;
-
-ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding
- {
- struct asm_symbol *const s =
- declare_variable(state, $2, at_attrib, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- s->attrib_binding = $4;
- state->InputsBound |= (1U << s->attrib_binding);
-
- if (!validate_inputs(& @4, state)) {
- YYERROR;
- }
- }
- }
- ;
-
-attribBinding: VERTEX vtxAttribItem
- {
- $$ = $2;
- }
- | FRAGMENT fragAttribItem
- {
- $$ = $2;
- }
- ;
-
-vtxAttribItem: POSITION
- {
- $$ = VERT_ATTRIB_POS;
- }
- | WEIGHT vtxOptWeightNum
- {
- $$ = VERT_ATTRIB_WEIGHT;
- }
- | NORMAL
- {
- $$ = VERT_ATTRIB_NORMAL;
- }
- | COLOR optColorType
- {
- if (!state->ctx->Extensions.EXT_secondary_color) {
- yyerror(& @2, state, "GL_EXT_secondary_color not supported");
- YYERROR;
- }
-
- $$ = VERT_ATTRIB_COLOR0 + $2;
- }
- | FOGCOORD
- {
- if (!state->ctx->Extensions.EXT_fog_coord) {
- yyerror(& @1, state, "GL_EXT_fog_coord not supported");
- YYERROR;
- }
-
- $$ = VERT_ATTRIB_FOG;
- }
- | TEXCOORD optTexCoordUnitNum
- {
- $$ = VERT_ATTRIB_TEX0 + $2;
- }
- | MATRIXINDEX '[' vtxWeightNum ']'
- {
- yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- }
- | VTXATTRIB '[' vtxAttribNum ']'
- {
- $$ = VERT_ATTRIB_GENERIC0 + $3;
- }
- ;
-
-vtxAttribNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxAttribs) {
- yyerror(& @1, state, "invalid vertex attribute reference");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-vtxOptWeightNum: | '[' vtxWeightNum ']';
-vtxWeightNum: INTEGER;
-
-fragAttribItem: POSITION
- {
- $$ = FRAG_ATTRIB_WPOS;
- }
- | COLOR optColorType
- {
- $$ = FRAG_ATTRIB_COL0 + $2;
- }
- | FOGCOORD
- {
- $$ = FRAG_ATTRIB_FOGC;
- }
- | TEXCOORD optTexCoordUnitNum
- {
- $$ = FRAG_ATTRIB_TEX0 + $2;
- }
- ;
-
-PARAM_statement: PARAM_singleStmt | PARAM_multipleStmt;
-
-PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit
- {
- struct asm_symbol *const s =
- declare_variable(state, $2, at_param, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- s->param_binding_type = $3.param_binding_type;
- s->param_binding_begin = $3.param_binding_begin;
- s->param_binding_length = $3.param_binding_length;
- s->param_binding_swizzle = $3.param_binding_swizzle;
- s->param_is_array = 0;
- }
- }
- ;
-
-PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit
- {
- if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) {
- free($2);
- yyerror(& @4, state,
- "parameter array size and number of bindings must match");
- YYERROR;
- } else {
- struct asm_symbol *const s =
- declare_variable(state, $2, $6.type, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- s->param_binding_type = $6.param_binding_type;
- s->param_binding_begin = $6.param_binding_begin;
- s->param_binding_length = $6.param_binding_length;
- s->param_binding_swizzle = SWIZZLE_XYZW;
- s->param_is_array = 1;
- }
- }
- }
- ;
-
-optArraySize:
- {
- $$ = 0;
- }
- | INTEGER
- {
- if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
- yyerror(& @1, state, "invalid parameter array size");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-paramSingleInit: '=' paramSingleItemDecl
- {
- $$ = $2;
- }
- ;
-
-paramMultipleInit: '=' '{' paramMultInitList '}'
- {
- $$ = $3;
- }
- ;
-
-paramMultInitList: paramMultipleItem
- | paramMultInitList ',' paramMultipleItem
- {
- $1.param_binding_length += $3.param_binding_length;
- $$ = $1;
- }
- ;
-
-paramSingleItemDecl: stateSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstDecl
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
- }
- ;
-
-paramSingleItemUse: stateSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstUse
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
- }
- ;
-
-paramMultipleItem: stateMultipleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programMultipleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstDecl
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
- }
- ;
-
-stateMultipleItem: stateSingleItem { memcpy($$, $1, sizeof($$)); }
- | STATE stateMatrixRows { memcpy($$, $2, sizeof($$)); }
- ;
-
-stateSingleItem: STATE stateMaterialItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightModelItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightProdItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateTexGenItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateTexEnvItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateFogItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateClipPlaneItem { memcpy($$, $2, sizeof($$)); }
- | STATE statePointItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateMatrixRow { memcpy($$, $2, sizeof($$)); }
- | STATE stateDepthItem { memcpy($$, $2, sizeof($$)); }
- ;
-
-stateMaterialItem: MATERIAL optFaceType stateMatProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_MATERIAL;
- $$[1] = $2;
- $$[2] = $3;
- }
- ;
-
-stateMatProperty: ambDiffSpecProperty
- {
- $$ = $1;
- }
- | EMISSION
- {
- $$ = STATE_EMISSION;
- }
- | SHININESS
- {
- $$ = STATE_SHININESS;
- }
- ;
-
-stateLightItem: LIGHT '[' stateLightNumber ']' stateLightProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHT;
- $$[1] = $3;
- $$[2] = $5;
- }
- ;
-
-stateLightProperty: ambDiffSpecProperty
- {
- $$ = $1;
- }
- | POSITION
- {
- $$ = STATE_POSITION;
- }
- | ATTENUATION
- {
- if (!state->ctx->Extensions.EXT_point_parameters) {
- yyerror(& @1, state, "GL_ARB_point_parameters not supported");
- YYERROR;
- }
-
- $$ = STATE_ATTENUATION;
- }
- | SPOT stateSpotProperty
- {
- $$ = $2;
- }
- | HALF
- {
- $$ = STATE_HALF_VECTOR;
- }
- ;
-
-stateSpotProperty: DIRECTION
- {
- $$ = STATE_SPOT_DIRECTION;
- }
- ;
-
-stateLightModelItem: LIGHTMODEL stateLModProperty
- {
- $$[0] = $2[0];
- $$[1] = $2[1];
- }
- ;
-
-stateLModProperty: AMBIENT
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTMODEL_AMBIENT;
- }
- | optFaceType SCENECOLOR
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTMODEL_SCENECOLOR;
- $$[1] = $1;
- }
- ;
-
-stateLightProdItem: LIGHTPROD '[' stateLightNumber ']' optFaceType stateLProdProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTPROD;
- $$[1] = $3;
- $$[2] = $5;
- $$[3] = $6;
- }
- ;
-
-stateLProdProperty: ambDiffSpecProperty;
-
-stateTexEnvItem: TEXENV optLegacyTexUnitNum stateTexEnvProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $3;
- $$[1] = $2;
- }
- ;
-
-stateTexEnvProperty: COLOR
- {
- $$ = STATE_TEXENV_COLOR;
- }
- ;
-
-ambDiffSpecProperty: AMBIENT
- {
- $$ = STATE_AMBIENT;
- }
- | DIFFUSE
- {
- $$ = STATE_DIFFUSE;
- }
- | SPECULAR
- {
- $$ = STATE_SPECULAR;
- }
- ;
-
-stateLightNumber: INTEGER
- {
- if ((unsigned) $1 >= state->MaxLights) {
- yyerror(& @1, state, "invalid light selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateTexGenItem: TEXGEN optTexCoordUnitNum stateTexGenType stateTexGenCoord
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_TEXGEN;
- $$[1] = $2;
- $$[2] = $3 + $4;
- }
- ;
-
-stateTexGenType: EYE
- {
- $$ = STATE_TEXGEN_EYE_S;
- }
- | OBJECT
- {
- $$ = STATE_TEXGEN_OBJECT_S;
- }
- ;
-stateTexGenCoord: TEXGEN_S
- {
- $$ = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_T
- {
- $$ = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_R
- {
- $$ = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_Q
- {
- $$ = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
- }
- ;
-
-stateFogItem: FOG stateFogProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $2;
- }
- ;
-
-stateFogProperty: COLOR
- {
- $$ = STATE_FOG_COLOR;
- }
- | PARAMS
- {
- $$ = STATE_FOG_PARAMS;
- }
- ;
-
-stateClipPlaneItem: CLIP '[' stateClipPlaneNum ']' PLANE
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_CLIPPLANE;
- $$[1] = $3;
- }
- ;
-
-stateClipPlaneNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxClipPlanes) {
- yyerror(& @1, state, "invalid clip plane selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-statePointItem: POINT_TOK statePointProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $2;
- }
- ;
-
-statePointProperty: SIZE_TOK
- {
- $$ = STATE_POINT_SIZE;
- }
- | ATTENUATION
- {
- $$ = STATE_POINT_ATTENUATION;
- }
- ;
-
-stateMatrixRow: stateMatrixItem ROW '[' stateMatrixRowNum ']'
- {
- $$[0] = $1[0];
- $$[1] = $1[1];
- $$[2] = $4;
- $$[3] = $4;
- $$[4] = $1[2];
- }
- ;
-
-stateMatrixRows: stateMatrixItem optMatrixRows
- {
- $$[0] = $1[0];
- $$[1] = $1[1];
- $$[2] = $2[2];
- $$[3] = $2[3];
- $$[4] = $1[2];
- }
- ;
-
-optMatrixRows:
- {
- $$[2] = 0;
- $$[3] = 3;
- }
- | ROW '[' stateMatrixRowNum DOT_DOT stateMatrixRowNum ']'
- {
- /* It seems logical that the matrix row range specifier would have
- * to specify a range or more than one row (i.e., $5 > $3).
- * However, the ARB_vertex_program spec says "a program will fail
- * to load if <a> is greater than <b>." This means that $3 == $5
- * is valid.
- */
- if ($3 > $5) {
- yyerror(& @3, state, "invalid matrix row range");
- YYERROR;
- }
-
- $$[2] = $3;
- $$[3] = $5;
- }
- ;
-
-stateMatrixItem: MATRIX stateMatrixName stateOptMatModifier
- {
- $$[0] = $2[0];
- $$[1] = $2[1];
- $$[2] = $3;
- }
- ;
-
-stateOptMatModifier:
- {
- $$ = 0;
- }
- | stateMatModifier
- {
- $$ = $1;
- }
- ;
-
-stateMatModifier: INVERSE
- {
- $$ = STATE_MATRIX_INVERSE;
- }
- | TRANSPOSE
- {
- $$ = STATE_MATRIX_TRANSPOSE;
- }
- | INVTRANS
- {
- $$ = STATE_MATRIX_INVTRANS;
- }
- ;
-
-stateMatrixRowNum: INTEGER
- {
- if ($1 > 3) {
- yyerror(& @1, state, "invalid matrix row reference");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateMatrixName: MODELVIEW stateOptModMatNum
- {
- $$[0] = STATE_MODELVIEW_MATRIX;
- $$[1] = $2;
- }
- | PROJECTION
- {
- $$[0] = STATE_PROJECTION_MATRIX;
- $$[1] = 0;
- }
- | MVP
- {
- $$[0] = STATE_MVP_MATRIX;
- $$[1] = 0;
- }
- | TEXTURE optTexCoordUnitNum
- {
- $$[0] = STATE_TEXTURE_MATRIX;
- $$[1] = $2;
- }
- | PALETTE '[' statePaletteMatNum ']'
- {
- yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- }
- | MAT_PROGRAM '[' stateProgramMatNum ']'
- {
- $$[0] = STATE_PROGRAM_MATRIX;
- $$[1] = $3;
- }
- ;
-
-stateOptModMatNum:
- {
- $$ = 0;
- }
- | '[' stateModMatNum ']'
- {
- $$ = $2;
- }
- ;
-stateModMatNum: INTEGER
- {
- /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
- * zero is valid.
- */
- if ($1 != 0) {
- yyerror(& @1, state, "invalid modelview matrix index");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-statePaletteMatNum: INTEGER
- {
- /* Since GL_ARB_matrix_palette isn't supported, just let any value
- * through here. The error will be generated later.
- */
- $$ = $1;
- }
- ;
-stateProgramMatNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxProgramMatrices) {
- yyerror(& @1, state, "invalid program matrix selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateDepthItem: DEPTH RANGE
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_DEPTH_RANGE;
- }
- ;
-
-
-programSingleItem: progEnvParam | progLocalParam;
-
-programMultipleItem: progEnvParams | progLocalParams;
-
-progEnvParams: PROGRAM ENV '[' progEnvParamNums ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_ENV;
- $$[2] = $4[0];
- $$[3] = $4[1];
- }
- ;
-
-progEnvParamNums: progEnvParamNum
- {
- $$[0] = $1;
- $$[1] = $1;
- }
- | progEnvParamNum DOT_DOT progEnvParamNum
- {
- $$[0] = $1;
- $$[1] = $3;
- }
- ;
-
-progEnvParam: PROGRAM ENV '[' progEnvParamNum ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_ENV;
- $$[2] = $4;
- $$[3] = $4;
- }
- ;
-
-progLocalParams: PROGRAM LOCAL '[' progLocalParamNums ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_LOCAL;
- $$[2] = $4[0];
- $$[3] = $4[1];
- }
-
-progLocalParamNums: progLocalParamNum
- {
- $$[0] = $1;
- $$[1] = $1;
- }
- | progLocalParamNum DOT_DOT progLocalParamNum
- {
- $$[0] = $1;
- $$[1] = $3;
- }
- ;
-
-progLocalParam: PROGRAM LOCAL '[' progLocalParamNum ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_LOCAL;
- $$[2] = $4;
- $$[3] = $4;
- }
- ;
-
-progEnvParamNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxEnvParams) {
- yyerror(& @1, state, "invalid environment parameter reference");
- YYERROR;
- }
- $$ = $1;
- }
- ;
-
-progLocalParamNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxLocalParams) {
- yyerror(& @1, state, "invalid local parameter reference");
- YYERROR;
- }
- $$ = $1;
- }
- ;
-
-
-
-paramConstDecl: paramConstScalarDecl | paramConstVector;
-paramConstUse: paramConstScalarUse | paramConstVector;
-
-paramConstScalarDecl: signedFloatConstant
- {
- $$.count = 4;
- $$.data[0] = $1;
- $$.data[1] = $1;
- $$.data[2] = $1;
- $$.data[3] = $1;
- }
- ;
-
-paramConstScalarUse: REAL
- {
- $$.count = 1;
- $$.data[0] = $1;
- $$.data[1] = $1;
- $$.data[2] = $1;
- $$.data[3] = $1;
- }
- | INTEGER
- {
- $$.count = 1;
- $$.data[0] = (float) $1;
- $$.data[1] = (float) $1;
- $$.data[2] = (float) $1;
- $$.data[3] = (float) $1;
- }
- ;
-
-paramConstVector: '{' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = 0.0f;
- $$.data[2] = 0.0f;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = 0.0f;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant ','
- signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = $6;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant ','
- signedFloatConstant ',' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = $6;
- $$.data[3] = $8;
- }
- ;
-
-signedFloatConstant: optionalSign REAL
- {
- $$ = ($1) ? -$2 : $2;
- }
- | optionalSign INTEGER
- {
- $$ = (float)(($1) ? -$2 : $2);
- }
- ;
-
-optionalSign: '+' { $$ = FALSE; }
- | '-' { $$ = TRUE; }
- | { $$ = FALSE; }
- ;
-
-TEMP_statement: optVarSize TEMP { $<integer>$ = $2; } varNameList
- ;
-
-optVarSize: string
- {
- /* NV_fragment_program_option defines the size qualifiers in a
- * fairly broken way. "SHORT" or "LONG" can optionally be used
- * before TEMP or OUTPUT. However, neither is a reserved word!
- * This means that we have to parse it as an identifier, then check
- * to make sure it's one of the valid values. *sigh*
- *
- * In addition, the grammar in the extension spec does *not* allow
- * the size specifier to be optional, but all known implementations
- * do.
- */
- if (!state->option.NV_fragment) {
- yyerror(& @1, state, "unexpected IDENTIFIER");
- YYERROR;
- }
-
- if (strcmp("SHORT", $1) == 0) {
- } else if (strcmp("LONG", $1) == 0) {
- } else {
- char *const err_str =
- make_error_string("invalid storage size specifier \"%s\"",
- $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid storage size specifier");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
- }
- |
- {
- }
- ;
-
-ADDRESS_statement: ADDRESS { $<integer>$ = $1; } varNameList
- ;
-
-varNameList: varNameList ',' IDENTIFIER
- {
- if (!declare_variable(state, $3, $<integer>0, & @3)) {
- free($3);
- YYERROR;
- }
- }
- | IDENTIFIER
- {
- if (!declare_variable(state, $1, $<integer>0, & @1)) {
- free($1);
- YYERROR;
- }
- }
- ;
-
-OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding
- {
- struct asm_symbol *const s =
- declare_variable(state, $3, at_output, & @3);
-
- if (s == NULL) {
- free($3);
- YYERROR;
- } else {
- s->output_binding = $5;
- }
- }
- ;
-
-resultBinding: RESULT POSITION
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_HPOS;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT FOGCOORD
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_FOGC;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT resultColBinding
- {
- $$ = $2;
- }
- | RESULT POINTSIZE
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_PSIZ;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT TEXCOORD optTexCoordUnitNum
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_TEX0 + $3;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT DEPTH
- {
- if (state->mode == ARB_fragment) {
- $$ = FRAG_RESULT_DEPTH;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-resultColBinding: COLOR optResultFaceType optResultColorType
- {
- $$ = $2 + $3;
- }
- ;
-
-optResultFaceType:
- {
- $$ = (state->mode == ARB_vertex)
- ? VERT_RESULT_COL0
- : FRAG_RESULT_COLOR;
- }
- | FRONT
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_COL0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- | BACK
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_BFC0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-optResultColorType:
- {
- $$ = 0;
- }
- | PRIMARY
- {
- if (state->mode == ARB_vertex) {
- $$ = 0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- | SECONDARY
- {
- if (state->mode == ARB_vertex) {
- $$ = 1;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-optFaceType: { $$ = 0; }
- | FRONT { $$ = 0; }
- | BACK { $$ = 1; }
- ;
-
-optColorType: { $$ = 0; }
- | PRIMARY { $$ = 0; }
- | SECONDARY { $$ = 1; }
- ;
-
-optTexCoordUnitNum: { $$ = 0; }
- | '[' texCoordUnitNum ']' { $$ = $2; }
- ;
-
-optTexImageUnitNum: { $$ = 0; }
- | '[' texImageUnitNum ']' { $$ = $2; }
- ;
-
-optLegacyTexUnitNum: { $$ = 0; }
- | '[' legacyTexUnitNum ']' { $$ = $2; }
- ;
-
-texCoordUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureCoordUnits) {
- yyerror(& @1, state, "invalid texture coordinate unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-texImageUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureImageUnits) {
- yyerror(& @1, state, "invalid texture image unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-legacyTexUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureUnits) {
- yyerror(& @1, state, "invalid texture unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
- {
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $2);
- struct asm_symbol *target = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $4);
-
- free($4);
-
- if (exist != NULL) {
- char m[1000];
- _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
- free($2);
- yyerror(& @2, state, m);
- YYERROR;
- } else if (target == NULL) {
- free($2);
- yyerror(& @4, state,
- "undefined variable binding in ALIAS statement");
- YYERROR;
- } else {
- _mesa_symbol_table_add_symbol(state->st, 0, $2, target);
- }
- }
- ;
-
-string: IDENTIFIER
- | USED_IDENTIFIER
- ;
-
-%%
-
-void
-asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- /* In the core ARB extensions only the KIL instruction doesn't have a
- * destination register.
- */
- if (dst == NULL) {
- init_dst_reg(& inst->Base.DstReg);
- } else {
- inst->Base.DstReg = *dst;
- }
-
- /* The only instruction that doesn't have any source registers is the
- * condition-code based KIL instruction added by NV_fragment_program_option.
- */
- if (src0 != NULL) {
- inst->Base.SrcReg[0] = src0->Base;
- inst->SrcReg[0] = *src0;
- } else {
- init_src_reg(& inst->SrcReg[0]);
- }
-
- if (src1 != NULL) {
- inst->Base.SrcReg[1] = src1->Base;
- inst->SrcReg[1] = *src1;
- } else {
- init_src_reg(& inst->SrcReg[1]);
- }
-
- if (src2 != NULL) {
- inst->Base.SrcReg[2] = src2->Base;
- inst->SrcReg[2] = *src2;
- } else {
- init_src_reg(& inst->SrcReg[2]);
- }
-}
-
-
-struct asm_instruction *
-asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = op;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-struct asm_instruction *
-asm_instruction_copy_ctor(const struct prog_instruction *base,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = base->Opcode;
- inst->Base.CondUpdate = base->CondUpdate;
- inst->Base.CondDst = base->CondDst;
- inst->Base.SaturateMode = base->SaturateMode;
- inst->Base.Precision = base->Precision;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-void
-init_dst_reg(struct prog_dst_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->File = PROGRAM_UNDEFINED;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-/** Like init_dst_reg() but set the File and Index fields. */
-void
-set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
-{
- const GLint maxIndex = 1 << INST_INDEX_BITS;
- const GLint minIndex = 0;
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- ASSERT(file == PROGRAM_TEMPORARY ||
- file == PROGRAM_ADDRESS ||
- file == PROGRAM_OUTPUT);
- memset(r, 0, sizeof(*r));
- r->File = file;
- r->Index = index;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-void
-init_src_reg(struct asm_src_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->Base.File = PROGRAM_UNDEFINED;
- r->Base.Swizzle = SWIZZLE_NOOP;
- r->Symbol = NULL;
-}
-
-
-/** Like init_src_reg() but set the File and Index fields.
- * \return GL_TRUE if a valid src register, GL_FALSE otherwise
- */
-void
-set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index)
-{
- set_src_reg_swz(r, file, index, SWIZZLE_XYZW);
-}
-
-
-void
-set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
- GLuint swizzle)
-{
- const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
- const GLint minIndex = -(1 << INST_INDEX_BITS);
- ASSERT(file < PROGRAM_FILE_MAX);
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- memset(r, 0, sizeof(*r));
- r->Base.File = file;
- r->Base.Index = index;
- r->Base.Swizzle = swizzle;
- r->Symbol = NULL;
-}
-
-
-/**
- * Validate the set of inputs used by a program
- *
- * Validates that legal sets of inputs are used by the program. In this case
- * "used" included both reading the input or binding the input to a name using
- * the \c ATTRIB command.
- *
- * \return
- * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
- */
-int
-validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
-{
- const int inputs = state->prog->InputsRead | state->InputsBound;
-
- if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
- yyerror(locp, state, "illegal use of generic attribute and name attribute");
- return 0;
- }
-
- return 1;
-}
-
-
-struct asm_symbol *
-declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
- struct YYLTYPE *locp)
-{
- struct asm_symbol *s = NULL;
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, name);
-
-
- if (exist != NULL) {
- yyerror(locp, state, "redeclared identifier");
- } else {
- s = calloc(1, sizeof(struct asm_symbol));
- s->name = name;
- s->type = t;
-
- switch (t) {
- case at_temp:
- if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
- yyerror(locp, state, "too many temporaries declared");
- free(s);
- return NULL;
- }
-
- s->temp_binding = state->prog->NumTemporaries;
- state->prog->NumTemporaries++;
- break;
-
- case at_address:
- if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
- yyerror(locp, state, "too many address registers declared");
- free(s);
- return NULL;
- }
-
- /* FINISHME: Add support for multiple address registers.
- */
- state->prog->NumAddressRegs++;
- break;
-
- default:
- break;
- }
-
- _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
- s->next = state->sym;
- state->sym = s;
- }
-
- return s;
-}
-
-
-int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH])
-{
- const GLuint size = 4; /* XXX fix */
- char *name;
- GLint index;
-
- name = _mesa_program_state_string(tokens);
- index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
- size, GL_NONE, NULL, tokens, 0x0);
- param_list->StateFlags |= _mesa_program_state_flags(tokens);
-
- /* free name string here since we duplicated it in add_parameter() */
- free(name);
-
- return index;
-}
-
-
-int
-initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_MATRIX that has multiple rows, we need to
- * unroll it and call add_state_reference() for each row
- */
- if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
- state_tokens[0] == STATE_PROJECTION_MATRIX ||
- state_tokens[0] == STATE_MVP_MATRIX ||
- state_tokens[0] == STATE_TEXTURE_MATRIX ||
- state_tokens[0] == STATE_PROGRAM_MATRIX)
- && (state_tokens[2] != state_tokens[3])) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
-
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-int
-initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
- || (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
- assert((state_tokens[1] == STATE_ENV)
- || (state_tokens[1] == STATE_LOCAL));
-
- /*
- * The param type is STATE_VAR. The program parameter entry will
- * effectively be a pointer into the LOCAL or ENV parameter array.
- */
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
- * we need to unroll it and call add_state_reference() for each row
- */
- if (state_tokens[2] != state_tokens[3]) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-/**
- * Put a float/vector constant/literal into the parameter list.
- * \param param_var returns info about the parameter/constant's location,
- * binding, type, etc.
- * \param vec the vector/constant to add
- * \param allowSwizzle if true, try to consolidate constants which only differ
- * by a swizzle. We don't want to do this when building
- * arrays of constants that may be indexed indirectly.
- * \return index of the constant in the parameter list.
- */
-int
-initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var,
- const struct asm_vector *vec,
- GLboolean allowSwizzle)
-{
- unsigned swizzle;
- const int idx = _mesa_add_unnamed_constant(prog->Parameters,
- vec->data, vec->count,
- allowSwizzle ? &swizzle : NULL);
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_CONSTANT;
-
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
-
- return idx;
-}
-
-
-char *
-make_error_string(const char *fmt, ...)
-{
- int length;
- char *str;
- va_list args;
-
-
- /* Call vsnprintf once to determine how large the final string is. Call it
- * again to do the actual formatting. from the vsnprintf manual page:
- *
- * Upon successful return, these functions return the number of
- * characters printed (not including the trailing '\0' used to end
- * output to strings).
- */
- va_start(args, fmt);
- length = 1 + vsnprintf(NULL, 0, fmt, args);
- va_end(args);
-
- str = malloc(length);
- if (str) {
- va_start(args, fmt);
- vsnprintf(str, length, fmt, args);
- va_end(args);
- }
-
- return str;
-}
-
-
-void
-yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
-{
- char *err_str;
-
-
- err_str = make_error_string("glProgramStringARB(%s)\n", s);
- if (err_str) {
- _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
- free(err_str);
- }
-
- err_str = make_error_string("line %u, char %u: error: %s\n",
- locp->first_line, locp->first_column, s);
- _mesa_set_program_error(state->ctx, locp->position, err_str);
-
- if (err_str) {
- free(err_str);
- }
-}
-
-
-GLboolean
-_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
- GLsizei len, struct asm_parser_state *state)
-{
- struct asm_instruction *inst;
- unsigned i;
- GLubyte *strz;
- GLboolean result = GL_FALSE;
- void *temp;
- struct asm_symbol *sym;
-
- state->ctx = ctx;
- state->prog->Target = target;
- state->prog->Parameters = _mesa_new_parameter_list();
-
- /* Make a copy of the program string and force it to be NUL-terminated.
- */
- strz = (GLubyte *) malloc(len + 1);
- if (strz == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
- return GL_FALSE;
- }
- memcpy (strz, str, len);
- strz[len] = '\0';
-
- state->prog->String = strz;
-
- state->st = _mesa_symbol_table_ctor();
-
- state->limits = (target == GL_VERTEX_PROGRAM_ARB)
- ? & ctx->Const.VertexProgram
- : & ctx->Const.FragmentProgram;
-
- state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
- state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
- state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
- state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
- state->MaxLights = ctx->Const.MaxLights;
- state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
-
- state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
- ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
-
- _mesa_set_program_error(ctx, -1, NULL);
-
- _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
- yyparse(state);
- _mesa_program_lexer_dtor(state->scanner);
-
-
- if (ctx->Program.ErrorPos != -1) {
- goto error;
- }
-
- if (! _mesa_layout_parameters(state)) {
- struct YYLTYPE loc;
-
- loc.first_line = 0;
- loc.first_column = 0;
- loc.position = len;
-
- yyerror(& loc, state, "invalid PARAM usage");
- goto error;
- }
-
-
-
- /* Add one instruction to store the "END" instruction.
- */
- state->prog->Instructions =
- _mesa_alloc_instructions(state->prog->NumInstructions + 1);
- inst = state->inst_head;
- for (i = 0; i < state->prog->NumInstructions; i++) {
- struct asm_instruction *const temp = inst->next;
-
- state->prog->Instructions[i] = inst->Base;
- inst = temp;
- }
-
- /* Finally, tag on an OPCODE_END instruction */
- {
- const GLuint numInst = state->prog->NumInstructions;
- _mesa_init_instructions(state->prog->Instructions + numInst, 1);
- state->prog->Instructions[numInst].Opcode = OPCODE_END;
- }
- state->prog->NumInstructions++;
-
- state->prog->NumParameters = state->prog->Parameters->NumParameters;
- state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
-
- /*
- * Initialize native counts to logical counts. The device driver may
- * change them if program is translated into a hardware program.
- */
- state->prog->NumNativeInstructions = state->prog->NumInstructions;
- state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
- state->prog->NumNativeParameters = state->prog->NumParameters;
- state->prog->NumNativeAttributes = state->prog->NumAttributes;
- state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
-
- result = GL_TRUE;
-
-error:
- for (inst = state->inst_head; inst != NULL; inst = temp) {
- temp = inst->next;
- free(inst);
- }
-
- state->inst_head = NULL;
- state->inst_tail = NULL;
-
- for (sym = state->sym; sym != NULL; sym = temp) {
- temp = sym->next;
-
- free((void *) sym->name);
- free(sym);
- }
- state->sym = NULL;
-
- _mesa_symbol_table_dtor(state->st);
- state->st = NULL;
-
- return result;
-}
+%{ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "main/mtypes.h" +#include "main/imports.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_parameter_layout.h" +#include "program/prog_statevars.h" +#include "program/prog_instruction.h" + +#include "program/symbol_table.h" +#include "program/program_parser.h" + +extern void *yy_scan_string(char *); +extern void yy_delete_buffer(void *); + +static struct asm_symbol *declare_variable(struct asm_parser_state *state, + char *name, enum asm_type t, struct YYLTYPE *locp); + +static int add_state_reference(struct gl_program_parameter_list *param_list, + const gl_state_index tokens[STATE_LENGTH]); + +static int initialize_symbol_from_state(struct gl_program *prog, + struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]); + +static int initialize_symbol_from_param(struct gl_program *prog, + struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]); + +static int initialize_symbol_from_const(struct gl_program *prog, + struct asm_symbol *param_var, const struct asm_vector *vec, + GLboolean allowSwizzle); + +static int yyparse(struct asm_parser_state *state); + +static char *make_error_string(const char *fmt, ...); + +static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state, + const char *s); + +static int validate_inputs(struct YYLTYPE *locp, + struct asm_parser_state *state); + +static void init_dst_reg(struct prog_dst_register *r); + +static void set_dst_reg(struct prog_dst_register *r, + gl_register_file file, GLint index); + +static void init_src_reg(struct asm_src_register *r); + +static void set_src_reg(struct asm_src_register *r, + gl_register_file file, GLint index); + +static void set_src_reg_swz(struct asm_src_register *r, + gl_register_file file, GLint index, GLuint swizzle); + +static void asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, const struct asm_src_register *src0, + const struct asm_src_register *src1, const struct asm_src_register *src2); + +static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, + const struct prog_dst_register *dst, const struct asm_src_register *src0, + const struct asm_src_register *src1, const struct asm_src_register *src2); + +static struct asm_instruction *asm_instruction_copy_ctor( + const struct prog_instruction *base, const struct prog_dst_register *dst, + const struct asm_src_register *src0, const struct asm_src_register *src1, + const struct asm_src_register *src2); + +#ifndef FALSE +#define FALSE 0 +#define TRUE (!FALSE) +#endif + +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do { \ + if (YYID(N)) { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).position = YYRHSLOC(Rhs, 1).position; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } else { \ + (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \ + (Current).last_line = (Current).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \ + (Current).last_column = (Current).first_column; \ + (Current).position = YYRHSLOC(Rhs, 0).position \ + + (Current).first_column; \ + } \ + } while(YYID(0)) + +#define YYLEX_PARAM state->scanner +%} + +%pure-parser +%locations +%parse-param { struct asm_parser_state *state } +%error-verbose +%lex-param { void *scanner } + +%union { + struct asm_instruction *inst; + struct asm_symbol *sym; + struct asm_symbol temp_sym; + struct asm_swizzle_mask swiz_mask; + struct asm_src_register src_reg; + struct prog_dst_register dst_reg; + struct prog_instruction temp_inst; + char *string; + unsigned result; + unsigned attrib; + int integer; + float real; + gl_state_index state[STATE_LENGTH]; + int negate; + struct asm_vector vector; + gl_inst_opcode opcode; + + struct { + unsigned swz; + unsigned rgba_valid:1; + unsigned xyzw_valid:1; + unsigned negate:1; + } ext_swizzle; +} + +%token ARBvp_10 ARBfp_10 + +/* Tokens for assembler pseudo-ops */ +%token <integer> ADDRESS +%token ALIAS ATTRIB +%token OPTION OUTPUT +%token PARAM +%token <integer> TEMP +%token END + + /* Tokens for instructions */ +%token <temp_inst> BIN_OP BINSC_OP SAMPLE_OP SCALAR_OP TRI_OP VECTOR_OP +%token <temp_inst> ARL KIL SWZ TXD_OP + +%token <integer> INTEGER +%token <real> REAL + +%token AMBIENT ATTENUATION +%token BACK +%token CLIP COLOR +%token DEPTH DIFFUSE DIRECTION +%token EMISSION ENV EYE +%token FOG FOGCOORD FRAGMENT FRONT +%token HALF +%token INVERSE INVTRANS +%token LIGHT LIGHTMODEL LIGHTPROD LOCAL +%token MATERIAL MAT_PROGRAM MATRIX MATRIXINDEX MODELVIEW MVP +%token NORMAL +%token OBJECT +%token PALETTE PARAMS PLANE POINT_TOK POINTSIZE POSITION PRIMARY PROGRAM PROJECTION +%token RANGE RESULT ROW +%token SCENECOLOR SECONDARY SHININESS SIZE_TOK SPECULAR SPOT STATE +%token TEXCOORD TEXENV TEXGEN TEXGEN_Q TEXGEN_R TEXGEN_S TEXGEN_T TEXTURE TRANSPOSE +%token TEXTURE_UNIT TEX_1D TEX_2D TEX_3D TEX_CUBE TEX_RECT +%token TEX_SHADOW1D TEX_SHADOW2D TEX_SHADOWRECT +%token TEX_ARRAY1D TEX_ARRAY2D TEX_ARRAYSHADOW1D TEX_ARRAYSHADOW2D +%token VERTEX VTXATTRIB +%token WEIGHT + +%token <string> IDENTIFIER USED_IDENTIFIER +%type <string> string +%token <swiz_mask> MASK4 MASK3 MASK2 MASK1 SWIZZLE +%token DOT_DOT +%token DOT + +%type <inst> instruction ALU_instruction TexInstruction +%type <inst> ARL_instruction VECTORop_instruction +%type <inst> SCALARop_instruction BINSCop_instruction BINop_instruction +%type <inst> TRIop_instruction TXD_instruction SWZ_instruction SAMPLE_instruction +%type <inst> KIL_instruction + +%type <dst_reg> dstReg maskedDstReg maskedAddrReg +%type <src_reg> srcReg scalarUse scalarSrcReg swizzleSrcReg +%type <swiz_mask> scalarSuffix swizzleSuffix extendedSwizzle +%type <ext_swizzle> extSwizComp extSwizSel +%type <swiz_mask> optionalMask + +%type <sym> progParamArray +%type <integer> addrRegRelOffset addrRegPosOffset addrRegNegOffset +%type <src_reg> progParamArrayMem progParamArrayAbs progParamArrayRel +%type <sym> addrReg +%type <swiz_mask> addrComponent addrWriteMask + +%type <dst_reg> ccMaskRule ccTest ccMaskRule2 ccTest2 optionalCcMask + +%type <result> resultBinding resultColBinding +%type <integer> optFaceType optColorType +%type <integer> optResultFaceType optResultColorType + +%type <integer> optTexImageUnitNum texImageUnitNum +%type <integer> optTexCoordUnitNum texCoordUnitNum +%type <integer> optLegacyTexUnitNum legacyTexUnitNum +%type <integer> texImageUnit texTarget +%type <integer> vtxAttribNum + +%type <attrib> attribBinding vtxAttribItem fragAttribItem + +%type <temp_sym> paramSingleInit paramSingleItemDecl +%type <integer> optArraySize + +%type <state> stateSingleItem stateMultipleItem +%type <state> stateMaterialItem +%type <state> stateLightItem stateLightModelItem stateLightProdItem +%type <state> stateTexGenItem stateFogItem stateClipPlaneItem statePointItem +%type <state> stateMatrixItem stateMatrixRow stateMatrixRows +%type <state> stateTexEnvItem stateDepthItem + +%type <state> stateLModProperty +%type <state> stateMatrixName optMatrixRows + +%type <integer> stateMatProperty +%type <integer> stateLightProperty stateSpotProperty +%type <integer> stateLightNumber stateLProdProperty +%type <integer> stateTexGenType stateTexGenCoord +%type <integer> stateTexEnvProperty +%type <integer> stateFogProperty +%type <integer> stateClipPlaneNum +%type <integer> statePointProperty + +%type <integer> stateOptMatModifier stateMatModifier stateMatrixRowNum +%type <integer> stateOptModMatNum stateModMatNum statePaletteMatNum +%type <integer> stateProgramMatNum + +%type <integer> ambDiffSpecProperty + +%type <state> programSingleItem progEnvParam progLocalParam +%type <state> programMultipleItem progEnvParams progLocalParams + +%type <temp_sym> paramMultipleInit paramMultInitList paramMultipleItem +%type <temp_sym> paramSingleItemUse + +%type <integer> progEnvParamNum progLocalParamNum +%type <state> progEnvParamNums progLocalParamNums + +%type <vector> paramConstDecl paramConstUse +%type <vector> paramConstScalarDecl paramConstScalarUse paramConstVector +%type <real> signedFloatConstant +%type <negate> optionalSign + +%{ +extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, + void *yyscanner); +%} + +%% + +program: language optionSequence statementSequence END + ; + +language: ARBvp_10 + { + if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { + yyerror(& @1, state, "invalid fragment program header"); + + } + state->mode = ARB_vertex; + } + | ARBfp_10 + { + if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { + yyerror(& @1, state, "invalid vertex program header"); + } + state->mode = ARB_fragment; + + state->option.TexRect = + (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE); + } + ; + +optionSequence: optionSequence option + | + ; + +option: OPTION string ';' + { + int valid = 0; + + if (state->mode == ARB_vertex) { + valid = _mesa_ARBvp_parse_option(state, $2); + } else if (state->mode == ARB_fragment) { + valid = _mesa_ARBfp_parse_option(state, $2); + } + + + free($2); + + if (!valid) { + const char *const err_str = (state->mode == ARB_vertex) + ? "invalid ARB vertex program option" + : "invalid ARB fragment program option"; + + yyerror(& @2, state, err_str); + YYERROR; + } + } + ; + +statementSequence: statementSequence statement + | + ; + +statement: instruction ';' + { + if ($1 != NULL) { + if (state->inst_tail == NULL) { + state->inst_head = $1; + } else { + state->inst_tail->next = $1; + } + + state->inst_tail = $1; + $1->next = NULL; + + state->prog->NumInstructions++; + } + } + | namingStatement ';' + ; + +instruction: ALU_instruction + { + $$ = $1; + state->prog->NumAluInstructions++; + } + | TexInstruction + { + $$ = $1; + state->prog->NumTexInstructions++; + } + ; + +ALU_instruction: ARL_instruction + | VECTORop_instruction + | SCALARop_instruction + | BINSCop_instruction + | BINop_instruction + | TRIop_instruction + | SWZ_instruction + ; + +TexInstruction: SAMPLE_instruction + | KIL_instruction + | TXD_instruction + ; + +ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg + { + $$ = asm_instruction_ctor(OPCODE_ARL, & $2, & $4, NULL, NULL); + } + ; + +VECTORop_instruction: VECTOR_OP maskedDstReg ',' swizzleSrcReg + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); + } + ; + +SCALARop_instruction: SCALAR_OP maskedDstReg ',' scalarSrcReg + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); + } + ; + +BINSCop_instruction: BINSC_OP maskedDstReg ',' scalarSrcReg ',' scalarSrcReg + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL); + } + ; + + +BINop_instruction: BIN_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL); + } + ; + +TRIop_instruction: TRI_OP maskedDstReg ',' + swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8); + } + ; + +SAMPLE_instruction: SAMPLE_OP maskedDstReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); + if ($$ != NULL) { + const GLbitfield tex_mask = (1U << $6); + GLbitfield shadow_tex = 0; + GLbitfield target_mask = 0; + + + $$->Base.TexSrcUnit = $6; + + if ($8 < 0) { + shadow_tex = tex_mask; + + $$->Base.TexSrcTarget = -$8; + $$->Base.TexShadow = 1; + } else { + $$->Base.TexSrcTarget = $8; + } + + target_mask = (1U << $$->Base.TexSrcTarget); + + /* If this texture unit was previously accessed and that access + * had a different texture target, generate an error. + * + * If this texture unit was previously accessed and that access + * had a different shadow mode, generate an error. + */ + if ((state->prog->TexturesUsed[$6] != 0) + && ((state->prog->TexturesUsed[$6] != target_mask) + || ((state->prog->ShadowSamplers & tex_mask) + != shadow_tex))) { + yyerror(& @8, state, + "multiple targets used on one texture image unit"); + YYERROR; + } + + + state->prog->TexturesUsed[$6] |= target_mask; + state->prog->ShadowSamplers |= shadow_tex; + } + } + ; + +KIL_instruction: KIL swizzleSrcReg + { + $$ = asm_instruction_ctor(OPCODE_KIL, NULL, & $2, NULL, NULL); + state->fragment.UsesKill = 1; + } + | KIL ccTest + { + $$ = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); + $$->Base.DstReg.CondMask = $2.CondMask; + $$->Base.DstReg.CondSwizzle = $2.CondSwizzle; + $$->Base.DstReg.CondSrc = $2.CondSrc; + state->fragment.UsesKill = 1; + } + ; + +TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget + { + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8); + if ($$ != NULL) { + const GLbitfield tex_mask = (1U << $10); + GLbitfield shadow_tex = 0; + GLbitfield target_mask = 0; + + + $$->Base.TexSrcUnit = $10; + + if ($12 < 0) { + shadow_tex = tex_mask; + + $$->Base.TexSrcTarget = -$12; + $$->Base.TexShadow = 1; + } else { + $$->Base.TexSrcTarget = $12; + } + + target_mask = (1U << $$->Base.TexSrcTarget); + + /* If this texture unit was previously accessed and that access + * had a different texture target, generate an error. + * + * If this texture unit was previously accessed and that access + * had a different shadow mode, generate an error. + */ + if ((state->prog->TexturesUsed[$10] != 0) + && ((state->prog->TexturesUsed[$10] != target_mask) + || ((state->prog->ShadowSamplers & tex_mask) + != shadow_tex))) { + yyerror(& @12, state, + "multiple targets used on one texture image unit"); + YYERROR; + } + + + state->prog->TexturesUsed[$10] |= target_mask; + state->prog->ShadowSamplers |= shadow_tex; + } + } + ; + +texImageUnit: TEXTURE_UNIT optTexImageUnitNum + { + $$ = $2; + } + ; + +texTarget: TEX_1D { $$ = TEXTURE_1D_INDEX; } + | TEX_2D { $$ = TEXTURE_2D_INDEX; } + | TEX_3D { $$ = TEXTURE_3D_INDEX; } + | TEX_CUBE { $$ = TEXTURE_CUBE_INDEX; } + | TEX_RECT { $$ = TEXTURE_RECT_INDEX; } + | TEX_SHADOW1D { $$ = -TEXTURE_1D_INDEX; } + | TEX_SHADOW2D { $$ = -TEXTURE_2D_INDEX; } + | TEX_SHADOWRECT { $$ = -TEXTURE_RECT_INDEX; } + | TEX_ARRAY1D { $$ = TEXTURE_1D_ARRAY_INDEX; } + | TEX_ARRAY2D { $$ = TEXTURE_2D_ARRAY_INDEX; } + | TEX_ARRAYSHADOW1D { $$ = -TEXTURE_1D_ARRAY_INDEX; } + | TEX_ARRAYSHADOW2D { $$ = -TEXTURE_2D_ARRAY_INDEX; } + ; + +SWZ_instruction: SWZ maskedDstReg ',' srcReg ',' extendedSwizzle + { + /* FIXME: Is this correct? Should the extenedSwizzle be applied + * FIXME: to the existing swizzle? + */ + $4.Base.Swizzle = $6.swizzle; + $4.Base.Negate = $6.mask; + + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); + } + ; + +scalarSrcReg: optionalSign scalarUse + { + $$ = $2; + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + } + | optionalSign '|' scalarUse '|' + { + $$ = $3; + + if (!state->option.NV_fragment) { + yyerror(& @2, state, "unexpected character '|'"); + YYERROR; + } + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + + $$.Base.Abs = 1; + } + ; + +scalarUse: srcReg scalarSuffix + { + $$ = $1; + + $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, + $2.swizzle); + } + | paramConstScalarUse + { + struct asm_symbol temp_sym; + + if (!state->option.NV_fragment) { + yyerror(& @1, state, "expected scalar suffix"); + YYERROR; + } + + memset(& temp_sym, 0, sizeof(temp_sym)); + temp_sym.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE); + + set_src_reg_swz(& $$, PROGRAM_CONSTANT, + temp_sym.param_binding_begin, + temp_sym.param_binding_swizzle); + } + ; + +swizzleSrcReg: optionalSign srcReg swizzleSuffix + { + $$ = $2; + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + + $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, + $3.swizzle); + } + | optionalSign '|' srcReg swizzleSuffix '|' + { + $$ = $3; + + if (!state->option.NV_fragment) { + yyerror(& @2, state, "unexpected character '|'"); + YYERROR; + } + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + + $$.Base.Abs = 1; + $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, + $4.swizzle); + } + + ; + +maskedDstReg: dstReg optionalMask optionalCcMask + { + $$ = $1; + $$.WriteMask = $2.mask; + $$.CondMask = $3.CondMask; + $$.CondSwizzle = $3.CondSwizzle; + $$.CondSrc = $3.CondSrc; + + if ($$.File == PROGRAM_OUTPUT) { + /* Technically speaking, this should check that it is in + * vertex program mode. However, PositionInvariant can never be + * set in fragment program mode, so it is somewhat irrelevant. + */ + if (state->option.PositionInvariant + && ($$.Index == VERT_RESULT_HPOS)) { + yyerror(& @1, state, "position-invariant programs cannot " + "write position"); + YYERROR; + } + + state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index); + } + } + ; + +maskedAddrReg: addrReg addrWriteMask + { + set_dst_reg(& $$, PROGRAM_ADDRESS, 0); + $$.WriteMask = $2.mask; + } + ; + +extendedSwizzle: extSwizComp ',' extSwizComp ',' extSwizComp ',' extSwizComp + { + const unsigned xyzw_valid = + ($1.xyzw_valid << 0) + | ($3.xyzw_valid << 1) + | ($5.xyzw_valid << 2) + | ($7.xyzw_valid << 3); + const unsigned rgba_valid = + ($1.rgba_valid << 0) + | ($3.rgba_valid << 1) + | ($5.rgba_valid << 2) + | ($7.rgba_valid << 3); + + /* All of the swizzle components have to be valid in either RGBA + * or XYZW. Note that 0 and 1 are valid in both, so both masks + * can have some bits set. + * + * We somewhat deviate from the spec here. It would be really hard + * to figure out which component is the error, and there probably + * isn't a lot of benefit. + */ + if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) { + yyerror(& @1, state, "cannot combine RGBA and XYZW swizzle " + "components"); + YYERROR; + } + + $$.swizzle = MAKE_SWIZZLE4($1.swz, $3.swz, $5.swz, $7.swz); + $$.mask = ($1.negate) | ($3.negate << 1) | ($5.negate << 2) + | ($7.negate << 3); + } + ; + +extSwizComp: optionalSign extSwizSel + { + $$ = $2; + $$.negate = ($1) ? 1 : 0; + } + ; + +extSwizSel: INTEGER + { + if (($1 != 0) && ($1 != 1)) { + yyerror(& @1, state, "invalid extended swizzle selector"); + YYERROR; + } + + $$.swz = ($1 == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE; + + /* 0 and 1 are valid for both RGBA swizzle names and XYZW + * swizzle names. + */ + $$.xyzw_valid = 1; + $$.rgba_valid = 1; + } + | string + { + char s; + + if (strlen($1) > 1) { + yyerror(& @1, state, "invalid extended swizzle selector"); + YYERROR; + } + + s = $1[0]; + free($1); + + switch (s) { + case 'x': + $$.swz = SWIZZLE_X; + $$.xyzw_valid = 1; + break; + case 'y': + $$.swz = SWIZZLE_Y; + $$.xyzw_valid = 1; + break; + case 'z': + $$.swz = SWIZZLE_Z; + $$.xyzw_valid = 1; + break; + case 'w': + $$.swz = SWIZZLE_W; + $$.xyzw_valid = 1; + break; + + case 'r': + $$.swz = SWIZZLE_X; + $$.rgba_valid = 1; + break; + case 'g': + $$.swz = SWIZZLE_Y; + $$.rgba_valid = 1; + break; + case 'b': + $$.swz = SWIZZLE_Z; + $$.rgba_valid = 1; + break; + case 'a': + $$.swz = SWIZZLE_W; + $$.rgba_valid = 1; + break; + + default: + yyerror(& @1, state, "invalid extended swizzle selector"); + YYERROR; + break; + } + } + ; + +srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ + { + struct asm_symbol *const s = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $1); + + free($1); + + if (s == NULL) { + yyerror(& @1, state, "invalid operand variable"); + YYERROR; + } else if ((s->type != at_param) && (s->type != at_temp) + && (s->type != at_attrib)) { + yyerror(& @1, state, "invalid operand variable"); + YYERROR; + } else if ((s->type == at_param) && s->param_is_array) { + yyerror(& @1, state, "non-array access to array PARAM"); + YYERROR; + } + + init_src_reg(& $$); + switch (s->type) { + case at_temp: + set_src_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding); + break; + case at_param: + set_src_reg_swz(& $$, s->param_binding_type, + s->param_binding_begin, + s->param_binding_swizzle); + break; + case at_attrib: + set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding); + state->prog->InputsRead |= (1U << $$.Base.Index); + + if (!validate_inputs(& @1, state)) { + YYERROR; + } + break; + + default: + YYERROR; + break; + } + } + | attribBinding + { + set_src_reg(& $$, PROGRAM_INPUT, $1); + state->prog->InputsRead |= (1U << $$.Base.Index); + + if (!validate_inputs(& @1, state)) { + YYERROR; + } + } + | progParamArray '[' progParamArrayMem ']' + { + if (! $3.Base.RelAddr + && ((unsigned) $3.Base.Index >= $1->param_binding_length)) { + yyerror(& @3, state, "out of bounds array access"); + YYERROR; + } + + init_src_reg(& $$); + $$.Base.File = $1->param_binding_type; + + if ($3.Base.RelAddr) { + state->prog->IndirectRegisterFiles |= (1 << $$.Base.File); + $1->param_accessed_indirectly = 1; + + $$.Base.RelAddr = 1; + $$.Base.Index = $3.Base.Index; + $$.Symbol = $1; + } else { + $$.Base.Index = $1->param_binding_begin + $3.Base.Index; + } + } + | paramSingleItemUse + { + gl_register_file file = ($1.name != NULL) + ? $1.param_binding_type + : PROGRAM_CONSTANT; + set_src_reg_swz(& $$, file, $1.param_binding_begin, + $1.param_binding_swizzle); + } + ; + +dstReg: resultBinding + { + set_dst_reg(& $$, PROGRAM_OUTPUT, $1); + } + | USED_IDENTIFIER /* temporaryReg | vertexResultReg */ + { + struct asm_symbol *const s = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $1); + + free($1); + + if (s == NULL) { + yyerror(& @1, state, "invalid operand variable"); + YYERROR; + } else if ((s->type != at_output) && (s->type != at_temp)) { + yyerror(& @1, state, "invalid operand variable"); + YYERROR; + } + + switch (s->type) { + case at_temp: + set_dst_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding); + break; + case at_output: + set_dst_reg(& $$, PROGRAM_OUTPUT, s->output_binding); + break; + default: + set_dst_reg(& $$, s->param_binding_type, s->param_binding_begin); + break; + } + } + ; + +progParamArray: USED_IDENTIFIER + { + struct asm_symbol *const s = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $1); + + free($1); + + if (s == NULL) { + yyerror(& @1, state, "invalid operand variable"); + YYERROR; + } else if ((s->type != at_param) || !s->param_is_array) { + yyerror(& @1, state, "array access to non-PARAM variable"); + YYERROR; + } else { + $$ = s; + } + } + ; + +progParamArrayMem: progParamArrayAbs | progParamArrayRel; + +progParamArrayAbs: INTEGER + { + init_src_reg(& $$); + $$.Base.Index = $1; + } + ; + +progParamArrayRel: addrReg addrComponent addrRegRelOffset + { + /* FINISHME: Add support for multiple address registers. + */ + /* FINISHME: Add support for 4-component address registers. + */ + init_src_reg(& $$); + $$.Base.RelAddr = 1; + $$.Base.Index = $3; + } + ; + +addrRegRelOffset: { $$ = 0; } + | '+' addrRegPosOffset { $$ = $2; } + | '-' addrRegNegOffset { $$ = -$2; } + ; + +addrRegPosOffset: INTEGER + { + if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) { + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", $1); + yyerror(& @1, state, s); + YYERROR; + } else { + $$ = $1; + } + } + ; + +addrRegNegOffset: INTEGER + { + if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) { + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", $1); + yyerror(& @1, state, s); + YYERROR; + } else { + $$ = $1; + } + } + ; + +addrReg: USED_IDENTIFIER + { + struct asm_symbol *const s = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $1); + + free($1); + + if (s == NULL) { + yyerror(& @1, state, "invalid array member"); + YYERROR; + } else if (s->type != at_address) { + yyerror(& @1, state, + "invalid variable for indexed array access"); + YYERROR; + } else { + $$ = s; + } + } + ; + +addrComponent: MASK1 + { + if ($1.mask != WRITEMASK_X) { + yyerror(& @1, state, "invalid address component selector"); + YYERROR; + } else { + $$ = $1; + } + } + ; + +addrWriteMask: MASK1 + { + if ($1.mask != WRITEMASK_X) { + yyerror(& @1, state, + "address register write mask must be \".x\""); + YYERROR; + } else { + $$ = $1; + } + } + ; + +scalarSuffix: MASK1; + +swizzleSuffix: MASK1 + | MASK4 + | SWIZZLE + | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; } + ; + +optionalMask: MASK4 | MASK3 | MASK2 | MASK1 + | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; } + ; + +optionalCcMask: '(' ccTest ')' + { + $$ = $2; + } + | '(' ccTest2 ')' + { + $$ = $2; + } + | + { + $$.CondMask = COND_TR; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + +ccTest: ccMaskRule swizzleSuffix + { + $$ = $1; + $$.CondSwizzle = $2.swizzle; + } + ; + +ccTest2: ccMaskRule2 swizzleSuffix + { + $$ = $1; + $$.CondSwizzle = $2.swizzle; + } + ; + +ccMaskRule: IDENTIFIER + { + const int cond = _mesa_parse_cc($1); + if ((cond == 0) || ($1[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + free(err_str); + } + + YYERROR; + } + + $$.CondMask = cond; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + +ccMaskRule2: USED_IDENTIFIER + { + const int cond = _mesa_parse_cc($1); + if ((cond == 0) || ($1[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + free(err_str); + } + + YYERROR; + } + + $$.CondMask = cond; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + +namingStatement: ATTRIB_statement + | PARAM_statement + | TEMP_statement + | ADDRESS_statement + | OUTPUT_statement + | ALIAS_statement + ; + +ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding + { + struct asm_symbol *const s = + declare_variable(state, $2, at_attrib, & @2); + + if (s == NULL) { + free($2); + YYERROR; + } else { + s->attrib_binding = $4; + state->InputsBound |= (1U << s->attrib_binding); + + if (!validate_inputs(& @4, state)) { + YYERROR; + } + } + } + ; + +attribBinding: VERTEX vtxAttribItem + { + $$ = $2; + } + | FRAGMENT fragAttribItem + { + $$ = $2; + } + ; + +vtxAttribItem: POSITION + { + $$ = VERT_ATTRIB_POS; + } + | WEIGHT vtxOptWeightNum + { + $$ = VERT_ATTRIB_WEIGHT; + } + | NORMAL + { + $$ = VERT_ATTRIB_NORMAL; + } + | COLOR optColorType + { + if (!state->ctx->Extensions.EXT_secondary_color) { + yyerror(& @2, state, "GL_EXT_secondary_color not supported"); + YYERROR; + } + + $$ = VERT_ATTRIB_COLOR0 + $2; + } + | FOGCOORD + { + if (!state->ctx->Extensions.EXT_fog_coord) { + yyerror(& @1, state, "GL_EXT_fog_coord not supported"); + YYERROR; + } + + $$ = VERT_ATTRIB_FOG; + } + | TEXCOORD optTexCoordUnitNum + { + $$ = VERT_ATTRIB_TEX0 + $2; + } + | MATRIXINDEX '[' vtxWeightNum ']' + { + yyerror(& @1, state, "GL_ARB_matrix_palette not supported"); + YYERROR; + } + | VTXATTRIB '[' vtxAttribNum ']' + { + $$ = VERT_ATTRIB_GENERIC0 + $3; + } + ; + +vtxAttribNum: INTEGER + { + if ((unsigned) $1 >= state->limits->MaxAttribs) { + yyerror(& @1, state, "invalid vertex attribute reference"); + YYERROR; + } + + $$ = $1; + } + ; + +vtxOptWeightNum: | '[' vtxWeightNum ']'; +vtxWeightNum: INTEGER; + +fragAttribItem: POSITION + { + $$ = FRAG_ATTRIB_WPOS; + } + | COLOR optColorType + { + $$ = FRAG_ATTRIB_COL0 + $2; + } + | FOGCOORD + { + $$ = FRAG_ATTRIB_FOGC; + } + | TEXCOORD optTexCoordUnitNum + { + $$ = FRAG_ATTRIB_TEX0 + $2; + } + ; + +PARAM_statement: PARAM_singleStmt | PARAM_multipleStmt; + +PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit + { + struct asm_symbol *const s = + declare_variable(state, $2, at_param, & @2); + + if (s == NULL) { + free($2); + YYERROR; + } else { + s->param_binding_type = $3.param_binding_type; + s->param_binding_begin = $3.param_binding_begin; + s->param_binding_length = $3.param_binding_length; + s->param_binding_swizzle = $3.param_binding_swizzle; + s->param_is_array = 0; + } + } + ; + +PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit + { + if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) { + free($2); + yyerror(& @4, state, + "parameter array size and number of bindings must match"); + YYERROR; + } else { + struct asm_symbol *const s = + declare_variable(state, $2, $6.type, & @2); + + if (s == NULL) { + free($2); + YYERROR; + } else { + s->param_binding_type = $6.param_binding_type; + s->param_binding_begin = $6.param_binding_begin; + s->param_binding_length = $6.param_binding_length; + s->param_binding_swizzle = SWIZZLE_XYZW; + s->param_is_array = 1; + } + } + } + ; + +optArraySize: + { + $$ = 0; + } + | INTEGER + { + if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) { + yyerror(& @1, state, "invalid parameter array size"); + YYERROR; + } else { + $$ = $1; + } + } + ; + +paramSingleInit: '=' paramSingleItemDecl + { + $$ = $2; + } + ; + +paramMultipleInit: '=' '{' paramMultInitList '}' + { + $$ = $3; + } + ; + +paramMultInitList: paramMultipleItem + | paramMultInitList ',' paramMultipleItem + { + $1.param_binding_length += $3.param_binding_length; + $$ = $1; + } + ; + +paramSingleItemDecl: stateSingleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_state(state->prog, & $$, $1); + } + | programSingleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_param(state->prog, & $$, $1); + } + | paramConstDecl + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE); + } + ; + +paramSingleItemUse: stateSingleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_state(state->prog, & $$, $1); + } + | programSingleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_param(state->prog, & $$, $1); + } + | paramConstUse + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE); + } + ; + +paramMultipleItem: stateMultipleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_state(state->prog, & $$, $1); + } + | programMultipleItem + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_param(state->prog, & $$, $1); + } + | paramConstDecl + { + memset(& $$, 0, sizeof($$)); + $$.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE); + } + ; + +stateMultipleItem: stateSingleItem { memcpy($$, $1, sizeof($$)); } + | STATE stateMatrixRows { memcpy($$, $2, sizeof($$)); } + ; + +stateSingleItem: STATE stateMaterialItem { memcpy($$, $2, sizeof($$)); } + | STATE stateLightItem { memcpy($$, $2, sizeof($$)); } + | STATE stateLightModelItem { memcpy($$, $2, sizeof($$)); } + | STATE stateLightProdItem { memcpy($$, $2, sizeof($$)); } + | STATE stateTexGenItem { memcpy($$, $2, sizeof($$)); } + | STATE stateTexEnvItem { memcpy($$, $2, sizeof($$)); } + | STATE stateFogItem { memcpy($$, $2, sizeof($$)); } + | STATE stateClipPlaneItem { memcpy($$, $2, sizeof($$)); } + | STATE statePointItem { memcpy($$, $2, sizeof($$)); } + | STATE stateMatrixRow { memcpy($$, $2, sizeof($$)); } + | STATE stateDepthItem { memcpy($$, $2, sizeof($$)); } + ; + +stateMaterialItem: MATERIAL optFaceType stateMatProperty + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_MATERIAL; + $$[1] = $2; + $$[2] = $3; + } + ; + +stateMatProperty: ambDiffSpecProperty + { + $$ = $1; + } + | EMISSION + { + $$ = STATE_EMISSION; + } + | SHININESS + { + $$ = STATE_SHININESS; + } + ; + +stateLightItem: LIGHT '[' stateLightNumber ']' stateLightProperty + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_LIGHT; + $$[1] = $3; + $$[2] = $5; + } + ; + +stateLightProperty: ambDiffSpecProperty + { + $$ = $1; + } + | POSITION + { + $$ = STATE_POSITION; + } + | ATTENUATION + { + if (!state->ctx->Extensions.EXT_point_parameters) { + yyerror(& @1, state, "GL_ARB_point_parameters not supported"); + YYERROR; + } + + $$ = STATE_ATTENUATION; + } + | SPOT stateSpotProperty + { + $$ = $2; + } + | HALF + { + $$ = STATE_HALF_VECTOR; + } + ; + +stateSpotProperty: DIRECTION + { + $$ = STATE_SPOT_DIRECTION; + } + ; + +stateLightModelItem: LIGHTMODEL stateLModProperty + { + $$[0] = $2[0]; + $$[1] = $2[1]; + } + ; + +stateLModProperty: AMBIENT + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_LIGHTMODEL_AMBIENT; + } + | optFaceType SCENECOLOR + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_LIGHTMODEL_SCENECOLOR; + $$[1] = $1; + } + ; + +stateLightProdItem: LIGHTPROD '[' stateLightNumber ']' optFaceType stateLProdProperty + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_LIGHTPROD; + $$[1] = $3; + $$[2] = $5; + $$[3] = $6; + } + ; + +stateLProdProperty: ambDiffSpecProperty; + +stateTexEnvItem: TEXENV optLegacyTexUnitNum stateTexEnvProperty + { + memset($$, 0, sizeof($$)); + $$[0] = $3; + $$[1] = $2; + } + ; + +stateTexEnvProperty: COLOR + { + $$ = STATE_TEXENV_COLOR; + } + ; + +ambDiffSpecProperty: AMBIENT + { + $$ = STATE_AMBIENT; + } + | DIFFUSE + { + $$ = STATE_DIFFUSE; + } + | SPECULAR + { + $$ = STATE_SPECULAR; + } + ; + +stateLightNumber: INTEGER + { + if ((unsigned) $1 >= state->MaxLights) { + yyerror(& @1, state, "invalid light selector"); + YYERROR; + } + + $$ = $1; + } + ; + +stateTexGenItem: TEXGEN optTexCoordUnitNum stateTexGenType stateTexGenCoord + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_TEXGEN; + $$[1] = $2; + $$[2] = $3 + $4; + } + ; + +stateTexGenType: EYE + { + $$ = STATE_TEXGEN_EYE_S; + } + | OBJECT + { + $$ = STATE_TEXGEN_OBJECT_S; + } + ; +stateTexGenCoord: TEXGEN_S + { + $$ = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; + } + | TEXGEN_T + { + $$ = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; + } + | TEXGEN_R + { + $$ = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; + } + | TEXGEN_Q + { + $$ = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; + } + ; + +stateFogItem: FOG stateFogProperty + { + memset($$, 0, sizeof($$)); + $$[0] = $2; + } + ; + +stateFogProperty: COLOR + { + $$ = STATE_FOG_COLOR; + } + | PARAMS + { + $$ = STATE_FOG_PARAMS; + } + ; + +stateClipPlaneItem: CLIP '[' stateClipPlaneNum ']' PLANE + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_CLIPPLANE; + $$[1] = $3; + } + ; + +stateClipPlaneNum: INTEGER + { + if ((unsigned) $1 >= state->MaxClipPlanes) { + yyerror(& @1, state, "invalid clip plane selector"); + YYERROR; + } + + $$ = $1; + } + ; + +statePointItem: POINT_TOK statePointProperty + { + memset($$, 0, sizeof($$)); + $$[0] = $2; + } + ; + +statePointProperty: SIZE_TOK + { + $$ = STATE_POINT_SIZE; + } + | ATTENUATION + { + $$ = STATE_POINT_ATTENUATION; + } + ; + +stateMatrixRow: stateMatrixItem ROW '[' stateMatrixRowNum ']' + { + $$[0] = $1[0]; + $$[1] = $1[1]; + $$[2] = $4; + $$[3] = $4; + $$[4] = $1[2]; + } + ; + +stateMatrixRows: stateMatrixItem optMatrixRows + { + $$[0] = $1[0]; + $$[1] = $1[1]; + $$[2] = $2[2]; + $$[3] = $2[3]; + $$[4] = $1[2]; + } + ; + +optMatrixRows: + { + $$[2] = 0; + $$[3] = 3; + } + | ROW '[' stateMatrixRowNum DOT_DOT stateMatrixRowNum ']' + { + /* It seems logical that the matrix row range specifier would have + * to specify a range or more than one row (i.e., $5 > $3). + * However, the ARB_vertex_program spec says "a program will fail + * to load if <a> is greater than <b>." This means that $3 == $5 + * is valid. + */ + if ($3 > $5) { + yyerror(& @3, state, "invalid matrix row range"); + YYERROR; + } + + $$[2] = $3; + $$[3] = $5; + } + ; + +stateMatrixItem: MATRIX stateMatrixName stateOptMatModifier + { + $$[0] = $2[0]; + $$[1] = $2[1]; + $$[2] = $3; + } + ; + +stateOptMatModifier: + { + $$ = 0; + } + | stateMatModifier + { + $$ = $1; + } + ; + +stateMatModifier: INVERSE + { + $$ = STATE_MATRIX_INVERSE; + } + | TRANSPOSE + { + $$ = STATE_MATRIX_TRANSPOSE; + } + | INVTRANS + { + $$ = STATE_MATRIX_INVTRANS; + } + ; + +stateMatrixRowNum: INTEGER + { + if ($1 > 3) { + yyerror(& @1, state, "invalid matrix row reference"); + YYERROR; + } + + $$ = $1; + } + ; + +stateMatrixName: MODELVIEW stateOptModMatNum + { + $$[0] = STATE_MODELVIEW_MATRIX; + $$[1] = $2; + } + | PROJECTION + { + $$[0] = STATE_PROJECTION_MATRIX; + $$[1] = 0; + } + | MVP + { + $$[0] = STATE_MVP_MATRIX; + $$[1] = 0; + } + | TEXTURE optTexCoordUnitNum + { + $$[0] = STATE_TEXTURE_MATRIX; + $$[1] = $2; + } + | PALETTE '[' statePaletteMatNum ']' + { + yyerror(& @1, state, "GL_ARB_matrix_palette not supported"); + YYERROR; + } + | MAT_PROGRAM '[' stateProgramMatNum ']' + { + $$[0] = STATE_PROGRAM_MATRIX; + $$[1] = $3; + } + ; + +stateOptModMatNum: + { + $$ = 0; + } + | '[' stateModMatNum ']' + { + $$ = $2; + } + ; +stateModMatNum: INTEGER + { + /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix + * zero is valid. + */ + if ($1 != 0) { + yyerror(& @1, state, "invalid modelview matrix index"); + YYERROR; + } + + $$ = $1; + } + ; +statePaletteMatNum: INTEGER + { + /* Since GL_ARB_matrix_palette isn't supported, just let any value + * through here. The error will be generated later. + */ + $$ = $1; + } + ; +stateProgramMatNum: INTEGER + { + if ((unsigned) $1 >= state->MaxProgramMatrices) { + yyerror(& @1, state, "invalid program matrix selector"); + YYERROR; + } + + $$ = $1; + } + ; + +stateDepthItem: DEPTH RANGE + { + memset($$, 0, sizeof($$)); + $$[0] = STATE_DEPTH_RANGE; + } + ; + + +programSingleItem: progEnvParam | progLocalParam; + +programMultipleItem: progEnvParams | progLocalParams; + +progEnvParams: PROGRAM ENV '[' progEnvParamNums ']' + { + memset($$, 0, sizeof($$)); + $$[0] = state->state_param_enum; + $$[1] = STATE_ENV; + $$[2] = $4[0]; + $$[3] = $4[1]; + } + ; + +progEnvParamNums: progEnvParamNum + { + $$[0] = $1; + $$[1] = $1; + } + | progEnvParamNum DOT_DOT progEnvParamNum + { + $$[0] = $1; + $$[1] = $3; + } + ; + +progEnvParam: PROGRAM ENV '[' progEnvParamNum ']' + { + memset($$, 0, sizeof($$)); + $$[0] = state->state_param_enum; + $$[1] = STATE_ENV; + $$[2] = $4; + $$[3] = $4; + } + ; + +progLocalParams: PROGRAM LOCAL '[' progLocalParamNums ']' + { + memset($$, 0, sizeof($$)); + $$[0] = state->state_param_enum; + $$[1] = STATE_LOCAL; + $$[2] = $4[0]; + $$[3] = $4[1]; + } + +progLocalParamNums: progLocalParamNum + { + $$[0] = $1; + $$[1] = $1; + } + | progLocalParamNum DOT_DOT progLocalParamNum + { + $$[0] = $1; + $$[1] = $3; + } + ; + +progLocalParam: PROGRAM LOCAL '[' progLocalParamNum ']' + { + memset($$, 0, sizeof($$)); + $$[0] = state->state_param_enum; + $$[1] = STATE_LOCAL; + $$[2] = $4; + $$[3] = $4; + } + ; + +progEnvParamNum: INTEGER + { + if ((unsigned) $1 >= state->limits->MaxEnvParams) { + yyerror(& @1, state, "invalid environment parameter reference"); + YYERROR; + } + $$ = $1; + } + ; + +progLocalParamNum: INTEGER + { + if ((unsigned) $1 >= state->limits->MaxLocalParams) { + yyerror(& @1, state, "invalid local parameter reference"); + YYERROR; + } + $$ = $1; + } + ; + + + +paramConstDecl: paramConstScalarDecl | paramConstVector; +paramConstUse: paramConstScalarUse | paramConstVector; + +paramConstScalarDecl: signedFloatConstant + { + $$.count = 4; + $$.data[0] = $1; + $$.data[1] = $1; + $$.data[2] = $1; + $$.data[3] = $1; + } + ; + +paramConstScalarUse: REAL + { + $$.count = 1; + $$.data[0] = $1; + $$.data[1] = $1; + $$.data[2] = $1; + $$.data[3] = $1; + } + | INTEGER + { + $$.count = 1; + $$.data[0] = (float) $1; + $$.data[1] = (float) $1; + $$.data[2] = (float) $1; + $$.data[3] = (float) $1; + } + ; + +paramConstVector: '{' signedFloatConstant '}' + { + $$.count = 4; + $$.data[0] = $2; + $$.data[1] = 0.0f; + $$.data[2] = 0.0f; + $$.data[3] = 1.0f; + } + | '{' signedFloatConstant ',' signedFloatConstant '}' + { + $$.count = 4; + $$.data[0] = $2; + $$.data[1] = $4; + $$.data[2] = 0.0f; + $$.data[3] = 1.0f; + } + | '{' signedFloatConstant ',' signedFloatConstant ',' + signedFloatConstant '}' + { + $$.count = 4; + $$.data[0] = $2; + $$.data[1] = $4; + $$.data[2] = $6; + $$.data[3] = 1.0f; + } + | '{' signedFloatConstant ',' signedFloatConstant ',' + signedFloatConstant ',' signedFloatConstant '}' + { + $$.count = 4; + $$.data[0] = $2; + $$.data[1] = $4; + $$.data[2] = $6; + $$.data[3] = $8; + } + ; + +signedFloatConstant: optionalSign REAL + { + $$ = ($1) ? -$2 : $2; + } + | optionalSign INTEGER + { + $$ = (float)(($1) ? -$2 : $2); + } + ; + +optionalSign: '+' { $$ = FALSE; } + | '-' { $$ = TRUE; } + | { $$ = FALSE; } + ; + +TEMP_statement: optVarSize TEMP { $<integer>$ = $2; } varNameList + ; + +optVarSize: string + { + /* NV_fragment_program_option defines the size qualifiers in a + * fairly broken way. "SHORT" or "LONG" can optionally be used + * before TEMP or OUTPUT. However, neither is a reserved word! + * This means that we have to parse it as an identifier, then check + * to make sure it's one of the valid values. *sigh* + * + * In addition, the grammar in the extension spec does *not* allow + * the size specifier to be optional, but all known implementations + * do. + */ + if (!state->option.NV_fragment) { + yyerror(& @1, state, "unexpected IDENTIFIER"); + YYERROR; + } + + if (strcmp("SHORT", $1) == 0) { + } else if (strcmp("LONG", $1) == 0) { + } else { + char *const err_str = + make_error_string("invalid storage size specifier \"%s\"", + $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid storage size specifier"); + + if (err_str != NULL) { + free(err_str); + } + + YYERROR; + } + } + | + { + } + ; + +ADDRESS_statement: ADDRESS { $<integer>$ = $1; } varNameList + ; + +varNameList: varNameList ',' IDENTIFIER + { + if (!declare_variable(state, $3, $<integer>0, & @3)) { + free($3); + YYERROR; + } + } + | IDENTIFIER + { + if (!declare_variable(state, $1, $<integer>0, & @1)) { + free($1); + YYERROR; + } + } + ; + +OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding + { + struct asm_symbol *const s = + declare_variable(state, $3, at_output, & @3); + + if (s == NULL) { + free($3); + YYERROR; + } else { + s->output_binding = $5; + } + } + ; + +resultBinding: RESULT POSITION + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_HPOS; + } else { + yyerror(& @2, state, "invalid program result name"); + YYERROR; + } + } + | RESULT FOGCOORD + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_FOGC; + } else { + yyerror(& @2, state, "invalid program result name"); + YYERROR; + } + } + | RESULT resultColBinding + { + $$ = $2; + } + | RESULT POINTSIZE + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_PSIZ; + } else { + yyerror(& @2, state, "invalid program result name"); + YYERROR; + } + } + | RESULT TEXCOORD optTexCoordUnitNum + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_TEX0 + $3; + } else { + yyerror(& @2, state, "invalid program result name"); + YYERROR; + } + } + | RESULT DEPTH + { + if (state->mode == ARB_fragment) { + $$ = FRAG_RESULT_DEPTH; + } else { + yyerror(& @2, state, "invalid program result name"); + YYERROR; + } + } + ; + +resultColBinding: COLOR optResultFaceType optResultColorType + { + $$ = $2 + $3; + } + ; + +optResultFaceType: + { + $$ = (state->mode == ARB_vertex) + ? VERT_RESULT_COL0 + : FRAG_RESULT_COLOR; + } + | FRONT + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_COL0; + } else { + yyerror(& @1, state, "invalid program result name"); + YYERROR; + } + } + | BACK + { + if (state->mode == ARB_vertex) { + $$ = VERT_RESULT_BFC0; + } else { + yyerror(& @1, state, "invalid program result name"); + YYERROR; + } + } + ; + +optResultColorType: + { + $$ = 0; + } + | PRIMARY + { + if (state->mode == ARB_vertex) { + $$ = 0; + } else { + yyerror(& @1, state, "invalid program result name"); + YYERROR; + } + } + | SECONDARY + { + if (state->mode == ARB_vertex) { + $$ = 1; + } else { + yyerror(& @1, state, "invalid program result name"); + YYERROR; + } + } + ; + +optFaceType: { $$ = 0; } + | FRONT { $$ = 0; } + | BACK { $$ = 1; } + ; + +optColorType: { $$ = 0; } + | PRIMARY { $$ = 0; } + | SECONDARY { $$ = 1; } + ; + +optTexCoordUnitNum: { $$ = 0; } + | '[' texCoordUnitNum ']' { $$ = $2; } + ; + +optTexImageUnitNum: { $$ = 0; } + | '[' texImageUnitNum ']' { $$ = $2; } + ; + +optLegacyTexUnitNum: { $$ = 0; } + | '[' legacyTexUnitNum ']' { $$ = $2; } + ; + +texCoordUnitNum: INTEGER + { + if ((unsigned) $1 >= state->MaxTextureCoordUnits) { + yyerror(& @1, state, "invalid texture coordinate unit selector"); + YYERROR; + } + + $$ = $1; + } + ; + +texImageUnitNum: INTEGER + { + if ((unsigned) $1 >= state->MaxTextureImageUnits) { + yyerror(& @1, state, "invalid texture image unit selector"); + YYERROR; + } + + $$ = $1; + } + ; + +legacyTexUnitNum: INTEGER + { + if ((unsigned) $1 >= state->MaxTextureUnits) { + yyerror(& @1, state, "invalid texture unit selector"); + YYERROR; + } + + $$ = $1; + } + ; + +ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER + { + struct asm_symbol *exist = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $2); + struct asm_symbol *target = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, $4); + + free($4); + + if (exist != NULL) { + char m[1000]; + _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2); + free($2); + yyerror(& @2, state, m); + YYERROR; + } else if (target == NULL) { + free($2); + yyerror(& @4, state, + "undefined variable binding in ALIAS statement"); + YYERROR; + } else { + _mesa_symbol_table_add_symbol(state->st, 0, $2, target); + } + } + ; + +string: IDENTIFIER + | USED_IDENTIFIER + ; + +%% + +void +asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + /* In the core ARB extensions only the KIL instruction doesn't have a + * destination register. + */ + if (dst == NULL) { + init_dst_reg(& inst->Base.DstReg); + } else { + inst->Base.DstReg = *dst; + } + + /* The only instruction that doesn't have any source registers is the + * condition-code based KIL instruction added by NV_fragment_program_option. + */ + if (src0 != NULL) { + inst->Base.SrcReg[0] = src0->Base; + inst->SrcReg[0] = *src0; + } else { + init_src_reg(& inst->SrcReg[0]); + } + + if (src1 != NULL) { + inst->Base.SrcReg[1] = src1->Base; + inst->SrcReg[1] = *src1; + } else { + init_src_reg(& inst->SrcReg[1]); + } + + if (src2 != NULL) { + inst->Base.SrcReg[2] = src2->Base; + inst->SrcReg[2] = *src2; + } else { + init_src_reg(& inst->SrcReg[2]); + } +} + + +struct asm_instruction * +asm_instruction_ctor(gl_inst_opcode op, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); + + if (inst) { + _mesa_init_instructions(& inst->Base, 1); + inst->Base.Opcode = op; + + asm_instruction_set_operands(inst, dst, src0, src1, src2); + } + + return inst; +} + + +struct asm_instruction * +asm_instruction_copy_ctor(const struct prog_instruction *base, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); + + if (inst) { + _mesa_init_instructions(& inst->Base, 1); + inst->Base.Opcode = base->Opcode; + inst->Base.CondUpdate = base->CondUpdate; + inst->Base.CondDst = base->CondDst; + inst->Base.SaturateMode = base->SaturateMode; + inst->Base.Precision = base->Precision; + + asm_instruction_set_operands(inst, dst, src0, src1, src2); + } + + return inst; +} + + +void +init_dst_reg(struct prog_dst_register *r) +{ + memset(r, 0, sizeof(*r)); + r->File = PROGRAM_UNDEFINED; + r->WriteMask = WRITEMASK_XYZW; + r->CondMask = COND_TR; + r->CondSwizzle = SWIZZLE_NOOP; +} + + +/** Like init_dst_reg() but set the File and Index fields. */ +void +set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index) +{ + const GLint maxIndex = 1 << INST_INDEX_BITS; + const GLint minIndex = 0; + ASSERT(index >= minIndex); + (void) minIndex; + ASSERT(index <= maxIndex); + (void) maxIndex; + ASSERT(file == PROGRAM_TEMPORARY || + file == PROGRAM_ADDRESS || + file == PROGRAM_OUTPUT); + memset(r, 0, sizeof(*r)); + r->File = file; + r->Index = index; + r->WriteMask = WRITEMASK_XYZW; + r->CondMask = COND_TR; + r->CondSwizzle = SWIZZLE_NOOP; +} + + +void +init_src_reg(struct asm_src_register *r) +{ + memset(r, 0, sizeof(*r)); + r->Base.File = PROGRAM_UNDEFINED; + r->Base.Swizzle = SWIZZLE_NOOP; + r->Symbol = NULL; +} + + +/** Like init_src_reg() but set the File and Index fields. + * \return GL_TRUE if a valid src register, GL_FALSE otherwise + */ +void +set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index) +{ + set_src_reg_swz(r, file, index, SWIZZLE_XYZW); +} + + +void +set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index, + GLuint swizzle) +{ + const GLint maxIndex = (1 << INST_INDEX_BITS) - 1; + const GLint minIndex = -(1 << INST_INDEX_BITS); + ASSERT(file < PROGRAM_FILE_MAX); + ASSERT(index >= minIndex); + (void) minIndex; + ASSERT(index <= maxIndex); + (void) maxIndex; + memset(r, 0, sizeof(*r)); + r->Base.File = file; + r->Base.Index = index; + r->Base.Swizzle = swizzle; + r->Symbol = NULL; +} + + +/** + * Validate the set of inputs used by a program + * + * Validates that legal sets of inputs are used by the program. In this case + * "used" included both reading the input or binding the input to a name using + * the \c ATTRIB command. + * + * \return + * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise. + */ +int +validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state) +{ + const int inputs = state->prog->InputsRead | state->InputsBound; + + if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) { + yyerror(locp, state, "illegal use of generic attribute and name attribute"); + return 0; + } + + return 1; +} + + +struct asm_symbol * +declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, + struct YYLTYPE *locp) +{ + struct asm_symbol *s = NULL; + struct asm_symbol *exist = (struct asm_symbol *) + _mesa_symbol_table_find_symbol(state->st, 0, name); + + + if (exist != NULL) { + yyerror(locp, state, "redeclared identifier"); + } else { + s = calloc(1, sizeof(struct asm_symbol)); + s->name = name; + s->type = t; + + switch (t) { + case at_temp: + if (state->prog->NumTemporaries >= state->limits->MaxTemps) { + yyerror(locp, state, "too many temporaries declared"); + free(s); + return NULL; + } + + s->temp_binding = state->prog->NumTemporaries; + state->prog->NumTemporaries++; + break; + + case at_address: + if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) { + yyerror(locp, state, "too many address registers declared"); + free(s); + return NULL; + } + + /* FINISHME: Add support for multiple address registers. + */ + state->prog->NumAddressRegs++; + break; + + default: + break; + } + + _mesa_symbol_table_add_symbol(state->st, 0, s->name, s); + s->next = state->sym; + state->sym = s; + } + + return s; +} + + +int add_state_reference(struct gl_program_parameter_list *param_list, + const gl_state_index tokens[STATE_LENGTH]) +{ + const GLuint size = 4; /* XXX fix */ + char *name; + GLint index; + + name = _mesa_program_state_string(tokens); + index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name, + size, GL_NONE, NULL, tokens, 0x0); + param_list->StateFlags |= _mesa_program_state_flags(tokens); + + /* free name string here since we duplicated it in add_parameter() */ + free(name); + + return index; +} + + +int +initialize_symbol_from_state(struct gl_program *prog, + struct asm_symbol *param_var, + const gl_state_index tokens[STATE_LENGTH]) +{ + int idx = -1; + gl_state_index state_tokens[STATE_LENGTH]; + + + memcpy(state_tokens, tokens, sizeof(state_tokens)); + + param_var->type = at_param; + param_var->param_binding_type = PROGRAM_STATE_VAR; + + /* If we are adding a STATE_MATRIX that has multiple rows, we need to + * unroll it and call add_state_reference() for each row + */ + if ((state_tokens[0] == STATE_MODELVIEW_MATRIX || + state_tokens[0] == STATE_PROJECTION_MATRIX || + state_tokens[0] == STATE_MVP_MATRIX || + state_tokens[0] == STATE_TEXTURE_MATRIX || + state_tokens[0] == STATE_PROGRAM_MATRIX) + && (state_tokens[2] != state_tokens[3])) { + int row; + const int first_row = state_tokens[2]; + const int last_row = state_tokens[3]; + + for (row = first_row; row <= last_row; row++) { + state_tokens[2] = state_tokens[3] = row; + + idx = add_state_reference(prog->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) { + param_var->param_binding_begin = idx; + param_var->param_binding_swizzle = SWIZZLE_XYZW; + } + + param_var->param_binding_length++; + } + } + else { + idx = add_state_reference(prog->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) { + param_var->param_binding_begin = idx; + param_var->param_binding_swizzle = SWIZZLE_XYZW; + } + param_var->param_binding_length++; + } + + return idx; +} + + +int +initialize_symbol_from_param(struct gl_program *prog, + struct asm_symbol *param_var, + const gl_state_index tokens[STATE_LENGTH]) +{ + int idx = -1; + gl_state_index state_tokens[STATE_LENGTH]; + + + memcpy(state_tokens, tokens, sizeof(state_tokens)); + + assert((state_tokens[0] == STATE_VERTEX_PROGRAM) + || (state_tokens[0] == STATE_FRAGMENT_PROGRAM)); + assert((state_tokens[1] == STATE_ENV) + || (state_tokens[1] == STATE_LOCAL)); + + /* + * The param type is STATE_VAR. The program parameter entry will + * effectively be a pointer into the LOCAL or ENV parameter array. + */ + param_var->type = at_param; + param_var->param_binding_type = PROGRAM_STATE_VAR; + + /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements, + * we need to unroll it and call add_state_reference() for each row + */ + if (state_tokens[2] != state_tokens[3]) { + int row; + const int first_row = state_tokens[2]; + const int last_row = state_tokens[3]; + + for (row = first_row; row <= last_row; row++) { + state_tokens[2] = state_tokens[3] = row; + + idx = add_state_reference(prog->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) { + param_var->param_binding_begin = idx; + param_var->param_binding_swizzle = SWIZZLE_XYZW; + } + param_var->param_binding_length++; + } + } + else { + idx = add_state_reference(prog->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) { + param_var->param_binding_begin = idx; + param_var->param_binding_swizzle = SWIZZLE_XYZW; + } + param_var->param_binding_length++; + } + + return idx; +} + + +/** + * Put a float/vector constant/literal into the parameter list. + * \param param_var returns info about the parameter/constant's location, + * binding, type, etc. + * \param vec the vector/constant to add + * \param allowSwizzle if true, try to consolidate constants which only differ + * by a swizzle. We don't want to do this when building + * arrays of constants that may be indexed indirectly. + * \return index of the constant in the parameter list. + */ +int +initialize_symbol_from_const(struct gl_program *prog, + struct asm_symbol *param_var, + const struct asm_vector *vec, + GLboolean allowSwizzle) +{ + unsigned swizzle; + const int idx = _mesa_add_unnamed_constant(prog->Parameters, + vec->data, vec->count, + allowSwizzle ? &swizzle : NULL); + + param_var->type = at_param; + param_var->param_binding_type = PROGRAM_CONSTANT; + + if (param_var->param_binding_begin == ~0U) { + param_var->param_binding_begin = idx; + param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW; + } + param_var->param_binding_length++; + + return idx; +} + + +char * +make_error_string(const char *fmt, ...) +{ + int length; + char *str; + va_list args; + + + /* Call vsnprintf once to determine how large the final string is. Call it + * again to do the actual formatting. from the vsnprintf manual page: + * + * Upon successful return, these functions return the number of + * characters printed (not including the trailing '\0' used to end + * output to strings). + */ + va_start(args, fmt); + length = 1 + vsnprintf(NULL, 0, fmt, args); + va_end(args); + + str = malloc(length); + if (str) { + va_start(args, fmt); + vsnprintf(str, length, fmt, args); + va_end(args); + } + + return str; +} + + +void +yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) +{ + char *err_str; + + + err_str = make_error_string("glProgramStringARB(%s)\n", s); + if (err_str) { + _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str); + free(err_str); + } + + err_str = make_error_string("line %u, char %u: error: %s\n", + locp->first_line, locp->first_column, s); + _mesa_set_program_error(state->ctx, locp->position, err_str); + + if (err_str) { + free(err_str); + } +} + + +GLboolean +_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str, + GLsizei len, struct asm_parser_state *state) +{ + struct asm_instruction *inst; + unsigned i; + GLubyte *strz; + GLboolean result = GL_FALSE; + void *temp; + struct asm_symbol *sym; + + state->ctx = ctx; + state->prog->Target = target; + state->prog->Parameters = _mesa_new_parameter_list(); + + /* Make a copy of the program string and force it to be NUL-terminated. + */ + strz = (GLubyte *) malloc(len + 1); + if (strz == NULL) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); + return GL_FALSE; + } + memcpy (strz, str, len); + strz[len] = '\0'; + + state->prog->String = strz; + + state->st = _mesa_symbol_table_ctor(); + + state->limits = (target == GL_VERTEX_PROGRAM_ARB) + ? & ctx->Const.VertexProgram + : & ctx->Const.FragmentProgram; + + state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits; + state->MaxTextureUnits = ctx->Const.MaxTextureUnits; + state->MaxClipPlanes = ctx->Const.MaxClipPlanes; + state->MaxLights = ctx->Const.MaxLights; + state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices; + + state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB) + ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM; + + _mesa_set_program_error(ctx, -1, NULL); + + _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len); + yyparse(state); + _mesa_program_lexer_dtor(state->scanner); + + + if (ctx->Program.ErrorPos != -1) { + goto error; + } + + if (! _mesa_layout_parameters(state)) { + struct YYLTYPE loc; + + loc.first_line = 0; + loc.first_column = 0; + loc.position = len; + + yyerror(& loc, state, "invalid PARAM usage"); + goto error; + } + + + + /* Add one instruction to store the "END" instruction. + */ + state->prog->Instructions = + _mesa_alloc_instructions(state->prog->NumInstructions + 1); + inst = state->inst_head; + for (i = 0; i < state->prog->NumInstructions; i++) { + struct asm_instruction *const temp = inst->next; + + state->prog->Instructions[i] = inst->Base; + inst = temp; + } + + /* Finally, tag on an OPCODE_END instruction */ + { + const GLuint numInst = state->prog->NumInstructions; + _mesa_init_instructions(state->prog->Instructions + numInst, 1); + state->prog->Instructions[numInst].Opcode = OPCODE_END; + } + state->prog->NumInstructions++; + + state->prog->NumParameters = state->prog->Parameters->NumParameters; + state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead); + + /* + * Initialize native counts to logical counts. The device driver may + * change them if program is translated into a hardware program. + */ + state->prog->NumNativeInstructions = state->prog->NumInstructions; + state->prog->NumNativeTemporaries = state->prog->NumTemporaries; + state->prog->NumNativeParameters = state->prog->NumParameters; + state->prog->NumNativeAttributes = state->prog->NumAttributes; + state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs; + + result = GL_TRUE; + +error: + for (inst = state->inst_head; inst != NULL; inst = temp) { + temp = inst->next; + free(inst); + } + + state->inst_head = NULL; + state->inst_tail = NULL; + + for (sym = state->sym; sym != NULL; sym = temp) { + temp = sym->next; + + free((void *) sym->name); + free(sym); + } + state->sym = NULL; + + _mesa_symbol_table_dtor(state->st); + state->st = NULL; + + return result; +} diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index fc5f60e92..836c76fe8 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -633,7 +633,7 @@ static void _save_reset_vertex( struct gl_context *ctx ) -#define ERROR(err) _mesa_compile_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); +#define ERROR(err) _mesa_compile_error( ctx, err, __FUNCTION__ ); /* Only one size for each attribute may be active at once. Eg. if |